:root {
  --bg: #0b0b0a;
  --bg-alt: #141311;
  --ink: #f4f1e8;
  --ink-soft: #b9b3a3;
  --card: #1d1b17;
  --border: #33291a;
  --accent: #f4c518;
  --accent-ink: #0b0b0a;
  --gold: #d9ad1c;
  --good: #62c98a;
  --good-bg: #16241c;
  --bad: #e07a72;
  --bad-bg: #2a1a17;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --radius: 14px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Georgia", "Iowan Old Style", "Palatino Linotype", serif;
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.brand {
  flex: 0 0 auto;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-pill {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}

.streak {
  color: var(--gold);
  font-weight: 700;
}

@media (max-width: 480px) {
  .topbar { padding: 10px 12px; gap: 10px; }
  .brand { font-size: 1.05rem; gap: 5px; }
  .progress-row { gap: 6px; min-width: 26px; }
  .progress-text { display: none; }
  .score-pill { font-size: 0.85rem; padding: 5px 10px; gap: 6px; }
}

main {
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 18px 16px;
  min-height: 0;
}

.screen {
  width: 100%;
  max-width: 760px;
}

#screen-quiz {
  max-width: 980px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ---- Start / End card ---- */

.start-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
  text-align: center;
}

.start-card h1 {
  margin: 0 0 12px;
  font-size: 2rem;
}

.lead {
  color: var(--ink-soft);
  line-height: 1.55;
  max-width: 46ch;
  margin: 0 auto 26px;
}

.option-group {
  margin-bottom: 22px;
  text-align: left;
}

.option-label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

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

.chip {
  font-family: inherit;
  font-size: 0.92rem;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.chip:hover { border-color: var(--gold); }

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn-primary {
  font-family: inherit;
  font-size: 1.05rem;
  padding: 13px 34px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(244, 197, 24, 0.28);
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(244, 197, 24, 0.35); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.btn-secondary:hover { border-color: var(--gold); }

.best-score {
  margin-top: 18px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* ---- Quiz screen ---- */

/* Lives in the topbar, next to the brand and score pill, so the quiz
   screen itself only holds the painting and the answer panel. */
.progress-row {
  flex: 1 1 auto;
  min-width: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

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

.progress-text {
  font-size: 0.85rem;
  color: var(--ink-soft);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.painting-frame {
  position: relative;
  background: #100d0a;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Grow to fill whatever vertical space is left in the browser window;
     the fixed min-height (not the painting's own aspect ratio) is what
     keeps the frame - and everything below it - from reflowing between
     questions. */
  flex: 1 1 0;
  min-height: 220px;
  margin-bottom: 14px;
  border: 10px solid var(--bg-alt);
  outline: 1px solid var(--border);
}

.painting-frame img {
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  display: block;
  object-fit: contain;
  background: #100d0a;
}

.img-loading {
  position: absolute;
  color: #cfc3ad;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

.answer-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  align-items: stretch;
  gap: 22px;
}

.options {
  flex: 0 1 460px;
  align-content: start;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Below this width there isn't room for options + reveal side by side;
   stack the reveal panel underneath instead (see .reveal media query below). */
@media (max-width: 760px) {
  .answer-panel { flex-direction: column; }
  .options { flex-basis: auto; }
}

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

.option-btn {
  font-family: inherit;
  font-size: 1rem;
  text-align: left;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color 0.12s, background 0.12s;
}

.option-btn .key {
  font-size: 0.75rem;
  color: var(--ink-soft);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  font-variant-numeric: tabular-nums;
}

.option-btn:hover:not(:disabled) { border-color: var(--gold); }
.option-btn:disabled { cursor: default; }

.option-btn.correct {
  background: var(--good-bg);
  border-color: var(--good);
  color: var(--good);
  font-weight: 700;
}

.option-btn.wrong {
  background: var(--bad-bg);
  border-color: var(--bad);
  color: var(--bad);
}

.option-btn.dim { opacity: 0.55; }

.reveal {
  flex: 1 1 260px;
  min-width: 220px;
  padding-left: 22px;
  border-left: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
}

@media (max-width: 760px) {
  .reveal {
    flex-basis: auto;
    min-width: 0;
    margin-top: 18px;
    padding-left: 0;
    padding-top: 16px;
    border-left: none;
    border-top: 1px dashed var(--border);
    text-align: center;
  }
}

.reveal-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  text-align: left;
}

@media (max-width: 760px) {
  .reveal-head { justify-content: center; }
}

.reveal-icon { font-size: 1.8rem; }

.reveal-artist {
  font-size: 1.3rem;
  font-weight: 700;
}

.reveal-title {
  font-style: italic;
  color: var(--ink-soft);
}

.reveal-meta {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 2px;
}

/* ---- End screen ---- */

.final-score {
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.missed-list {
  text-align: left;
  margin: 18px 0;
  max-height: 260px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.missed-list:empty { display: none; }

.missed-item {
  display: flex;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
  align-items: center;
}

.missed-item img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--border);
}

.missed-item .missed-text b { color: var(--accent); }
.missed-item .missed-text .missed-your { color: var(--ink-soft); font-size: 0.85rem; }

.end-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.site-footer {
  text-align: center;
  font-size: 0.78rem;
  color: var(--ink-soft);
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}
