:root {
  --black: #000000;
  --panel: rgba(0, 0, 0, 0.72);
  --panel-soft: rgba(255, 255, 255, 0.1);
  --white: #ffffff;
  --dim: rgba(255, 255, 255, 0.64);
  --faint: rgba(255, 255, 255, 0.36);
  --cash: #7fdc86;
  --gold: #f2c84b;
  --red: #e5484d;
  --blip: #62b6f0;
  --pink: #ff4f9a;
  --font: 'Barlow', system-ui, sans-serif;
  --display: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;
  --hud-shadow: 0 0 3px rgba(0, 0, 0, 0.9), 2px 2px 0 rgba(0, 0, 0, 0.85);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--black);
  color: var(--white);
  font-family: var(--font);
  font-weight: 500;
  overflow: hidden;
}

#app { position: relative; width: 100%; height: 100dvh; }

.backdrop {
  position: absolute;
  inset: -40px;
  background: #10151a center / cover no-repeat;
  filter: blur(22px) brightness(0.42) saturate(1.15);
  transition: background-image 1.2s ease;
}

.screen { position: absolute; inset: 0; display: none; flex-direction: column; }
.screen.active { display: flex; }

button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

h1, h2, h3, p { margin: 0; }

/* ---------- Botões ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 30px;
  border: none;
  border-radius: 0;
  font: 700 1.2rem var(--display);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.1s ease, color 0.1s ease;
}

.btn-green, .btn-blue { background: var(--white); color: var(--black); }
.btn-green:hover:not(:disabled), .btn-blue:hover:not(:disabled) { background: var(--gold); }

.btn-white { background: var(--panel-soft); color: var(--white); }
.btn-white:hover:not(:disabled) { background: var(--white); color: var(--black); }

.btn:disabled { background: var(--panel-soft); color: var(--faint); cursor: default; }

.tag {
  flex: none;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.16);
  color: var(--dim);
  font: 600 0.72rem var(--font);
  letter-spacing: 0.02em;
  text-transform: none;
}

.icon-button {
  flex: none;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--panel-soft);
  color: var(--white);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.icon-button:hover { background: var(--white); color: var(--black); }

/* ---------- Menu (estilo menu de pausa) ---------- */

.menu-header, .menu-body, .credits {
  position: relative;
  width: min(1120px, calc(100% - 48px));
  margin-left: auto;
  margin-right: auto;
}

.menu-header {
  flex: none;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: clamp(24px, 7vh, 72px) 0 18px;
}

.wordmark {
  font: italic 800 clamp(2.6rem, 6vw, 4.6rem) / 0.95 var(--display);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  text-shadow: var(--hud-shadow);
}

.tagline {
  margin-top: 6px;
  font: italic 700 clamp(1.2rem, 2.2vw, 1.7rem) var(--display);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--dim);
  text-shadow: var(--hud-shadow);
}

.menu-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }

.lang-select {
  height: 36px;
  padding: 0 10px;
  border: none;
  border-radius: 0;
  background: var(--panel);
  color: var(--white);
  font: 500 0.95rem var(--font);
  cursor: pointer;
}

.lang-select option { background: #111111; color: var(--white); }

.best-score {
  min-height: 1.2em;
  font: 700 1.7rem var(--display);
  color: var(--cash);
  text-shadow: var(--hud-shadow);
  font-variant-numeric: tabular-nums;
}

.menu-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 400px) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 2px;
  align-content: start;
}

.menu-strip {
  grid-column: 1 / -1;
  padding: 10px 16px;
  background: var(--panel);
  border-top: 3px solid var(--pink);
  font: 700 1.05rem var(--display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.menu-actions { display: flex; flex-direction: column; gap: 2px; }

.menu-actions .btn {
  justify-content: space-between;
  min-height: 46px;
  padding: 0 14px 0 16px;
  background: var(--panel);
  color: var(--white);
  font: 500 1.05rem var(--font);
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
}

/* A primeira linha fica selecionada até outra receber foco ou mouse. */
.menu-actions .btn-green,
.menu-actions .btn:hover,
.menu-actions .btn:focus-visible { background: var(--white); color: var(--black); }

.menu-actions:hover .btn-green:not(:hover),
.menu-actions:focus-within .btn-green:not(:focus) { background: var(--panel); color: var(--white); }

.menu-actions .btn:hover .tag,
.menu-actions .btn:focus-visible .tag { background: var(--black); color: var(--white); }

.menu-detail { display: flex; flex-direction: column; gap: 2px; min-height: 0; }

.photo-card {
  position: relative;
  flex: 0 1 auto;
  aspect-ratio: 16 / 9;
  max-height: 48vh;
  overflow: hidden;
  background: var(--panel);
}

.photo-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.photo-card img.shown { opacity: 1; }

.detail-text { padding: 14px 16px 16px; background: var(--panel); }
.detail-text h2 { font: 700 1.35rem var(--display); letter-spacing: 0.04em; text-transform: uppercase; }
.detail-text p { margin-top: 6px; max-width: 60ch; line-height: 1.45; color: var(--dim); }

.credits {
  flex: none;
  padding: 14px 0 18px;
  font-size: 0.74rem;
  font-weight: 400;
  line-height: 1.45;
  color: var(--faint);
}

.credits a { color: var(--dim); }

/* ---------- Partida ---------- */

#screen-game { background: var(--black); }

.lesson-top {
  flex: none;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 58px;
  padding: 0 20px;
  background: var(--black);
}

/* Barra de rodadas em cinco segmentos, como uma barra de vida. */
.progress {
  flex: none;
  width: min(260px, 40vw);
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 calc(20% - 3px), transparent calc(20% - 3px) 20%);
  mask: repeating-linear-gradient(90deg, #000 0 calc(20% - 3px), transparent calc(20% - 3px) 20%);
}

.progress-fill { height: 100%; width: 0; background: var(--cash); transition: width 0.4s ease; }

.score {
  margin-left: auto;
  font: 700 2rem var(--display);
  color: var(--cash);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.stage { position: relative; flex: 1; min-height: 0; }

.scene { position: absolute; inset: 0; overflow: hidden; background: #0c1014; }
.scene img { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene-bg { object-fit: cover; filter: blur(30px) brightness(0.5); transform: scale(1.12); }
.scene-img { object-fit: contain; }

.help-box {
  position: absolute;
  top: 18px;
  left: 20px;
  z-index: 4;
  max-width: min(320px, calc(100% - 40px));
  padding: 10px 14px;
  background: var(--panel);
  font-size: 0.95rem;
  line-height: 1.4;
}

.lesson-bottom {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 104px;
  padding: 18px 20px;
  background: var(--black);
}

.prompt h2 { font: italic 700 1.9rem / 1 var(--display); text-transform: uppercase; letter-spacing: 0.02em; }
.prompt p { margin-top: 6px; color: var(--dim); }

.lesson-bottom .btn { flex: none; min-width: 230px; min-height: 58px; font-size: 1.3rem; }

.feedback, #btn-next-round { display: none; }

/* ---------- Radar ---------- */

.guess-dock {
  position: absolute;
  left: 20px;
  bottom: 20px;
  z-index: 5;
  width: 300px;
  opacity: 0.94;
  transition: width 0.18s ease, opacity 0.18s ease;
}

.guess-dock .map-wrap { height: 200px; transition: height 0.18s ease; }

.guess-dock.expanded { width: min(62%, 860px); opacity: 1; }
.guess-dock.expanded .map-wrap { height: min(calc(100dvh - 230px), 620px); }

.dock-cover, .dock-close { display: none; }

.map-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 2px solid var(--black);
  background: #2f90b0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22), 0 8px 24px rgba(0, 0, 0, 0.5);
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.map-inner { position: absolute; top: 0; left: 0; transform-origin: 0 0; will-change: transform; }
.map-inner img { width: 100%; height: 100%; display: block; pointer-events: none; }

.map-pins { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.map-pins text {
  fill: var(--white);
  font: 600 14px var(--font);
  paint-order: stroke;
  stroke: var(--black);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.pin-guess circle { fill: var(--blip); stroke: var(--black); stroke-width: 3; }
.pin-actual circle { fill: var(--gold); stroke: var(--black); stroke-width: 3; }
.pin-line-under { stroke: var(--black); stroke-width: 7; stroke-linecap: round; }
.pin-line { stroke: var(--gold); stroke-width: 3.5; stroke-linecap: round; }

.map-zoom { position: absolute; top: 10px; right: 10px; display: none; flex-direction: column; gap: 2px; }
.expanded .map-zoom, .revealed .map-zoom { display: flex; }

.map-zoom button {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--panel);
  color: var(--white);
  font-size: 1.25rem;
  cursor: pointer;
}

.map-zoom button:hover { background: var(--white); color: var(--black); }

/* ---------- Resultado da rodada ---------- */

.revealed .guess-dock { inset: 0; width: 100%; opacity: 1; transition: none; }

.revealed .guess-dock .map-wrap {
  height: 100%;
  border: none;
  box-shadow: none;
  cursor: grab;
  transition: none;
}

#screen-game.revealed .dock-cover, #screen-game.revealed .dock-close,
.revealed .help-box, .revealed .prompt, .revealed #btn-confirm-guess { display: none; }

.revealed .feedback { display: flex; align-items: center; gap: 18px; flex: 1; min-width: 0; }
.revealed #btn-next-round { display: inline-flex; }

.revealed .feedback-text h2 { animation: stamp 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }

@keyframes stamp {
  from { transform: scale(1.5); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.result-thumb { flex: none; width: 128px; aspect-ratio: 16 / 9; object-fit: cover; border: 2px solid var(--white); }

.feedback-text { flex: 1; min-width: 0; }

.feedback-text h2 {
  transform-origin: left center;
  font: italic 800 2.3rem / 1 var(--display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.lesson-bottom.good .feedback-text h2 { color: var(--gold); }
.lesson-bottom.bad .feedback-text h2 { color: var(--red); }

.feedback-text p { margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#result-distance { color: var(--dim); }

.feedback-points { flex: none; font: 700 2.5rem var(--display); color: var(--cash); font-variant-numeric: tabular-nums; }
.lesson-bottom.bad .feedback-points { color: var(--white); }

/* ---------- Fim de partida ---------- */

.final-panel {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  width: min(720px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(24px, 7vh, 64px) 0 24px;
}

.final-title {
  font: italic 800 clamp(2.6rem, 7vw, 4.4rem) / 0.95 var(--display);
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: var(--hud-shadow);
}

.final-verdict { margin-top: 10px; font-size: 1.15rem; text-shadow: var(--hud-shadow); }

.stats { display: flex; flex-direction: column; gap: 2px; margin-top: 26px; }

.stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: var(--panel);
}

.stat-head { color: var(--dim); }
.stat-body { font: 700 1.5rem var(--display); font-variant-numeric: tabular-nums; }
.stat-yellow { border-top: 3px solid var(--pink); padding-top: 12px; }
.stat-yellow .stat-head { color: var(--white); }
.stat-yellow .stat-body { font-size: 2.4rem; color: var(--cash); }

.final-record { margin-top: 12px; min-height: 1.4em; color: var(--dim); text-shadow: var(--hud-shadow); }
.final-record.is-record { color: var(--gold); font-weight: 600; }

.round-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }

.round-list li { display: flex; align-items: center; gap: 14px; padding: 6px 16px 6px 6px; background: var(--panel); }

.round-list img { flex: none; width: 92px; aspect-ratio: 16 / 9; object-fit: cover; }
.round-list .info { flex: 1; min-width: 0; }
.round-list .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.round-list .dist { font-size: 0.9rem; color: var(--dim); }
.round-list .pts { flex: none; font: 700 1.35rem var(--display); color: var(--cash); font-variant-numeric: tabular-nums; }

.final-bottom {
  position: relative;
  flex: none;
  display: flex;
  justify-content: flex-end;
  gap: 2px;
  padding: 18px 20px;
  background: var(--black);
}

.final-bottom .btn { min-width: 210px; }

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.7);
}

.modal-overlay.open { display: flex; }

.modal { width: min(440px, 100%); padding: 22px 24px 24px; background: #0b0b0b; border-top: 3px solid var(--pink); }
.modal h3 { font: 700 1.6rem var(--display); letter-spacing: 0.04em; text-transform: uppercase; }
.modal p { margin: 10px 0 22px; line-height: 1.5; color: var(--dim); }
.modal .btn { width: 100%; }

/* ---------- Telas pequenas e toque ---------- */

@media (hover: none), (max-width: 760px) {
  .guess-dock { left: 12px; bottom: 12px; width: 170px; }
  .guess-dock .map-wrap { height: 118px; }

  .guess-dock:not(.expanded) .dock-cover {
    display: block;
    position: absolute;
    inset: 0;
    border: none;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0) 65%);
    color: var(--white);
    font: 700 1.05rem var(--display);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding-top: 74px;
    cursor: pointer;
  }

  .guess-dock.expanded { left: 0; right: 0; bottom: 0; top: 0; width: auto; }
  .guess-dock.expanded .map-wrap { height: 100%; border: none; }

  .guess-dock.expanded .dock-close {
    display: block;
    position: absolute;
    top: 10px;
    left: 10px;
    width: 40px;
    height: 36px;
    border: none;
    background: var(--panel);
    color: var(--white);
    font-size: 1rem;
    cursor: pointer;
  }
}

@media (max-width: 760px) {
  .menu-header { flex-direction: column; align-items: flex-start; gap: 10px; padding-top: 22px; }
  .menu-side { flex-direction: row-reverse; align-items: center; gap: 14px; }
  .menu-body { grid-template-columns: 1fr; grid-template-rows: auto auto minmax(0, 1fr); overflow-y: auto; }
  .photo-card { max-height: 30vh; }
  .credits { font-size: 0.66rem; }

  .help-box { top: 10px; left: 12px; font-size: 0.85rem; }
  .lesson-bottom { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 16px 18px; }
  .lesson-bottom .btn { width: 100%; }
  .prompt h2 { font-size: 1.5rem; }
  .result-thumb { width: 84px; }
  .feedback-text h2 { font-size: 1.6rem; }
  .feedback-points { font-size: 1.7rem; }

  .final-bottom { flex-direction: column-reverse; padding: 14px 16px 18px; }
  .final-bottom .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
