/* CityQuiz — dark two-panel layout: photo left, form right. */

:root {
  --bg-0: #070b14;
  --bg-1: #0c1526;
  --panel: #101b31;
  --panel-2: #0b1424;
  --line: #22335380;
  --text: #e9eefc;
  --muted: #8fa3c8;
  --accent: #4cc2ff;
  --accent-ink: #05263a;
  --good: #3ddc97;
  --bad: #ff6b6b;
  --radius: 18px;
}

* { box-sizing: border-box; }

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

body {
  background:
    radial-gradient(1100px 700px at 85% -10%, #14305566, transparent 60%),
    radial-gradient(900px 600px at -10% 110%, #0e3a4d55, transparent 55%),
    var(--bg-0);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.noscript {
  padding: 16px;
  text-align: center;
  color: var(--bad);
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px clamp(12px, 3vw, 28px) 24px;
}

/* ---- Top bar ---- */

.topbar {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  padding: 6px 4px 14px;
}

.brand {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.brand-globe { margin-right: 2px; }

.tagline {
  color: var(--muted);
  font-size: 14px;
}

.hud {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.hud-chip {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--muted);
}

.hud-chip strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
}

#score.good { color: var(--good); }
#score.bad  { color: var(--bad); }

/* ---- Board: photo left, form right ---- */

.board {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  gap: 18px;
  align-items: stretch;
}

.photo-panel {
  position: relative;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 460px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(600px 400px at 50% 30%, #16233f, var(--panel-2));
}

.photo-panel img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.45s ease;
}

.photo-panel img.visible { opacity: 1; }

/* dim + focus the photo once the answer is revealed */
.photo-panel img.revealed {
  opacity: 0.82;
}

.reveal {
  position: absolute;
  left: 14px;
  top: 14px;
  display: flex;
  flex-direction: column;
  padding: 10px 16px;
  border-radius: 12px;
  background: #0a1220e6;
  border: 1px solid var(--line);
  animation: pop 0.25s ease;
}

.reveal.good { border-color: var(--good); }
.reveal.bad  { border-color: var(--bad); }

.reveal-name {
  font-size: 20px;
  font-weight: 800;
}

.reveal-country {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

@keyframes pop {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.credit {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--muted);
  background: linear-gradient(transparent, #070b14cc);
}

.credit a {
  color: var(--accent);
  text-decoration: none;
}

.credit a:hover { text-decoration: underline; }

.skip {
  position: absolute;
  left: 50%;
  bottom: 44px;
  transform: translateX(-50%);
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text);
  background: #0a1220e6;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.skip:hover { border-color: var(--accent); }

/* ---- Right panel ---- */

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 20px;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 14px;
  color: var(--muted);
}

#q-count {
  color: var(--text);
  font-weight: 700;
}

.progress-hint { font-size: 12px; }

.bar {
  height: 8px;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  overflow: hidden;
}

.bar > div {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #7dffb2);
  transition: width 0.35s ease;
}

.guess-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.guess-form label {
  font-size: 15px;
  font-weight: 700;
}

#guess {
  width: 100%;
  padding: 13px 14px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#guess:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #4cc2ff26;
}

#guess:disabled { opacity: 0.55; }

.btn {
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
}

.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(180deg, #56c8ff, #2ea3e6);
  border-color: #2ea3e6;
  color: var(--accent-ink);
}

.feedback {
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 15px;
  color: var(--muted);
}

.feedback.good {
  color: var(--good);
  border-color: #3ddc9755;
  background: #3ddc9712;
}

.feedback.bad {
  color: var(--bad);
  border-color: #ff6b6b55;
  background: #ff6b6b12;
}

.tip {
  margin-top: auto;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---- Screens (loading / results) ---- */

.screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-card, .results-card {
  width: min(680px, 100%);
  text-align: center;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.loading-card h2, .results-card h2 { margin: 8px 0 4px; }

.loading-status { color: var(--muted); margin: 6px 0 2px; }

.loading-count {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin: 0 0 14px;
}

.loading-bar {
  height: 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  overflow: hidden;
}

.loading-fill {
  height: 100%;
  width: 40%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #7dffb2);
}

.indeterminate { animation: sweep 1.2s ease-in-out infinite alternate; }

@keyframes sweep {
  from { margin-left: 0; }
  to   { margin-left: 60%; }
}

.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 10px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Results ---- */

.results-emoji { font-size: 44px; }

.results-score {
  font-size: 52px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.results-score-label {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.results-record {
  margin-top: 8px;
  color: #ffd166;
  font-weight: 700;
}

.recap {
  list-style: none;
  margin: 22px 0;
  padding: 0;
  text-align: left;
  max-height: 260px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.recap-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.recap-place { flex: 1; font-weight: 600; }

.recap-answer {
  color: var(--muted);
  font-style: italic;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recap-mark { width: 18px; text-align: center; font-weight: 800; }
.recap-mark.good { color: var(--good); }
.recap-mark.bad  { color: var(--bad); }
.recap-mark.skip { color: var(--muted); }

.results-card .btn-primary { margin-top: 4px; min-width: 200px; }

/* ---- Responsive ---- */

@media (max-width: 920px) {
  .board {
    grid-template-columns: 1fr;
  }

  .photo-panel {
    min-height: 42vh;
  }

  .hud { margin-left: 0; }
}
