/* ---------- Tokens ---------- */
:root {
  --bg: #FAF5EC;
  --surface: #FFFFFF;
  --surface-2: #F3ECDF;
  --ink: #1E1A22;
  --muted: #6E6673;
  --line: #E2D8C8;
  --tile-border: #CDC1AF;
  --tile-filled: #8F8577;
  --key: #E6DCCB;
  --key-ink: #1E1A22;

  --rosa: #E4007C;
  --rosa-ink: #FFFFFF;
  --ok: #2E9A5A;
  --mid: #C98200;
  --no: #8A8190;

  --c1: #E4007C; --c2: #00979A; --c3: #E8A200; --c4: #2E9A5A; --c5: #6B3FA0; --c6: #F0621B;

  --radius: 10px;
  --shadow: 0 10px 40px rgb(30 26 34 / .18);
  --font: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Bungee', 'Bricolage Grotesque', system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151118; --surface: #211A25; --surface-2: #2A222F; --ink: #F3ECF6; --muted: #A99EAF;
    --line: #3A3140; --tile-border: #4A4050; --tile-filled: #8A7F92; --key: #3B3342; --key-ink: #F3ECF6;
    --no: #3F3846; --shadow: 0 10px 40px rgb(0 0 0 / .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151118; --surface: #211A25; --surface-2: #2A222F; --ink: #F3ECF6; --muted: #A99EAF;
  --line: #3A3140; --tile-border: #4A4050; --tile-filled: #8A7F92; --key: #3B3342; --key-ink: #F3ECF6;
  --no: #3F3846; --shadow: 0 10px 40px rgb(0 0 0 / .5);
  color-scheme: dark;
}
:root[data-hc="1"] { --ok: #E8641E; --mid: #2F7FD1; }

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app {
  height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 0 8px env(safe-area-inset-bottom);
}

/* ---------- Papel picado ---------- */
.picado {
  height: 26px;
  display: flex;
  gap: 4px;
  justify-content: center;
  overflow: hidden;
  flex: none;
  margin: 0 -8px;
  border-top: 2px solid var(--ink);
  position: relative;
}
.flag {
  flex: none;
  width: 30px;
  height: 22px;
  background: var(--fc);
  transform-origin: top center;
  -webkit-mask: radial-gradient(circle at 50% 42%, #0000 3px, #000 3.4px);
  mask: radial-gradient(circle at 50% 42%, #0000 3px, #000 3.4px);
  clip-path: polygon(0 0, 100% 0, 100% 78%, 87.5% 100%, 75% 78%, 62.5% 100%, 50% 78%, 37.5% 100%, 25% 78%, 12.5% 100%, 0 78%);
  animation: sway 4s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.37s);
}
@keyframes sway { 50% { transform: rotate(3deg) skewX(2deg); } }
.party .flag { animation: party .5s ease-in-out 4; }
@keyframes party { 50% { transform: translateY(3px) rotate(-6deg); } }

/* ---------- Header ---------- */
.top {
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 6px 0 8px;
  border-bottom: 1px solid var(--line);
}
.top-side { display: flex; align-items: center; gap: 2px; }
.top-side.end { justify-content: flex-end; }
.brand { text-align: center; }
.logo {
  font-family: var(--display);
  font-weight: 400;
  font-size: 30px;
  line-height: 1;
  margin: 0;
  color: var(--rosa);
  letter-spacing: .01em;
  text-shadow: 2px 2px 0 var(--ink);
}
.sub { margin: 4px 0 0; font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; display: flex; align-items: center; justify-content: center; gap: 6px; }

.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0; background: none; border-radius: 10px;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg .fill { fill: currentColor; stroke: none; }

.streak-chip {
  display: inline-flex; align-items: center; gap: 3px;
  height: 22px; padding: 0 8px 0 6px; font-size: 12px; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface);
}
.streak-chip b { font-weight: 800; font-variant-numeric: tabular-nums; }
.streak-chip.hot { border-color: var(--rosa); }
.streak-chip.cold { opacity: .55; }

/* ---------- Pistas ---------- */
.hints { flex: none; padding: 10px 2px 4px; }
.hint-chips { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.hint-tag { width: 100%; text-align: center; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 11px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 13px; font-weight: 600;
  white-space: nowrap;
}
.chip.tag { background: var(--surface-2); border-color: transparent; cursor: default; }
.chip.locked { color: var(--muted); border-style: dashed; }
.chip.locked .lock { font-size: 11px; font-weight: 800; background: var(--surface-2); padding: 2px 6px; border-radius: 99px; }
.chip.confirm { border-color: var(--rosa); color: var(--rosa); border-style: solid; }
.chip.open { border-color: var(--ink); }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.fresh { animation: pulse 1s ease-out 2; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgb(228 0 124 / .6); } 100% { box-shadow: 0 0 0 10px rgb(228 0 124 / 0); } }

.hint-text {
  min-height: 0;
  margin: 8px auto 0;
  max-width: 440px;
  text-align: center;
  font-size: 15px;
  line-height: 1.35;
  text-wrap: balance;
}
.hint-text:empty { display: none; }
.hint-text .blank { display: inline-block; border-bottom: 2.5px solid var(--rosa); color: transparent; letter-spacing: .1em; min-width: 3ch; }
.hint-text .lbl { display: block; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--rosa); margin-bottom: 2px; }

/* ---------- Tablero ---------- */
.board-wrap { flex: 1 1 auto; min-height: 0; display: grid; place-items: center; padding: 6px 0; }
.board { display: grid; gap: var(--gap, 5px); }
.row { display: flex; justify-content: center; gap: var(--gap, 5px); }
.row .sp { flex: none; width: calc(var(--tile) * .4); }
.tile {
  width: var(--tile); height: var(--tile);
  display: grid; place-items: center;
  border: 2px solid var(--tile-border);
  border-radius: 6px;
  font-weight: 800;
  font-size: calc(var(--tile) * .52);
  text-transform: uppercase;
  line-height: 1;
  user-select: none;
  background: var(--bg);
}
.tile.filled { border-color: var(--tile-filled); animation: pop .1s ease-out; }
@keyframes pop { 50% { transform: scale(1.1); } }
.tile.ok, .tile.mid, .tile.no { border-color: transparent; color: #fff; }
.tile.ok { background: var(--ok); }
.tile.mid { background: var(--mid); }
.tile.no { background: var(--no); }
.tile.flip { animation: flip .5s ease-in-out both; }
@keyframes flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(-90deg); } 100% { transform: rotateX(0); } }
.row.shake { animation: shake .45s; }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); } }
.tile.jump { animation: jump .5s ease both; }
@keyframes jump { 30% { transform: translateY(-28%); } 55% { transform: translateY(4%); } 75% { transform: translateY(-6%); } }

/* ---------- Teclado ---------- */
.keyboard { flex: none; padding: 4px 0 8px; user-select: none; }
.kb-row { display: flex; gap: 5px; margin-bottom: 7px; justify-content: center; }
.key {
  flex: 1 1 0;
  height: clamp(46px, 7.2dvh, 58px);
  min-width: 0;
  border: 0; border-radius: 6px;
  background: var(--key); color: var(--key-ink);
  font-weight: 800; font-size: 17px;
  text-transform: uppercase;
  display: grid; place-items: center;
  touch-action: manipulation;
  transition: transform .06s;
}
.key:active { transform: scale(.94); }
.key.wide { flex: 1.55 1 0; font-size: 11px; letter-spacing: 0; }
.key.wide svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.key.ok, .key.mid, .key.no { color: #fff; }
.key.ok { background: var(--ok); }
.key.mid { background: var(--mid); }
.key.no { background: var(--no); color: #fffd; }
:root[data-theme="dark"] .key.no { color: #fff8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .key.no { color: #fff8; } }

/* ---------- Toasts / confeti ---------- */
.toasts { position: fixed; top: 92px; left: 0; right: 0; display: grid; justify-items: center; gap: 8px; pointer-events: none; z-index: 60; }
.toast {
  background: var(--ink); color: var(--bg);
  padding: 11px 16px; border-radius: 8px;
  font-weight: 700; font-size: 15px;
  box-shadow: var(--shadow);
  animation: toast-in .2s ease-out;
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.badge { background: var(--rosa); color: #fff; }
.toast.out { opacity: 0; transition: opacity .3s; }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }

/* ---------- Hoja modal ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 50;
  background: rgb(15 10 18 / .5);
  display: grid; align-items: end; justify-items: center;
  animation: fade .2s;
}
.scrim[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: relative;
  width: 100%; max-width: 520px;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
  animation: rise .28s cubic-bezier(.2, .9, .3, 1.05);
  overscroll-behavior: contain;
}
@media (min-width: 640px) {
  .scrim { align-items: center; }
  .sheet { border-radius: 20px; max-height: 88dvh; }
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.sheet-close { position: absolute; top: 10px; right: 10px; }
.sheet h2 { font-family: var(--display); font-weight: 400; font-size: 26px; margin: 0 40px 4px 0; line-height: 1.1; }
.sheet h3 { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 0 10px; }
.sheet p { margin: 0 0 10px; line-height: 1.45; }
.lead { color: var(--muted); font-size: 15px; }

/* Resultado */
.result-top { display: grid; grid-template-columns: 124px 1fr; gap: 16px; align-items: start; margin-top: 14px; }
.meaning { font-size: 17px; font-weight: 600; line-height: 1.35; margin-bottom: 8px; }
.example { font-style: italic; color: var(--muted); font-size: 15px; }
.example b { color: var(--ink); font-style: normal; }
.eq { display: flex; flex-wrap: wrap; gap: 6px; }
.eq span { background: var(--surface-2); border-radius: 999px; padding: 6px 11px; font-size: 14px; font-weight: 600; }
.fact { background: color-mix(in srgb, var(--c3) 14%, var(--surface-2)); padding: 10px 12px; border-radius: 10px; font-size: 14.5px; margin-top: 14px; }

/* Carta de lotería */
.carta {
  --cc: var(--c1);
  position: relative;
  aspect-ratio: 5 / 7.4;
  background: #FFF9EE;
  border-radius: 8px;
  padding: 7px;
  box-shadow: 0 1px 0 #0002, 0 8px 22px rgb(30 26 34 / .22);
  color: #1E1A22;
  display: flex; flex-direction: column;
  border: 1px solid #0002;
}
.carta-in { flex: 1; border: 2px solid #1E1A22; border-radius: 3px; display: flex; flex-direction: column; overflow: hidden; }
.carta-art {
  flex: 1; display: grid; place-items: center;
  background:
    radial-gradient(circle at 50% 45%, #fff6 0 30%, transparent 31%),
    var(--cc);
  font-size: var(--emoji, 52px);
  line-height: 1;
  position: relative;
}
.carta-num { position: absolute; top: 4px; left: 6px; font-family: var(--display); font-size: 12px; color: #1E1A22; background: #FFF9EE; padding: 1px 5px; border-radius: 3px; }
.carta-name {
  font-family: var(--display); font-size: var(--name, 13px); text-align: center;
  padding: 5px 2px 4px; border-top: 2px solid #1E1A22; background: #FFF9EE;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.carta.reveal { animation: card-in .7s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes card-in { from { transform: rotateY(90deg) scale(.8); } }
.carta.lost .carta-art { filter: grayscale(1) contrast(.9); }
.carta.lost::after { content: 'SE ESCAPÓ'; position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%) rotate(-14deg); font-family: var(--display); font-size: 13px; color: #fff; background: #1E1A22; padding: 3px 7px; border-radius: 3px; white-space: nowrap; }
.carta.back .carta-art {
  background: repeating-linear-gradient(45deg, var(--c1) 0 8px, #d20073 8px 16px);
  font-family: var(--display); font-size: 26px; color: #FFF9EE;
}
.carta.skip .carta-art { background: var(--surface-2); filter: none; }

/* Botones */
.actions { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; margin-top: 18px; }
.btn {
  height: 52px; padding: 0 18px;
  border-radius: 999px; border: 0;
  font-weight: 800; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.primary { background: var(--rosa); color: var(--rosa-ink); }
.btn.ghost { background: var(--surface-2); }
.btn.round { width: 52px; padding: 0; }
.btn svg { width: 22px; height: 22px; }
.btn:active { transform: scale(.97); }

.countdown { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.countdown b { display: block; font-size: 28px; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: .02em; }

/* Estadísticas */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.stats b { display: block; font-size: 28px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; color: var(--muted); line-height: 1.2; display: block; }
.dist { display: grid; gap: 5px; }
.dist-row { display: grid; grid-template-columns: 14px 1fr; gap: 8px; align-items: center; font-size: 14px; font-weight: 700; }
.dist-bar { background: var(--no); color: #fff; min-width: 28px; padding: 3px 8px; border-radius: 4px; text-align: right; font-variant-numeric: tabular-nums; }
.dist-bar.me { background: var(--ok); }

.level { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.level-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.level-name { font-family: var(--display); font-size: 18px; color: var(--rosa); }
.level-next { font-size: 13px; color: var(--muted); }
.bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; width: 100%; height: 100%; background: var(--rosa); transform-origin: left; transition: transform .8s cubic-bezier(.16, 1, .3, 1); }

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.badge-it { background: var(--surface-2); border-radius: 12px; padding: 10px 6px; text-align: center; font-size: 12px; font-weight: 700; line-height: 1.2; }
.badge-it i { display: block; font-style: normal; font-size: 26px; margin-bottom: 4px; }
.badge-it small { display: block; font-weight: 500; color: var(--muted); margin-top: 3px; }
.badge-it.locked { opacity: .45; }
.badge-it.locked i { filter: grayscale(1); }

/* Álbum */
.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; }
.album .carta { --emoji: 34px; --name: 10px; cursor: pointer; border: 0; padding: 5px; font: inherit; }
.album .carta.back, .album .carta.skip { cursor: default; }
.album .carta-num { font-size: 10px; }

/* Ajustes */
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting b { display: block; }
.setting small { color: var(--muted); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; padding: 7px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.switch { width: 50px; height: 30px; border-radius: 99px; border: 0; background: var(--line); position: relative; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px #0003; }
.switch[aria-checked="true"] { background: var(--rosa); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.credits { font-size: 12.5px; color: var(--muted); margin-top: 18px; line-height: 1.5; }
.credits a { color: inherit; }

/* Cómo jugar */
.ex { display: flex; gap: 4px; margin: 12px 0 6px; --tile: 40px; }
.ex .tile { font-size: 21px; }
.rules { padding-left: 20px; margin: 10px 0; line-height: 1.5; }
.rules li { margin-bottom: 6px; }

@media (max-height: 640px) {
  .picado { height: 18px; }
  .flag { height: 16px; width: 24px; }
  .logo { font-size: 24px; }
  .sub { display: none; }
  .hints { padding-top: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.carta-btn { border: 0; background: none; padding: 0; text-align: inherit; display: block; }
.carta-btn:focus-visible, .btn:focus-visible, .key:focus-visible, .chip:focus-visible, .icon-btn:focus-visible { outline: 3px solid var(--rosa); outline-offset: 2px; }

/* ---------- Dibujos e íconos ---------- */
.carta-art {
  background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--cc) 34%, #FFF9EE) 0 44%, #FFF9EE 45%);
}
.carta-art > svg { width: 82%; height: 82%; }
.carta.back .carta-art > svg { width: 50%; height: 50%; }
.eq span { display: inline-flex; flex-direction: column; line-height: 1.15; padding: 6px 12px 7px; border-radius: 12px; }
.eq small { font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.fact { display: flex; gap: 10px; align-items: flex-start; }
.fact-ico { flex: none; width: 26px; height: 26px; }
.fact-ico svg, .toast-ico svg, .chip-ico svg, .confirm-ico svg, .badge-it i svg { width: 100%; height: 100%; display: block; }
.badge-it i { width: 44px; height: 44px; margin: 0 auto 6px; }
.chip-ico { width: 16px; height: 16px; display: inline-block; }
.toast { display: flex; align-items: center; gap: 8px; }
.toast-ico { width: 30px; height: 30px; flex: none; background: #FFF9EE; border-radius: 50%; padding: 3px; }
.chip svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chip.ready { border-color: var(--rosa); color: var(--rosa); background: var(--surface); }
.chip.ready .lock { background: var(--rosa); color: #fff; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 99px; }
.chip:disabled { cursor: default; }
.confirm-ico { width: 64px; height: 64px; margin: 4px 0 10px; }
.actions.two { grid-template-columns: 1fr 1fr; }
.level-next .pts { color: var(--ink); }

/* ---------- Pestañas Palabra / Frase ---------- */
.modes { flex: none; display: flex; justify-content: center; gap: 4px; margin: 8px auto 0; padding: 3px; background: var(--surface-2); border-radius: 999px; }
.modes a { position: relative; padding: 6px 18px; border-radius: 999px; font-weight: 800; font-size: 13px; color: var(--muted); text-decoration: none; }
.modes a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.modes a.pending::after { content: ''; position: absolute; top: 4px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--rosa); }
.btn.cross { width: 100%; margin-top: 14px; background: var(--ink); color: var(--bg); text-decoration: none; }

/* ---------- Logros por nivel de dificultad ---------- */
.tier { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 0 8px; font-family: var(--display); font-size: 15px; }
.tier span { font-family: var(--font); font-weight: 800; font-size: 13px; color: var(--muted); }
.tier-facil { color: var(--ok); }
.tier-medio { color: var(--mid); }
.tier-dificil { color: var(--rosa); }
.tier-loco { color: var(--c5); }
:root[data-theme="dark"] .tier-loco { color: #B08BE0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tier-loco { color: #B08BE0; } }
.badge-it.got { background: color-mix(in srgb, var(--c3) 16%, var(--surface-2)); }
.badge-it.got.t-loco { background: color-mix(in srgb, var(--c5) 22%, var(--surface-2)); }
.badge-it .prog { display: block; height: 5px; background: var(--line); border-radius: 9px; margin: 7px 6px 2px; overflow: hidden; }
.badge-it .prog i { display: block; height: 100%; background: var(--rosa); border-radius: 9px; }
.badge-it em { display: block; font-style: normal; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.badge-it.locked { opacity: 1; }
.badge-it.locked i, .badge-it.locked > small { opacity: .5; }
.badge-it.locked i svg { filter: grayscale(1); }

/* ---------- Dicho oculto ---------- */
.phrase {
  flex: none;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 7px 12px;
  margin: 10px 2px 2px; padding: 12px 10px;
  background: var(--surface); border: 2px solid var(--line); border-radius: 14px;
  transition: border-color .2s;
}
.phrase[hidden] { display: none; }
.phrase.solving { border-color: var(--rosa); box-shadow: 0 0 0 4px color-mix(in srgb, var(--rosa) 18%, transparent); }
.phrase.shake { animation: shake .45s; }
.pw { display: inline-flex; gap: 3px; }
.ps {
  width: 21px; height: 28px;
  display: grid; place-items: center;
  border-bottom: 3px solid var(--tile-border);
  font-weight: 800; font-size: 17px; line-height: 1;
}
.ps.on { border-color: var(--ok); color: var(--ink); }
.ps.pop { animation: pop-in .45s cubic-bezier(.16, 1, .3, 1); }
@keyframes pop-in { 0% { transform: scale(.2); color: var(--ok); } 60% { transform: scale(1.3); } }
.ps.typed { color: var(--rosa); border-color: var(--rosa); }
.ps.caret { border-color: var(--rosa); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { border-color: transparent; } }
.ps.solved { color: var(--rosa); border-color: var(--rosa); }
.ps.missed { color: var(--muted); border-color: var(--no); }
.board.dim { opacity: .35; transition: opacity .2s; }
.tile.bad { background: repeating-linear-gradient(45deg, #D7263D 0 6px, #b81f33 6px 12px); border-color: transparent; }
.solve-row { flex: none; padding: 2px 0 6px; }
.solve-row[hidden] { display: none; }
.solve-row .btn { width: 100%; height: 44px; font-size: 15px; }
.solve-row .btn:disabled { opacity: 1; cursor: default; background: var(--rosa); color: #fff; }
.dist-row { grid-template-columns: 42px 1fr; }
@media (max-width: 360px) { .ps { width: 18px; height: 25px; font-size: 15px; } }

/* ---------- Todo centrado ---------- */
.sheet { text-align: center; }
.sheet h2 { margin: 0 40px 6px; }
.lead { margin-left: auto; margin-right: auto; max-width: 42ch; }
.result-top { grid-template-columns: 1fr; justify-items: center; gap: 14px; }
.result-top .carta { width: 150px; }
.result-top > div:last-child { max-width: 40ch; }
.eq { justify-content: center; }
.eq span { align-items: center; }
.fact { flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.ex { justify-content: center; }
.rules { list-style: none; padding: 0; max-width: 40ch; margin: 10px auto; }
.rules li { margin-bottom: 10px; }
.level { text-align: center; }
.level-top { flex-direction: column; align-items: center; gap: 4px; }
.dist { max-width: 320px; margin: 0 auto; }
.tier { justify-content: center; gap: 10px; }
.setting { flex-direction: column; justify-content: center; text-align: center; gap: 10px; }
.confirm-ico { margin: 4px auto 10px; }
.album { justify-content: center; }
.hint-text { text-align: center; }
