/* ───────────────────────── Curva · Liquid Glass UI ───────────────────────── */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --ink: rgba(255, 255, 255, .96);
  --ink-2: rgba(255, 255, 255, .62);
  --ink-3: rgba(255, 255, 255, .38);
  --fill: rgba(255, 255, 255, .07);
  --fill-2: rgba(255, 255, 255, .12);
  --fill-3: rgba(255, 255, 255, .2);
  --stroke: rgba(255, 255, 255, .1);
  --tint: rgba(22, 22, 26, .42);
  --tint-strong: rgba(18, 18, 22, .6);
  --shadow: 0 24px 70px -18px rgba(0, 0, 0, .55), 0 2px 10px rgba(0, 0, 0, .18);
  --rim-a: rgba(255, 255, 255, .55);
  --rim-b: rgba(255, 255, 255, .06);
  --accent: #fff;
  --r-xl: 30px;
  --r-lg: 22px;
  --r-md: 16px;
  --pad: 16px;
  --panel-w: 360px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.36, .44, 1);
  color-scheme: dark;
}
body.ui-light {
  --ink: rgba(10, 12, 18, .92);
  --ink-2: rgba(10, 12, 18, .6);
  --ink-3: rgba(10, 12, 18, .38);
  --fill: rgba(0, 0, 0, .05);
  --fill-2: rgba(0, 0, 0, .08);
  --fill-3: rgba(0, 0, 0, .14);
  --stroke: rgba(0, 0, 0, .08);
  --tint: rgba(255, 255, 255, .42);
  --tint-strong: rgba(255, 255, 255, .7);
  --rim-a: rgba(255, 255, 255, .95);
  --rim-b: rgba(255, 255, 255, .25);
  --shadow: 0 24px 60px -20px rgba(20, 30, 60, .35), 0 2px 8px rgba(0, 0, 0, .06);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: #000; }
body {
  font-family: var(--font);
  color: var(--ink);
  font-size: 13px;
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  transition: color .4s;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.75; flex: none; }

/* ───────── Glass ───────── */
.glass {
  position: relative;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tint) 90%, transparent), var(--tint));
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  backdrop-filter: blur(26px) saturate(180%);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 0 0 .5px rgba(255, 255, 255, .06);
  transition: background .4s, box-shadow .4s;
}
.glass::before { /* borde especular */
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(155deg, var(--rim-a), var(--rim-b) 28%, transparent 50%, var(--rim-b) 75%, color-mix(in srgb, var(--rim-a) 70%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.glass::after { /* brillo interior */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(120% 60% at 15% -10%, rgba(255, 255, 255, .12), transparent 55%);
}
/* Vidrio líquido: bisel grueso + borde especular + cáustica inferior (sin filtros SVG) */
body.liquid .glass[data-liquid] {
  background: linear-gradient(180deg, color-mix(in srgb, var(--tint) 55%, transparent), color-mix(in srgb, var(--tint) 82%, transparent));
  -webkit-backdrop-filter: blur(22px) saturate(200%) brightness(1.06) contrast(1.04);
  backdrop-filter: blur(22px) saturate(200%) brightness(1.06) contrast(1.04);
  box-shadow: var(--shadow),
    inset 1.5px 1.5px 1px -.5px rgba(255, 255, 255, .5),
    inset -1px -1px 1px -.5px rgba(255, 255, 255, .28),
    inset 8px 12px 24px -16px rgba(255, 255, 255, .32),
    inset -10px -14px 26px -18px rgba(0, 0, 0, .4),
    inset 0 0 22px rgba(255, 255, 255, .05);
}
body.liquid .glass[data-liquid]::after {
  background:
    radial-gradient(90% 50% at 18% -12%, rgba(255, 255, 255, .16), transparent 60%),
    radial-gradient(70% 30% at 70% 112%, rgba(255, 255, 255, .12), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, .06), transparent 25%);
}
body.liquid .dice, body.liquid .island button.on, body.liquid .seg-thumb {
  box-shadow: inset 1px 1px 1px -.5px rgba(255, 255, 255, .55), inset -1px -1px 1px -.5px rgba(255, 255, 255, .25), inset 0 -8px 16px -10px rgba(255, 255, 255, .18), 0 6px 18px -6px rgba(0, 0, 0, .45);
}

/* ───────── Escenario y mockups ───────── */
#ambient { position: fixed; inset: 0; opacity: 0; transition: opacity .7s var(--ease); }
#ambient canvas { width: 100%; height: 100%; filter: blur(60px) saturate(130%) brightness(.55); transform: scale(1.25); }
body.mock #ambient { opacity: 1; }
#ambient::after { content: ""; position: absolute; inset: 0; background: radial-gradient(80% 80% at 50% 50%, transparent, rgba(0, 0, 0, .55)); }

#stage { position: fixed; inset: 0; }
.device {
  position: absolute; left: 0; top: 0; width: 100vw; height: 100vh;
  transition: left .7s var(--ease), top .7s var(--ease), width .7s var(--ease), height .7s var(--ease);
  --u: 1px;
}
.bezel { position: absolute; inset: 0; transition: padding .7s var(--ease), border-radius .7s var(--ease), background .5s, box-shadow .5s; }
.screen { position: relative; width: 100%; height: 100%; overflow: hidden; transition: border-radius .7s var(--ease); background: #000; }
#gl, #fade { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#gl { cursor: grab; touch-action: none; }
#gl.dragging { cursor: grabbing; }
#fade { pointer-events: none; opacity: 0; }
#fade.go { transition: opacity .55s var(--ease); }
.notch, .lock, .stand { opacity: 0; pointer-events: none; transition: opacity .5s .2s; }

/* iPhone */
.device.phone .bezel {
  padding: calc(var(--u) * 11); border-radius: calc(var(--u) * 62);
  background: linear-gradient(140deg, #8a8a8f, #3a3a3e 18%, #1d1d20 50%, #3c3c40 82%, #9a9a9f);
  box-shadow: 0 40px 90px -20px rgba(0, 0, 0, .7), inset 0 0 0 calc(var(--u) * 1.5) rgba(255, 255, 255, .25), inset 0 0 0 calc(var(--u) * 4) #0b0b0c;
}
.device.phone .screen { border-radius: calc(var(--u) * 51); }
.device.phone .notch { opacity: 1; position: absolute; top: calc(var(--u) * 11); left: 50%; transform: translateX(-50%); width: calc(var(--u) * 124); height: calc(var(--u) * 36); border-radius: 99px; background: #000; z-index: 3; }
.device.phone .lock, .device.tablet .lock { opacity: 1; }
.lock { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; color: rgba(255, 255, 255, .92); text-shadow: 0 1px 12px rgba(0, 0, 0, .18); }
.lock-date { margin-top: calc(var(--u) * 78); font-weight: 600; font-size: calc(var(--u) * 19); letter-spacing: .01em; opacity: .9; }
.lock-time { font-family: "SF Pro Rounded", var(--font); font-weight: 700; font-size: calc(var(--u) * 100); line-height: .95; letter-spacing: -.03em; mix-blend-mode: overlay; color: #fff; opacity: .95; }
.lock-bottom { position: absolute; bottom: calc(var(--u) * 46); left: calc(var(--u) * 44); right: calc(var(--u) * 44); display: flex; justify-content: space-between; }
.lock-bottom span { width: calc(var(--u) * 50); height: calc(var(--u) * 50); border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .16); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
.lock-bottom svg.lucide { width: calc(var(--u) * 20); height: calc(var(--u) * 20); }
.home-bar { position: absolute; bottom: calc(var(--u) * 9); width: calc(var(--u) * 140); height: calc(var(--u) * 5); border-radius: 9px; background: rgba(255, 255, 255, .85); }
.device.tablet .lock-date { margin-top: calc(var(--u) * 50); font-size: calc(var(--u) * 16); }
.device.tablet .lock-time { font-size: calc(var(--u) * 92); }
.device.tablet .lock-bottom { display: none; }

/* iPad */
.device.tablet .bezel {
  padding: calc(var(--u) * 20); border-radius: calc(var(--u) * 42);
  background: linear-gradient(140deg, #bfc0c4, #77787d 14%, #2a2a2d 22%, #121214 50%, #2a2a2d 78%, #8a8b90 88%, #cfd0d4);
  box-shadow: 0 40px 90px -20px rgba(0, 0, 0, .7), inset 0 0 0 calc(var(--u) * 1.4) rgba(255, 255, 255, .3), inset 0 0 0 calc(var(--u) * 3) #0b0b0c;
}
.device.tablet .screen { border-radius: calc(var(--u) * 22); }
.device.tablet .notch { opacity: 1; position: absolute; top: calc(var(--u) * -12.5); left: 50%; width: calc(var(--u) * 6); height: calc(var(--u) * 6); border-radius: 50%; background: radial-gradient(circle at 40% 40%, #2a3550, #050508 60%); transform: translateX(-50%); }

/* Monitores */
.device.desktop .bezel, .device.wide .bezel {
  padding: calc(var(--u) * 14); border-radius: calc(var(--u) * 16);
  background: linear-gradient(180deg, #1b1b1d, #0a0a0b);
  box-shadow: 0 0 0 calc(var(--u) * 3.5) #c9cacd, 0 0 0 calc(var(--u) * 4.5) #8e8f93, 0 50px 100px -30px rgba(0, 0, 0, .75);
}
.device.desktop .screen, .device.wide .screen { border-radius: calc(var(--u) * 3); }
.device.desktop .stand, .device.wide .stand { opacity: 1; }
.stand { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); width: 34%; display: flex; flex-direction: column; align-items: center; z-index: -1; }
.neck { width: 46%; height: calc(var(--u) * 92); background: linear-gradient(90deg, #8d8e92, #e3e4e7 30%, #c3c4c8 70%, #7f8084); clip-path: polygon(6% 0, 94% 0, 100% 100%, 0 100%); }
.foot { width: 100%; height: calc(var(--u) * 9); border-radius: calc(var(--u) * 3) calc(var(--u) * 3) calc(var(--u) * 6) calc(var(--u) * 6); background: linear-gradient(180deg, #e8e9ec, #9d9ea2); box-shadow: 0 18px 30px -8px rgba(0, 0, 0, .8); }
.device.wide .stand { width: 22%; }

/* ───────── Barra superior ───────── */
.topbar {
  position: fixed; top: 16px; left: 16px; right: 16px; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; pointer-events: none;
  transition: opacity .4s var(--ease), transform .5s var(--ease);
}
.topbar > * { pointer-events: auto; }
.brand { justify-self: start; height: 44px; padding: 0 20px; border-radius: 99px; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; letter-spacing: .01em; }
.logo { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.actions { justify-self: end; height: 48px; padding: 4px; border-radius: 99px; display: flex; gap: 2px; }
.actions button { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); transition: background .2s, transform .2s var(--spring); }
.actions button:hover { background: var(--fill-2); }
.actions button:active { transform: scale(.9); }
.actions button.primary { background: var(--ink); color: color-mix(in srgb, var(--tint-strong) 100%, #000); }
body:not(.ui-light) .actions button.primary { color: #0b0b0d; }

/* Segmentados con pulgar deslizante (estilo "Inbox / Draft") */
.seg { position: relative; display: flex; padding: 4px; border-radius: 99px; gap: 0; }
.seg > button { position: relative; z-index: 1; flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; height: 36px; border-radius: 99px; color: var(--ink-2); font-weight: 500; transition: color .3s; white-space: nowrap; }
.seg > button.on { color: var(--ink); }
.seg > button:hover { color: var(--ink); }
.seg-thumb {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 99px;
  background: linear-gradient(180deg, var(--fill-3), var(--fill-2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 -1px 0 rgba(255, 255, 255, .05), 0 4px 14px -4px rgba(0, 0, 0, .35);
  transition: left .45s var(--spring), width .45s var(--spring);
}
.formats { height: 48px; }
.formats > button { width: 48px; flex: none; height: 40px; }

/* ───────── Panel ───────── */
.panel {
  position: fixed; z-index: 15; left: 16px; top: 76px; bottom: 16px; width: var(--panel-w);
  border-radius: var(--r-xl); display: flex; flex-direction: column; overflow: hidden;
  transition: transform .6s var(--ease), opacity .4s;
}
.grabber { display: none; }
.tabs { margin: 10px 10px 0; background: var(--fill); flex: none; }
.tabs > button { flex-direction: column; gap: 2px; height: 50px; font-size: 11px; border-radius: 22px; }
.tabs .seg-thumb { border-radius: 22px; }
.tab-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px 14px 22px; scrollbar-width: none; mask-image: linear-gradient(180deg, transparent 0, #000 12px, #000 calc(100% - 22px), transparent); }
.tab-body::-webkit-scrollbar { display: none; }
.tab { display: none; animation: tabIn .45s var(--ease); }
.tab.on { display: block; }
@keyframes tabIn { from { opacity: 0; transform: translateY(6px); } }

.row-island { display: flex; gap: 8px; align-items: center; }
.island { flex: 1; display: flex; justify-content: space-between; padding: 4px; border-radius: 99px; background: var(--fill); box-shadow: inset 0 0 0 .5px var(--stroke); overflow-x: auto; scrollbar-width: none; }
.island::-webkit-scrollbar { display: none; }
.island button { position: relative; width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); transition: background .25s, color .25s, transform .25s var(--spring); }
.island button svg.lucide { width: 17px; height: 17px; }
.island button:hover { color: var(--ink); background: var(--fill); }
.island button.on { color: var(--ink); background: linear-gradient(180deg, var(--fill-3), var(--fill-2)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 4px 12px -4px rgba(0, 0, 0, .4); }
.island button:active { transform: scale(.88); }
.dice {
  width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(180deg, var(--fill-3), var(--fill)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), inset 0 0 0 .5px var(--stroke), 0 6px 18px -6px rgba(0, 0, 0, .5);
  transition: transform .5s var(--spring);
}
.dice svg.lucide { width: 21px; height: 21px; }
.dice svg.lucide { transition: transform .5s var(--spring); }
.dice:hover svg.lucide { transform: rotate(-14deg) scale(1.06); }
.dice.roll svg.lucide { animation: roll .6s var(--spring); }
@keyframes roll { 0% { transform: rotate(0) scale(1); } 40% { transform: rotate(200deg) scale(.86); } 100% { transform: rotate(360deg) scale(1); } }

.eq-head { display: flex; align-items: flex-end; justify-content: space-between; margin: 18px 4px 10px; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.eq-head h2 { font-size: 20px; font-weight: 650; letter-spacing: -.025em; margin-top: 2px; }
.eq-nav { display: flex; gap: 2px; }
.icon-btn { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); transition: background .2s, color .2s; }
.icon-btn:hover { background: var(--fill-2); color: var(--ink); }
.icon-btn svg.lucide { width: 17px; height: 17px; }

.eq-card {
  border-radius: var(--r-lg); padding: 18px 14px 10px; background: linear-gradient(180deg, var(--fill), transparent 140%);
  box-shadow: inset 0 0 0 .5px var(--stroke), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.tex { min-height: 54px; display: flex; align-items: center; justify-content: center; overflow-x: auto; scrollbar-width: none; font-size: 15px; }
.tex::-webkit-scrollbar { display: none; }
.tex .katex-display { margin: 0; }
.tex .katex { font-size: 1.18em; }
.tex-mods { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--ink-2); font-size: 12px; }
.tex-mods:empty { display: none; }
.tex-mods .katex { font-size: 1.05em; }
.eq-foot { display: flex; gap: 6px; margin-top: 12px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 99px; background: var(--fill); color: var(--ink-2); font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.chip svg.lucide { width: 13px; height: 13px; }
.chip b { font-weight: 500; }
.chip.btn { padding: 0; width: 26px; justify-content: center; transition: background .2s, color .2s; }
.chip.btn:hover { background: var(--fill-3); color: var(--ink); }
#chip-zoom { margin-right: auto; }

.group { margin-top: 20px; }
.group-title { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin: 0 4px 8px; display: flex; justify-content: space-between; align-items: baseline; }
.group-title .hint { text-transform: none; letter-spacing: 0; font-weight: 400; }
.note { font-size: 11.5px; color: var(--ink-3); line-height: 1.45; margin: 10px 4px 0; }

/* Sliders */
.slider { display: grid; grid-template-columns: 1fr auto; align-items: center; row-gap: 6px; padding: 7px 4px 8px; }
.slider label { color: var(--ink-2); font-weight: 500; }
.slider output { font-family: var(--mono); font-size: 11.5px; color: var(--ink); min-width: 42px; text-align: right; padding: 2px 6px; border-radius: 7px; cursor: text; }
.slider output:hover { background: var(--fill); }
.slider input[type=range] { grid-column: 1 / -1; }
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; --p: 50%;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 9px;
  background: linear-gradient(90deg, var(--ink) 0 var(--p), var(--fill-2) var(--p) 100%);
  box-shadow: inset 0 0 0 .5px var(--stroke);
}
input[type=range]::-moz-range-track { height: 6px; border-radius: 9px; background: var(--fill-2); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 9px; background: var(--ink); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, #fff, #e9e9ee); box-shadow: 0 2px 8px rgba(0, 0, 0, .35), inset 0 -1px 1px rgba(0, 0, 0, .08);
  transition: transform .25s var(--spring);
}
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.18); }

/* Disclosure de modificadores */
.mod { border-radius: var(--r-md); background: var(--fill); margin-bottom: 6px; box-shadow: inset 0 0 0 .5px var(--stroke); overflow: hidden; }
.mod-head { display: flex; align-items: center; gap: 10px; padding: 0 8px 0 12px; height: 46px; cursor: pointer; }
.mod-head svg.lucide { color: var(--ink-2); width: 17px; height: 17px; }
.mod-head .t { flex: 1; font-weight: 500; }
.mod-head .sub { color: var(--ink-3); font-size: 12px; font-family: var(--mono); }
.mod-body { display: none; padding: 0 10px 10px; }
.mod.open .mod-body { display: block; }
.toggle { width: 42px; height: 26px; border-radius: 99px; background: var(--fill-2); position: relative; transition: background .3s; flex: none; box-shadow: inset 0 0 0 .5px var(--stroke); }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); transition: transform .35s var(--spring); }
.toggle.on { background: #34c759; }
.toggle.on::after { transform: translateX(16px); }

.seg.mini { background: var(--fill); margin-bottom: 8px; }
.seg.mini > button { height: 32px; font-size: 12.5px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 6px; }
.chip-btn { height: 30px; padding: 0 12px; border-radius: 99px; background: var(--fill); color: var(--ink-2); font-weight: 500; display: inline-flex; align-items: center; gap: 6px; transition: all .25s; box-shadow: inset 0 0 0 .5px var(--stroke); }
.chip-btn svg.lucide { width: 15px; height: 15px; }
.chip-btn.on { background: var(--ink); color: #0b0b0d; }
body.ui-light .chip-btn.on { color: #fff; }

.select { width: 100%; height: 38px; padding: 0 12px; border-radius: 12px; border: 0; background: var(--fill-2); color: var(--ink); font: inherit; font-weight: 500; margin-bottom: 8px; appearance: none; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.select option, .select optgroup { background: #1c1c1f; color: #fff; }

/* Tiles (materiales, superficies, filtros) */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tiles.small { grid-template-columns: repeat(4, 1fr); }
.tile {
  height: 70px; border-radius: var(--r-md); background: var(--fill); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  color: var(--ink-2); font-size: 11.5px; font-weight: 500; box-shadow: inset 0 0 0 .5px var(--stroke); transition: all .25s var(--ease);
}
.tiles.small .tile { height: 62px; font-size: 10.5px; gap: 6px; }
.tile svg.lucide { width: 20px; height: 20px; }
.tile:hover { background: var(--fill-2); color: var(--ink); }
.tile.on { color: var(--ink); background: linear-gradient(180deg, var(--fill-3), var(--fill-2)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28), inset 0 1px 0 rgba(255, 255, 255, .3), 0 6px 16px -6px rgba(0, 0, 0, .4); }
body.ui-light .tile.on { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12), 0 6px 16px -8px rgba(0, 0, 0, .25); }
.tile:active { transform: scale(.95); }
#mat-params { margin-top: 10px; }

/* Paletas */
.pal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.pal { border-radius: var(--r-md); padding: 6px; background: var(--fill); text-align: left; box-shadow: inset 0 0 0 .5px var(--stroke); transition: all .25s var(--ease); }
.pal i { display: block; height: 38px; border-radius: 11px; box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .15); }
.pal span { display: block; padding: 6px 4px 1px; font-size: 11.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal:hover { background: var(--fill-2); }
.pal.on { background: var(--fill-2); box-shadow: inset 0 0 0 1.5px var(--ink); }
.pal.on span { color: var(--ink); }
.grad-preview { height: 44px; border-radius: 14px; box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .2); }
.stops { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 2px; }
.stop { position: relative; width: 36px; height: 36px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .35), 0 3px 10px -3px rgba(0, 0, 0, .5); cursor: pointer; transition: transform .3s var(--spring); }
.stop:hover { transform: scale(1.08); }
.stop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.stop .rm { position: absolute; top: -5px; right: -5px; width: 18px; height: 18px; border-radius: 50%; background: #1c1c1f; color: #fff; display: none; place-items: center; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); z-index: 2; }
.stop .rm svg.lucide { width: 11px; height: 11px; stroke-width: 2.5; }
.stop:hover .rm { display: grid; }
.btn-row { display: flex; gap: 6px; }
.pill-btn { flex: 1; height: 36px; border-radius: 99px; background: var(--fill); display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 500; color: var(--ink-2); box-shadow: inset 0 0 0 .5px var(--stroke); transition: all .2s; }
.pill-btn:hover { background: var(--fill-2); color: var(--ink); }
.pill-btn svg.lucide { width: 15px; height: 15px; }

/* Pila de filtros */
#fx-stack { margin-top: 14px; }
.fx { border-radius: var(--r-md); background: var(--fill); padding: 4px 10px 6px; margin-bottom: 8px; box-shadow: inset 0 0 0 .5px var(--stroke); animation: tabIn .4s var(--ease); }
.fx-head { display: flex; align-items: center; gap: 8px; height: 40px; }
.fx-head .t { flex: 1; font-weight: 600; }
.fx-head svg.lucide { width: 16px; height: 16px; color: var(--ink-2); }
.fx-head .icon-btn { width: 28px; height: 28px; }
.fx.off { opacity: .45; }
.colors { display: flex; gap: 8px; align-items: center; padding: 4px 4px 6px; color: var(--ink-2); }
.colors .stop { width: 26px; height: 26px; }
.empty { text-align: center; color: var(--ink-3); padding: 26px 10px; line-height: 1.5; }

/* Pista inferior */
.hint-pill { position: fixed; z-index: 14; bottom: 18px; left: calc(var(--panel-w) + 32px); right: 0; margin: 0 auto; width: max-content; height: 36px; padding: 0 16px; border-radius: 99px; display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 12px; transition: opacity .6s, transform .6s var(--ease); }
.hint-pill svg.lucide { width: 14px; height: 14px; }
.hint-pill b { color: var(--ink); font-weight: 500; }
kbd { font-family: var(--font); font-size: 11px; padding: 1px 5px; border-radius: 5px; background: var(--fill-2); }
.hint-pill.gone { opacity: 0; transform: translateY(10px); pointer-events: none; }

/* Tooltips */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  padding: 6px 10px; border-radius: 9px; background: rgba(20, 20, 24, .88); color: #fff; font-size: 11.5px; font-weight: 500; white-space: pre; pointer-events: none; z-index: 50;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); animation: tip .2s .35s both; letter-spacing: 0;
}
.panel [data-tip]:hover::after { top: auto; bottom: calc(100% + 8px); }
@keyframes tip { from { opacity: 0; transform: translate(-50%, -3px); } }

/* Hojas modales */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(0, 0, 0, .25); opacity: 0; pointer-events: none; transition: opacity .35s; }
.sheet-wrap.on { opacity: 1; pointer-events: auto; }
.sheet { width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: hidden; display: flex; flex-direction: column; border-radius: var(--r-xl); padding: 18px; transform: scale(.94) translateY(10px); transition: transform .5s var(--spring); scrollbar-width: none; background: var(--tint-strong); }
.sheet.wide { width: min(760px, calc(100vw - 32px)); }
.sheet-wrap.on .sheet { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.sheet-head h3 { font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
.sheet-head .seg { flex: 1; max-width: 420px; margin: 0; }
.res-list { display: grid; gap: 6px; margin-bottom: 16px; }
.res { display: flex; align-items: center; justify-content: space-between; height: 46px; padding: 0 14px; border-radius: 14px; background: var(--fill); box-shadow: inset 0 0 0 .5px var(--stroke); transition: all .2s; }
.res b { font-weight: 600; }
.res span { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.res.on { background: var(--fill-3); box-shadow: inset 0 0 0 1.5px var(--ink); }
.cta { width: 100%; height: 50px; margin-top: 8px; border-radius: 99px; background: var(--ink); color: #0b0b0d; font-weight: 600; font-size: 14.5px; display: flex; align-items: center; justify-content: center; gap: 8px; transition: transform .25s var(--spring), opacity .2s; }
body.ui-light .cta { color: #fff; }
.cta:active { transform: scale(.97); }
.cta:disabled { opacity: .5; }
.cta.ghost { background: var(--fill-2); color: var(--ink); }
.progress { height: 4px; border-radius: 9px; background: var(--fill-2); overflow: hidden; opacity: 0; transition: opacity .3s; margin: 4px 0; }
.progress.on { opacity: 1; }
.progress div { height: 100%; width: 0; background: var(--ink); transition: width .15s; }

.lib-grid { overflow-y: auto; min-height: 0; flex: 1 1 auto; scrollbar-width: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; min-height: 120px; grid-auto-rows: max-content; align-content: start; }
.lib-item { position: relative; border-radius: 16px; overflow: hidden; aspect-ratio: 16/10; background: var(--fill); box-shadow: inset 0 0 0 .5px var(--stroke); transition: transform .35s var(--spring); }
.lib-item:hover { transform: translateY(-2px) scale(1.02); }
.lib-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-item span { position: absolute; left: 8px; bottom: 8px; padding: 3px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: rgba(0, 0, 0, .35); color: #fff; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.lib-item .rm { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; background: rgba(0, 0, 0, .45); color: #fff; display: none; place-items: center; }
.lib-item .rm svg.lucide { width: 13px; height: 13px; }
.lib-item:hover .rm { display: grid; }
.lib-item.loading { animation: pulse 1.2s infinite ease-in-out; }
@keyframes pulse { 50% { opacity: .5; } }

.eq-list { columns: 3 200px; column-gap: 16px; overflow-y: auto; min-height: 0; flex: 1 1 auto; scrollbar-width: none; }
.eq-list h4 { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin: 6px 6px 6px; display: flex; gap: 6px; align-items: center; break-after: avoid; }
.eq-list h4 svg.lucide { width: 14px; height: 14px; }
.eq-list .cat { break-inside: avoid; margin-bottom: 14px; }
.eq-list button { display: block; width: 100%; text-align: left; padding: 7px 8px; border-radius: 9px; color: var(--ink-2); font-weight: 500; }
.eq-list button:hover { background: var(--fill-2); color: var(--ink); }
.eq-list button.on { color: var(--ink); background: var(--fill-2); }

#toast { position: fixed; z-index: 60; top: 80px; left: 50%; transform: translate(-50%, -16px); padding: 10px 16px; border-radius: 99px; font-weight: 500; opacity: 0; pointer-events: none; transition: all .45s var(--spring); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

#busy { position: fixed; z-index: 30; right: 26px; bottom: 66px; opacity: 0; transition: opacity .3s; pointer-events: none; }
#busy.on { opacity: 1; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .2); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#nogl { display: none; position: fixed; inset: 0; z-index: 99; place-content: center; text-align: center; gap: 10px; background: #000; color: #fff; padding: 24px; }
body.nogl #nogl { display: grid; }

/* Ocultar interfaz */
body.hide-ui .topbar .brand, body.hide-ui .topbar .formats { opacity: 0; pointer-events: none; }
body.hide-ui .actions > :not(#btn-hide) { display: none; }
body.hide-ui .panel { transform: translateX(calc(-100% - 40px)); opacity: 0; }
body.hide-ui .hint-pill { opacity: 0; }
body.booting .panel, body.booting .topbar { opacity: 0; }
.panel, .topbar { transition: transform .6s var(--ease), opacity .6s; }

/* ───────── Móvil ───────── */
@media (max-width: 760px) {
  :root { --panel-w: 100vw; }
  .topbar { top: max(10px, env(safe-area-inset-top)); left: 8px; right: 8px; grid-template-columns: auto 1fr auto; gap: 6px; }
  .brand { height: 42px; padding: 0 14px; font-size: 14px; }
  .formats { justify-self: center; height: 42px; }
  .formats > button { width: 31px; height: 34px; }
  .actions { height: 42px; }
  .actions button { width: 31px; height: 34px; }
  .topbar svg.lucide { width: 17px; height: 17px; }
  #btn-surprise, #btn-share { display: none; }
  .panel { left: 0; right: 0; top: auto; bottom: 0; width: 100%; height: 50vh; border-radius: 28px 28px 0 0; transition: height .5s var(--ease), transform .6s var(--ease); }
  .panel.min { height: 168px; }
  .grabber { display: block; width: 38px; height: 5px; border-radius: 9px; background: var(--fill-3); margin: 8px auto 0; flex: none; cursor: grab; }
  .tabs > button { height: 44px; }
  .hint-pill { display: none; }
  body.hide-ui .panel { transform: translateY(110%); }
  [data-tip]:hover::after { display: none; }
}

/* ───────── Cursores premium ───────── */
html, body, button, .tile, .pal, .island button, [data-tip] {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26' viewBox='0 0 26 26'%3E%3Cdefs%3E%3Cfilter id='s' x='-50%25' y='-50%25' width='200%25' height='200%25'%3E%3CfeDropShadow dx='0' dy='1' stdDeviation='1' flood-opacity='.45'/%3E%3C/filter%3E%3C/defs%3E%3Cpath filter='url(%23s)' d='M6 4.2v15.6c0 .5.6.8 1 .4l3.6-3.4 2.4 5.3c.2.4.6.6 1 .4l1.6-.7c.4-.2.6-.6.4-1l-2.4-5.2h5c.5 0 .8-.6.4-1L7 3.8c-.4-.3-1 0-1 .4z' fill='white' stroke='%23111' stroke-width='1.1' stroke-linejoin='round'/%3E%3C/svg%3E") 6 4, default;
}
input[type=range], .sv, .gbar, .gstop, .hue { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26' viewBox='0 0 26 26'%3E%3Ccircle cx='13' cy='13' r='6.5' fill='white' fill-opacity='.18' stroke='white' stroke-width='1.6'/%3E%3Ccircle cx='13' cy='13' r='7.6' fill='none' stroke='black' stroke-opacity='.35' stroke-width='.8'/%3E%3C/svg%3E") 13 13, pointer; }
#gl { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='9' fill='none' stroke='black' stroke-opacity='.35' stroke-width='3'/%3E%3Ccircle cx='16' cy='16' r='9' fill='none' stroke='white' stroke-width='1.4'/%3E%3Ccircle cx='16' cy='16' r='1.8' fill='white' stroke='black' stroke-opacity='.4' stroke-width='.6'/%3E%3C/svg%3E") 16 16, grab; }
#gl.dragging { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='6.5' fill='white' fill-opacity='.35' stroke='black' stroke-opacity='.35' stroke-width='3'/%3E%3Ccircle cx='16' cy='16' r='6.5' fill='white' fill-opacity='.25' stroke='white' stroke-width='1.4'/%3E%3C/svg%3E") 16 16, grabbing; }
input.hex { cursor: text; }

/* ───────── Add-on de fusión ───────── */
#merge-card { margin-top: 8px; }
.addon-btn { width: 100%; height: 44px; border-radius: var(--r-md); display: flex; align-items: center; gap: 10px; padding: 0 12px; color: var(--ink-2); font-weight: 500;
  border: 1px dashed color-mix(in srgb, var(--ink) 22%, transparent); transition: all .25s var(--ease); }
.addon-btn span { flex: 1; text-align: left; }
.addon-btn:hover { color: var(--ink); background: var(--fill); border-color: color-mix(in srgb, var(--ink) 40%, transparent); }
.addon { border-radius: var(--r-lg); padding: 8px 10px 4px; background: linear-gradient(180deg, var(--fill-2), var(--fill)); box-shadow: inset 0 0 0 .5px var(--stroke), inset 0 1px 0 rgba(255, 255, 255, .08); animation: tabIn .4s var(--ease); }
.addon-head { display: flex; align-items: center; gap: 8px; height: 34px; margin-bottom: 4px; }
.addon-head .t { flex: 1; font-weight: 600; }
.addon-head svg.lucide { width: 16px; height: 16px; color: var(--ink-2); }
.addon-head .icon-btn { width: 28px; height: 28px; }
.ops { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--fill); margin-bottom: 4px; }
.op { height: 34px; border-radius: 10px; font-size: 17px; color: var(--ink-2); font-family: "Times New Roman", serif; transition: all .25s var(--ease); }
.op:hover { color: var(--ink); }
.op.on { color: var(--ink); background: linear-gradient(180deg, var(--fill-3), var(--fill-2)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 4px 12px -5px rgba(0, 0, 0, .45); }

/* ───────── Barra de degradado y selector de color ───────── */
.gbar { position: relative; height: 34px; margin: 4px 11px 20px; }
.gbar-track { position: absolute; inset: 0 -11px; border-radius: 12px; box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .25), inset 0 1px 0 rgba(255, 255, 255, .2); }
.gstop { position: absolute; top: 100%; width: 22px; height: 22px; margin: -6px 0 0 -11px; border-radius: 50%; background: var(--c);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .9), 0 3px 10px rgba(0, 0, 0, .45); transition: transform .25s var(--spring), opacity .2s; touch-action: none; }
.gstop::before { content: ""; position: absolute; left: 50%; bottom: 100%; width: 2px; height: 10px; margin-left: -1px; background: rgba(255, 255, 255, .9); box-shadow: 0 0 3px rgba(0, 0, 0, .4); }
.gstop.on { transform: scale(1.18); box-shadow: 0 0 0 2.5px #fff, 0 0 0 4.5px rgba(0, 0, 0, .25), 0 4px 14px rgba(0, 0, 0, .5); z-index: 2; }
.gstop.away { opacity: .35; transform: scale(.8); }
.stop-head { display: flex; align-items: center; gap: 8px; margin: 2px 2px 8px; }
.stop-head .lbl { flex: 1; color: var(--ink-2); font-weight: 500; }
.stop-head .icon-btn:disabled { opacity: .3; }
.picker { border-radius: var(--r-lg); padding: 10px; background: var(--fill); box-shadow: inset 0 0 0 .5px var(--stroke); margin-bottom: 10px; }
.sv { position: relative; height: 128px; border-radius: 12px; touch-action: none;
  background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, var(--h)); box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .2); }
.sv-thumb { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; box-shadow: 0 0 0 2.5px #fff, 0 2px 8px rgba(0, 0, 0, .5); pointer-events: none; }
.picker-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.swatch { width: 28px; height: 28px; border-radius: 9px; flex: none; box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .3); }
input.hue { flex: 1; }
input.hue::-webkit-slider-runnable-track { background: linear-gradient(90deg, #f00, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00); }
input.hue::-moz-range-track { background: linear-gradient(90deg, #f00, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00); }
input.hue::-moz-range-progress { background: transparent; }
.hexrow { gap: 6px; }
.hexrow .hash { color: var(--ink-3); font-family: var(--mono); padding-left: 4px; }
input.hex { flex: 1; min-width: 0; height: 32px; border: 0; border-radius: 9px; padding: 0 10px; background: var(--fill-2); color: var(--ink); font: 500 13px var(--mono); letter-spacing: .06em; text-transform: uppercase; outline: none; box-shadow: inset 0 0 0 .5px var(--stroke); }
input.hex:focus { box-shadow: inset 0 0 0 1.5px var(--ink); }
.fx .picker { margin-top: 6px; }
.colors .stop.on { box-shadow: 0 0 0 2px var(--ink), 0 3px 10px -3px rgba(0, 0, 0, .5); }

/* ───────── Interruptor en fila ───────── */
.row-toggle { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-md); background: var(--fill); box-shadow: inset 0 0 0 .5px var(--stroke); margin-bottom: 6px; }
.row-toggle > div:first-child { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.row-toggle b { font-weight: 600; }
.row-toggle span { color: var(--ink-3); font-size: 11.5px; line-height: 1.35; }

/* ───────── Insignia de vista previa ───────── */
#preview-badge { position: fixed; z-index: 14; right: 66px; bottom: 21px; height: 30px; padding: 0 12px 0 10px; border-radius: 99px; display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink-2); transition: opacity .4s; }
#preview-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: #34c759; box-shadow: 0 0 8px #34c759; }
#preview-badge.busy .dot { background: #ffd60a; box-shadow: 0 0 8px #ffd60a; animation: pulse 1s infinite; }
#preview-badge[data-tip]:hover::after { top: auto; bottom: calc(100% + 8px); left: auto; right: 0; transform: none; }
body.hide-ui #preview-badge { opacity: 0; }
@media (max-width: 760px) { #preview-badge { display: none; } }

#sound-pop { position: fixed; z-index: 45; top: 74px; right: 18px; width: 276px; padding: 14px 14px 12px; border-radius: 22px; display: flex; flex-direction: column; gap: 10px; opacity: 0; pointer-events: none; transform: translateY(-8px) scale(.97); transform-origin: top right; transition: opacity .3s, transform .45s var(--spring); }
#sound-pop.on { opacity: 1; pointer-events: auto; transform: none; }
#sound-pop .pop-title { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3, var(--ink-2)); padding: 0 2px; }
#btn-sound.muted { opacity: .55; }
body.hide-ui #sound-pop { opacity: 0; pointer-events: none; }
@media (max-width: 760px) { #sound-pop { top: 64px; right: 10px; left: 10px; width: auto; } }
@media (max-width: 480px) { .brand { display: none; } .topbar { grid-template-columns: auto 1fr; gap: 8px; } .actions { justify-self: end; } .actions button { width: 29px; } }

/* ───── Tacto: goma líquida al presionar y brillo suave al pasar ───── */
:is(.actions button, .island button, .icon-btn, .chip.btn, .chip-btn, .tile, .seg > button, .lib-item, .pal, .row-toggle, .tabs button, #tabs button, .eq-nav button, .addon button, .sheet button, #sound-pop .row-toggle) {
  transition: transform .6s var(--spring), background .25s, color .25s, box-shadow .35s, filter .35s;
  will-change: transform;
}
:is(.actions button, .island button, .icon-btn, .chip.btn, .chip-btn, .tile, .seg > button, .lib-item, .pal, .row-toggle, .tabs button, #tabs button, .eq-nav button, .addon button, .sheet button):active {
  transform: scale(.9, .84);
  transition: transform .09s ease-out, background .25s, color .25s;
}
.lib-item:active, .tile:active, .row-toggle:active { transform: scale(.96, .92); }
@media (hover: hover) {
  :is(.actions button, .island button, .icon-btn, .chip.btn, .chip-btn, .tile, .lib-item, .pal, .row-toggle, #tabs button):hover {
    filter: brightness(1.14);
    box-shadow: 0 0 0 .5px rgba(255, 255, 255, .22) inset, 0 0 20px rgba(255, 255, 255, .13);
  }
  body.ui-light :is(.actions button, .island button, .icon-btn, .chip.btn, .chip-btn, .tile, .lib-item, .pal, .row-toggle, #tabs button):hover {
    filter: brightness(1.04);
    box-shadow: 0 0 0 .5px rgba(255, 255, 255, .6) inset, 0 0 18px rgba(255, 255, 255, .5);
  }
}
.row-toggle:active .toggle::after { width: 27px; }
.row-toggle:active .toggle.on::after { transform: translateX(9px); }
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.3, .9); }
.sub-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin: 2px 2px 6px; }
@media (prefers-reduced-motion: reduce) { :is(button, .tile, .lib-item, .row-toggle):active { transform: none; } }

/* ───── Firma KB: enlace al portfolio ───── */
.credit { position: fixed; z-index: 14; right: 18px; bottom: 18px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); transition: transform .6s var(--spring), filter .35s, box-shadow .35s; }
.credit .logo { display: block; width: 18px; height: 18px; fill: currentColor; stroke: none; opacity: .9; }
@media (hover: hover) { .credit:hover { transform: scale(1.1); filter: brightness(1.15); box-shadow: 0 0 0 .5px rgba(255, 255, 255, .25) inset, 0 0 22px rgba(255, 255, 255, .2); } }
.credit:active { transform: scale(.88, .82); transition: transform .09s ease-out; }
.credit[data-tip]:hover::after { top: auto; bottom: calc(100% + 8px); left: auto; right: 0; transform: none; }
body.hide-ui .credit { opacity: .5; }
@media (max-width: 760px) { .credit { display: none; } }
@media (max-width: 1000px) { #hint { display: none; } }

/* ───── Asistente: armá tu fondo por pasos ───── */
#asistente { position: fixed; z-index: 55; left: 50%; bottom: 22px; width: min(820px, calc(100vw - 24px)); padding: 18px 18px 14px; border-radius: 30px; display: none; flex-direction: column; gap: 12px; transform: translate(-50%, 24px) scale(.97); opacity: 0; transition: transform .6s var(--spring), opacity .35s; }
#asistente.on { display: flex; transform: translate(-50%, 0); opacity: 1; }
#asistente h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; font-weight: 650; }
#asistente p { margin: 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.45; }
.as-cabeza { display: flex; align-items: center; gap: 12px; }
.as-cuenta { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin-right: auto; }
.as-prog { display: flex; gap: 5px; flex: 1; max-width: 320px; }
.as-prog span { height: 4px; flex: 1; border-radius: 99px; background: var(--fill-2); transition: background .4s, flex .5s var(--spring); }
.as-prog span.hecho { background: color-mix(in srgb, var(--ink) 55%, transparent); }
.as-prog span.on { background: var(--ink); flex: 1.6; }
.as-opciones { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 8px; }
.opc { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 92px; padding: 10px 8px; border-radius: 18px; background: var(--fill); color: var(--ink); text-align: center; box-shadow: inset 0 0 0 .5px var(--stroke); }
.opc svg.lucide { width: 22px; height: 22px; margin-bottom: 2px; }
.opc b { font-size: 13px; font-weight: 600; letter-spacing: -.01em; }
.opc span { font-size: 11px; color: var(--ink-2); line-height: 1.25; }
.opc.on { background: var(--ink); color: #fff; box-shadow: none; }
.opc.on span { color: rgba(255, 255, 255, .65); }
body:not(.ui-light) .opc.on, body:not(.ui-light) .as-primario { color: #0b0b0d; }
body:not(.ui-light) .opc.on span { color: rgba(0, 0, 0, .55); }
.as-muestra { display: flex; flex-direction: column; gap: 3px; width: 70%; margin-top: 3px; }
.as-muestra i { height: 5px; border-radius: 99px; display: block; }
.as-pie, .as-acciones { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.as-pie { justify-content: flex-start; }
.as-pie .as-primario { margin-left: auto; }
.as-sec { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 99px; background: var(--fill); color: var(--ink); font-size: 12.5px; font-weight: 550; box-shadow: inset 0 0 0 .5px var(--stroke); }
.as-sec[disabled] { opacity: .35; pointer-events: none; }
.as-sec svg.lucide, .as-primario svg.lucide { width: 15px; height: 15px; }
.as-primario { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 20px; border-radius: 99px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 650; margin-left: auto; }
.as-intro { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 14px 18px 8px; }
.as-intro p { max-width: 460px; }
.as-intro .as-primario { margin: 8px 0 0; }
.as-insignia { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--fill-2); }
.as-insignia svg.lucide { width: 24px; height: 24px; }
.as-cerrar { flex: none; }
.as-resumen { display: flex; flex-wrap: wrap; gap: 6px; }
.as-chip { height: 28px; padding: 0 12px; border-radius: 99px; background: var(--fill); color: var(--ink-2); font-size: 12px; font-weight: 550; box-shadow: inset 0 0 0 .5px var(--stroke); }
.as-nav { display: flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; margin-right: 4px; }
.as-nav .icon-btn[disabled] { opacity: .3; pointer-events: none; }
.lib-wizard { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 18px; background: var(--fill-2); color: var(--ink); text-align: left; box-shadow: inset 0 0 0 .5px var(--stroke); }
.lib-wizard div { flex: 1; display: grid; gap: 2px; }
.lib-wizard b { font-size: 14px; font-weight: 650; }
.lib-wizard span { font-size: 12px; color: var(--ink-2); }
.lib-wizard svg.lucide { width: 20px; height: 20px; flex: none; }
body.en-asistente .credit, body.en-asistente #hint { opacity: 0; pointer-events: none; }
@media (max-width: 480px) { .brand { display: none; } .topbar { grid-template-columns: auto 1fr; gap: 8px; } .actions { justify-self: end; } .actions button { width: 29px; } }

/* ───── Tacto: goma líquida al presionar y brillo suave al pasar ───── */
:is(.actions button, .island button, .icon-btn, .chip.btn, .chip-btn, .tile, .seg > button, .lib-item, .pal, .row-toggle, .tabs button, #tabs button, .eq-nav button, .addon button, .sheet button, #sound-pop .row-toggle) {
  transition: transform .6s var(--spring), background .25s, color .25s, box-shadow .35s, filter .35s;
  will-change: transform;
}
:is(.actions button, .island button, .icon-btn, .chip.btn, .chip-btn, .tile, .seg > button, .lib-item, .pal, .row-toggle, .tabs button, #tabs button, .eq-nav button, .addon button, .sheet button):active {
  transform: scale(.9, .84);
  transition: transform .09s ease-out, background .25s, color .25s;
}
.lib-item:active, .tile:active, .row-toggle:active { transform: scale(.96, .92); }
@media (hover: hover) {
  :is(.actions button, .island button, .icon-btn, .chip.btn, .chip-btn, .tile, .lib-item, .pal, .row-toggle, #tabs button):hover {
    filter: brightness(1.14);
    box-shadow: 0 0 0 .5px rgba(255, 255, 255, .22) inset, 0 0 20px rgba(255, 255, 255, .13);
  }
  body.ui-light :is(.actions button, .island button, .icon-btn, .chip.btn, .chip-btn, .tile, .lib-item, .pal, .row-toggle, #tabs button):hover {
    filter: brightness(1.04);
    box-shadow: 0 0 0 .5px rgba(255, 255, 255, .6) inset, 0 0 18px rgba(255, 255, 255, .5);
  }
}
.row-toggle:active .toggle::after { width: 27px; }
.row-toggle:active .toggle.on::after { transform: translateX(9px); }
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.3, .9); }
.sub-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin: 2px 2px 6px; }
@media (prefers-reduced-motion: reduce) { :is(button, .tile, .lib-item, .row-toggle):active { transform: none; } }

/* ───── Firma KB: enlace al portfolio ───── */
.credit { position: fixed; z-index: 14; right: 18px; bottom: 18px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); transition: transform .6s var(--spring), filter .35s, box-shadow .35s; }
.credit .logo { display: block; width: 18px; height: 18px; fill: currentColor; stroke: none; opacity: .9; }
@media (hover: hover) { .credit:hover { transform: scale(1.1); filter: brightness(1.15); box-shadow: 0 0 0 .5px rgba(255, 255, 255, .25) inset, 0 0 22px rgba(255, 255, 255, .2); } }
.credit:active { transform: scale(.88, .82); transition: transform .09s ease-out; }
.credit[data-tip]:hover::after { top: auto; bottom: calc(100% + 8px); left: auto; right: 0; transform: none; }
body.hide-ui .credit { opacity: .5; }
@media (max-width: 760px) { .credit { display: none; } }
@media (max-width: 1000px) { #hint { display: none; } }

/* ───── Asistente: armá tu fondo por pasos ───── */
#asistente { position: fixed; z-index: 55; left: 50%; bottom: 22px; width: min(820px, calc(100vw - 24px)); padding: 18px 18px 14px; border-radius: 30px; display: none; flex-direction: column; gap: 12px; transform: translate(-50%, 24px) scale(.97); opacity: 0; transition: transform .6s var(--spring), opacity .35s; }
#asistente.on { display: flex; transform: translate(-50%, 0); opacity: 1; }
#asistente h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; font-weight: 650; }
#asistente p { margin: 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.45; }
.as-cabeza { display: flex; align-items: center; gap: 12px; }
.as-cuenta { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin-right: auto; }
.as-prog { display: flex; gap: 5px; flex: 1; max-width: 320px; }
.as-prog span { height: 4px; flex: 1; border-radius: 99px; background: var(--fill-2); transition: background .4s, flex .5s var(--spring); }
.as-prog span.hecho { background: color-mix(in srgb, var(--ink) 55%, transparent); }
.as-prog span.on { background: var(--ink); flex: 1.6; }
.as-opciones { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 8px; }
.opc { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 92px; padding: 10px 8px; border-radius: 18px; background: var(--fill); color: var(--ink); text-align: center; box-shadow: inset 0 0 0 .5px var(--stroke); }
.opc svg.lucide { width: 22px; height: 22px; margin-bottom: 2px; }
.opc b { font-size: 13px; font-weight: 600; letter-spacing: -.01em; }
.opc span { font-size: 11px; color: var(--ink-2); line-height: 1.25; }
.opc.on { background: var(--ink); color: #fff; box-shadow: none; }
.opc.on span { color: rgba(255, 255, 255, .65); }
body:not(.ui-light) .opc.on, body:not(.ui-light) .as-primario { color: #0b0b0d; }
body:not(.ui-light) .opc.on span { color: rgba(0, 0, 0, .55); }
.as-muestra { display: flex; flex-direction: column; gap: 3px; width: 70%; margin-top: 3px; }
.as-muestra i { height: 5px; border-radius: 99px; display: block; }
.as-pie, .as-acciones { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.as-pie { justify-content: flex-start; }
.as-pie .as-primario { margin-left: auto; }
.as-sec { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 99px; background: var(--fill); color: var(--ink); font-size: 12.5px; font-weight: 550; box-shadow: inset 0 0 0 .5px var(--stroke); }
.as-sec[disabled] { opacity: .35; pointer-events: none; }
.as-sec svg.lucide, .as-primario svg.lucide { width: 15px; height: 15px; }
.as-primario { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 20px; border-radius: 99px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 650; margin-left: auto; }
.as-intro { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 14px 18px 8px; }
.as-intro p { max-width: 460px; }
.as-intro .as-primario { margin: 8px 0 0; }
.as-insignia { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--fill-2); }
.as-insignia svg.lucide { width: 24px; height: 24px; }
.as-cerrar { flex: none; }
.as-resumen { display: flex; flex-wrap: wrap; gap: 6px; }
.as-chip { height: 28px; padding: 0 12px; border-radius: 99px; background: var(--fill); color: var(--ink-2); font-size: 12px; font-weight: 550; box-shadow: inset 0 0 0 .5px var(--stroke); }
.as-nav { display: flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; margin-right: 4px; }
.as-nav .icon-btn[disabled] { opacity: .3; pointer-events: none; }
.lib-wizard { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 18px; background: var(--fill-2); color: var(--ink); text-align: left; box-shadow: inset 0 0 0 .5px var(--stroke); }
.lib-wizard div { flex: 1; display: grid; gap: 2px; }
.lib-wizard b { font-size: 14px; font-weight: 650; }
.lib-wizard span { font-size: 12px; color: var(--ink-2); }
.lib-wizard svg.lucide { width: 20px; height: 20px; flex: none; }
body.en-asistente .credit, body.en-asistente #hint { opacity: 0; pointer-events: none; }
@media (max-width: 600px) {
  #asistente { bottom: 10px; padding: 14px 12px 12px; border-radius: 26px; }
  .as-opciones { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
  .opc { min-height: 78px; } .opc span { display: none; }
  .as-primario { width: 100%; justify-content: center; margin: 4px 0 0; }
}
@media (max-width: 480px) { #btn-engine { display: none; } }

/* Cursor propio: anillo con inercia + punto */
html.cursor-curva, html.cursor-curva * { cursor: none !important; }
html.cursor-curva input[type=text], html.cursor-curva textarea { cursor: text !important; }
#cur-anillo, #cur-punto { position: fixed; left: 0; top: 0; z-index: 9999; pointer-events: none; opacity: 0; transition: opacity .25s; mix-blend-mode: difference; }
#cur-anillo.on, #cur-punto.on { opacity: 1; }
#cur-anillo::before, #cur-punto::before { content: ''; position: absolute; border-radius: 50%; }
#cur-anillo::before { width: 30px; height: 30px; left: -15px; top: -15px; border: 1.5px solid #fff; transition: width .35s var(--spring), height .35s var(--spring), left .35s var(--spring), top .35s var(--spring), background .25s; }
#cur-punto::before { width: 6px; height: 6px; left: -3px; top: -3px; background: #fff; }
#cur-anillo.sobre::before { width: 46px; height: 46px; left: -23px; top: -23px; background: rgba(255, 255, 255, .22); }
#cur-anillo.pres::before { width: 20px; height: 20px; left: -10px; top: -10px; background: rgba(255, 255, 255, .5); }

/* Asistente: gestor de categorías */
.as-cats { display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.as-cats::-webkit-scrollbar { display: none; }
.as-cat { flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 78px; padding: 8px 10px; border-radius: 16px; color: var(--ink); background: transparent; transition: background .25s, box-shadow .25s, transform .4s var(--spring); }
.as-cat svg.lucide { width: 18px; height: 18px; }
.as-cat b { font-size: 12px; font-weight: 620; }
.as-cat span { font-size: 10.5px; color: var(--ink-2); max-width: 90px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-cat.on { background: var(--fill-2); box-shadow: inset 0 0 0 .5px var(--stroke); }
.as-cat:hover, .opc:hover, .as-sec:hover, .as-primario:hover { box-shadow: inset 0 0 0 .5px var(--stroke), 0 0 22px -2px rgba(140, 170, 255, .55); transform: translateY(-1px); background-color: var(--fill-2); }
.opc.on:hover, .as-primario:hover { background-color: var(--ink); box-shadow: 0 0 26px -2px rgba(150, 180, 255, .75); }
.opc:active, .as-cat:active, .as-sec:active, .as-primario:active { transform: scale(.96); }
.opc { transition: background .25s, box-shadow .25s, transform .4s var(--spring); position: relative; }
.as-variante { position: absolute; top: 6px; right: 8px; font-size: 9.5px; font-style: normal; opacity: .6; }
.as-ayuda { text-align: center; font-size: 12px !important; }
.as-opciones.ocupado { opacity: .7; pointer-events: none; }
.as-pie .icon-btn[disabled] { opacity: .3; pointer-events: none; }
.as-pie .as-primario { margin-left: auto; }


/* Asistente compacto: opciones arriba, barra de categorías abajo */
#asistente { bottom: 14px; width: min(760px, calc(100vw - 20px)); padding: 10px; gap: 8px; border-radius: 26px; }
#asistente .as-intro { padding: 8px 12px 4px; }
.as-opciones { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.as-opciones::-webkit-scrollbar { display: none; }
.as-opciones.plegado { display: none; }
.opc { flex: 1 0 auto; flex-direction: row; gap: 8px; min-height: 0; height: 44px; padding: 0 14px; border-radius: 99px; white-space: nowrap; }
.opc svg.lucide { margin: 0; width: 17px; height: 17px; }
.opc span { display: none; }
.opc .as-muestra { flex-direction: row; width: auto; margin: 0; gap: 2px; }
.opc .as-muestra i { width: 14px; height: 14px; border-radius: 50%; }
.as-barra { display: flex; align-items: center; gap: 8px; }
.as-cats { flex: 1; min-width: 0; padding: 0; }
.as-cat { flex-direction: row; gap: 6px; min-width: 0; padding: 0 12px; height: 38px; border-radius: 99px; }
.as-cat b { font-size: 12.5px; }
.as-acc { display: flex; align-items: center; gap: 4px; flex: none; }
.as-acc .as-primario { height: 36px; padding: 0 16px; font-size: 13px; margin-left: 4px; }
@media (max-width: 640px) { .as-cat b { display: none; } .as-cat { padding: 0 10px; } .as-acc .as-primario span, .as-acc .as-primario { padding: 0 12px; } .as-opciones { max-height: none; } }

/* Biblioteca en celular: una tarjeta en foco al centro, las demás atenuadas y con aire alrededor */
@media (max-width: 760px) {
  .lib-grid { grid-template-columns: 1fr; gap: 14px; padding: 6px 6px 40%; scroll-snap-type: y proximity; -webkit-overflow-scrolling: touch; }
  .lib-item { scroll-snap-align: center; transform: scale(.9); opacity: .5; transition: transform .45s var(--spring), opacity .3s, box-shadow .3s; }
  .lib-item.foco { transform: scale(1); opacity: 1; box-shadow: 0 0 0 2px var(--ink), 0 14px 34px -8px rgba(0, 0, 0, .55); }
  .lib-item.foco span { font-size: 13px; padding: 5px 12px; }
  .lib-wizard { scroll-snap-align: center; }
}
.as-cat:not(.on) b { display: none; }
.as-cat { flex: 0 0 auto; padding: 0 12px; }
.as-cats { overflow-x: auto; }
@media (max-width: 640px) { .as-cat.on b { display: inline; } .as-cats { gap: 2px; } .as-acc .icon-btn { width: 34px; height: 34px; } #asistente { padding: 8px; } }
@media (max-width: 640px) {
  .as-barra { flex-wrap: wrap; gap: 4px; }
  .as-cats { flex: 1 1 100%; overflow: visible; }
  .as-cat { flex: 1 1 0; justify-content: center; padding: 0; height: 40px; }
  .as-cat.on b { display: none; }
  .as-acc { flex: 1 1 100%; }
  .as-acc .as-primario { margin-left: auto; }
  .opc { height: 42px; padding: 0 12px; }
}
