/* ============================================================
   PROGRAMEAZĂ MAȘINA — înfățișarea jocului
   ============================================================

   Scena are 1600 x 900 de puncte și atât are oricând; potrivirea la
   ecran se face din `--scara` (ecran.js). În stânga stau harta și ce
   spune Bit; în dreapta, misiunea, blocurile și programul.

   Fiecare fel de bloc are culoarea lui, aceeași în paletă și în
   program: mișcările sunt albastre, „dacă” e galben, „repetă” e mov.
   ============================================================ */

:root {
  --albastru: #2f7ff0;
  --albastru-umbra: #1b4fb0;
  --verde: #34b36a;
  --verde-umbra: #1e7a45;
  --rosu: #e4573d;
  --galben: #f5b800;
  --galben-umbra: #b98700;
  --mov: #8b5cf6;
  --mov-umbra: #5b34c4;

  --bleumarin: #12307a;
  --cerneala: #1f2933;

  --scara: 1;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--cerneala);
  background: #0e2a63;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   RAMA ȘI SCENA
   ============================================================ */

.rama {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scena {
  position: relative;
  width: 1600px;
  height: 900px;
  flex: none;
  overflow: hidden;
  transform: scale(var(--scara));
  transform-origin: center center;
  background: linear-gradient(180deg, #cfe6ff, #e9f3ff);
}

.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

/* ============================================================
   BARA DE SUS
   ============================================================ */

.bara {
  position: absolute;
  top: 12px;
  left: 24px;
  right: 24px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.bara__dreapta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pastila {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 24px;
  border-radius: 28px;
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  border: 4px solid rgba(255, 255, 255, 0.85);
  background: linear-gradient(180deg, #4b95ff, var(--albastru));
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.16), 0 12px 22px rgba(18, 48, 122, 0.25);
  white-space: nowrap;
}

.misiuni {
  display: flex;
  gap: 10px;
}

.misiune-buton {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 78px;
  height: 58px;
  padding: 0;
  border: 4px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  background: #ffffff;
  color: var(--bleumarin);
  font: inherit;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(18, 48, 122, 0.15);
}

.misiune-buton small { font-size: 14px; color: #f0a500; letter-spacing: 1px; margin-top: 3px; }

.misiune-buton[aria-current="step"] {
  background: linear-gradient(180deg, #4b95ff, var(--albastru));
  color: #fff;
}

.misiune-buton[aria-current="step"] small { color: #ffe27a; }

.rotund {
  width: 56px;
  height: 56px;
  flex: none;
  padding: 0;
  border: 4px solid rgba(255, 255, 255, 0.85);
  border-radius: 18px;
  background: linear-gradient(180deg, #4b95ff, var(--albastru));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.16), 0 12px 22px rgba(18, 48, 122, 0.25);
  display: grid;
  place-items: center;
}

.rotund svg { width: 28px; height: 28px; }
.rotund:active { transform: translateY(4px); }

/* ============================================================
   HARTA ȘI CE SPUNE BIT
   ============================================================ */

.stanga {
  position: absolute;
  top: 88px;
  left: 24px;
  width: 784px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.harta-rama {
  padding: 8px;
  border-radius: 26px;
  background: #ffffff;
  box-shadow: 0 8px 0 rgba(18, 48, 122, 0.12), 0 14px 26px rgba(18, 48, 122, 0.16);
}

.harta {
  display: block;
  width: 768px;
  height: 576px;
  border-radius: 20px;
}

.masina {
  transition: transform 0.5s ease-in-out;
}

.masina.fara-miscare { transition: none; }

.semafor .lumina-rosie { fill: #5a1e17; }
.semafor .lumina-verde { fill: #1d4a2c; }
.semafor[data-culoare="rosu"] .lumina-rosie { fill: #ff3b30; filter: drop-shadow(0 0 6px #ff3b30); }
.semafor[data-culoare="verde"] .lumina-verde { fill: #3ddc6b; filter: drop-shadow(0 0 6px #3ddc6b); }

.vorba {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0;
  padding: 10px 24px 10px 12px;
  border-radius: 22px;
  background: #ffffff;
  border: 4px solid rgba(18, 48, 122, 0.12);
  color: var(--bleumarin);
  font-size: 23px;
  font-weight: 600;
  line-height: 1.3;
}

.vorba__bit { width: auto; height: 150px; flex: none; margin-top: 30px; align-self: flex-end; }

.vorba[data-ton="gandeste"] { border-color: #f3b3a6; background: #fff4f1; color: #8a2412; }
.vorba[data-ton="bucurie"] { border-color: #a9e2c1; background: #f0fbf4; color: #17613a; }

/* ============================================================
   MISIUNEA, BLOCURILE, PROGRAMUL
   ============================================================ */

.dreapta {
  position: absolute;
  top: 88px;
  left: 828px;
  right: 24px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.misiune {
  padding: 14px 22px;
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 6px 0 rgba(18, 48, 122, 0.1);
}

.misiune__cap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.misiune__titlu { font-size: 24px; font-weight: 800; color: var(--bleumarin); }

.misiune__structura {
  padding: 4px 14px;
  border-radius: 14px;
  background: #e3eefe;
  color: #33518c;
  font-size: 18px;
  font-weight: 700;
}

body[data-nivel="mediu"] .misiune__structura { background: #fff4cc; color: #7a5a00; }
body[data-nivel="greu"] .misiune__structura { background: #ede4ff; color: #4b2aa8; }

.misiune__text {
  margin: 8px 0 0;
  font-size: 22px;
  line-height: 1.3;
  color: #2a3c66;
}

/* ---------- paleta ---------- */

.paleta {
  display: flex;
  gap: 10px;
}

.bloc-paleta {
  --fond: linear-gradient(180deg, #5ea2ff, var(--albastru));
  --umbra: var(--albastru-umbra);
  flex: 0 0 96px;
  height: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  border: 4px solid #ffffff;
  border-radius: 20px;
  background: var(--fond);
  color: #ffffff;
  font: inherit;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 7px 0 var(--umbra);
}

.bloc-paleta .semn { font-size: 34px; line-height: 1; }
.bloc-paleta:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--umbra); }
.bloc-paleta[hidden] { display: none; }

.bloc-paleta--daca {
  --fond: linear-gradient(180deg, #ffd24d, var(--galben));
  --umbra: var(--galben-umbra);
  flex-basis: 176px;
  color: #4a3400;
}

.bloc-paleta--repeta {
  --fond: linear-gradient(180deg, #a98bff, var(--mov));
  --umbra: var(--mov-umbra);
  flex-basis: 120px;
}

/* ---------- programul ---------- */

.program {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  border-radius: 22px;
  background: #ffffff;
  border: 4px dashed #b9d0f5;
}

.program__cap {
  display: flex;
  justify-content: space-between;
  font-size: 20px;
  font-weight: 800;
  color: #5b6f96;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.program__contor { text-transform: none; letter-spacing: 0; color: #33518c; }
.program__contor.plin { color: #a92d18; }

.program__blocuri {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  margin-top: 10px;
}

.program__gol {
  margin: 30px auto;
  font-size: 22px;
  color: #8a97ad;
  text-align: center;
}

.bloc {
  width: 76px;
  height: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border: 3px solid var(--albastru-umbra);
  border-radius: 16px;
  background: linear-gradient(180deg, #5ea2ff, var(--albastru));
  color: #ffffff;
  font: inherit;
  cursor: pointer;
}

.bloc .semn { font-size: 30px; line-height: 1; }
.bloc small { font-size: 12px; font-weight: 700; }

.bloc--daca {
  width: 116px;
  border-color: var(--galben-umbra);
  background: linear-gradient(180deg, #ffd24d, var(--galben));
  color: #4a3400;
}

.bloc--daca small { line-height: 1.1; text-align: center; }

.bloc-repeta {
  flex: 0 0 100%;
  padding: 8px 10px 10px;
  border: 3px solid var(--mov-umbra);
  border-radius: 18px;
  background: #efe8ff;
}

.bloc-repeta.tinta { box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.45); background: #e6dcff; }

.bloc-repeta__cap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 800;
  color: #4b2aa8;
}

.bloc-repeta__cap .semn { font-size: 24px; }
.bloc-repeta__ori { min-width: 26px; text-align: center; font-size: 26px; }

.mic {
  width: 38px;
  height: 38px;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: var(--mov);
  color: #ffffff;
  font: inherit;
  font-size: 24px;
  font-weight: 800;
  cursor: pointer;
}

.mic--sterge { margin-left: auto; background: #c9b8f5; color: #4b2aa8; }

.eticheta-buton {
  padding: 6px 14px;
  border: none;
  border-radius: 12px;
  background: #ffffff;
  color: #4b2aa8;
  font: inherit;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
}

.bloc-repeta__corp {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 60px;
  margin-top: 8px;
  padding: 8px;
  border-radius: 12px;
  background: #ffffff;
}

.bloc-repeta__gol { align-self: center; font-size: 18px; color: #8a7bb8; }

/* Blocul care se execută acum și blocul care a greșit. */
.bloc.ruleaza { outline: 5px solid #ffc53d; outline-offset: 2px; transform: scale(1.08); }
.bloc-repeta.ruleaza { box-shadow: 0 0 0 4px #ffc53d; }
.bloc.eroare { outline: 5px solid var(--rosu); outline-offset: 2px; animation: tremura 0.45s ease; }

/* ---------- comenzile ---------- */

.comenzi {
  display: flex;
  gap: 12px;
}

.buton {
  height: 84px;
  padding: 0 16px;
  white-space: nowrap;
  border: 5px solid #ffffff;
  border-radius: 26px;
  color: #ffffff;
  font: inherit;
  font-size: 26px;
  font-weight: 800;
  cursor: pointer;
}

.buton:active { transform: translateY(6px); }

.buton--porneste {
  flex: 1.4;
  background: linear-gradient(180deg, #46d585, var(--verde));
  box-shadow: 0 8px 0 var(--verde-umbra);
}

.buton--pas {
  flex: 1;
  background: linear-gradient(180deg, #7fa8ec, #4b79d0);
  box-shadow: 0 8px 0 #2a4f97;
}

.buton--sterge {
  flex: 0.9;
  background: linear-gradient(180deg, #f28b77, var(--rosu));
  box-shadow: 0 8px 0 #a92d18;
}

/* Cât timp mașina execută programul, programul nu se schimbă. */
body.ruleaza .paleta,
body.ruleaza .program,
body.ruleaza .comenzi,
body.ruleaza .misiuni { pointer-events: none; opacity: 0.6; }

/* ============================================================
   PANOURILE
   ============================================================ */

.panou {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: radial-gradient(120% 120% at 50% 0%, rgba(18, 48, 122, 0.45), rgba(18, 48, 122, 0.72));
}

body[data-stare="meniu"] .panou--start,
body[data-stare="reusita"] .panou--reusita { display: flex; }

body[data-stare="meniu"] .bara,
body[data-stare="meniu"] .stanga,
body[data-stare="meniu"] .dreapta { pointer-events: none; }

.panou__cutie {
  width: 1180px;
  max-width: 100%;
  padding: 34px 50px 30px;
  border-radius: 44px;
  border: 8px solid rgba(255, 255, 255, 0.9);
  background: linear-gradient(180deg, #ffffff, #eaf3ff);
  box-shadow: 0 26px 60px rgba(8, 24, 64, 0.45);
  text-align: center;
  animation: intra 0.3s ease-out;
}

.titlu-joc {
  margin: 0;
  font-size: 62px;
  font-weight: 800;
  line-height: 1.05;
  color: var(--bleumarin);
  text-shadow: 0 5px 0 rgba(47, 127, 240, 0.22);
}

.panou__titlu {
  margin: 0;
  font-size: 56px;
  font-weight: 800;
  color: var(--bleumarin);
}

.panou__subtitlu {
  margin: 12px auto 0;
  max-width: 980px;
  font-size: 24px;
  line-height: 1.45;
  color: #3c5280;
}

.niveluri {
  display: flex;
  gap: 20px;
  margin-top: 26px;
}

.nivel {
  --culoare: var(--albastru);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 22px;
  border: 6px solid var(--culoare);
  border-radius: 28px;
  background: #ffffff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 10px 0 rgba(18, 48, 122, 0.12);
}

.nivel:active { transform: translateY(6px); }
.nivel--mediu { --culoare: var(--galben); }
.nivel--greu { --culoare: var(--mov); }

.nivel__nume { font-size: 34px; font-weight: 800; color: var(--bleumarin); }
.nivel__structura { font-size: 21px; font-weight: 800; color: var(--culoare); }
.nivel--mediu .nivel__structura { color: #b98700; }
.nivel__descriere { font-size: 18px; line-height: 1.35; color: #3c5280; }
.nivel__stele { margin-top: auto; font-size: 20px; font-weight: 800; color: #f0a500; }

.stele {
  margin-top: 12px;
  font-size: 72px;
  line-height: 1;
  color: #d9e3f2;
}

.stele .plina { color: #ffc53d; text-shadow: 0 4px 0 #e0a800; }

.incheiere {
  max-width: 960px;
  margin: 16px auto 0;
  padding: 16px 24px;
  border-radius: 20px;
  background: #eef7ff;
  border: 3px solid #b9d0f5;
  font-size: 22px;
  line-height: 1.4;
  color: var(--bleumarin);
}

.incheiere[hidden] { display: none; }

.buton-mare {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 380px;
  min-height: 90px;
  margin-top: 22px;
  padding: 0 44px;
  border: 6px solid #ffffff;
  border-radius: 50px;
  background: linear-gradient(180deg, #46d585, var(--verde));
  color: #fff;
  font: inherit;
  font-size: 36px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 0 var(--verde-umbra), 0 20px 34px rgba(8, 24, 64, 0.35);
}

.buton-mare[hidden] { display: none; }
.buton-mare:active { transform: translateY(8px); }

.buton-mare--sters {
  background: linear-gradient(180deg, #7fa8ec, #4b79d0);
  box-shadow: 0 12px 0 #2a4f97, 0 20px 34px rgba(8, 24, 64, 0.35);
}

.buton-mic {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 12px 26px;
  border: 3px solid #b9d0f5;
  border-radius: 30px;
  background: #ffffff;
  color: #33518c;
  font: inherit;
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
}

.buton-mic[aria-pressed="false"] { color: #8a97ad; }
.buton-mic__semn { font-size: 26px; line-height: 1; }

.panou__unelte {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}

.panou__unelte--final { gap: 26px; }

.inapoi {
  display: inline-block;
  margin-top: 18px;
  color: #5b6f96;
  font-size: 22px;
  font-weight: 700;
  text-decoration: none;
}

.inapoi:hover { color: var(--albastru); text-decoration: underline; }

/* ============================================================
   MIȘCĂRILE
   ============================================================ */

@keyframes tremura {
  0%, 100% { translate: 0 0; }
  25% { translate: -8px 0; }
  50% { translate: 8px 0; }
  75% { translate: -4px 0; }
}

@keyframes intra {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .masina { transition: none; }
  .bloc.eroare, .panou__cutie { animation: none; }
}
