/* ============================================================================
   PickSpin — sistema visual. Las reglas escritas están en DESIGN.md.
   Resumen: letra redondeada del sistema, grises de iOS (negro real en oscuro),
   cuatro luces de fondo que viajan y cambian de color, tarjetas de vidrio
   teñidas apenas con el color de cada herramienta (--tc), íconos en dos tonos
   que brillan, y movimiento con RESORTE en todo lo que se toca.
   ========================================================================= */

@font-face {
  font-family: 'Nunito Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url('../fonts/nunito-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Nunito Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url('../fonts/nunito-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Layout: una columna centrada de 68rem; barra de vidrio arriba; cada herramienta es un "escenario" grande con su color. */
:root {
  --font: ui-rounded, 'SF Pro Rounded', 'Nunito Variable', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --t-hero: clamp(2.4rem, 7vw, 4.25rem);
  --t-xl: clamp(1.9rem, 4.6vw, 2.6rem);
  --t-l: 1.375rem;
  --t-m: 1.0625rem;
  --t-s: 0.9375rem;
  --t-xs: 0.8125rem;
  --t-xxs: 0.6875rem;

  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --surface-3: #e5e5ea;
  --text: #000000;
  --text-2: rgba(60, 60, 67, 0.64);
  --text-3: rgba(60, 60, 67, 0.36);
  --line: rgba(60, 60, 67, 0.12);
  --line-strong: rgba(60, 60, 67, 0.22);
  --material: rgba(255, 255, 255, 0.68);
  --material-edge: rgba(255, 255, 255, 0.7);
  --thumb: #ffffff;
  --orb-o: 0.3;
  --fill: rgba(255, 255, 255, 0.5);
  --fill-strong: rgba(255, 255, 255, 0.78);
  --field: rgba(255, 255, 255, 0.62);
  --brand: #0a84ff;
  --tc: var(--brand);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.07), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.18), 0 8px 20px rgba(0, 0, 0, 0.08);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 30px;

  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.36, 0.64, 1);
  --spring-soft: cubic-bezier(0.22, 1.12, 0.36, 1);
  --dur: 240ms;
  --dur-spring: 560ms;
  --lift: -3px;
  color-scheme: light;
}
@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --spring: linear(0, 0.0127, 0.0484 2.3%, 0.1838 5%, 0.4014 8.4%, 0.6513 12.4%, 0.8481 16.3%, 0.9206 18.3%, 0.9783 20.4%, 1.0219 22.6%, 1.0516 24.9%, 1.0686 27.4%, 1.0743 30.3%, 1.0688 33.6%, 1.0545 37.4%, 1.0122 47.3%, 0.9993 54.3%, 0.9947 61.7%, 0.9963 76.9%, 1);
    --spring-soft: linear(0, 0.0262, 0.0985 4.4%, 0.3489 10.1%, 0.6265 16.4%, 0.8259 22.5%, 0.9418 28.9%, 1.0001 35.6%, 1.0219 42.8%, 1.0206 51.7%, 1.0059 66.7%, 1);
  }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e; --surface-3: #3a3a3c; --text: #ffffff;
    --text-2: rgba(235, 235, 245, 0.62); --text-3: rgba(235, 235, 245, 0.3); --line: rgba(84, 84, 88, 0.42); --line-strong: rgba(84, 84, 88, 0.7);
    --material: rgba(28, 28, 30, 0.62); --material-edge: rgba(255, 255, 255, 0.08); --thumb: #636366; --orb-o: 0.48; --fill: rgba(255, 255, 255, 0.08); --fill-strong: rgba(255, 255, 255, 0.15); --field: rgba(255, 255, 255, 0.07);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5); --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.55); --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e; --surface-3: #3a3a3c; --text: #ffffff;
  --text-2: rgba(235, 235, 245, 0.62); --text-3: rgba(235, 235, 245, 0.3); --line: rgba(84, 84, 88, 0.42); --line-strong: rgba(84, 84, 88, 0.7);
  --material: rgba(28, 28, 30, 0.62); --material-edge: rgba(255, 255, 255, 0.08); --thumb: #636366; --orb-o: 0.48; --fill: rgba(255, 255, 255, 0.08); --fill-strong: rgba(255, 255, 255, 0.15); --field: rgba(255, 255, 255, 0.07);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5); --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.55); --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

/* ── Base ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
html, body { margin: 0; color: var(--text); }
html { background: var(--bg); }
/* El body sin fondo propio: si lo tuviera, taparía las luces (.bg-orbs, z-index -1). */
body { background: transparent; }
body {
  font-family: var(--font); font-size: var(--t-m); line-height: 1.42; letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent; overflow-x: hidden; min-height: 100vh;
}
/* Fondo (G5): cuatro luces que viajan de esquina en esquina y van cambiando de color
   (rojo, azul, violeta, rosa, índigo), muy despacio. Le dan al vidrio algo para desenfocar. */
.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: var(--bg); }
/* Rendimiento (medido: con las luces animando left/top y su color, la página perdía 30–60 cuadros al cargar;
   sin luces, ~16). Ahora la placa de video solo MUEVE y FUNDE manchas ya dibujadas, sin redibujarlas:
   - cada luz (<i>) viaja de esquina en esquina con transform;
   - el color cambia fundiendo dos manchas (<b>) con opacity. Nunca animar left/top/background acá. */
.bg-orbs i { position: absolute; left: -28vmax; top: -32vmax; width: 60vmax; height: 60vmax; will-change: transform;
  animation: orb-move 64s ease-in-out infinite; animation-delay: var(--om, 0s); }
.bg-orbs i:nth-child(2) { animation-delay: calc(var(--om, 0s) - 16s); }
.bg-orbs i:nth-child(3) { animation-delay: calc(var(--om, 0s) - 32s); }
.bg-orbs i:nth-child(4) { animation-delay: calc(var(--om, 0s) - 48s); }
/* Sin filter:blur (carísimo en manchas de 60vmax): un degradado circular ya nace difuminado y moverlo no cuesta nada. */
.bg-orbs b { position: absolute; inset: -20%; border-radius: 50%; background: radial-gradient(closest-side, var(--c) 0%, var(--c) 18%, color-mix(in srgb, var(--c) 72%, transparent) 42%, color-mix(in srgb, var(--c) 28%, transparent) 70%, transparent 100%); opacity: var(--orb-o); will-change: opacity;
  animation: orb-fade 26s ease-in-out infinite alternate; animation-delay: var(--oh, 0s); }
.bg-orbs b + b { animation-direction: alternate-reverse; }
.bg-orbs i:nth-child(1) b:first-child { --c: #ff375f; } .bg-orbs i:nth-child(1) b + b { --c: #ff6bcb; }
.bg-orbs i:nth-child(2) b:first-child { --c: #0a84ff; } .bg-orbs i:nth-child(2) b + b { --c: #8b5cf6; }
.bg-orbs i:nth-child(3) b:first-child { --c: #8b5cf6; } .bg-orbs i:nth-child(3) b + b { --c: #5e5ce6; }
.bg-orbs i:nth-child(4) b:first-child { --c: #5e5ce6; } .bg-orbs i:nth-child(4) b + b { --c: #ff375f; }
.bg-orbs i:nth-child(2) b { animation-delay: calc(var(--oh, 0s) - 6.5s); }
.bg-orbs i:nth-child(3) b { animation-delay: calc(var(--oh, 0s) - 13s); }
.bg-orbs i:nth-child(4) b { animation-delay: calc(var(--oh, 0s) - 19.5s); }
@keyframes orb-move {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(calc(100vw - 4vmax), 0); }
  50% { transform: translate(calc(100vw - 4vmax), calc(100vh + 4vmax)); }
  75% { transform: translate(0, calc(100vh + 4vmax)); }
}
@keyframes orb-fade { from { opacity: 0; } to { opacity: var(--orb-o); } }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; }
h1, h2, h3 { letter-spacing: -0.022em; line-height: 1.1; text-wrap: balance; margin: 0; }
p { margin: 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--tc) 55%, transparent); outline-offset: 2px; border-radius: 8px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.small { font-size: var(--t-xs); }
.wrap { width: 100%; max-width: 68rem; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; z-index: 99; background: var(--surface); padding: 8px 12px; border-radius: 10px; }
.row { display: flex; align-items: center; gap: 0.5rem; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; }
.row.wrap { flex-wrap: wrap; }
.gap-lg { gap: 1.25rem; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack.center { align-items: center; text-align: center; }
[hidden] { display: none !important; }

/* Vidrio: superficies grandes */
.glass {
  background: var(--material); border: 0.5px solid var(--material-edge); border-radius: var(--r-xl);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

/* ── Barra superior: transparente arriba, vidrio al bajar (como iOS) ─── */
.bar { position: sticky; top: 0; z-index: 30; padding-top: env(safe-area-inset-top, 0px); transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
html.scrolled .bar {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  box-shadow: 0 0.5px 0 var(--line-strong);
}
.bar-in { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; height: 3.75rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; text-decoration: none; border-radius: 12px; }
.brand-mark { width: 2rem; height: 2rem; flex-shrink: 0; }
.bar-tools { display: flex; align-items: center; gap: 0.5rem; }
@media (max-width: 340px) { .brand-name { display: none; } }

/* Botón redondo de la barra (abrir el menú de herramientas) */
.round {
  display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 0; padding: 0;
  background: var(--material); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: inset 0 0 0 0.5px var(--line-strong); color: var(--text);
  transition: transform var(--dur-spring) var(--spring), background var(--dur);
}
.round svg { width: 1.2rem; height: 1.2rem; }
.round:hover { background: var(--fill-strong); }
.round:active { transform: scale(0.9); transition-duration: 80ms; }

/* ── Control segmentado con "pastilla" que se desliza (EN|ES, claro|oscuro) ── */
.seg {
  --x: 0px; --w: 0px;
  position: relative; display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px;
  background: var(--fill); border: 0.5px solid var(--material-edge); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  isolation: isolate;
}
.seg::before {
  content: ''; position: absolute; z-index: -1; top: var(--y, 3px); left: 0; width: var(--w); height: var(--h, calc(100% - 6px));
  transform: translateX(var(--x)); border-radius: 999px;
  background: radial-gradient(120% 100% at 30% 0%, rgba(255, 255, 255, 0.32), transparent 60%), var(--tc);
  box-shadow: 0 3px 12px color-mix(in srgb, var(--tc) 45%, transparent), inset 0 0 0 0.5px rgba(255, 255, 255, 0.25);
  opacity: 0; transition: transform var(--dur-spring) var(--spring), width var(--dur-spring) var(--spring), top var(--dur-spring) var(--spring), opacity 150ms;
}
.seg.ready::before { opacity: 1; }
.seg.snap::before { transition: none !important; }
.seg > button, .seg > a {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; min-height: 2rem; min-width: 2.4rem; padding: 0 0.75rem;
  border: 0; background: transparent; border-radius: 999px; color: var(--text-2); font-size: var(--t-xs); font-weight: 700;
  text-decoration: none; white-space: nowrap; transition: color var(--dur) var(--ease), transform 420ms var(--spring);
}
.seg > [aria-pressed='true'], .seg > [aria-current] { color: var(--tc-ink, #fff); }
.seg > button:active, .seg > a:active { transform: scale(0.92); transition-duration: 80ms; }
.seg svg { width: 1rem; height: 1rem; }
.seg.lg > button { min-height: 2.5rem; font-size: var(--t-s); padding: 0 1rem; }
.seg.wrap { flex-wrap: wrap; border-radius: 18px; }
.seg.wrap::before { border-radius: 14px; }

/* ── Menú de herramientas (popover de vidrio que crece desde el botón) ── */
.menu {
  margin: 0; inset: auto; position: fixed; top: calc(env(safe-area-inset-top, 0px) + 4.25rem); right: max(16px, env(safe-area-inset-right, 0px)); left: auto;
  width: min(23rem, calc(100vw - 32px)); padding: 1rem; border-radius: var(--r-xl); color: var(--text);
  background: color-mix(in srgb, var(--surface) 46%, transparent); -webkit-backdrop-filter: saturate(190%) blur(34px); backdrop-filter: saturate(190%) blur(34px);
  border: 0.5px solid var(--material-edge); box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transform-origin: top right; opacity: 0; transform: scale(0.6);
  transition: opacity 220ms var(--ease), transform var(--dur-spring) var(--spring), overlay 300ms allow-discrete, display 300ms allow-discrete;
}
.menu:popover-open { opacity: 1; transform: none; }
@starting-style { .menu:popover-open { opacity: 0; transform: scale(0.6); } }
.menu::backdrop { background: transparent; }
.menu-title { font-size: var(--t-xs); font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; padding: 0 0.25rem 0.6rem; }
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.9rem 0.4rem; }
.menu-grid a { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; text-decoration: none; font-size: var(--t-xxs); font-weight: 700; text-align: center; line-height: 1.2; padding: 0.3rem; border-radius: 14px; transition: transform 420ms var(--spring), background var(--dur); }
.menu-grid a:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.menu-grid a:active { transform: scale(0.92); transition-duration: 80ms; }
.menu-grid .app-icon { --size: 2.6rem; }
.menu-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-top: 1rem; padding-top: 0.9rem; box-shadow: 0 -0.5px 0 var(--line-strong); }
@media (min-width: 640px) { .menu-foot { display: none; } }
@media (max-width: 639px) { .bar-tools .seg { display: none; } }

/* ── Ícono de herramienta: dos tonos del color propio, con un brillo sutil SOLO en el ícono ── */
.app-icon {
  --size: 2.9rem;
  position: relative; display: grid; place-items: center; flex-shrink: 0; width: var(--size); height: var(--size); color: var(--tc);
  filter: drop-shadow(0 0 7px color-mix(in srgb, var(--tc) 55%, transparent)) drop-shadow(0 0 16px color-mix(in srgb, var(--tc) 22%, transparent));
}
.app-icon svg { width: 100%; height: 100%; overflow: visible; }
.app-icon.lg { --size: 3.6rem; }

/* ── Inicio ───────────────────────────────────────────────────────────── */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 1rem; padding: clamp(2.5rem, 7vw, 4.5rem) 0 clamp(0.5rem, 2vw, 1rem); }
.eyebrow { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.8rem 0.3rem 0.65rem; border-radius: 999px; font-size: var(--t-xs); font-weight: 700; color: var(--text-2); background: var(--fill); border: 0.5px solid var(--material-edge); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.eyebrow i { width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--brand); box-shadow: 0 0 10px var(--brand); }
.hero h1 { font-size: clamp(1.9rem, 4.6vw, 3.6rem); font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; white-space: nowrap; }
@media (max-width: 560px) { .hero h1 { white-space: normal; max-width: 14ch; } }
.hero h1 em { font-style: normal; color: var(--brand); text-shadow: 0 0 28px color-mix(in srgb, var(--brand) 45%, transparent); }
.hero .lead { font-size: clamp(1.05rem, 2.2vw, 1.2rem); color: var(--text-2); max-width: 34rem; font-weight: 600; }
.group-title { font-size: var(--t-l); font-weight: 800; letter-spacing: -0.02em; margin: 2.25rem 0 0.9rem; }
.group-title small { display: block; font-size: var(--t-s); font-weight: 500; color: var(--text-2); letter-spacing: -0.01em; margin-top: 0.2rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: 0.9rem; }
.tile {
  position: relative; isolation: isolate; display: flex; flex-direction: column; align-items: flex-start; gap: 0.85rem; padding: 1.15rem 1.2rem 1.2rem; border-radius: var(--r-lg);
  background: linear-gradient(160deg, color-mix(in srgb, var(--tc) 18%, transparent), color-mix(in srgb, var(--tc) 2%, transparent)), var(--material);
  border: 1px solid color-mix(in srgb, var(--tc) 38%, var(--material-edge));
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--tc) 12%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  text-decoration: none; overflow: hidden;
  transition: transform var(--dur-spring) var(--spring), box-shadow var(--dur) var(--ease);
}
.tile-text { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.tile-name { font-weight: 800; font-size: var(--t-m); letter-spacing: -0.015em; }
.tile-desc { color: var(--text-2); font-size: var(--t-xs); line-height: 1.4; font-weight: 600; }
.tile-chev { position: absolute; top: 1rem; right: 1rem; color: var(--text-3); transition: transform var(--dur-spring) var(--spring), color var(--dur); }
.tile-chev svg { width: 1.1rem; height: 1.1rem; display: block; }
@media (hover: hover) {
  .tile:hover { transform: translateY(var(--lift)); box-shadow: 0 18px 44px color-mix(in srgb, var(--tc) 20%, rgba(0, 0, 0, 0.3)), inset 0 1px 0 rgba(255, 255, 255, 0.16); }
  .tile:hover .tile-chev { transform: translateX(3px); color: var(--tc); }
}
.tile:active { transform: scale(0.98); transition-duration: 90ms; }

/* Brillo que sigue al cursor (color de la herramienta) */
.glow::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; z-index: -1;
  background: radial-gradient(16rem circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--tc) 22%, transparent), transparent 66%);
  transition: opacity 300ms var(--ease);
}
@media (hover: hover) { .glow:hover::after { opacity: 1; } }

/* ── Página de herramienta ───────────────────────────────────────────── */
.back { display: inline-flex; align-items: center; gap: 0.1rem; margin: 0.75rem 0 0 -0.35rem; padding: 0.25rem 0.5rem 0.25rem 0.2rem; border-radius: 10px; color: var(--tc-text); font-weight: 600; font-size: var(--t-s); text-decoration: none; transition: background var(--dur); }
.back svg { width: 1.2rem; height: 1.2rem; }
.back:hover { background: color-mix(in srgb, var(--tc) 12%, transparent); }
.tool-head { display: flex; align-items: center; gap: 1rem; padding: 0.9rem 0 1.4rem; }
.tool-head h1 { font-size: var(--t-xl); font-weight: 800; letter-spacing: -0.03em; }
.tool-head .lead { color: var(--text-2); font-size: var(--t-s); margin-top: 0.35rem; max-width: 40rem; }
@media (max-width: 560px) { .tool-head { align-items: flex-start; } .tool-head .app-icon.lg { --size: 3.5rem; } }

/* Escenario: la tarjeta grande donde vive la herramienta */
.stage {
  position: relative; isolation: isolate; padding: clamp(1rem, 3vw, 2rem); border-radius: var(--r-xl);
  background: var(--material); border: 0.5px solid var(--material-edge); box-shadow: var(--shadow-md);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.stage::before {
  content: ''; position: absolute; inset: 0 0 auto; height: 14rem; z-index: -1; pointer-events: none; border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: radial-gradient(70% 100% at 50% 0%, color-mix(in srgb, var(--tc) 12%, transparent), transparent 70%);
}

/* Grupo estilo iOS (lista agrupada) */
.group {
  display: flex; flex-direction: column; gap: 0.85rem; padding: 1rem; border-radius: var(--r-lg); text-align: left;
  /* Panel de vidrio con un velo del color de la herramienta (antes: gris opaco, se veía plano) */
  background: linear-gradient(160deg, color-mix(in srgb, var(--tc) 12%, transparent), transparent 65%), var(--fill);
  border: 1px solid color-mix(in srgb, var(--tc) 18%, var(--material-edge));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.group.wide { width: 100%; max-width: 34rem; }
.label { font-size: var(--t-xs); font-weight: 700; color: var(--text-2); padding-left: 0.15rem; }
.field { display: flex; flex-direction: column; gap: 0.4rem; align-items: stretch; }
.field.inline { align-items: center; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 1.25rem; align-items: start; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

textarea, input[type='text'], input[type='number'] {
  width: 100%; min-height: 2.9rem; padding: 0.7rem 1rem; border: 0; border-radius: var(--r-md); background: var(--field); color: var(--text); outline: none;
  font-size: var(--t-m); box-shadow: inset 0 0 0 0.5px var(--line); transition: box-shadow var(--dur) var(--ease);
}
textarea { resize: vertical; min-height: 9rem; line-height: 1.55; }
textarea::placeholder, input::placeholder { color: var(--text-3); }
input[type='number'] { width: 7.5rem; text-align: center; font-weight: 800; font-size: 1.2rem; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
input[type='number']::-webkit-inner-spin-button { -webkit-appearance: none; }
textarea, input[type='text'], input[type='number'] { box-shadow: inset 0 0 0 1px var(--material-edge), inset 0 1px 0 rgba(255, 255, 255, 0.05); }
textarea:focus, input:focus { box-shadow: 0 0 0 1px var(--tc), 0 0 0 5px color-mix(in srgb, var(--tc) 18%, transparent); }

/* Interruptor estilo iOS */
.switch { display: inline-flex; align-items: center; gap: 0.7rem; font-weight: 700; font-size: var(--t-s); cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; position: relative; width: 3.1rem; height: 1.9rem; margin: 0; border-radius: 999px; background: var(--fill-strong); cursor: pointer; transition: background var(--dur) var(--ease); flex-shrink: 0; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: calc(1.9rem - 4px); height: calc(1.9rem - 4px); border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16); transition: transform var(--dur-spring) var(--spring); }
.switch input:checked { background: var(--tc); }
.switch input:checked::after { transform: translateX(1.2rem); }

body[data-tool='coin'], body[data-tool='pendulum'] { --tc-ink: rgba(0, 0, 0, 0.8); }
/* Texto en el color de la herramienta: en claro se oscurece un poco para que se lea (ámbar y celeste sobre blanco no se leen). */
body { --tc-text: color-mix(in srgb, var(--tc) 66%, #000); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) body { --tc-text: var(--tc); } }
:root[data-theme='dark'] body { --tc-text: var(--tc); }

/* Ayuda flotante: cualquier elemento con data-tip (con mouse). En celular, la misma explicación va en un .hint. */
@media (hover: hover) {
  [data-tip] { position: relative; }
  [data-tip]:hover::after {
    content: attr(data-tip); position: absolute; z-index: 40; left: 50%; bottom: calc(100% + 0.55rem); transform: translateX(-50%);
    width: max-content; max-width: 15rem; padding: 0.55rem 0.75rem; border-radius: 12px; white-space: normal; text-align: left;
    font-size: var(--t-xs); font-weight: 600; line-height: 1.35; color: var(--text);
    background: var(--material); border: 0.5px solid var(--material-edge); box-shadow: var(--shadow-md);
    -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
    pointer-events: none; animation: tip-in 160ms var(--ease-out) both;
  }
}
@keyframes tip-in { from { opacity: 0; transform: translate(-50%, 4px); } }

/* ── Botones ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 2.75rem; padding: 0 1.15rem; border-radius: 999px; border: 0;
  background: var(--fill); color: var(--text); font-weight: 700; font-size: var(--t-s); letter-spacing: -0.01em; white-space: nowrap; text-decoration: none;
  box-shadow: inset 0 0 0 0.5px var(--line-strong);
  transition: transform var(--dur-spring) var(--spring), background var(--dur) var(--ease), filter var(--dur), opacity var(--dur), box-shadow var(--dur);
}
.btn svg { width: 1.1rem; height: 1.1rem; }
.btn:hover { background: var(--fill-strong); }
.btn:active { transform: scale(0.95); transition-duration: 80ms; }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.btn.primary { background: var(--tc); color: var(--tc-ink, #fff); box-shadow: 0 6px 18px color-mix(in srgb, var(--tc) 36%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.22); }
.btn.primary:hover { filter: brightness(1.08); background: var(--tc); }
.btn.tinted { background: color-mix(in srgb, var(--tc) 14%, transparent); color: var(--tc-text); box-shadow: none; }
.btn.tinted:hover { background: color-mix(in srgb, var(--tc) 22%, transparent); }
.btn.plain { background: transparent; box-shadow: none; color: var(--tc-text); }
.btn.plain:hover { background: color-mix(in srgb, var(--tc) 10%, transparent); }
.btn.lg { min-height: 3.5rem; padding: 0 2.25rem; font-size: var(--t-m); font-weight: 800; }
.btn.sm { min-height: 2.1rem; padding: 0 0.85rem; font-size: var(--t-xs); }
.btn.icon { width: 2.75rem; padding: 0; font-size: 1.35rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.count-out { min-width: 2.5ch; text-align: center; font-weight: 800; font-size: 1.4rem; font-variant-numeric: tabular-nums; }

/* ── Hoja de resultado (crece con resorte, fondo desenfocado) ─────────── */
dialog.sheet {
  border: 0; padding: 2rem 1.5rem 1.5rem; width: min(92vw, 26rem); border-radius: var(--r-xl); text-align: center; color: var(--text);
  background: var(--material); -webkit-backdrop-filter: saturate(180%) blur(36px); backdrop-filter: saturate(180%) blur(36px);
  box-shadow: var(--shadow-lg), inset 0 0 0 0.5px var(--material-edge);
  opacity: 0; transform: scale(0.82) translateY(12px);
  transition: opacity 220ms var(--ease), transform var(--dur-spring) var(--spring), overlay 300ms allow-discrete, display 300ms allow-discrete;
}
dialog.sheet[open] { opacity: 1; transform: none; }
@starting-style { dialog.sheet[open] { opacity: 0; transform: scale(0.82) translateY(12px); } }
dialog.sheet::backdrop { background: rgba(0, 0, 0, 0); transition: background 300ms, overlay 300ms allow-discrete, display 300ms allow-discrete; }
dialog.sheet[open]::backdrop { background: rgba(0, 0, 0, 0.32); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@starting-style { dialog.sheet[open]::backdrop { background: rgba(0, 0, 0, 0); } }
.sheet-kicker { font-size: var(--t-xs); font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.08em; }
.sheet-big { font-size: clamp(2rem, 8vw, 2.8rem); font-weight: 900; letter-spacing: -0.03em; color: var(--tc); margin: 0.4rem 0 1.5rem; word-break: break-word; line-height: 1.05; }
.sheet .btn-row { justify-content: center; }

.result { font-size: clamp(1.75rem, 6vw, 2.6rem); font-weight: 900; letter-spacing: -0.03em; line-height: 1.1; min-height: 1.15em; }
.result.pop { animation: pop 520ms var(--spring) both; }
@keyframes pop { from { opacity: 0; transform: scale(0.7); } }

/* ── Aviso flotante (cápsula de vidrio) ───────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 1.5rem); z-index: 60; pointer-events: none;
  padding: 0.7rem 1.2rem; border-radius: 999px; font-weight: 700; font-size: var(--t-s); color: var(--text);
  background: var(--material); -webkit-backdrop-filter: saturate(180%) blur(28px); backdrop-filter: saturate(180%) blur(28px);
  box-shadow: var(--shadow-md), inset 0 0 0 0.5px var(--material-edge);
  opacity: 0; transform: translate(-50%, 1rem) scale(0.9); transition: opacity 200ms var(--ease), transform var(--dur-spring) var(--spring);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ── Anuncios: hueco reservado, siempre DEBAJO de la herramienta ──────── */
.ad-slot { width: 100%; max-width: 45.5rem; min-height: 6.25rem; margin: 2rem auto; position: relative; }
.ad-slot.is-off { min-height: 0; margin: 0 auto; }
.ad-label { position: absolute; top: -1.2rem; left: 0; font-size: var(--t-xxs); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; }

/* ── Texto y preguntas frecuentes ─────────────────────────────────────── */
.prose { max-width: 42rem; margin: 3rem auto 0; display: flex; flex-direction: column; gap: 0.75rem; }
.prose h2 { font-size: var(--t-l); font-weight: 800; margin-top: 1.25rem; }
.prose p { color: var(--text-2); line-height: 1.6; }
.prose a { color: var(--tc-text); }
.page-legal { padding: 2.5rem 0 1rem; }
.page-legal h1 { font-size: var(--t-xl); font-weight: 800; letter-spacing: -0.03em; }
.faq { display: flex; flex-direction: column; border-radius: var(--r-lg); background: var(--material); border: 0.5px solid var(--material-edge); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); box-shadow: var(--shadow-sm); overflow: hidden; }
.faq details + details { border-top: 0.5px solid var(--line-strong); }
.faq summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.15rem; font-weight: 700; transition: background var(--dur); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { background: color-mix(in srgb, var(--tc) 6%, transparent); }
.faq summary svg { width: 1rem; height: 1rem; color: var(--text-3); flex-shrink: 0; transition: transform var(--dur-spring) var(--spring); }
.faq details[open] summary svg { transform: rotate(90deg); color: var(--tc-text); }
.faq details p { padding: 0 1.15rem 1rem; color: var(--text-2); line-height: 1.55; }
.faq details[open] p { animation: reveal 380ms var(--spring-soft) both; }
@keyframes reveal { from { opacity: 0; transform: translateY(-6px); } }
.section-title { font-size: var(--t-l); font-weight: 800; margin: 3.5rem 0 0.9rem; }

.foot { margin-top: 4.5rem; padding-block: 2rem calc(2.5rem + env(safe-area-inset-bottom, 0px)); border-top: 0.5px solid var(--line-strong); }
.foot-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.foot p { color: var(--text-2); font-size: var(--t-xs); }
.foot nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; }
.foot nav a { color: var(--text-2); font-size: var(--t-xs); text-decoration: none; }
.foot nav a:hover { color: var(--text); }

/* ── Entradas escalonadas ─────────────────────────────────────────────── */
@keyframes appear { from { opacity: 0; transform: translateY(8px); } }
.enter { animation: appear 420ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 30ms); }

/* ── Transición entre páginas (el ícono "viaja" del inicio a la herramienta) ── */
/* Cambio de página SIN View Transitions entre documentos: esas obligan al navegador a "fotografiar" la
   página y el fondo de luces (muy desenfocado = pesado), y en algunas máquinas la pantalla quedaba vacía
   1–2 s. Ahora: al salir, el contenido se va hacia arriba (150 ms, ver core.js) y al entrar aparece
   deslizando. La barra y el fondo son iguales en todas las páginas y el fondo sigue el reloj: no saltan. */
#main { animation: page-in 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } }
/* La salida es otra animación (no una transición): la de entrada queda "pegada" con fill y le ganaría. */
html.leaving #main, html.leaving .foot { animation: page-out 90ms ease-in both; }
@keyframes page-out { to { opacity: 0; transform: translateY(-4px); } }
.enter { animation: none; }
/* Cambio de tema: todo se funde parejo (sin deslizar) */
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; } }
html.vt-theme::view-transition-old(root) { animation: vt-fade-out 280ms ease both; }
html.vt-theme::view-transition-new(root) { animation: vt-fade-in 280ms ease both; }

/* ============================ HERRAMIENTAS ============================ */

/* Ruleta */
.wheel-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(1.25rem, 3vw, 2.5rem); align-items: center; }
@media (max-width: 760px) { .wheel-layout { grid-template-columns: 1fr; } }
.wheel-stage { position: relative; width: 100%; max-width: 32rem; aspect-ratio: 1; margin: 0 auto; }
.wheel-canvas { display: block; width: 100%; height: 100%; cursor: pointer; }
.wheel-pointer {
  position: absolute; top: 1.5%; left: 50%; width: 1.75rem; height: 2.3rem; margin-left: -0.875rem; z-index: 3; color: var(--text); transform-origin: 50% 25%;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--text) 50%, transparent)) drop-shadow(0 3px 4px rgba(0, 0, 0, 0.4));
}
.wheel-pointer.tick { animation: tick 150ms var(--ease-out); }
@keyframes tick { 40% { transform: rotate(-16deg); } }
.wheel-hub {
  position: absolute; top: 50%; left: 50%; width: 22%; aspect-ratio: 1; transform: translate(-50%, -50%); border: 0; border-radius: 50%; z-index: 2;
  color: var(--text); font-weight: 900; font-size: clamp(0.85rem, 2.4vw, 1.1rem); letter-spacing: -0.02em;
  background: var(--material); -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3), inset 0 0 0 0.5px var(--material-edge), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform var(--dur-spring) var(--spring);
}
.wheel-hub:hover { transform: translate(-50%, -50%) scale(1.06); }
.wheel-hub:active { transform: translate(-50%, -50%) scale(0.94); transition-duration: 80ms; }
.wheel-hub:disabled { cursor: default; }
.entries textarea { min-height: 15rem; }
/* Personalizar la ruleta: panel plegable debajo */
.group.custom { margin-top: clamp(1rem, 3vw, 1.5rem); padding: 0; gap: 0; }
.custom-title { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.6rem; padding: 0.95rem 1.1rem; font-weight: 800; font-size: var(--t-s); border-radius: inherit; }
.custom-title::-webkit-details-marker { display: none; }
.custom-title svg { width: 1.1rem; height: 1.1rem; color: var(--tc-text); }
.custom-title svg:last-child { margin-left: auto; color: var(--text-3); transition: transform var(--dur-spring) var(--spring); }
.custom[open] .custom-title svg:last-child { transform: rotate(90deg); }
.custom-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 1.1rem 1.6rem; padding: 0.2rem 1.1rem 1.2rem; align-items: start; }
.custom[open] .custom-grid { animation: reveal 380ms var(--spring-soft) both; }
.hint { font-size: var(--t-xs); color: var(--text-2); font-weight: 600; line-height: 1.4; min-height: 2.8em; }
.range-ends { font-size: var(--t-xxs); color: var(--text-3); font-weight: 700; }
.sheet-note { font-size: var(--t-xs); color: var(--text-2); font-weight: 700; margin: -0.9rem 0 1.2rem; }

/* Deslizador */
input[type='range'] { -webkit-appearance: none; appearance: none; width: 100%; height: 1.8rem; background: transparent; cursor: pointer; margin: 0; }
input[type='range']:focus { box-shadow: none; }
input[type='range']::-webkit-slider-runnable-track { height: 0.42rem; border-radius: 999px; background: linear-gradient(to right, var(--tc) var(--p, 50%), var(--fill-strong) var(--p, 50%)); box-shadow: 0 0 12px color-mix(in srgb, var(--tc) 30%, transparent); }
input[type='range']::-moz-range-track { height: 0.42rem; border-radius: 999px; background: var(--fill-strong); }
input[type='range']::-moz-range-progress { height: 0.42rem; border-radius: 999px; background: var(--tc); }
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 1.45rem; height: 1.45rem; margin-top: -0.52rem; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 4px color-mix(in srgb, var(--tc) 30%, transparent); transition: transform var(--dur-spring) var(--spring); }
input[type='range']::-moz-range-thumb { width: 1.45rem; height: 1.45rem; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 4px color-mix(in srgb, var(--tc) 30%, transparent); }
input[type='range']:active::-webkit-slider-thumb { transform: scale(1.12); }


/* Moneda: metal ámbar con brillo (el color de la herramienta), emblema blanco en dos tonos.
   Al lanzar: sube girando dejando líneas que caen, baja y rebota al tocar el piso (ver coin.js). */
.coin-wrap { position: relative; display: flex; flex-direction: column; align-items: center; padding-top: 7rem; perspective: 1100px; }
.coin-fly { position: relative; z-index: 2; will-change: transform; }
.coin { position: relative; display: block; width: 10.5rem; height: 10.5rem; border: 0; padding: 0; background: none; border-radius: 50%; transform-style: preserve-3d; }
.coin-face {
  position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; color: rgba(255, 255, 255, 0.95);
  background:
    radial-gradient(120% 90% at 30% 15%, rgba(255, 255, 255, 0.55), transparent 42%),
    radial-gradient(circle at 50% 50%, #ffc964 0, #ffb340 52%, #e8931c 78%, #b86a0c 100%);
  box-shadow:
    inset 0 0 0 0.45rem rgba(255, 255, 255, 0.22), inset 0 0 0 0.62rem rgba(150, 82, 0, 0.32),
    inset 0 -0.7rem 1.4rem rgba(140, 70, 0, 0.4), inset 0 0.5rem 1rem rgba(255, 240, 200, 0.35),
    0 0 36px rgba(255, 179, 64, 0.38), 0 14px 30px rgba(120, 60, 0, 0.35);
}
.coin-face svg { width: 48%; height: 48%; filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.55)) drop-shadow(0 2px 2px rgba(120, 60, 0, 0.35)); }
.coin-face.tails { transform: rotateX(180deg); }
/* Líneas de velocidad: aparecen donde estaba la moneda y caen mientras sube */
.coin-streaks { position: absolute; left: 50%; top: 9rem; width: 8rem; height: 9rem; margin-left: -4rem; pointer-events: none; z-index: 1; }
.coin-streaks i { position: absolute; top: 0; width: 3px; border-radius: 3px; height: 3.2rem; opacity: 0; background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--tc) 85%, #fff)); box-shadow: 0 0 8px color-mix(in srgb, var(--tc) 60%, transparent); }
.coin-streaks i:nth-child(1) { left: 10%; } .coin-streaks i:nth-child(2) { left: 26%; height: 4.4rem; } .coin-streaks i:nth-child(3) { left: 44%; height: 2.6rem; }
.coin-streaks i:nth-child(4) { left: 58%; height: 4.8rem; } .coin-streaks i:nth-child(5) { left: 74%; height: 3rem; } .coin-streaks i:nth-child(6) { left: 90%; height: 3.8rem; }
.coin-wrap.go .coin-streaks i { animation: streak 620ms cubic-bezier(0.3, 0.6, 0.4, 1) both; }
.coin-wrap.go .coin-streaks i:nth-child(2) { animation-delay: 50ms; } .coin-wrap.go .coin-streaks i:nth-child(3) { animation-delay: 110ms; }
.coin-wrap.go .coin-streaks i:nth-child(4) { animation-delay: 30ms; } .coin-wrap.go .coin-streaks i:nth-child(5) { animation-delay: 140ms; } .coin-wrap.go .coin-streaks i:nth-child(6) { animation-delay: 80ms; }
@keyframes streak { 0% { opacity: 0; transform: translateY(-2rem) scaleY(0.4); } 25% { opacity: 0.9; } 100% { opacity: 0; transform: translateY(6rem) scaleY(1.1); } }
/* "Pling" al caer: un aro que se abre en el piso */
.coin-ring { position: absolute; left: 50%; bottom: 0.35rem; width: 10rem; height: 2.2rem; margin-left: -5rem; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--tc) 80%, #fff); opacity: 0; pointer-events: none; box-shadow: 0 0 14px var(--tc); }
.coin-wrap.land .coin-ring { animation: ring 560ms cubic-bezier(0.2, 0.7, 0.3, 1) both; }
@keyframes ring { 0% { opacity: 0.9; transform: scale(0.45); } 100% { opacity: 0; transform: scale(1.5); } }
.coin-shadow { width: 8.5rem; height: 1.1rem; margin-top: 0.9rem; border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, 0.35), transparent); }
.tally { display: flex; justify-content: center; gap: 0.6rem; }
.tally-item { display: flex; flex-direction: column; align-items: center; min-width: 6.5rem; padding: 0.7rem 1rem; border-radius: var(--r-md); background: linear-gradient(160deg, color-mix(in srgb, var(--tc) 14%, transparent), transparent), var(--field); border: 1px solid color-mix(in srgb, var(--tc) 22%, transparent); }
.tally-item b { font-size: 1.6rem; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.tally-item span { font-size: var(--t-xs); color: var(--text-2); font-weight: 700; }
.streak { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; min-height: 0.9rem; }
.dot { width: 0.9rem; height: 0.9rem; border-radius: 50%; }
.dot.new { animation: pop 420ms var(--spring) both; }
.dot.h { background: radial-gradient(circle at 35% 30%, #ffe2a8, #ffb340 60%, #c47a12); box-shadow: 0 0 6px rgba(255, 179, 64, 0.5); }
.dot.t { background: radial-gradient(circle at 35% 30%, #ffe2a8, #e0a23a 55%, #8f560c); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5); }

/* Dados */
.dice-tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; min-height: 6rem; padding: 0.5rem; }
.die {
  position: relative; width: 5rem; height: 5rem; border-radius: 1.2rem; display: grid; place-items: center;
  background: linear-gradient(160deg, #ffffff, #eef0f5); color: var(--tc-text); font-weight: 900; font-size: 2rem; letter-spacing: -0.03em;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.06), inset 0 1px 0 #fff, 0 10px 22px rgba(0, 0, 0, 0.14), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
}
.die.d6 { grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 0.85rem; }
.die.d6 i { width: 0.8rem; height: 0.8rem; border-radius: 50%; place-self: center; background: radial-gradient(circle at 35% 30%, #48484a, #000); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.5); }
.die small { position: absolute; bottom: 0.3rem; right: 0.55rem; font-size: 0.6rem; color: #8e8e93; font-weight: 800; }
.total { display: flex; align-items: baseline; gap: 0.5rem; justify-content: center; }
.total span { font-size: var(--t-s); color: var(--text-2); font-weight: 700; }
.total b { font-size: 2.6rem; font-weight: 900; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }

/* Equipos: cada equipo es una tarjeta de vidrio con su color; los nombres se "reparten" como cartas */
.teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr)); gap: 0.8rem; }
.team {
  position: relative; overflow: hidden; padding: 0.95rem 1rem 1rem; border-radius: var(--r-lg);
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 24%, transparent), color-mix(in srgb, var(--c) 5%, transparent)), var(--fill);
  border: 1px solid color-mix(in srgb, var(--c) 42%, var(--material-edge));
  box-shadow: 0 10px 28px color-mix(in srgb, var(--c) 16%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  animation: team-in 520ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 70ms);
}
@keyframes team-in { from { opacity: 0; transform: translate3d(0, 12px, 0) scale(0.96); } }
.team h3 { display: flex; align-items: center; gap: 0.5rem; font-size: var(--t-s); font-weight: 800; margin-bottom: 0.7rem; }
.team h3::before { content: ''; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.team h3 small { margin-left: auto; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: var(--t-xxs); font-weight: 800; color: var(--text-2); background: var(--fill); }
.team ol { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.35rem; }
.team li {
  display: flex; align-items: center; gap: 0.55rem; padding: 0.3rem 0.45rem 0.3rem 0.3rem; border-radius: 999px; font-size: var(--t-s); font-weight: 600;
  background: color-mix(in srgb, var(--c) 10%, transparent);
  will-change: transform, opacity; animation: deal 460ms cubic-bezier(0.22, 1.25, 0.36, 1) both; animation-delay: calc(var(--d, 0) * 45ms + 140ms);
}
.team li .av { flex-shrink: 0; width: 1.65rem; height: 1.65rem; border-radius: 50%; display: grid; place-items: center; font-size: 0.75rem; font-weight: 900; color: #fff;
  background: radial-gradient(120% 90% at 30% 15%, rgba(255, 255, 255, 0.4), transparent 55%), var(--c); box-shadow: 0 0 10px color-mix(in srgb, var(--c) 45%, transparent); }
.team li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes deal { 0% { opacity: 0; transform: translate3d(-1.8rem, -0.5rem, 0) rotate(-6deg) scale(0.85); } 100% { opacity: 1; transform: none; } }
textarea.shuffled { animation: shuffled 420ms var(--ease-out); }
@keyframes shuffled { 0% { opacity: 0.35; transform: translateY(4px); } }
.empty { display: grid; place-items: center; gap: 0.6rem; padding: 3rem 1rem; border-radius: var(--r-lg); border: 1.5px dashed color-mix(in srgb, var(--tc) 40%, var(--line-strong)); background: color-mix(in srgb, var(--tc) 6%, transparent); color: var(--text-2); text-align: center; font-size: var(--t-s); font-weight: 600; }
.empty svg { width: 2.6rem; height: 2.6rem; color: var(--tc); filter: drop-shadow(0 0 10px color-mix(in srgb, var(--tc) 50%, transparent)); }

/* Número */
.number-out { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; min-height: 7rem; align-items: center; }
.number-out .n1 { font-size: clamp(4.5rem, 18vw, 8rem); font-weight: 900; letter-spacing: -0.05em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--tc-text); }
.number-out .n1 { display: inline-flex; text-shadow: 0 0 0 transparent; transition: text-shadow 400ms var(--ease), transform var(--dur-spring) var(--spring); }
.number-out .n1.lit { text-shadow: 0 0 34px color-mix(in srgb, var(--tc) 60%, transparent); animation: num-pop 520ms var(--spring) both; }
@keyframes num-pop { 40% { transform: scale(1.08); } }
/* Recorta solo arriba/abajo: el dígito se pasa 1–5 px de su caja a lo ancho (letra gruesa + interletrado negativo),
   y con overflow:hidden se veía cortado (medido con measureText). */
.number-out .reel { display: inline-block; height: 1em; overflow-x: visible; overflow-y: clip; line-height: 1; }
.number-out .strip { display: block; }
.number-out .strip span { display: block; height: 1em; line-height: 1; text-align: center; }
.number-out .nn { padding: 0.35rem 0.8rem; border-radius: 12px; background: color-mix(in srgb, var(--tc) 13%, transparent); color: var(--tc-text); font-weight: 800; font-size: 1.3rem; font-variant-numeric: tabular-nums; animation: num-drop 560ms var(--spring) both; animation-delay: calc(var(--i, 0) * 18ms); }
@keyframes num-drop { 0% { opacity: 0; transform: translateY(-16px) scale(0.6); } 60% { opacity: 1; transform: translateY(3px) scale(1.08); } }
.number-out .ph { font-size: clamp(4.5rem, 18vw, 8rem); font-weight: 900; color: var(--text-3); line-height: 1; }

/* Péndulo */
.pendulum-stage { position: relative; width: min(100%, 25rem); aspect-ratio: 4 / 3; color: var(--text); margin-bottom: 0.9rem; }
.pendulum-arc { position: absolute; inset: 0; width: 100%; height: 100%; }
.pendulum { position: absolute; top: 6.667%; left: 50%; height: 70%; width: 0; transform-origin: top center; }
.pendulum::before { content: ''; position: absolute; top: -0.4rem; left: -0.4rem; width: 0.8rem; height: 0.8rem; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 3px var(--surface); }
.pendulum-string { position: absolute; left: -0.5px; top: 0; width: 1px; height: 100%; background: linear-gradient(var(--text-3), var(--text-2)); }
.pendulum-bob {
  position: absolute; left: -1.35rem; bottom: -2.5rem; width: 2.7rem; height: 3.3rem;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.9) 0 18%, transparent 19% 45%, rgba(255, 255, 255, 0.35) 46% 52%, transparent 53%), linear-gradient(180deg, color-mix(in srgb, var(--tc) 55%, #fff), var(--tc) 55%, color-mix(in srgb, var(--tc) 60%, #000));
  clip-path: polygon(50% 100%, 0 36%, 22% 0, 78% 0, 100% 36%);
  filter: drop-shadow(0 8px 14px color-mix(in srgb, var(--tc) 55%, transparent));
}
.pendulum-labels span { position: absolute; transform: translate(-50%, -50%); max-width: 32%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0.3rem 0.75rem; border-radius: 999px; font-size: var(--t-xs); font-weight: 800; background: var(--fill); color: var(--text-2); transition: background var(--dur), color var(--dur), transform var(--dur-spring) var(--spring), box-shadow var(--dur); }
.pendulum-labels span.on { background: var(--tc); color: var(--tc-ink, #fff); transform: translate(-50%, -50%) scale(1.15); box-shadow: 0 6px 18px color-mix(in srgb, var(--tc) 45%, transparent); }

/* Confeti (canvas a pantalla completa, sin capturar toques) */
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }

@media (prefers-reduced-motion: reduce) {
  .bg-orbs i, .bg-orbs b { animation: none !important; }
  .bg-orbs b + b { opacity: 0; }
  .bg-orbs i:nth-child(2) { transform: translate(calc(100vw - 4vmax), 0); }
  .bg-orbs i:nth-child(3) { transform: translate(calc(100vw - 4vmax), calc(100vh + 4vmax)); }
  .bg-orbs i:nth-child(4) { transform: translate(0, calc(100vh + 4vmax)); }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
