/* Layout: una sola pantalla sin scroll; cabecera, intentos compactos, palabra actual, tablero que ocupa el hueco libre, acciones y banner */
:root {
  --bg: #e6f2ef;
  --surface: #f7fbfa;
  --fg: #12302e;
  --muted: #5d7673;
  --line: #c3d9d5;
  --accent: #ff4f93;
  --accent-ink: #ffffff;
  --bubble-hue: 175;
  --good: #23a86a;
  --near: #e9a92a;
  --miss: #93a5a2;
  --ad: #fff4c7;
  --ad-ink: #6b5410;
  --display: "Fredoka", "Nunito", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1d22; --surface: #10292f; --fg: #dff2ee; --muted: #8fb0ab; --line: #24454b;
    --accent: #ff6aa5; --accent-ink: #1a0610; --good: #2fbf7b; --near: #e5ad37; --miss: #4b6266;
    --ad: #3a3317; --ad-ink: #f4dc8a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1d22; --surface: #10292f; --fg: #dff2ee; --muted: #8fb0ab; --line: #24454b;
  --accent: #ff6aa5; --accent-ink: #1a0610; --good: #2fbf7b; --near: #e5ad37; --miss: #4b6266;
  --ad: #3a3317; --ad-ink: #f4dc8a; color-scheme: dark;
}
[hidden] { display: none !important; }
html, body { height: 100%; }
html { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 15px; box-sizing: border-box;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 8px;
}
.app { max-width: 440px; height: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.app > * { flex-shrink: 0; }
header { display: flex; align-items: center; justify-content: space-between; gap: 6px 8px; flex-wrap: wrap; }
h1 { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1; margin: 0; letter-spacing: -0.5px; }
h1 span { color: var(--accent); }
.meta { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.modes { display: flex; gap: 6px; flex-basis: 100%; }
.modes .meta { margin-left: auto; align-self: center; white-space: nowrap; }
.tools { display: flex; gap: 6px; align-self: center; }
.icon {
  width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); color: var(--fg);
  font: 700 17px var(--display); cursor: pointer; display: grid; place-items: center; padding: 0;
}
.icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chip {
  font: 600 13px var(--body); border: 1.5px solid var(--line); background: transparent; color: var(--fg);
  border-radius: 999px; padding: 5px 12px; cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.hist {
  min-height: 74px; display: grid; grid-template-rows: repeat(3, 22px); grid-auto-flow: column; grid-auto-columns: max-content;
  gap: 4px 18px; justify-content: center; align-content: center;
}
.hist .row { grid-template-columns: repeat(5, 22px); gap: 3px; }
.hist .cell { height: 22px; font-size: 12px; border-width: 0; }
.hist .empty { grid-row: 1 / -1; align-self: center; color: var(--muted); font-size: 13px; text-align: center; }
.now { justify-content: center; }
.now .cell { height: 46px; font-size: 24px; }
.row { display: grid; grid-template-columns: repeat(5, 46px); gap: 6px; }
.cell {
  height: 38px; border-radius: 50%; display: grid; place-items: center;
  font: 600 18px var(--display); text-transform: uppercase; border: 2px solid var(--line); color: var(--fg);
}
.cell.good { background: var(--good); border-color: var(--good); color: #fff; }
.cell.near { background: var(--near); border-color: var(--near); color: #fff; }
.cell.miss { background: var(--miss); border-color: var(--miss); color: #fff; }
.cell.hint { border-color: var(--good); color: var(--good); border-style: dashed; }
.cell.extra { opacity: .5; }
.cell.cur { border-color: var(--accent); animation: pop .25s ease-out; }
.row.reveal .cell { animation: flip .5s ease-in-out both; }
.row.reveal .cell:nth-child(2) { animation-delay: .1s; } .row.reveal .cell:nth-child(3) { animation-delay: .2s; }
.row.reveal .cell:nth-child(4) { animation-delay: .3s; } .row.reveal .cell:nth-child(5) { animation-delay: .4s; }
.row.shake { animation: shake .4s; }
.row.win .cell { animation: jump .5s ease-in-out both; }
.row.win .cell:nth-child(2) { animation-delay: .08s; } .row.win .cell:nth-child(3) { animation-delay: .16s; }
.row.win .cell:nth-child(4) { animation-delay: .24s; } .row.win .cell:nth-child(5) { animation-delay: .32s; }
@keyframes flip { 0% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
@keyframes shake { 20%, 60% { translate: -6px 0; } 40%, 80% { translate: 6px 0; } }
@keyframes jump { 40% { translate: 0 -10px; } }


.fizz { position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.fizz i {
  position: absolute; bottom: -40px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.95) 0 10%, rgba(255,255,255,0) 18%), radial-gradient(circle, transparent 55%, hsla(var(--h), 80%, 62%, .7) 100%);
  animation: rise var(--t) ease-in forwards;
}
@keyframes rise { to { translate: var(--x) -115vh; opacity: .2; } }

.tuto-art { height: 120px; position: relative; display: grid; place-items: center; }
.tuto-art .mini { position: absolute; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font: 600 20px var(--display); background: radial-gradient(circle at 32% 26%, rgba(255,255,255,.95) 0 8%, rgba(255,255,255,0) 14%), radial-gradient(circle, transparent 55%, hsla(190, 80%, 62%, .6) 100%); box-shadow: inset 0 0 0 1.5px hsla(190,60%,50%,.4); color: var(--fg); }
.tuto-art .mini.big { width: 58px; height: 58px; font-size: 26px; box-shadow: inset 0 0 0 3px var(--accent); }
.tuto-art .mini.tap { animation: tapme 1.4s ease-in-out infinite; }
@keyframes tapme { 0%, 100% { scale: 1; } 50% { scale: 1.15; box-shadow: inset 0 0 0 3px var(--accent); } }
.dots { display: flex; justify-content: center; gap: 6px; }
.dots b { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots b.on { background: var(--accent); }
.now .cell:not(.cur):not(.hint) { border-color: var(--line); border-style: dashed; }

.stage { flex: 1 1 auto; min-height: 150px; container-type: size; display: grid; place-items: center; }
.board {
  position: relative; width: min(100cqw, 100cqh, 400px); aspect-ratio: 1; container-type: inline-size;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.board svg { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity .2s; }
.board svg line { stroke: var(--line); stroke-width: 0.5; stroke-linecap: round; }
.board svg line.trail { stroke: var(--accent); stroke-width: 0.9; }
.bubble {
  position: absolute; left: 50%; top: 50%; width: 22%; aspect-ratio: 1; border-radius: 50%;
  transform: translate(-50%, -50%); border: none; padding: 0; cursor: pointer;
  display: grid; place-items: center; color: var(--fg);
  font: 600 9cqw var(--display); text-transform: uppercase;
  background:
    radial-gradient(circle at 32% 26%, rgba(255,255,255,.95) 0 7%, rgba(255,255,255,0) 13%),
    radial-gradient(circle at 70% 78%, rgba(255,255,255,.45) 0 5%, rgba(255,255,255,0) 10%),
    radial-gradient(circle at 50% 50%, hsla(var(--h, 175), 70%, 70%, .10) 0 55%, hsla(var(--h, 175), 80%, 62%, .55) 78%, hsla(calc(var(--h, 175) + 60), 85%, 66%, .85) 100%);
  box-shadow: inset 0 0 0 1.5px hsla(var(--h, 175), 60%, 50%, .35), 0 6px 18px -8px hsla(var(--h,175), 60%, 30%, .45);
  transition: left .42s cubic-bezier(.3,.7,.2,1), top .42s cubic-bezier(.3,.7,.2,1), width .42s, opacity .35s, font-size .42s;
}
.bubble.center { width: 28%; font-size: 12cqw; z-index: 3; cursor: default; }
.bubble.n1 { z-index: 2; animation: float 4s ease-in-out infinite; animation-delay: var(--d, 0s); }
.bubble.n2 { width: 10%; font-size: clamp(12px, 3.6vw, 16px); opacity: 0; cursor: default; z-index: 1; pointer-events: none; }
.bubble.pick { animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: inset 0 0 0 3px var(--accent), 0 6px 18px -8px hsla(var(--h,175), 60%, 30%, .45); } }
.bubble.far { width: 4%; opacity: 0; pointer-events: none; z-index: 0; }
.bubble.used { box-shadow: inset 0 0 0 3px var(--accent), 0 6px 18px -8px hsla(var(--h,175), 60%, 30%, .45); }
.bubble.used.n1 { opacity: .55; cursor: not-allowed; }
.bubble.used.n1.back { opacity: 1; cursor: pointer; }
.bubble:disabled { color: var(--fg); }
.bubble.gone { color: var(--miss) !important; text-decoration: line-through; text-decoration-thickness: 2px; }
.bubble .ord {
  position: absolute; right: 2%; top: 2%; width: 34%; aspect-ratio: 1; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font: 800 3.4cqw var(--body);
  display: grid; place-items: center;
}
.bubble.pop { animation: pop .3s ease-out; }
@keyframes float { 50% { translate: 0 -3px; } }
@keyframes pop { 40% { scale: 1.12; } }
@media (prefers-reduced-motion: reduce) {
  .bubble { transition: none; } .bubble.n1, .bubble.pop, .bubble.pick, .row .cell, .row.shake, .fizz i, .tuto-art .mini.tap { animation: none !important; }
}

.status { text-align: center; min-height: 22px; color: var(--fg); font-weight: 600; font-size: 15px; margin: 0; text-wrap: balance; }

.actions { display: grid; grid-template-columns: 1fr auto 1.3fr; gap: 8px; }
.btn {
  font: 700 15px var(--body); border-radius: 14px; padding: 12px 10px; cursor: pointer;
  border: 2px solid var(--line); background: var(--surface); color: var(--fg);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ad { background: transparent; color: var(--fg); border: 1.5px dashed var(--line); display: flex; justify-content: center; align-items: center; gap: 6px; font-weight: 700; }
#hint { flex-direction: column; gap: 1px; padding: 6px 12px; font-size: 13px; line-height: 1.1; }
#hint.nudge { border-color: var(--accent); animation: tapme 1.4s ease-in-out infinite; }
.status { min-height: 20px; font-size: 14px; }
.tag { font: 800 9px var(--body); letter-spacing: .08em; text-transform: uppercase; border: 1px solid currentColor; border-radius: 5px; padding: 1px 4px; color: var(--muted); }
.share { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.share a, .share button { text-decoration: none; text-align: center; font: 700 14px var(--body); border-radius: 12px; padding: 11px 6px; border: 1.5px solid var(--line); background: var(--bg); color: var(--fg); cursor: pointer; }
.share .wa { background: #25d366; border-color: #25d366; color: #0b2e18; }
.share-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.chip .lock { width: 11px; height: 11px; margin-left: 4px; vertical-align: -1px; fill: none; stroke: currentColor; stroke-width: 2.4; }


.banner {
  background: var(--surface); color: var(--muted); border-radius: 8px;
  height: 50px; margin-top: auto; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px;
}

.overlay {
  position: fixed; inset: 0; background: rgba(5, 20, 22, .6); display: grid; place-items: center; z-index: 20;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.sheet {
  background: var(--surface); color: var(--fg); border-radius: 22px; padding: 22px; width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 12px; text-align: center; max-height: 100%; overflow: auto;
}
.sheet h2 { font: 700 24px var(--display); margin: 0; text-wrap: balance; }
.sheet p { margin: 0; color: var(--muted); }
.adbox {
  background: var(--ad); color: var(--ad-ink); border-radius: 14px; padding: 26px 16px; display: grid; gap: 6px;
  font-weight: 600;
}
.adbox strong { font: 700 44px var(--display); font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stats div { display: grid; }
.stats b { font: 700 24px var(--display); font-variant-numeric: tabular-nums; }
.stats small { color: var(--muted); font-size: 11px; }
.answer { font: 700 30px var(--display); letter-spacing: .15em; text-transform: uppercase; color: var(--accent); }
.next { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }

.link { font: inherit; color: var(--accent); background: none; border: none; padding: 0; text-decoration: underline; cursor: pointer; }
.legal { color: var(--muted); font-size: 13px; }

