/* ============================================================
   Vânătoarea de comori — David
   Temă: negru & galben. Mobile-first (de la 360px în sus).
   ============================================================ */

:root {
  --yellow: #ffc93c;
  --yellow-bright: #ffd60a;
  --yellow-dim: #b38a1f;
  --black: #0a0a0a;
  --panel: rgba(12, 12, 12, 0.82);
  --panel-line: rgba(255, 201, 60, 0.28);
  --green: #46d369;
  --red: #ff5a5a;
  --text: #f3e9cf;

  --radius: 14px;
  --tap: 52px; /* țintă minimă de atins cu degetul */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--black);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

/* ---------- Fundal ---------- */
/* Element separat ca să putem fixa imaginea fără bug-urile de
   background-attachment:fixed de pe mobil. */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(5, 5, 5, 0.74), rgba(5, 5, 5, 0.88)),
    url("assets/davidBdayBackgrounad.jpg");
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

/* ---------- Layout ---------- */
#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 18px 14px 8px;
}

.screen[hidden] { display: none; }

.card {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  padding: 22px 18px 26px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
}

.card > *:first-child { margin-top: 0; }
.card > *:last-child { margin-bottom: 0; }

/* ---------- Tipografie ---------- */
.eyebrow {
  margin: 0 0 2px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.74rem;
  color: var(--yellow-dim);
}

.title {
  margin: 0;
  font-size: clamp(2rem, 9vw, 2.9rem);
  line-height: 1.05;
  color: var(--yellow-bright);
  text-shadow: 0 0 22px rgba(255, 201, 60, 0.3);
  letter-spacing: -0.02em;
}

.aka {
  margin: 8px 0 20px;
  font-size: 0.86rem;
  color: var(--yellow-dim);
}

.lead {
  font-size: 1.12rem;
  color: var(--yellow);
  font-weight: 600;
}

.whisper {
  font-style: italic;
  font-size: 0.93rem;
  color: #a79a7d;
  margin-top: -6px;
}

.worth {
  color: var(--yellow-bright);
  font-weight: 700;
  font-style: italic;
  font-size: 1.05rem;
}

.muted { color: #a79a7d; }
.small { font-size: 0.88rem; }

.rule {
  border: 0;
  border-top: 1px dashed var(--panel-line);
  margin: 20px 0;
}

/* ---------- Nivel ---------- */
.progress { margin-bottom: 14px; }

.progress-label {
  display: block;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--yellow-dim);
  margin-bottom: 6px;
}

.progress-track {
  height: 5px;
  background: rgba(255, 201, 60, 0.15);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--yellow-dim), var(--yellow-bright));
  border-radius: 99px;
  transition: width 0.45s ease;
}

.level-intro {
  color: var(--yellow);
  font-weight: 600;
  white-space: pre-line;
}

.clue {
  margin-top: 16px;
  white-space: pre-line;
  font-size: 1.05rem;
}

/* ---------- Media ---------- */
.media { margin: 18px 0 4px; }

/* Rama păstrează locul pozei dinainte să se încarce, ca să nu sară
   layout-ul. Toate pozele sunt 900x1600, deci 9/16 e exact. */
.photo-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  margin-bottom: 12px;
  border-radius: 10px;
  border: 1px solid var(--panel-line);
  background: #0d0d0d;
  overflow: hidden;
}

/* Schelet care pulsează cât se încarcă poza. */
.photo-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    rgba(255, 201, 60, 0.03) 30%,
    rgba(255, 201, 60, 0.13) 50%,
    rgba(255, 201, 60, 0.03) 70%
  );
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.photo-frame.is-ready::after {
  opacity: 0;
  animation: none;
}

@keyframes shimmer {
  from { background-position: 220% 0; }
  to   { background-position: -220% 0; }
}

.photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  /* Fără tranziție aici: poza veche trebuie să dispară INSTANT când
     trecem la alt nivel, altfel se vede cum se stinge încet. */
  transition: none;
}

/* Tranziția e doar la apariție, pe poza nouă. */
.photo-frame.is-ready .photo {
  opacity: 1;
  transition: opacity 0.3s ease;
}

.video-wrap video {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--panel-line);
  background: #000;
}

/* ---------- Ghicitori ---------- */
.reward-intro {
  color: var(--yellow);
  font-weight: 600;
  white-space: pre-line;
}

.riddle {
  margin: 18px 0 0;
  padding: 16px 14px;
  border: 1px solid rgba(255, 201, 60, 0.18);
  border-radius: 12px;
  background: rgba(255, 201, 60, 0.04);
}

.riddle.solved {
  border-color: rgba(70, 211, 105, 0.5);
  background: rgba(70, 211, 105, 0.07);
}

.riddle-q {
  margin: 0 0 14px;
  white-space: pre-line;
  font-size: 1.03rem;
}

.answer-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.answer-row input {
  flex: 1 1 150px;
  min-width: 0;
  min-height: var(--tap);
  padding: 0 14px;
  font-size: 1.05rem; /* >=16px ca iOS/Android să nu dea zoom la focus */
  font-family: inherit;
  color: var(--text);
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--panel-line);
  border-radius: 10px;
}

.answer-row input::placeholder { color: #6d6450; }

.answer-row input:focus {
  outline: 2px solid var(--yellow);
  outline-offset: 1px;
  border-color: var(--yellow);
}

.answer-row input:disabled {
  color: var(--green);
  font-weight: 700;
  border-color: rgba(70, 211, 105, 0.45);
  opacity: 1;
}

/* Varianta PIN: căsuțele stau pe un rând, butonul dedesubt. */
.answer-row--pin {
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.pin {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 300px;
}

.pin-box {
  flex: 1 1 0;
  min-width: 0;
  height: 68px;
  padding: 0;
  text-align: center;
  font-family: inherit;
  font-size: 1.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--yellow-bright);
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  caret-color: var(--yellow);
}

.pin-box:focus {
  outline: 2px solid var(--yellow);
  outline-offset: 1px;
  border-color: var(--yellow);
  background: rgba(255, 201, 60, 0.08);
}

.pin-box:disabled {
  color: var(--green);
  border-color: rgba(70, 211, 105, 0.45);
  opacity: 1;
}

.answer-row--pin .btn-check {
  width: 100%;
  max-width: 300px;
}

.feedback {
  margin: 10px 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  min-height: 1.2em;
}

.feedback.ok { color: var(--green); }
.feedback.bad { color: var(--red); }

/* Hint */
.hint-row { margin-top: 12px; }

.btn-hint {
  min-height: 40px;
  padding: 0 14px;
  font: inherit;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--yellow);
  background: transparent;
  border: 1px dashed var(--panel-line);
  border-radius: 99px;
  cursor: pointer;
}

.btn-hint:hover { border-style: solid; }

.hint-text {
  margin: 10px 0 0;
  font-size: 1.5rem; /* emoji-urile trebuie să fie mari și clare */
  line-height: 1.3;
  color: var(--yellow);
}

.hint-text.is-words {
  font-size: 0.98rem;
  font-style: italic;
  color: #c9b88d;
}

/* ---------- Deblocat / final ---------- */
.unlocked {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed var(--panel-line);
  text-align: center;
}

.unlocked-msg {
  margin: 0 0 14px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--green);
}

.card-final { text-align: center; }

.enjoy {
  margin: 6px 0 10px;
  font-size: clamp(2.6rem, 15vw, 4.5rem);
  color: var(--yellow-bright);
  text-shadow: 0 0 30px rgba(255, 201, 60, 0.45);
  letter-spacing: 0.02em;
}

/* Creditul final, cu toate culorile pe repeat. */
.credit {
  margin: 26px 0 0;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #ff0040;
  animation: color-cycle 1.1s linear infinite;
}

@keyframes color-cycle {
  from { filter: hue-rotate(0deg); }
  to   { filter: hue-rotate(360deg); }
}

/* ---------- Confetti ---------- */
.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  pointer-events: none;
}

.confetti[hidden] { display: none; }

/* ---------- Butoane ---------- */
.btn {
  display: inline-block;
  width: 100%;
  min-height: var(--tap);
  padding: 14px 20px;
  font: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  color: #1a1400;
  background: linear-gradient(180deg, var(--yellow-bright), var(--yellow));
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 201, 60, 0.22);
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: translateY(1px); }

.btn-big {
  margin-top: 18px;
  font-size: 1.2rem;
  letter-spacing: 0.1em;
}

.btn-check {
  flex: 0 0 auto;
  width: auto;
  min-width: 108px;
  min-height: var(--tap);
  padding: 0 18px;
  font-size: 0.95rem;
}

/* ---------- Footer ---------- */
.footer {
  max-width: 640px;
  margin: 0 auto;
  padding: 18px 14px 28px;
  text-align: center;
}

.btn-reset {
  font: inherit;
  font-size: 0.78rem;
  color: #6d6450;
  background: none;
  border: 0;
  text-decoration: underline;
  cursor: pointer;
  padding: 10px;
}

/* ---------- Animație la intrare ---------- */
.screen:not([hidden]) {
  animation: rise 0.35s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .screen:not([hidden]) { animation: none; }
  .progress-fill { transition: none; }
  .credit { animation: none; color: var(--yellow-bright); }
  .photo-frame::after { animation: none; }
  .photo { transition: none; }
}

/* ---------- Ecrane mai mari ---------- */
@media (min-width: 700px) {
  body { font-size: 18px; }
  #app { padding: 40px 20px 10px; }
  .card { padding: 32px 30px 36px; }
}
