/* ============================================================
   Detectivii Siguranței — joc ANITP (1 Iunie)
   Țintă: iPad 2015, Safari mai vechi, landscape. Offline-first.
   Paleta e scoasă din ilustrații: navy ANITP, lemn cald, cer,
   plus accente curate (verde-ok, roșu-stop, galben-cadou).
   Fără gradiente decorative — culoarea vine din desene.
   ============================================================ */

/* Font jucăuș, variabil, bundle-uit local.
   Baloo 2 are suport COMPLET pentru română (ă â î ș ț, cu virgulă dedesubt).
   Re-subsetat manual din fontul oficial Google Fonts => offline 100%. */
@font-face {
  font-family: "Baloo 2";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../assets/fonts/baloo2.woff2") format("woff2");
}

:root {
  /* Brand: navy ANITP + auriu cald (insignă/cadou/luminițe) + crem cald.
     Paleta e ancorată în logo-ul ANITP și în tonul ilustrațiilor. */
  --navy:        #283a60;   /* albastrul ANITP, ușor mai bogat */
  --navy-deep:   #1a2742;
  --ink:         #223052;
  --sky:         #6fb3e6;
  --sky-soft:    #bfe2f7;
  --sand:        #f3d9a8;
  --wood:        #c98a4b;
  --cream:       #fff7ea;   /* hârtie caldă, se leagă de lemn/scene */
  --paper:       #f8ecd4;

  /* Auriu de brand — culoarea „eroului” (CTA, highlight) */
  --gold:        #f2a93b;
  --gold-deep:   #cf8421;
  --gold-soft:   #f7c869;   /* fundal de marker */

  /* Accente de joc (răspunsuri) — mai adânci, mai puțin „candy” */
  --ok:          #2f9e63;
  --ok-deep:     #1f7a47;
  --stop:        #db4a3d;
  --stop-deep:   #b23528;
  --gift:        #f2a93b;
  --mark:        #f7c869;   /* highlight de cuvinte-cheie (auriu cald) */

  /* Spațiere ritmată (totul derivă din --u pentru simetrie) */
  --u: clamp(8px, 1.4vmin, 16px);
  --radius: clamp(16px, 2.4vmin, 28px);
  --radius-lg: clamp(22px, 3.4vmin, 40px);

  /* Tipografie — Baloo 2 peste tot (jucăuș, rotunjit, cu diacritice RO complete) */
  --font-display: "Baloo 2", "Trebuchet MS", "Segoe UI", Verdana, sans-serif;
  --font-body:    "Baloo 2", "Trebuchet MS", "Segoe UI", Verdana, sans-serif;

  --shadow: 0 10px 26px rgba(31, 42, 68, 0.22);
  --shadow-sm: 0 4px 12px rgba(31, 42, 68, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--navy-deep);
  font-family: var(--font-body);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
  -webkit-touch-callout: none;
}

/* niciun element nu poate fi „ridicat" ca imagine la atingere (iPad) */
img { -webkit-user-drag: none; user-drag: none; -webkit-touch-callout: none; }

#app {
  position: fixed;
  inset: 0;
  height: 100%;
  width: 100%;
}

/* ---------- Stage: fundalul plin + un strat de conținut centrat ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Animații de intrare/ieșire ale ecranelor */
.screen.enter { animation: screenIn .42s cubic-bezier(.16,.84,.34,1) both; }
.screen.exit  { animation: screenOut .30s ease-in both; }
@keyframes screenIn  { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes screenOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-12px) scale(.99); } }

/* Voal subtil ca textul să fie lizibil peste orice fundal */
.veil::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(31,42,68,.18), rgba(31,42,68,.42));
}
.screen > * { position: relative; z-index: 1; }

/* ===================== TOP BAR ===================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--u);
  padding: calc(var(--u) * 1.1) calc(var(--u) * 1.6);
}
.topbar .logo { height: clamp(34px, 6.5vmin, 58px); width: auto; filter: drop-shadow(0 2px 5px rgba(0,0,0,.3)); }
.topbar .world-name {
  font-family: var(--font-display);
  font-weight: 800;
  color: #fff;
  font-size: clamp(18px, 3.2vmin, 30px);
  text-shadow: 0 2px 8px rgba(0,0,0,.35);
  white-space: nowrap;
}
.topbar.many-dots .world-name { font-size: clamp(15px, 2.6vmin, 25px); max-width: 42vw; overflow: hidden; text-overflow: ellipsis; }
.topbar.many-dots .progress { gap: clamp(3px, .6vmin, 7px); }
.topbar.many-dots .dot {
  width: clamp(7px, 1.15vmin, 12px);
  height: clamp(7px, 1.15vmin, 12px);
}
.progress-count {
  min-width: clamp(44px, 7vmin, 64px);
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  color: var(--navy-deep);
  box-shadow: var(--shadow-sm);
  padding: clamp(5px, .8vmin, 8px) clamp(9px, 1.3vmin, 14px);
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(14px, 2.2vmin, 22px);
  line-height: 1;
}

/* Progres (puncte) */
.progress { display: flex; gap: calc(var(--u) * .6); align-items: center; }
.dot {
  width: clamp(10px, 1.6vmin, 16px);
  height: clamp(10px, 1.6vmin, 16px);
  border-radius: 50%;
  background: rgba(255,255,255,.45);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.55);
  transition: transform .25s, background .25s;
}
.dot.done { background: var(--ok); box-shadow: inset 0 0 0 2px #fff; }
.dot.now  { background: var(--gift); transform: scale(1.35); box-shadow: inset 0 0 0 2px #fff; }

/* Buton rotund (home / înapoi) */
.icon-btn {
  border: none;
  background: rgba(255,255,255,.92);
  color: var(--navy);
  width: clamp(44px, 7vmin, 60px);
  height: clamp(44px, 7vmin, 60px);
  border-radius: 50%;
  font-size: clamp(20px, 3.4vmin, 28px);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.icon-btn:active { transform: scale(.92); }

/* ===================== ECRAN START ===================== */
.start {
  align-items: center;
  justify-content: flex-start;
  text-align: center;
}
/* overlay puțin mai adânc => titlul alb rămâne lizibil fără umbră pe text */
.start.veil::before {
  background: linear-gradient(180deg, rgba(26,39,66,.44), rgba(26,39,66,.26) 45%, rgba(26,39,66,.52));
}
/* header: logo ANITP centrat */
.start-logo {
  height: clamp(40px, 8.5vh, 88px);
  width: auto;
  margin-top: clamp(10px, 3vh, 30px);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  z-index: 2;
}
/* polițista — BUST: capul sub buton, corpul iese pe sub marginea de jos */
.start-hero {
  position: absolute;
  left: 50%;
  top: 40%;                 /* capul începe sub buton */
  transform: translateX(-50%);
  height: 118%;             /* înaltă => talia/picioarele ies sub margine (clip) */
  width: auto;
  object-position: top center;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,.26));
  pointer-events: none;
  z-index: 1;
}

.title {
  font-family: var(--font-display);
  font-weight: 800;
  color: #fff;
  line-height: 1.02;
  font-size: clamp(34px, 8vmin, 86px);
  margin-top: clamp(14px, 4.5vh, 50px);
  z-index: 2;
}
.start .btn { margin-top: clamp(12px, 2.6vh, 26px); z-index: 2; }

/* Buton fullscreen — colțul din dreapta-sus al ecranului de start.
   Dispare când pagina e deja pe tot ecranul. */
.fs-btn {
  position: absolute;
  top: clamp(10px, 2.2vh, 22px);
  right: clamp(10px, 2.4vw, 24px);
  z-index: 20;
  display: flex; align-items: center; gap: .4em;
  border: none; cursor: pointer;
  background: rgba(255, 255, 255, .92);
  color: var(--navy);
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(13px, 1.9vh, 18px);
  padding: clamp(8px, 1.3vh, 12px) clamp(12px, 1.8vw, 18px);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.fs-btn:active { transform: scale(.94); }
.fs-btn .ico { font-size: 1.3em; line-height: 1; }
body.is-fullscreen .fs-btn { display: none; }

/* ===================== AUDIO ===================== */
.audio-control {
  position: fixed;
  left: clamp(10px, 2vw, 22px);
  bottom: clamp(10px, 2vh, 22px);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0;
  border-radius: 999px;
  background: rgba(255, 247, 234, .94);
  box-shadow: var(--shadow-sm);
  padding: clamp(6px, 1vh, 10px) clamp(8px, 1.4vw, 14px);
  overflow: hidden;
  transition: gap .22s ease, padding-right .22s ease, background-color .22s ease;
}
.audio-toggle {
  border: none;
  cursor: pointer;
  width: clamp(40px, 6.6vmin, 54px);
  height: clamp(40px, 6.6vmin, 54px);
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: clamp(19px, 3.2vmin, 27px);
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 0 var(--navy-deep);
}
.audio-toggle:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--navy-deep);
}
.audio-range {
  width: 0;
  max-width: 0;
  opacity: 0;
  accent-color: var(--gold);
  cursor: pointer;
  pointer-events: none;
  transform: translateX(-8px);
  transition: width .22s ease, max-width .22s ease, opacity .16s ease, transform .22s ease;
}
.audio-control:hover,
.audio-control:focus-within {
  gap: clamp(6px, 1vw, 10px);
  padding-right: clamp(10px, 1.8vw, 18px);
  background: rgba(255, 247, 234, .98);
}
.audio-control:hover .audio-range,
.audio-control:focus-within .audio-range {
  width: clamp(96px, 14vw, 148px);
  max-width: clamp(96px, 14vw, 148px);
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

/* Marker pe cuvinte-cheie din titluri */
.mark {
  background: var(--mark);
  color: var(--navy-deep);
  padding: 0 .28em;
  border-radius: .28em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* Buton mare „pătlăgea” (CTA) */
.btn {
  font-family: var(--font-display);
  font-weight: 800;
  border: none;
  cursor: pointer;
  color: var(--navy-deep);
  background: var(--gold);
  border-radius: 999px;
  padding: calc(var(--u) * 1.1) calc(var(--u) * 2.6);
  font-size: clamp(20px, 3.4vmin, 34px);
  box-shadow: 0 6px 0 var(--gold-deep), var(--shadow);
  margin-top: calc(var(--u) * 1.8);
  transition: transform .08s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--gold-deep), var(--shadow-sm); }

/* ===================== HARTA LUMILOR ===================== */
/* Harta: titlu + grilă centrate ca un grup, titlul stă chiar deasupra căsuțelor */
.map {
  justify-content: center;
  overflow-y: auto;
  padding: calc(var(--u) * 1.2) 0 calc(var(--u) * 1.6);
}
.map-head { text-align: center; padding: 0 var(--u) calc(var(--u) * 1.4); }
.map-head h2 {
  font-family: var(--font-display); color: #fff; font-weight: 800;
  font-size: clamp(22px, 4.6vmin, 44px); text-shadow: 0 3px 10px rgba(0,0,0,.4);
}
.worlds {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: calc(var(--u) * 1.4);
  width: min(96%, 1120px);
  margin: 0 auto;
  padding: 0 calc(var(--u) * 1.2);
}
.world-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  background: var(--cream);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  border: 4px solid #fff;
  transition: transform .12s;
}
.world-card:active { transform: scale(.97); }
.world-card .thumb { aspect-ratio: 16/10; background-size: cover; background-position: center; }
.world-card .label {
  display: flex; align-items: center; gap: .5em;
  padding: calc(var(--u) * .9) var(--u);
  font-family: var(--font-display); font-weight: 800;
  color: var(--navy-deep);
  font-size: clamp(14px, 2.2vmin, 22px);
}
.world-card .label .emoji { font-size: 1.4em; }
.world-card.done::after {
  content: "★";
  position: absolute; top: 8px; right: 12px;
  color: var(--gift); font-size: clamp(22px, 4vmin, 38px);
  text-shadow: 0 2px 4px rgba(0,0,0,.4);
}

/* ===================== SCENĂ DE JOC ===================== */
.play { }
/* Scena e un singur strat: personajul iese din cadru, cardul plutește peste el */
.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Personajul care reacționează — MARE, ancorat de jos, iese pe sub margine */
.actor-col {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}
.reactor {
  height: 98%;                 /* portrait: mare și centrat */
  width: auto;
  object-fit: contain;
  margin-bottom: -2%;          /* iese pe sub marginea de jos */
  transform-origin: bottom center;
  filter: drop-shadow(0 18px 20px rgba(0,0,0,.34));
  transition: transform .28s cubic-bezier(.18,.9,.3,1.2);
}
.reactor.pop { animation: pop .42s cubic-bezier(.18,.9,.3,1.3); }
@keyframes pop { 0% { transform: scale(.84) translateY(18px); } 60% { transform: scale(1.05); } 100% { transform: none; } }

.bubble {
  position: absolute;
  top: 2.5%;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--cream);
  color: var(--navy-deep);
  font-weight: 700;
  font-size: clamp(19px, 3.2vmin, 32px);
  line-height: 1.25;
  padding: calc(var(--u) * 1.05) calc(var(--u) * 1.4);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: min(90%, 600px);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  z-index: 6;
}
.bubble.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.bubble.ok   { border: 3px solid var(--ok); }
.bubble.bad  { border: 3px solid var(--stop); }

/* Panoul cu întrebarea — bottom-sheet pe portrait */
.panel {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: clamp(10px, 2.4vh, 30px);
  width: min(94%, 700px);
  background: rgba(255, 253, 246, .97);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: calc(var(--u) * 1.4) calc(var(--u) * 1.6);
  display: flex;
  flex-direction: column;
  max-height: 62%;
  z-index: 5;
}
.scene-art {
  align-self: center;
  height: clamp(64px, 15vmin, 150px);
  margin-bottom: var(--u);
  filter: drop-shadow(0 8px 12px rgba(0,0,0,.18));
}
.prompt {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy-deep);
  text-align: center;
  font-size: clamp(18px, 3.1vmin, 34px);
  line-height: 1.18;
}

/* Controale: binar (2 butoane) / choice (până la 3) */
.choices {
  display: grid;
  gap: calc(var(--u) * 1.1);
  margin-top: auto;
  padding-top: calc(var(--u) * 1.4);
}
.choices.two   { grid-template-columns: 1fr 1fr; }
.choices.list  { grid-template-columns: 1fr; }

.choice {
  border: none;
  cursor: pointer;
  border-radius: var(--radius);
  padding: calc(var(--u) * 1.3) var(--u);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(17px, 2.8vmin, 28px);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  min-height: clamp(64px, 12vmin, 96px);
  box-shadow: var(--shadow-sm);
  transition: transform .08s, filter .15s;
}
.choice:active { transform: scale(.96); }
.choice .ico { font-size: 1.3em; }
.choice.green  { background: var(--ok);   box-shadow: 0 5px 0 var(--ok-deep); }
.choice.red    { background: var(--stop); box-shadow: 0 5px 0 var(--stop-deep); }
.choice.neutral{ background: var(--navy); box-shadow: 0 5px 0 var(--navy-deep); color:#fff; }
.choice:disabled { opacity: .45; }
.choice.picked-wrong { animation: shake .4s; }
.choice.picked-right { animation: rightPulse .5s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-8px)} 75%{transform:translateX(8px)} }
@keyframes rightPulse { 0%{transform:scale(1)} 50%{transform:scale(1.05)} 100%{transform:scale(1)} }

/* Buton „mai departe” care apare după răspuns */
.next-row { margin-top: calc(var(--u) * 1.2); display: flex; justify-content: center; }
.next-btn {
  font-family: var(--font-display); font-weight: 800; border: none; cursor: pointer;
  color: #fff; background: var(--navy);
  border-radius: 999px; padding: calc(var(--u)*.9) calc(var(--u)*2.2);
  font-size: clamp(16px, 2.6vmin, 26px);
  box-shadow: 0 5px 0 var(--navy-deep);
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity .3s, transform .3s;
}
.next-btn.show { opacity: 1; transform: none; pointer-events: auto; }
.next-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--navy-deep); }

/* ===================== GHICEȘTE CUVINTELE ===================== */
.word-setup {
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}
.word-setup-hero {
  position: absolute;
  left: clamp(0px, 4vw, 54px);
  bottom: -10%;
  height: clamp(430px, 94vh, 780px);
  width: auto;
  filter: drop-shadow(0 12px 18px rgba(0,0,0,.3));
  pointer-events: none;
  z-index: 1;
}
.word-setup-panel {
  position: relative;
  z-index: 3;
  width: min(88%, 560px);
  background: rgba(255, 247, 234, .97);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vh, 34px) clamp(20px, 4vw, 46px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 1.8vh, 18px);
}
.word-setup-panel h2 {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--navy-deep);
  font-size: clamp(30px, 5.5vh, 56px);
  line-height: 1;
}
.round-options {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(10px, 1.8vmin, 18px);
}
.round-choice {
  border: none;
  cursor: pointer;
  border-radius: var(--radius);
  background: var(--gold);
  color: var(--navy-deep);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(15px, 2.5vmin, 23px);
  line-height: 1.05;
  padding: clamp(12px, 2vh, 22px) clamp(8px, 1.4vw, 16px);
  min-height: clamp(92px, 15vh, 132px);
  box-shadow: 0 6px 0 var(--gold-deep), var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, .8vh, 8px);
}
.round-choice span {
  font-size: clamp(34px, 6vh, 62px);
  line-height: .9;
}
.round-choice:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--gold-deep), var(--shadow-sm); }
.setup-back {
  margin-top: clamp(2px, .5vh, 6px);
}
.word-play .panel {
  max-height: 74%;
  gap: calc(var(--u) * .8);
}
.word-kicker {
  align-self: center;
  background: var(--gold-soft);
  color: var(--navy-deep);
  border-radius: 999px;
  padding: calc(var(--u) * .35) calc(var(--u) * 1.1);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(15px, 2.3vmin, 22px);
  line-height: 1.1;
}
.word-hint {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy-deep);
  text-align: center;
  font-size: clamp(19px, 3vmin, 32px);
  line-height: 1.15;
}
.word-slots {
  display: flex;
  justify-content: center;
  gap: clamp(5px, 1vmin, 10px);
  margin-top: calc(var(--u) * .4);
}
.word-slot {
  width: clamp(34px, 7vmin, 64px);
  height: clamp(42px, 8.2vmin, 72px);
  border-radius: clamp(10px, 1.8vmin, 18px);
  border: 3px solid rgba(40,58,96,.18);
  background: #fff;
  box-shadow: inset 0 -5px 0 rgba(40,58,96,.08), var(--shadow-sm);
  display: grid;
  place-items: center;
  color: var(--navy-deep);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(23px, 4.5vmin, 44px);
  line-height: 1;
}
.word-slot.filled { border-color: var(--gold); }
.letter-pool {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(8px, 1.4vmin, 14px);
  margin-top: calc(var(--u) * .8);
}
.letter-tile {
  border: none;
  cursor: pointer;
  width: clamp(44px, 8vmin, 72px);
  height: clamp(48px, 8.5vmin, 78px);
  border-radius: clamp(12px, 2vmin, 20px);
  background: var(--gold);
  color: var(--navy-deep);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(25px, 4.8vmin, 46px);
  line-height: 1;
  box-shadow: 0 5px 0 var(--gold-deep), var(--shadow-sm);
  transition: transform .08s, opacity .15s;
}
.letter-tile:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--gold-deep), var(--shadow-sm); }
.letter-tile.used,
.letter-tile:disabled {
  opacity: .32;
  transform: scale(.94);
}
.word-tools {
  display: flex;
  justify-content: center;
  gap: clamp(8px, 1.6vmin, 16px);
  margin-top: calc(var(--u) * .6);
}
.small-action {
  border: none;
  cursor: pointer;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(15px, 2.4vmin, 22px);
  padding: calc(var(--u) * .6) calc(var(--u) * 1.35);
  box-shadow: 0 4px 0 var(--navy-deep), var(--shadow-sm);
}
.small-action:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--navy-deep), var(--shadow-sm); }
.small-action:disabled { opacity: .45; }

/* ===================== SORTARE (drag & drop) ===================== */
.sort-wrap { display: grid; grid-template-rows: auto auto 1fr; gap: var(--u); flex: 1; min-height: 0; padding: 0 calc(var(--u)*1.8) calc(var(--u)*1.4); }
.sort-prompt {
  text-align: center; font-family: var(--font-display); font-weight: 800; color: #fff;
  font-size: clamp(18px, 3.2vmin, 34px); text-shadow: 0 3px 10px rgba(0,0,0,.4);
  padding-top: var(--u);
}
.tray {
  display: flex; flex-wrap: wrap; gap: clamp(10px, 1.8vh, 20px);
  justify-content: center; align-content: center;
  background: rgba(255,253,246,.5); border-radius: var(--radius); padding: clamp(10px, 2vh, 22px);
}
/* 3 jetoane pe rând (5 elemente => 3 + 2 centrate dedesubt), imagini mari */
.token {
  flex: 0 0 30%;
  background: var(--cream); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: clamp(8px, 1.4vh, 16px); text-align: center; cursor: grab; touch-action: none;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.token img { height: clamp(80px, 15vh, 156px); width: auto; object-fit: contain; }
.token span { font-family: var(--font-display); font-weight: 700; font-size: clamp(14px, 2vh, 22px); color: var(--navy-deep); }
.token.dragging { opacity: .5; }
.token.flydone { animation: rightPulse .4s; }

.bins { display: grid; grid-template-columns: 1fr 1fr; gap: calc(var(--u)*1.4); min-height: 0; }
.bin {
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
  border: 4px dashed #fff; color: #fff; font-family: var(--font-display); font-weight: 800;
  padding: clamp(8px, 1.4vh, 14px); gap: clamp(4px, 0.8vh, 10px);
  overflow: hidden; min-height: 0;
}
.bin-head { display: flex; align-items: center; justify-content: center; gap: .35em; font-size: clamp(16px, 2.6vmin, 28px); }
.bin-head .ico { font-size: 1.5em; }
/* zona unde se stivuiesc jetoanele plasate */
.bin-drop {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-wrap: wrap; align-content: center; justify-content: center;
  gap: clamp(12px, 2.4vh, 26px); padding: clamp(8px, 1.4vh, 16px);
}
.bin.trust { background: rgba(47,161,90,.85); }
.bin.no    { background: rgba(224,71,62,.85); }
.bin.over  { border-style: solid; transform: scale(1.01); }

/* jeton plasat: card mai mare, bine distanțat, ușor de văzut */
.bin-drop .token {
  flex: 0 0 auto; width: auto;
  padding: clamp(8px, 1.4vh, 15px) clamp(10px, 1.4vh, 16px);
  gap: 4px;
}
.bin-drop .token img { height: clamp(72px, 12.5vh, 132px); }
.bin-drop .token span { font-size: clamp(20px, 2.8vh, 30px); color: var(--ok); }

/* ===================== ECRAN FINAL / RECOMPENSĂ ===================== */
.reward { align-items: center; justify-content: flex-start; text-align: center; }

/* header: logo ANITP centrat */
.reward-logo {
  position: absolute; top: clamp(8px, 2.4vh, 22px); left: 50%; transform: translateX(-50%);
  height: clamp(34px, 7vh, 70px); width: auto;
  border-radius: 10px; box-shadow: var(--shadow-sm); z-index: 5;
}

/* panoul central — același font, text mare, pe crem cald */
.reward-panel {
  position: relative; z-index: 3;
  width: min(88%, 540px);
  max-height: 86%;
  margin-top: clamp(70px, 9.5vh, 104px);   /* sub logo, fără să-l atingă */
  background: rgba(255, 247, 234, .97);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(14px, 2.2vh, 26px) clamp(22px, 4.5vw, 52px);
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(6px, 1.3vh, 14px);
  overflow-y: auto; overflow-x: hidden;   /* plasă de siguranță: nimic nu se taie */
}

.reward .shield { height: clamp(56px, 10.5vh, 110px); filter: drop-shadow(0 8px 14px rgba(0,0,0,.28)); animation: pop .6s; }
.reward h2 {
  font-family: var(--font-display); font-weight: 800; color: var(--navy-deep);
  font-size: clamp(24px, 4.2vh, 44px); line-height: 1.05;
}
.stars { font-size: clamp(26px, 5vh, 52px); letter-spacing: .12em; color: var(--gold); }
.reward p {
  font-family: var(--font-body); color: var(--ink); font-weight: 600;
  font-size: clamp(18px, 2.9vh, 28px); line-height: 1.32; max-width: 36ch;
}

/* numere: grilă 2 coloane; ANITP pe toată lățimea, dedesubt */
.numbers {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 1.6vh, 16px); width: 100%; margin-top: clamp(4px, 1vh, 10px);
}
.num-card {
  background: #fff; border-radius: var(--radius);
  border: 2px solid rgba(40,58,96,.14);
  padding: clamp(12px, 2vh, 22px) clamp(8px, 1.5vw, 16px);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.num-card.wide { grid-column: 1 / -1; }
.num-card .n { font-family: var(--font-display); font-weight: 800; color: var(--stop); font-size: clamp(28px, 5vh, 50px); line-height: 1; }
.num-card .t { color: var(--navy-deep); font-weight: 600; font-size: clamp(13px, 2vh, 20px); margin-top: 4px; }

.reward .row-btns { display: flex; gap: clamp(10px, 2vw, 20px); margin-top: clamp(8px, 1.6vh, 18px); flex-wrap: nowrap; justify-content: center; width: 100%; }
/* butoane mai mici, pe același rând */
.reward .btn {
  margin-top: 0;
  padding: clamp(10px, 1.6vh, 18px) clamp(14px, 2.6vw, 26px);
  font-size: clamp(15px, 2.3vh, 23px);
  box-shadow: 0 5px 0 var(--gold-deep), var(--shadow-sm);
  white-space: nowrap;
}
.reward .btn:active { box-shadow: 0 2px 0 var(--gold-deep), var(--shadow-sm); }

/* polițista iese din colțul dreapta-jos, fără să intre peste panou */
/* polițista: bust mare care iese din colțul dreapta-jos (restul e out of bounds) */
.reward-hero {
  position: absolute; right: -6%; bottom: -10%;
  height: clamp(360px, 86vh, 820px); width: auto;
  object-position: top center;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,.3));
  pointer-events: none; z-index: 1;
}

/* ===================== LABIRINT ===================== */
.maze-screen {
  position: absolute;
  align-items: center;
  justify-content: center;
  text-align: center;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.maze-play {
  touch-action: none;
}
.maze-play.veil::before {
  background:
    radial-gradient(circle at 88% 22%, rgba(67,139,224,.30), transparent 24%),
    radial-gradient(circle at 88% 76%, rgba(219,74,61,.28), transparent 23%),
    linear-gradient(180deg, rgba(26,39,66,.14), rgba(26,39,66,.30));
}
.maze-logo {
  position: absolute;
  top: clamp(10px, 2vh, 20px);
  left: clamp(10px, 2vw, 22px);
  height: clamp(34px, 6.5vh, 64px);
  width: auto;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  z-index: 20;
}
.maze-home {
  position: absolute;
  top: clamp(10px, 2vh, 20px);
  right: clamp(10px, 2vw, 22px);
  z-index: 30;
  border: none;
  cursor: pointer;
  width: clamp(48px, 8vmin, 66px);
  height: clamp(48px, 8vmin, 66px);
  border-radius: 50%;
  background: rgba(255,255,255,.94);
  color: var(--navy-deep);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(28px, 5vmin, 42px);
  line-height: 1;
  box-shadow: var(--shadow-sm);
}
.maze-status {
  position: absolute;
  top: clamp(13px, 2.4vh, 28px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 24;
  border-radius: 999px;
  background: rgba(255,247,234,.96);
  color: var(--navy-deep);
  box-shadow: var(--shadow-sm);
  padding: clamp(7px, 1.1vmin, 11px) clamp(13px, 2.4vmin, 24px);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(16px, 2.7vmin, 26px);
  line-height: 1;
  white-space: nowrap;
}
.maze-board,
.maze-canvas,
.maze-trace {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.maze-board {
  z-index: 8;
  touch-action: none;
}
.maze-trace {
  z-index: 9;
  cursor: grab;
  touch-action: none;
}
.maze-board.offtrack .maze-trace {
  animation: shake .28s;
}
.maze-person,
.maze-target,
.maze-bad-hero {
  position: absolute;
  z-index: 16;
  pointer-events: none;
}
.maze-boy {
  width: clamp(74px, 16vmin, 150px);
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 8px 14px rgba(0,0,0,.28));
}
.maze-target {
  width: clamp(84px, 18vmin, 170px);
  height: clamp(84px, 18vmin, 170px);
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
}
.maze-target::before {
  content: "";
  position: absolute;
  inset: -12%;
  border-radius: 50%;
  filter: blur(3px);
  opacity: .92;
}
.maze-target.safe::before {
  inset: -24%;
  background: radial-gradient(circle, rgba(78,157,236,.58), rgba(78,157,236,.24) 56%, transparent 74%);
}
.maze-target.bad::before {
  inset: -34%;
  background: radial-gradient(circle, rgba(219,74,61,.62), rgba(219,74,61,.24) 58%, transparent 76%);
}
.maze-target img {
  position: relative;
  z-index: 2;
  max-width: 118%;
  max-height: 118%;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,.30));
}
.maze-panel {
  position: relative;
  z-index: 24;
  width: min(88%, 560px);
  background: rgba(255, 247, 234, .97);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vh, 34px) clamp(22px, 5vw, 56px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 1.8vh, 18px);
}
.maze-panel h2 {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--navy-deep);
  font-size: clamp(34px, 6vh, 62px);
  line-height: 1;
}
.maze-panel p {
  font-weight: 700;
  color: var(--ink);
  font-size: clamp(18px, 3vh, 28px);
  line-height: 1.2;
}
.maze-note {
  color: var(--navy);
}
.maze-panel .row-btns {
  display: flex;
  justify-content: center;
  width: 100%;
}
.maze-panel .btn {
  margin-top: clamp(4px, 1vh, 10px);
  font-size: clamp(17px, 2.8vh, 26px);
}
.maze-bad.veil::before {
  background:
    radial-gradient(circle at 78% 57%, rgba(219,74,61,.56), transparent 28%),
    linear-gradient(180deg, rgba(26,39,66,.25), rgba(26,39,66,.48));
}
.maze-bad-hero {
  z-index: 12;
  right: clamp(2px, 3vw, 40px);
  bottom: -10%;
  height: clamp(340px, 80vh, 740px);
  filter: drop-shadow(0 10px 20px rgba(0,0,0,.32));
}

.maze-bad .maze-panel {
  max-height: calc(100% - clamp(28px, 6vh, 56px));
}

/* Landscape: panoul la stânga, polițista mare jos-dreapta, doar bustul vizibil */
@media (orientation: landscape) {
  .reward { align-items: flex-start; }
  .reward-panel {
    margin-left: clamp(58px, 7vw, 112px);
    margin-top: clamp(72px, 10vh, 96px);
    max-height: calc(100% - clamp(112px, 16vh, 150px));
    width: min(62vw, 700px);
    padding: clamp(12px, 1.8vh, 20px) clamp(30px, 4vw, 58px);
    gap: clamp(4px, .9vh, 10px);
  }
  .reward .shield { height: clamp(48px, 8vh, 82px); }
  .reward h2 { font-size: clamp(30px, 5vh, 44px); }
  .reward p { font-size: clamp(18px, 2.6vh, 25px); line-height: 1.18; max-width: 44ch; }
  .stars { font-size: clamp(28px, 4.8vh, 48px); }
  .reward .numbers { grid-template-columns: repeat(3, 1fr); gap: clamp(8px, 1.3vh, 14px); }
  .reward .num-card { padding: clamp(10px, 1.5vh, 16px) clamp(8px, 1.3vw, 14px); }
  .reward .num-card.wide { grid-column: auto; }
  .reward .num-card .n { font-size: clamp(26px, 4.4vh, 42px); }
  .reward .num-card .t { font-size: clamp(12px, 1.7vh, 18px); line-height: 1.05; }
  .reward .row-btns { margin-top: clamp(4px, .8vh, 10px); }
  .reward .btn { padding: clamp(9px, 1.4vh, 15px) clamp(16px, 2.4vw, 26px); }
  /* dimensiune proporțională cu înălțimea => consistent pe orice landscape */
  .reward-hero { right: -2%; bottom: -55vh; height: 130vh; }
}

/* ===================== PORTRAIT (fallback) ===================== */
/* LANDSCAPE (orientarea principală pe iPad): personaj uriaș în stânga,
   cardul întrebării plutește în dreapta, vertical centrat. */
@media (orientation: landscape) {
  /* figură mare: cap sus, picioarele ies pe sub marginea de jos */
  .actor-col { align-items: flex-start; justify-content: flex-start; padding-left: clamp(0px, 2vw, 36px); }
  .reactor { height: 128%; margin-bottom: 0; }
  .bubble { left: 30%; top: 1.5%; max-width: min(52%, 520px); }
  .panel {
    left: auto; right: 2.6%;
    top: 50%; bottom: auto;
    transform: translateY(-50%);
    width: min(54%, 560px);
    max-height: 90%;
  }
  .word-play .panel { width: min(58%, 640px); }
  .maze-bad {
    justify-content: flex-start;
    padding-left: clamp(18px, 5vw, 70px);
  }
  .maze-bad .maze-panel {
    width: min(56%, 560px);
  }
  .word-setup-panel {
    margin-left: auto;
    margin-right: clamp(22px, 5vw, 84px);
    width: min(56%, 580px);
  }
}

@media (orientation: portrait) {
  .map {
    justify-content: flex-start;
    padding-top: clamp(18px, 4vh, 42px);
  }
  .worlds { grid-template-columns: 1fr 1fr; }
  .bins { grid-template-columns: 1fr 1fr; }
  /* panoul de final centrat vertical (nu lipit de sus) */
  .reward { justify-content: center; }
  .reward-panel { margin-top: clamp(40px, 6vh, 70px); }
  .word-setup {
    justify-content: flex-end;
    padding-bottom: clamp(18px, 4vh, 44px);
  }
  .word-setup-hero {
    left: 50%;
    transform: translateX(-50%);
    bottom: 20%;
    height: clamp(390px, 68vh, 660px);
  }
  .word-setup-panel {
    width: min(94%, 420px);
  }
  .maze-bad {
    justify-content: flex-start;
    padding-top: clamp(18px, 7vh, 78px);
  }
  .maze-bad .maze-panel {
    width: min(92%, 520px);
  }
  .maze-bad-hero {
    right: clamp(-70px, -8vw, -28px);
    bottom: -8%;
    height: clamp(230px, 42vh, 420px);
  }
}

/* Ecrane foarte mici în înălțime: strânge personajul */
@media (max-height: 480px) {
  .scene-art { display: none; }
  .map-head { padding-bottom: calc(var(--u) * .8); }
  .world-card .label { padding: calc(var(--u) * .55) calc(var(--u) * .8); }
  .word-play .panel { max-height: 86%; }
  .word-kicker { display: none; }
  .word-setup-panel { padding: clamp(12px, 2vh, 20px) clamp(18px, 4vw, 34px); }
  .round-choice { min-height: 74px; }
}
