/* Prioritate! — stil funcțional, mobil întâi. */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #10141c;
  --panel: #1b2230;
  --text: #edf1f7;
  --muted: #93a0b4;
  --green: #22c55e;
  --green-dark: #15803d;
  --amber: #f59e0b;
  --amber-dark: #b45309;
  --red: #ef4444;
  --blue: #3b82f6;
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

.hidden { display: none !important; }

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.btn {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 8px auto 0;
  padding: 14px 20px;
  border: 0;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:active { transform: scale(.97); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid #2c3648; }

/* ---- start ---- */
.home-box { text-align: center; padding: 24px; max-width: 420px; }
.home-logo { font-size: 56px; }
.home-box h1 { font-size: 40px; margin: 6px 0 8px; }
.tagline { color: var(--muted); margin-bottom: 18px; font-size: 16px; }
.home-best { background: var(--panel); border-radius: 12px; padding: 10px; margin-bottom: 14px; font-size: 15px; }
.home-hint { color: var(--muted); font-size: 13px; margin-top: 16px; }

/* ---- joc ---- */
#screen-game { justify-content: flex-start; padding: 10px 10px calc(14px + env(safe-area-inset-bottom)); }

.hud {
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
  padding: 4px 6px;
}
#hud-score { font-size: 20px; color: var(--green); }
#hud-streak { color: var(--amber); }
#btn-pause {
  background: transparent;
  border: 1px solid #2c3648;
  color: var(--muted);
  border-radius: 10px;
  font-size: 16px;
  line-height: 1;
  padding: 7px 11px;
  cursor: pointer;
}

/* pauza acoperă TOT (scenă, butoane, HUD) — situația nu se poate studia cu timpul oprit */
#overlay-pause {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
}
#overlay-pause p { color: var(--muted); font-size: 14px; max-width: 320px; line-height: 1.45; }

/* contorul bonusului de viteză: plin = bonus maxim, se golește cât timp eziți.
   Nu e limită de timp — golirea costă doar puncte, nu e greșeală. Aprins doar
   cât aștepți o decizie (idle = estompat, plin, „pregătit"). */
#speedmeter {
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 8px;
  transition: opacity .25s;
}
#speedmeter.idle { opacity: .3; }
#speedbolt { font-size: 13px; line-height: 1; }
#speedmeter.empty #speedbolt { filter: grayscale(1); opacity: .55; }
#speedbar {
  flex: 1;
  height: 8px;
  background: #232c3d;
  border-radius: 4px;
  overflow: hidden;
}
#speedfill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #f7b500, var(--amber));
  border-radius: 4px;
}

#scene-wrap {
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 1;
}
#scene { width: 100%; height: 100%; display: block; border-radius: 16px; background: #2a3325; }
#fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

#coach {
  position: absolute;
  left: 8px; right: 8px; top: 8px;
  background: rgba(12, 16, 24, .88);
  border: 1px solid #34405a;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.35;
  pointer-events: none;
}

/* cardul cu indicatorul propriu, vizibil doar în faza de apropiere */
#approach-card {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(12, 16, 24, .9);
  border: 1px solid #34405a;
  border-radius: 12px;
  padding: 9px 14px;
  max-width: 92%;
  cursor: pointer;
}
#approach-card svg { width: 72px; flex: none; display: block; }
#approach-label { font-size: 15px; font-weight: 800; line-height: 1.25; }
#approach-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; max-width: 190px; }

.sign-pulse { animation: signpulse 1.1s ease-in-out infinite; }
@keyframes signpulse {
  0%, 100% { stroke-opacity: .95; }
  50% { stroke-opacity: .2; }
}

#banner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(10, 13, 20, .72);
  border-radius: 16px;
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  padding: 20px;
}
#banner small { font-size: 15px; font-weight: 600; color: var(--muted); }

#popup-score {
  position: absolute;
  left: 50%; top: 40%;
  transform: translateX(-50%);
  font-size: 30px;
  font-weight: 900;
  color: var(--green);
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
  pointer-events: none;
  animation: floatUp .9s ease-out forwards;
}
@keyframes floatUp {
  from { opacity: 1; translate: 0 0; }
  to { opacity: 0; translate: 0 -70px; }
}
#popup-score.fast { color: #f7b500; } /* decizie rapidă — auriu, ca bonusul */

#maneuver-chip {
  margin: 10px 0 6px;
  font-size: 15px;
  color: var(--muted);
}
#maneuver-chip b { color: var(--text); font-size: 17px; }

#controls {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 480px;
}
.btn-decision {
  flex: 1;
  padding: 20px 0;
  border: 0;
  border-radius: 16px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
}
.btn-decision:disabled { opacity: .45; }
.btn-wait { background: linear-gradient(180deg, var(--amber), var(--amber-dark)); }
.btn-go { background: linear-gradient(180deg, var(--green), var(--green-dark)); }
.btn-decision:active:not(:disabled) { transform: scale(.96); }
.btn-decision.flash-good { box-shadow: 0 0 0 4px rgba(34,197,94,.55); }

/* ---- foaia de greșeală ---- */
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--panel);
  border-radius: 18px 18px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  max-width: 520px;
  margin: 0 auto;
  box-shadow: 0 -8px 30px rgba(0,0,0,.5);
  z-index: 30;
}
.sheet h2 { color: var(--red); font-size: 20px; margin-bottom: 8px; }
.sheet p { font-size: 15px; line-height: 1.45; }

/* ---- modale ---- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 13, .8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 20px;
}
.modal-card {
  background: var(--panel);
  border-radius: 18px;
  padding: 20px;
  max-width: 340px;
  width: 100%;
  text-align: center;
}
.modal-card h2 { margin-bottom: 8px; }
.modal-card p { font-size: 15px; line-height: 1.4; }
#sign-zoom { width: 170px; height: auto; margin: 0 auto 8px; display: block; }
.modal-hint { color: var(--muted); font-size: 12px; margin-top: 10px; }

/* ---- final ---- */
.end-box { text-align: center; padding: 24px; width: 100%; max-width: 460px; }
.end-score { font-size: 56px; font-weight: 900; color: var(--green); margin: 4px 0; }
#end-stats { color: var(--muted); margin-bottom: 14px; }
#end-mistakes { text-align: left; max-height: 40dvh; overflow-y: auto; margin-bottom: 12px; }
.mistake-item {
  background: var(--panel);
  border-left: 3px solid var(--red);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.4;
  margin-bottom: 8px;
}
.mistake-item b { color: var(--red); }
.end-clean { background: var(--panel); border-radius: 12px; padding: 14px; color: var(--green); font-weight: 700; }

/* raportul pe situații: cum s-a calculat scorul, unde s-au pierdut puncte */
.report-head {
  background: var(--panel);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  margin-bottom: 8px;
}
.report-head b { color: var(--text, #e7edf7); }
.report-item {
  background: var(--panel);
  border-left: 3px solid var(--muted);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 6px;
  color: var(--muted);
}
.report-item b { color: inherit; }
.report-item .report-pts { font-weight: 900; margin: 0 8px; }
.report-item.full { border-left-color: var(--green); }
.report-item.full .report-pts { color: var(--green); }
.report-item.slow { border-left-color: var(--amber); }
.report-item.slow .report-pts { color: var(--amber); }
.report-item.bad { border-left-color: var(--red); }
.report-item.bad .report-pts { color: var(--red); }

/* ---- statistici (istoricul rezultatelor) ---- */
.stats-box { width: 100%; max-width: 460px; padding: 24px; text-align: center; }
.stats-box h1 { font-size: 28px; margin-bottom: 14px; }
#stats-empty { color: var(--muted); background: var(--panel); border-radius: 12px; padding: 14px; }
#stats-list { text-align: left; max-height: 62dvh; overflow-y: auto; margin-bottom: 4px; }
.hist-item { background: var(--panel); border-radius: 10px; margin-bottom: 6px; overflow: hidden; }
.hist-head { display: flex; align-items: center; gap: 10px; padding: 11px 12px; cursor: pointer; font-size: 14px; }
.hist-date { color: var(--muted); flex: 1; }
.hist-score { font-weight: 900; color: var(--green); }
.hist-arrow { color: var(--muted); font-size: 12px; }
.hist-detail { padding: 0 8px 8px; }
.hist-sum { color: var(--muted); font-size: 12.5px; margin-bottom: 8px; padding: 0 4px; }
/* în interiorul unui card de istoric, rândurile raportului au nevoie de alt fundal */
.hist-detail .report-head, .hist-detail .report-item { background: #232c3d; }

/* ---- ajutor (cum se punctează) ---- */
.help-card { text-align: left; max-width: 380px; max-height: 86dvh; overflow-y: auto; }
.help-card h2 { text-align: center; }
.help-list { margin: 10px 0 4px; padding: 0; list-style: none; }
.help-list li { font-size: 14px; line-height: 1.5; margin-bottom: 9px; padding-left: 18px; position: relative; }
.help-list li::before { content: '•'; position: absolute; left: 4px; color: var(--amber); }

/* ---- elemente SVG ---- */
.girofar { animation: blink .5s steps(2) infinite; }
@keyframes blink { 50% { opacity: .15; } }
.blocker-ring { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.sign-tap { cursor: pointer; }
