/* Little Words — shared game styles (games/shared/lw-games.css)
   Brand tokens mirror landing/index.html. Mobile-first at 375px. */
:root {
  --cream:#FFFBF5; --blush:#FFF0E8; --coral:#F28B6E; --deep-coral:#B95233;
  --burnt:#A6402A; --navy:#1E2A4A; --soft-navy:#2D3E5F; --sage:#6BAF8D;
  --light-sage:#E5F2EB; --gold:#E8C36A; --pale-gold:#FEF6E0; --text:#2A2A2A;
  --body:#4A4A4A; --muted:#6B6B6B; --border:#EDE6DC;
  --sky:#BDE3F5; --sky-deep:#8FCBEA; --sand:#F5DFA9; --sand-deep:#E8C983;
  --grass-g:#8CC98A; --radius:18px;
  --shadow:0 6px 24px rgba(30,42,74,.14);
}
@font-face { font-family:'Bricolage Grotesque'; src:url('/assets/fonts/bricolage-var-latin.woff2') format('woff2'); font-weight:600 800; font-style:normal; font-display:swap; }
@font-face { font-family:'DM Sans'; src:url('/assets/fonts/dmsans-var-latin.woff2') format('woff2'); font-weight:400 700; font-style:normal; font-display:swap; }

* { box-sizing:border-box; margin:0; padding:0; }
html { -webkit-text-size-adjust:100%; }
body {
  font-family:'DM Sans',system-ui,-apple-system,sans-serif; color:var(--text);
  background:var(--cream); min-height:100vh; min-height:100dvh;
  -webkit-tap-highlight-color:transparent;
}
h1,h2,h3,.display { font-family:'Bricolage Grotesque','DM Sans',system-ui,sans-serif; color:var(--navy); }
img { max-width:100%; }
button { font-family:inherit; cursor:pointer; border:0; background:none; }
a { color:var(--deep-coral); }
:focus-visible { outline:3px solid var(--coral); outline-offset:2px; border-radius:8px; }
[hidden] { display:none !important; }

/* ---------- site chrome (hub + game headers) ---------- */
.lw-nav { position:sticky; top:0; z-index:50; background:rgba(255,251,245,.92); backdrop-filter:blur(8px); border-bottom:1px solid var(--border); }
.lw-nav .wrap { max-width:1080px; margin:0 auto; padding:10px 16px; display:flex; align-items:center; gap:16px; }
.lw-nav .brand { display:flex; align-items:center; gap:8px; font-family:'Bricolage Grotesque',sans-serif; font-weight:700; font-size:1.15rem; color:var(--navy); text-decoration:none; }
.lw-nav .brand img { width:34px; height:34px; border-radius:10px; }
.lw-nav .brand span { color:var(--coral); }
.lw-nav .links { margin-left:auto; display:flex; gap:14px; font-size:.95rem; }
.lw-nav .links a { color:var(--soft-navy); text-decoration:none; font-weight:500; }
.lw-nav .links a[aria-current="page"], .lw-nav .links a:hover { color:var(--deep-coral); }
@media (max-width:540px){
  .lw-nav .links { gap:10px; font-size:.85rem; }
  .lw-nav .brand { font-size:0; gap:0; }
  .lw-nav .brand img { width:30px; height:30px; }
}

.lw-footer { border-top:1px solid var(--border); background:var(--blush); margin-top:48px; }
.lw-footer .wrap { max-width:1080px; margin:0 auto; padding:28px 16px; font-size:.9rem; color:var(--muted); display:flex; flex-wrap:wrap; gap:12px 24px; justify-content:space-between; }
.lw-footer a { color:var(--soft-navy); text-decoration:none; }

/* ---------- hub ---------- */
.hub-hero { max-width:1080px; margin:0 auto; padding:40px 16px 8px; text-align:center; }
.hub-hero h1 { font-size:clamp(1.9rem,5.5vw,3rem); letter-spacing:-.5px; }
.hub-hero p { color:var(--body); max-width:560px; margin:12px auto 0; font-size:1.06rem; line-height:1.55; }
.hub-grid { max-width:880px; margin:28px auto 0; padding:0 16px; display:grid; gap:22px; grid-template-columns:1fr; }
@media (min-width:720px){ .hub-grid { grid-template-columns:1fr 1fr; } }
.game-card { display:flex; flex-direction:column; background:#fff; border:1px solid var(--border); border-radius:22px; overflow:hidden; text-decoration:none; color:inherit; box-shadow:var(--shadow); transition:transform .18s ease, box-shadow .18s ease; }
.game-card:hover { transform:translateY(-4px); box-shadow:0 12px 32px rgba(30,42,74,.18); }
.game-card .art { height:190px; position:relative; overflow:hidden; }
.game-card .meta { padding:18px 20px 22px; }
.game-card h2 { font-size:1.4rem; }
.game-card p { color:var(--body); margin-top:6px; line-height:1.5; font-size:.98rem; }
.game-card .chips { margin-top:12px; display:flex; flex-wrap:wrap; gap:8px; }
.chip { font-size:.78rem; font-weight:600; padding:4px 10px; border-radius:999px; background:var(--light-sage); color:#2E5C46; }
.chip.gold { background:var(--pale-gold); color:#8A6A1B; }
.chip.coral { background:var(--blush); color:var(--deep-coral); }
.game-card .play { margin-top:16px; display:inline-flex; align-items:center; gap:8px; align-self:flex-start; background:var(--coral); color:#fff; font-weight:700; font-size:1rem; padding:10px 22px; border-radius:999px; }

/* ---------- game stage ---------- */
.stage-wrap { position:fixed; inset:0; display:flex; flex-direction:column; background:var(--sky); overflow:hidden; }
.stage-bar { display:flex; align-items:center; gap:10px; padding:8px 10px; padding-top:calc(8px + env(safe-area-inset-top)); background:rgba(255,251,245,.9); backdrop-filter:blur(6px); border-bottom:1px solid rgba(237,230,220,.7); z-index:30; }
.stage-bar .home { display:flex; align-items:center; gap:6px; text-decoration:none; color:var(--navy); font-weight:700; font-size:.95rem; }
.stage-bar .home img { width:26px; height:26px; border-radius:8px; }
.stage-bar .title { font-family:'Bricolage Grotesque',sans-serif; font-weight:700; color:var(--navy); font-size:1rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.stage-bar .spacer { flex:1; }
.icon-btn { width:44px; height:44px; min-width:44px; border-radius:12px; background:#fff; border:1px solid var(--border); display:inline-flex; align-items:center; justify-content:center; font-size:1.15rem; color:var(--navy); transition:transform .12s; }
.icon-btn:active { transform:scale(.92); }
.progress-pill { display:inline-flex; align-items:center; gap:6px; background:#fff; border:1px solid var(--border); border-radius:999px; padding:5px 12px; font-weight:700; font-size:.9rem; color:var(--navy); white-space:nowrap; }
.stage-bar .home { margin-right:2px; }
.stage-bar .title { min-width:0; flex:0 1 auto; }
@media (max-width:420px){ .stage-bar .title { font-size:.9rem; } .progress-pill { font-size:.8rem; padding:4px 9px; } }

.stage { position:relative; flex:1; overflow:hidden; }
.scene { position:absolute; inset:0; opacity:0; visibility:hidden; pointer-events:none; transition:opacity .5s ease, visibility .5s; }
.scene.active { opacity:1; visibility:visible; pointer-events:auto; }
.scene-bg-img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; z-index:1; }
/* when a real generated scene background lands (asset-map contract), the
   composed CSS scenery yields to it */
.scene.has-bg .ground, .scene.has-bg .scenery, .scene.has-bg .sun-el,
.scene.has-bg .cloud-el, .scene.has-bg .wave-band, .scene.has-bg .beach-props,
.scene.has-bg .scroll-strip, .scene.has-bg .ship-el { display:none; }

/* big friendly buttons */
.big-btn {
  display:inline-flex; align-items:center; justify-content:center; gap:10px;
  background:#BE4327; color:#fff; font-family:'Bricolage Grotesque',sans-serif;
  font-weight:700; font-size:1.25rem; padding:14px 34px; border-radius:999px;
  box-shadow:0 6px 0 #8E3118, 0 10px 24px rgba(142,49,24,.35);
  transition:transform .12s, box-shadow .12s; user-select:none;
}
.big-btn:active { transform:translateY(4px); box-shadow:0 2px 0 #8E3118; }
.big-btn.sage { background:#3F7A5C; box-shadow:0 6px 0 #2E5B44, 0 10px 24px rgba(46,91,68,.4); }
.big-btn.sage:active { box-shadow:0 2px 0 #2E5B44; }
.big-btn.bounce { animation:btn-bounce 1.6s ease-in-out infinite; }
@keyframes btn-bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-7px)} }
.text-btn { font-size:.92rem; font-weight:600; color:var(--soft-navy); padding:11px 16px; min-height:44px; display:inline-flex; align-items:center; border-radius:999px; background:rgba(255,255,255,.75); border:1px solid var(--border); }

/* ---------- intro overlay panels ---------- */
.panel-overlay { position:absolute; inset:0; z-index:40; display:flex; align-items:center; justify-content:center; padding:18px; background:rgba(30,42,74,.35); backdrop-filter:blur(3px); opacity:0; pointer-events:none; transition:opacity .3s ease; }
/* round-6 (R3 polish): while the target picker is open (.tp-open on the stage)
   the intro title/CTA fades out twice as fast as the picker fades in — title
   text and the Play button are never legible over the deck picker mid-fade. */
.intro-panel, .intro-inner, .intro-cluster { transition:opacity .15s ease; }
.tp-open .intro-panel, .tp-open .intro-inner, .tp-open .intro-cluster { opacity:0; }
.panel-overlay.show { opacity:1; pointer-events:auto; }
.panel { background:var(--cream); border-radius:26px; box-shadow:0 20px 60px rgba(30,42,74,.35); width:min(560px,100%); max-height:calc(100% - 12px); overflow:auto; padding:26px 22px; text-align:center; transform:translateY(16px) scale(.97); transition:transform .22s cubic-bezier(.34,1.56,.64,1); }
.panel-overlay.show .panel { transform:none; }
.panel h2 { font-size:1.55rem; margin-bottom:6px; }
.panel .sub { color:var(--body); font-size:1rem; line-height:1.5; }

/* speech bubble */
.bubble { position:relative; background:#fff; border:2px solid var(--navy); border-radius:18px; padding:12px 16px; font-weight:600; color:var(--navy); font-size:1.05rem; line-height:1.4; box-shadow:0 4px 14px rgba(30,42,74,.15); }
.bubble:after { content:''; position:absolute; bottom:-12px; left:34px; width:18px; height:18px; background:#fff; border-right:2px solid var(--navy); border-bottom:2px solid var(--navy); transform:rotate(45deg) skew(8deg,8deg); }

/* ---------- target picker ---------- */
.tp-groups { text-align:left; margin-top:16px; display:grid; gap:16px; }
.tp-group h3 { font-size:.85rem; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); margin-bottom:8px; }
.tp-list { display:grid; gap:10px; grid-template-columns:1fr; }
@media (min-width:480px){ .tp-list { grid-template-columns:1fr 1fr; } }
.tp-tile { position:relative; display:flex; align-items:center; gap:12px; padding:12px 14px; background:#fff; border:2px solid var(--border); border-radius:16px; cursor:pointer; transition:border-color .15s, transform .12s; text-align:left; width:100%; }
.tp-tile:active { transform:scale(.98); }
.tp-tile .badge { width:46px; height:46px; min-width:46px; border-radius:14px; display:flex; align-items:center; justify-content:center; font-family:'Bricolage Grotesque',sans-serif; font-weight:800; font-size:1.25rem; color:#fff; background:var(--coral); }
.tp-tile[data-domain="language"] .badge { background:var(--sage); font-size:1.02rem; }
.tp-tile .lab { flex:1; }
.tp-tile .lab b { display:block; color:var(--navy); font-size:.98rem; line-height:1.25; }
.tp-tile .lab small { color:var(--muted); font-size:.8rem; }
.tp-tile .check { width:26px; height:26px; min-width:26px; border-radius:50%; border:2px solid var(--border); display:flex; align-items:center; justify-content:center; color:#fff; font-size:.85rem; transition:all .15s; }
.tp-tile[aria-pressed="true"] { border-color:var(--coral); background:var(--blush); }
.tp-tile[aria-pressed="true"] .check { background:var(--coral); border-color:var(--coral); animation:pop-in .25s cubic-bezier(.34,1.56,.64,1); }
@keyframes pop-in { 0%{transform:scale(.4)} 100%{transform:scale(1)} }
.tp-start { margin-top:20px; width:100%; }
.tp-hint { margin-top:10px; font-size:.85rem; color:var(--muted); min-height:1.2em; }

/* ---------- card reveal overlay ---------- */
.cr-overlay { position:absolute; inset:0; z-index:60; display:flex; align-items:center; justify-content:center; padding:14px; background:rgba(30,42,74,.45); opacity:0; pointer-events:none; transition:opacity .15s; }
.cr-overlay.show { opacity:1; pointer-events:auto; }
.cr-card { width:min(340px, calc(100vw - 40px)); aspect-ratio:3/4; max-height:calc(100% - 130px); position:relative; perspective:1200px; }
.cr-inner { position:absolute; inset:0; transform-style:preserve-3d; transition:transform .55s cubic-bezier(.4,.2,.2,1); }
.cr-card.flipped .cr-inner { transform:rotateY(180deg); }
.cr-face { position:absolute; inset:0; backface-visibility:hidden; -webkit-backface-visibility:hidden; border-radius:22px; overflow:hidden; box-shadow:0 18px 50px rgba(30,42,74,.4); }
.cr-back { background:
  radial-gradient(circle at 20% 25%, rgba(255,255,255,.18) 0 8px, transparent 9px),
  radial-gradient(circle at 75% 15%, rgba(255,255,255,.16) 0 6px, transparent 7px),
  radial-gradient(circle at 60% 70%, rgba(255,255,255,.15) 0 9px, transparent 10px),
  radial-gradient(circle at 30% 80%, rgba(255,255,255,.17) 0 6px, transparent 7px),
  radial-gradient(circle at 85% 55%, rgba(255,255,255,.14) 0 7px, transparent 8px),
  linear-gradient(150deg, #6BAF8D, #4A8A6A);
  display:flex; align-items:center; justify-content:center; }
.cr-back .logo-circ { width:84px; height:84px; border-radius:50%; background:rgba(255,251,245,.92); display:flex; align-items:center; justify-content:center; font-size:2.2rem; box-shadow:0 4px 18px rgba(0,0,0,.18); }
.cr-front { background:#fff; transform:rotateY(180deg); display:flex; flex-direction:column; }
.cr-img { flex:1; min-height:0; position:relative; background:var(--pale-gold); display:flex; align-items:center; justify-content:center; }
.cr-img img { width:100%; height:100%; object-fit:cover; }
.cr-img .ph { width:100%; height:100%; display:flex; align-items:center; justify-content:center; }
.cr-text { padding:14px 16px 8px; text-align:center; }
.cr-word { font-family:'Bricolage Grotesque',sans-serif; font-weight:800; color:var(--navy); font-size:1.7rem; line-height:1.15; overflow-wrap:break-word; }
.cr-word.small { font-size:1.15rem; font-weight:700; }
.cr-tools { display:flex; align-items:center; justify-content:center; gap:10px; padding:6px 12px 14px; }
.cr-speaker { width:52px; height:52px; border-radius:50%; background:var(--gold); color:var(--navy); font-size:1.4rem; display:flex; align-items:center; justify-content:center; box-shadow:0 4px 0 #C9A248; transition:transform .12s, box-shadow .12s; }
.cr-speaker:active { transform:translateY(3px); box-shadow:0 1px 0 #C9A248; }
.cr-speaker.playing { animation:speaker-pulse .8s ease-in-out infinite; }
@keyframes speaker-pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.12)} }
.cr-levels { display:flex; background:var(--blush); border-radius:999px; padding:3px; gap:2px; }
.cr-levels button { font-size:.78rem; font-weight:700; padding:7px 12px; border-radius:999px; color:var(--deep-coral); }
.cr-levels button[aria-pressed="true"] { background:var(--coral); color:#fff; }
.cr-done { position:absolute; left:50%; bottom:max(18px, env(safe-area-inset-bottom)); transform:translateX(-50%); z-index:2; }
.cr-overlay .cr-wrapper { position:relative; width:100%; height:100%; display:flex; align-items:center; justify-content:center; }

/* fly-in animation */
.cr-card.enter { animation:cr-enter .45s cubic-bezier(.34,1.4,.64,1); }
@keyframes cr-enter { 0%{ transform:scale(.15) translateY(40px); opacity:0 } 100%{ transform:scale(1) translateY(0); opacity:1 } }
.cr-card.exit { animation:cr-exit .3s ease-in forwards; }
@keyframes cr-exit { to { transform:scale(.2) translateY(30px); opacity:0 } }

/* ---------- celebration ---------- */
.celebrate-overlay { position:absolute; inset:0; z-index:55; display:flex; align-items:center; justify-content:center; padding:20px; pointer-events:none; opacity:0; transition:opacity .18s; }
.celebrate-overlay.show { opacity:1; pointer-events:auto; }
.celebrate-card { background:var(--cream); border-radius:26px; padding:30px 26px; text-align:center; box-shadow:0 20px 60px rgba(30,42,74,.4); width:min(440px,100%); transform:scale(.8); transition:transform .28s cubic-bezier(.34,1.56,.64,1); }
.celebrate-overlay.show .celebrate-card { transform:scale(1); }
.celebrate-card .big-emoji { font-size:3.4rem; line-height:1; animation:hooray 1s ease-in-out infinite alternate; display:inline-block; }
@keyframes hooray { from{transform:rotate(-6deg) scale(1)} to{transform:rotate(6deg) scale(1.12)} }
.celebrate-card h2 { font-size:1.7rem; margin-top:10px; }
.celebrate-card p { color:var(--body); margin-top:6px; font-size:1.02rem; }
.celebrate-card .row { display:flex; flex-wrap:wrap; gap:12px; justify-content:center; margin-top:20px; }
canvas.confetti { position:absolute; inset:0; width:100%; height:100%; z-index:54; pointer-events:none; }


/* Instant press acknowledgement: applied on pointerdown by game-kit.js.
   No !important so an in-flight drag (inline transform on .kid) still wins. */
.pressing:not(.dragging) { transform:scale(.94); transition:transform .05s ease-out; filter:brightness(1.05); }

/* encourage toast */
.toast { position:absolute; left:50%; bottom:88px; transform:translateX(-50%) translateY(18px); background:var(--navy); color:#fff; font-weight:600; padding:10px 20px; border-radius:999px; font-size:.98rem; opacity:0; transition:all .35s cubic-bezier(.34,1.56,.64,1); z-index:45; pointer-events:none; white-space:nowrap; }
.toast.show { opacity:1; transform:translateX(-50%) translateY(0); }

/* reduced motion */
@media (prefers-reduced-motion:reduce) {
  *, *:before, *:after { animation-duration:.001s !important; transition-duration:.001s !important; }
}
