:root {
  --navy: #17365d;
  --navy-dark: #0d2746;
  --gold: #d7a928;
  --cream: #fffaf0;
  --paper: #ffffff;
  --ink: #1e2a38;
  --muted: #667281;
  --line: #dce3ea;
  --success: #26734d;
  --law: #7e57c2;
  --history: #3d8b5a;
  --poetry: #d99a24;
  --prophets: #b84b4b;
  --gospels: #6b55a3;
  --letters: #3478b8;
  --prophecy: #c49b18;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(215, 169, 40, .15), transparent 28rem),
    linear-gradient(135deg, #edf3f8, #fffaf0);
}

button, a { font: inherit; }
button { cursor: pointer; }

.game-shell {
  width: min(980px, calc(100% - 28px));
  margin: 24px auto;
  padding: 24px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(23,54,93,.14);
  border-radius: 24px;
  box-shadow: 0 18px 50px rgba(13,39,70,.13);
}

.home-link {
  display: inline-block;
  color: var(--navy);
  font-weight: 800;
  letter-spacing: .1em;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.home-link:hover, .home-link:focus-visible { border-color: var(--gold); }

.game-header { text-align: center; padding: 12px 8px 18px; }
.eyebrow { margin: 0; color: var(--gold); font-weight: 800; letter-spacing: .16em; }
h1 { margin: 8px 0; color: var(--navy); font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1.05; }
.instructions { margin: 0; color: var(--muted); font-size: 1.05rem; }

.control-panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 20px;
  padding: 16px;
  background: #f5f8fb;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.mode-controls, .action-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

.mode-btn, .secondary-btn {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 700;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.mode-btn { color: var(--navy); background: white; border: 2px solid var(--navy); }
.mode-btn.active { color: white; background: var(--navy); box-shadow: 0 4px 12px rgba(23,54,93,.25); }
.secondary-btn { color: var(--ink); background: white; border: 1px solid #aeb9c5; }
.mode-btn:hover, .secondary-btn:hover { transform: translateY(-1px); }
button:focus-visible, a:focus-visible { outline: 3px solid rgba(215,169,40,.55); outline-offset: 3px; }

.game-card {
  position: relative;
  overflow: hidden;
  margin-top: 20px;
  min-height: 430px;
  padding: clamp(24px, 5vw, 48px);
  text-align: center;
  background: var(--cream);
  border: 3px solid var(--navy);
  border-radius: 22px;
}
.game-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 8px;
  background: var(--category-color, var(--law));
}
.status-row { display: flex; justify-content: space-between; gap: 10px; }
.status-pill { padding: 7px 12px; color: white; background: var(--navy); border-radius: 999px; font-size: .9rem; font-weight: 700; }
.testament-pill { background: var(--category-color, var(--law)); }
.prompt-label { margin: 40px 0 8px; color: var(--muted); font-size: clamp(1.1rem, 2.5vw, 1.45rem); }
.current-book { color: var(--navy-dark); font-size: clamp(3rem, 9vw, 6.6rem); font-weight: 800; line-height: 1; text-wrap: balance; }

.countdown-area { max-width: 620px; margin: 34px auto 12px; }
.countdown-track, .progress-track { overflow: hidden; background: #dfe6ed; border-radius: 999px; }
.countdown-track { height: 14px; }
.countdown-bar { width: 100%; height: 100%; background: var(--gold); transform-origin: left; }
.countdown-text { margin: 8px 0 0; color: var(--muted); font-weight: 700; }

.answer-panel { margin-top: 26px; padding-top: 22px; border-top: 2px dashed rgba(23,54,93,.25); animation: answerIn .45s ease both; }
.answer-label { margin: 0 0 5px; color: var(--success); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.next-book { color: var(--success); font-size: clamp(2.5rem, 7vw, 5rem); font-weight: 800; line-height: 1.05; }
@keyframes answerIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.progress-panel { margin-top: 18px; padding: 14px 4px; }
.progress-copy { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-weight: 700; }
.progress-track { height: 9px; }
.progress-bar { height: 100%; width: 1.5%; background: var(--navy); transition: width .3s ease; }

.legend { margin-top: 10px; padding: 18px; border-top: 1px solid var(--line); }
.legend h2 { margin: 0 0 12px; text-align: center; color: var(--navy); font-size: 1.1rem; }
.legend-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 18px; color: var(--muted); font-size: .92rem; }
.legend-grid span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 11px; height: 11px; border-radius: 50%; }
.law { background: var(--law); } .history { background: var(--history); } .poetry { background: var(--poetry); }
.prophets { background: var(--prophets); } .gospels { background: var(--gospels); } .letters { background: var(--letters); }
.prophecy { background: var(--prophecy); }

@media (max-width: 620px) {
  .game-shell { width: min(100% - 14px, 980px); margin: 7px auto; padding: 15px; border-radius: 16px; }
  .status-row { align-items: center; }
  .status-pill { font-size: .78rem; }
  .game-card { min-height: 400px; }
  .mode-btn, .secondary-btn { flex: 1 1 145px; }
}

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