:root {
  --bg: #0b0e14;
  --panel: #12161f;
  --ink: #e6edf7;
  --muted: #8b9bb4;
  --accent: #7dd3fc;
  --accent2: #c4b5fd;
  --gold: #fcd34d;
  --line: #1e2633;
  --glow: rgba(125, 211, 252, 0.35);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #152033 0%, var(--bg) 55%);
  color: var(--ink);
  min-height: 100vh;
}

.cabinet {
  max-width: 820px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

header {
  text-align: center;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.5rem;
}

h1 {
  font-weight: 600;
  font-size: 2.1rem;
  letter-spacing: 0.04em;
  margin: 0 0 0.4rem;
  background: linear-gradient(90deg, var(--accent), var(--accent2), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  color: var(--muted);
  margin: 0.25rem 0;
  font-size: 1.05rem;
}

.byline {
  color: var(--muted);
  font-size: 0.85rem;
  opacity: 0.8;
  margin: 0.5rem 0 0;
}

h2 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem 1.35rem 1.4rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.02), 0 12px 40px rgba(0,0,0,0.35);
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 0.9rem;
}

#orbit {
  display: block;
  width: 100%;
  height: auto;
  max-width: 720px;
  background: #070a10;
  border-radius: 10px;
  border: 1px solid #1a2230;
  cursor: crosshair;
  touch-action: none;
}

#ripple {
  display: block;
  width: 100%;
  height: auto;
  max-width: 720px;
  background: #070a10;
  border-radius: 10px;
  border: 1px solid #1a2230;
  cursor: crosshair;
  touch-action: none;
}

.toy-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-top: 0.85rem;
}

button {
  font: inherit;
  font-size: 0.9rem;
  background: #1a2333;
  color: var(--ink);
  border: 1px solid #2a3548;
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

button:hover {
  background: #243044;
  border-color: var(--accent);
}

button:active { transform: scale(0.97); }

.stats {
  color: var(--muted);
  font-size: 0.85rem;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.theory-shelf {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.theory-card {
  background: #0e131c;
  border-left: 3px solid var(--accent2);
  border-radius: 0 10px 10px 0;
  padding: 0.85rem 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.theory-card:hover {
  border-left-color: var(--gold);
  box-shadow: 0 0 24px var(--glow);
}

.theory-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  color: var(--gold);
  font-weight: 600;
}

.theory-card p {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
  font-size: 0.95rem;
}

.theory-card .crumb {
  display: block;
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-style: italic;
}

.wonder-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.wonder-list li {
  position: relative;
  padding: 0.55rem 0.75rem 0.55rem 1.4rem;
  border-bottom: 1px solid var(--line);
  line-height: 1.4;
  color: var(--ink);
}

.wonder-list li:last-child { border-bottom: none; }

.wonder-list li::before {
  content: "✦";
  position: absolute;
  left: 0.15rem;
  color: var(--accent);
  font-size: 0.75rem;
  top: 0.7rem;
}

/* Soft Die */
.die-stage {
  display: flex;
  justify-content: center;
  padding: 1.1rem 0.5rem 0.4rem;
  cursor: pointer;
}
.die-face {
  width: min(100%, 420px);
  min-height: 168px;
  background:
    radial-gradient(ellipse at 28% 18%, rgba(252, 211, 77, 0.12), transparent 50%),
    radial-gradient(ellipse at 78% 88%, rgba(125, 211, 252, 0.10), transparent 55%),
    linear-gradient(155deg, #161b27 0%, #0f131c 100%);
  border: 1px solid rgba(252, 211, 77, 0.28);
  border-radius: 18px;
  padding: 1.35rem 1.5rem 1.25rem;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.03),
    0 14px 36px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.04);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, filter 0.2s ease;
  position: relative;
  overflow: hidden;
}
.die-stage:hover .die-face,
.die-stage:focus-visible .die-face {
  border-color: rgba(252, 211, 77, 0.55);
  box-shadow:
    0 0 0 1px rgba(252, 211, 77, 0.12),
    0 16px 44px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,255,255,0.05);
  outline: none;
}
.die-face.is-tumbling {
  transform: rotate(-8deg) scale(0.97);
  filter: blur(1.2px) brightness(1.08);
  border-color: rgba(196, 181, 253, 0.55);
}
.die-face.is-landing {
  transform: rotate(0deg) scale(1.02);
  filter: none;
  border-color: rgba(125, 211, 252, 0.55);
  box-shadow:
    0 0 0 1px rgba(125, 211, 252, 0.18),
    0 0 28px rgba(125, 211, 252, 0.18),
    0 16px 44px rgba(0,0,0,0.45);
}
.die-pips {
  display: grid;
  grid-template-columns: repeat(3, 10px);
  grid-template-rows: repeat(3, 10px);
  gap: 6px;
  margin-bottom: 0.85rem;
  opacity: 0.9;
}
.die-pips .pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(252, 211, 77, 0.45);
  opacity: 0.15;
}
.die-pips .pip.on {
  opacity: 1;
}
.die-name {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.45rem;
  font-weight: 600;
}
.die-line {
  margin: 0 0 0.85rem;
  font-size: 1.12rem;
  line-height: 1.45;
  color: #e8eef8;
  font-weight: 500;
}
.die-crumb {
  display: inline-block;
  font-size: 0.78rem;
  font-style: italic;
  color: rgba(167, 176, 196, 0.85);
}
.die-face.is-tumbling .die-line,
.die-face.is-tumbling .die-name {
  opacity: 0.55;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 2rem;
  line-height: 1.5;
}

footer a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

footer a:hover { border-bottom-color: var(--accent); }

@media (max-width: 560px) {
  h1 { font-size: 1.65rem; }
  .cabinet { padding: 1.5rem 0.85rem 3rem; }
}

/* Reverse Oracle */
.oracle-stage {
  background: linear-gradient(160deg, rgba(12, 18, 32, 0.95), rgba(18, 12, 28, 0.9));
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: 14px;
  padding: 2.2rem 1.6rem 1.6rem;
  min-height: 140px;
  cursor: pointer;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
  position: relative;
  overflow: hidden;
}
.oracle-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(196, 181, 253, 0.08), transparent 55%),
              radial-gradient(ellipse at 80% 90%, rgba(125, 211, 252, 0.07), transparent 50%);
  pointer-events: none;
}
.oracle-stage:hover,
.oracle-stage:focus-visible {
  border-color: rgba(196, 181, 253, 0.45);
  box-shadow: 0 0 0 1px rgba(196, 181, 253, 0.12), 0 12px 40px rgba(0, 0, 0, 0.35);
  outline: none;
}
.oracle-stage:active {
  transform: scale(0.995);
}
.oracle-q {
  position: relative;
  margin: 0 0 1.1rem;
  font-size: 1.22rem;
  line-height: 1.45;
  color: #e8eef8;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.oracle-q.is-leaving {
  opacity: 0;
  transform: translateY(-6px);
}
.oracle-q.is-entering {
  opacity: 0;
  transform: translateY(8px);
}
.oracle-crumb {
  position: relative;
  display: inline-block;
  font-size: 0.78rem;
  font-style: italic;
  color: rgba(167, 176, 196, 0.85);
  letter-spacing: 0.02em;
}

/* ---------- True & Not Helpful ---------- */
.true-stage {
  margin: 0.9rem 0 0.35rem;
  padding: 1.4rem 1.5rem 1.2rem;
  border-radius: 16px;
  background:
    radial-gradient(ellipse at 18% 12%, rgba(196, 181, 253, 0.10), transparent 52%),
    radial-gradient(ellipse at 88% 90%, rgba(125, 211, 252, 0.08), transparent 55%),
    linear-gradient(160deg, #141924 0%, #0e121a 100%);
  border: 1px solid rgba(167, 139, 250, 0.28);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.03),
    0 12px 32px rgba(0,0,0,0.38),
    inset 0 1px 0 rgba(255,255,255,0.04);
  cursor: pointer;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease, filter 0.2s ease;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.true-stage:hover,
.true-stage:focus-visible {
  border-color: rgba(196, 181, 253, 0.55);
  box-shadow:
    0 0 0 1px rgba(196, 181, 253, 0.12),
    0 14px 40px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,255,255,0.05);
  outline: none;
}
.true-stage.is-leaving {
  opacity: 0.35;
  transform: translateY(4px);
  filter: blur(0.6px);
}
.true-stage.is-entering {
  animation: trueIn 280ms ease forwards;
}
@keyframes trueIn {
  from { opacity: 0.2; transform: translateY(-6px); filter: blur(1px); }
  to   { opacity: 1;   transform: translateY(0);    filter: none; }
}
.true-line {
  margin: 0 0 0.85rem;
  font-size: 1.18rem;
  line-height: 1.5;
  color: #e8eef8;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.true-crumb {
  display: inline-block;
  font-size: 0.78rem;
  font-style: italic;
  color: rgba(196, 181, 253, 0.85);
}


/* ---------- The Gap That Stays ---------- */
#gap {
  display: block;
  width: 100%;
  height: auto;
  max-width: 720px;
  background: #070a10;
  border-radius: 10px;
  border: 1px solid #1a2230;
  cursor: default;
  touch-action: none;
}
#gap-stats {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
  min-width: 12rem;
}
