:root {
  --bg: #090909;
  --panel: rgba(17, 17, 17, 0.88);
  --panel-2: rgba(29, 24, 18, 0.92);
  --gold: #d5a72f;
  --gold-light: #f0cf71;
  --text: #f4efe5;
  --muted: #cfc5b6;
  --line: rgba(213, 167, 47, 0.32);
  --danger: #7b3f1b;
  --shadow: rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 18%, rgba(213, 167, 47, 0.08), transparent 28rem),
    radial-gradient(circle at 78% 58%, rgba(213, 167, 47, 0.06), transparent 34rem),
    linear-gradient(rgba(7,7,7,.88), rgba(7,7,7,.9)),
    #0b0b0b;
}

/* Fix Georgia zero rendering for TDG labels only */
.zero-fix {
  font-family: Arial, Helvetica, sans-serif !important;
}
/* Force proper baseline numerals */
h1,
h2,
h3,
button,
.result-box,
.info-panel,
.flip-hint,
.subtitle,
.copy {
  font-variant-numeric: lining-nums !important;
  font-feature-settings: "lnum" 1 !important;
}
.instruction-box ol {
  display: inline-block;
  text-align: left;
  margin: 0 auto;
  padding-left: 1.5rem;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.11;
  background-image:
    repeating-linear-gradient(8deg, transparent 0 22px, rgba(255,255,255,.05) 23px, transparent 24px),
    repeating-linear-gradient(95deg, transparent 0 54px, rgba(255,255,255,.035) 55px, transparent 56px);
  mix-blend-mode: screen;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(0,0,0,.92);
  border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 8px 22px rgba(0,0,0,.35);
}

.top-nav {
  width: min(1120px, 94vw);
  margin: 0 auto;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(0.8rem, 2vw, 1.6rem);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: .95rem;
}

.top-nav a {
  color: #fff;
  text-decoration: none;
}

.top-nav a:hover, .top-nav a:focus { color: var(--gold-light); }

.app {
  width: min(1180px, 94vw);
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 3rem) 0 2rem;
}

.screen {
  display: grid;
  gap: 1.25rem;
  justify-items: center;
  text-align: center;
}

.hero {
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(0,0,0,.55), rgba(28,22,14,.72));
  box-shadow: 0 18px 44px var(--shadow);
  width: min(900px, 100%);
}

h1, h2, h3 { margin: 0; color: var(--gold); line-height: 1.15; }

h1 { font-size: clamp(2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.55rem, 3.2vw, 2.45rem); }
h3 { font-size: clamp(1.15rem, 2.2vw, 1.55rem); }

.subtitle {
  color: var(--gold-light);
  font-size: clamp(1.05rem, 2.4vw, 1.45rem);
  max-width: 860px;
  margin: .9rem auto 0;
  line-height: 1.4;
  font-weight: 700;
}

.copy {
  max-width: 780px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 1.05rem;
}

.button-row, .choice-grid, .utility-row, .back-card-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .75rem;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 1fr));
  width: min(920px, 100%);
}

button, .button-link {
  border: 1px solid rgba(240, 207, 113, .45);
  border-radius: 12px;
  padding: .85rem 1rem;
  min-height: 48px;
  background: linear-gradient(180deg, #2f2413, #15100a);
  color: var(--gold-light);
  cursor: pointer;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(0,0,0,.34);
}

button:hover, button:focus, .button-link:hover, .button-link:focus {
  transform: translateY(-1px);
  border-color: var(--gold-light);
  background: linear-gradient(180deg, #493416, #1e160b);
}

.secondary {
  color: var(--text);
  background: linear-gradient(180deg, #202020, #101010);
  border-color: rgba(255,255,255,.18);
}

.card-image {
  display: block;
  max-width: min(100%, 640px);
  max-height: 78vh;
  width: auto;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 18px 44px rgba(0,0,0,.58);
  background: #e5d8c2;
}

.card-image.landscape { max-width: min(100%, 880px); }

.info-panel {
  width: min(880px, 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  padding: 1rem;
  box-shadow: 0 14px 34px var(--shadow);
  text-align: left;
}

.info-panel.center { text-align: center; }

.info-panel p { margin: .35rem 0; line-height: 1.45; }

.result-box {
  width: min(880px, 100%);
  border: 1px solid rgba(240, 207, 113, .55);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(36, 26, 13, .92), rgba(8,8,8,.95));
  padding: clamp(1rem, 2.5vw, 1.5rem);
  box-shadow: 0 18px 44px var(--shadow);
}

.result-text {
  font-size: clamp(1.15rem, 2.5vw, 1.55rem);
  color: var(--gold-light);
  line-height: 1.35;
  font-weight: 700;
}

.die {
  display: inline-grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin: 0 .3rem;
  border: 2px solid var(--gold-light);
  border-radius: .55rem;
  color: #111;
  background: #f4e3b6;
  font-size: 1.8rem;
  font-weight: 700;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.site-footer {
  width: min(1120px, 94vw);
  margin: 0 auto;
  padding: 1.5rem 0 2.2rem;
  color: var(--muted);
  text-align: center;
  font-size: .85rem;
}

.site-footer p { margin: .15rem 0; }

@media (max-width: 760px) {
  .top-nav {
    justify-content: center;
    flex-wrap: wrap;
    padding: .7rem 0;
    gap: .8rem;
    font-size: .82rem;
  }

  .choice-grid { grid-template-columns: 1fr; }

  .card-image { max-height: none; width: min(100%, 560px); }

  .button-row, .utility-row, .back-card-grid { flex-direction: column; width: min(560px, 100%); }

  button, .button-link { width: 100%; }
}

.flip-hint {
  margin: -0.25rem 0 0.25rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.35;
}

.future-note {
  max-width: 900px;
  margin: 1.5rem auto;
  padding: 0 1rem;
  font-size: 0.95rem;
  font-style: italic;
  line-height: 1.5;
  color: #c8b27a;
  opacity: 0.85;
  text-align: center;
}