/* ─── Kat's Calling — Athena palette ─────────────────────────────────────── */
:root {
  --parchment: #f4eedf;
  --parchment-dark: #e6dcc3;
  --ink: #1d1a14;
  --navy: #1f2f4a;
  --navy-dark: #142036;
  --olive: #6b7a3a;
  --gold: #c9a227;
  --terracotta: #b5532f;
  --muted: #6e5f47;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--navy-dark);
  background-image:
    radial-gradient(ellipse at 20% 30%, rgba(201,162,39,0.12) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 80%, rgba(107,122,58,0.18) 0%, transparent 50%);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  font-family: 'Courier Prime', monospace;
}

#game-wrapper { width: 100%; max-width: 680px; }

/* ─── The book page ─────────────────────────────────────────────────────── */
.book-page {
  background: var(--parchment);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
  border: 3px solid var(--navy);
  box-shadow:
    0 0 0 1px var(--gold),
    inset 0 0 60px rgba(180,140,80,0.12),
    6px 6px 0 rgba(0,0,0,0.45),
    12px 12px 0 rgba(0,0,0,0.2);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  transition: opacity 0.2s ease;
}

/* Book spine crease */
.book-page::before {
  content: '';
  position: absolute;
  left: 44px; top: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, transparent, rgba(90,60,20,0.18) 20%, rgba(90,60,20,0.22) 50%, rgba(90,60,20,0.18) 80%, transparent);
  pointer-events: none;
  z-index: 5;
}

/* ─── Header ────────────────────────────────────────────────────────────── */
.cyoa-header {
  background: linear-gradient(to bottom, var(--navy), var(--navy-dark));
  border-bottom: 3px solid var(--gold);
  padding: 10px 48px;
  text-align: center;
  position: relative;
}
.cyoa-header h1 {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  color: var(--gold);
  font-size: 1.15rem;
  letter-spacing: 0.14em;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
}
.owl-mark { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 1.2rem; }
.page-number {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  font-family: 'Cinzel', serif; color: rgba(255,255,255,0.75); font-size: 1rem;
}

/* ─── Scene image ───────────────────────────────────────────────────────── */
.scene-frame { border-bottom: 3px solid var(--navy); background: var(--terracotta); }
.scene-image { width: 100%; display: block; aspect-ratio: 3 / 2; object-fit: cover; }

/* ─── Athena's favour bar ───────────────────────────────────────────────── */
.favour-bar {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 6px 24px 6px 60px;
  font-size: 0.78rem; color: var(--muted);
  border-bottom: 1px dashed rgba(31,47,74,0.25);
  background: rgba(201,162,39,0.08);
}
.favour-bar strong { color: var(--navy); }

/* ─── Story text ────────────────────────────────────────────────────────── */
.story-area { padding: 24px 28px 18px 64px; }

.story-text {
  font-family: 'Special Elite', serif;
  font-size: 1rem;
  line-height: 1.8;
  color: var(--ink);
  margin-bottom: 14px;
}

/* The team as a Greek chorus */
.chorus {
  font-family: 'Courier Prime', monospace;
  font-style: italic;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--olive);
  margin: 4px 0 16px;
  padding: 8px 12px;
  border-left: 3px solid var(--olive);
  background: rgba(107,122,58,0.07);
}
.chorus::before {
  content: 'THE CHORUS';
  display: block;
  font-family: 'Cinzel', serif;
  font-style: normal;
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  color: var(--olive);
  margin-bottom: 2px;
}

/* A god speaks / a scroll is read */
.scroll {
  font-family: 'Cinzel', serif;
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--navy);
  background: var(--parchment-dark);
  border: 2px solid var(--gold);
  border-radius: 2px;
  padding: 14px 18px;
  margin: 6px 0 18px;
  box-shadow: inset 0 0 20px rgba(201,162,39,0.18);
}
.scroll .sig { display: block; text-align: right; margin-top: 8px; font-style: italic; }

/* ─── Choices ───────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--navy) 20%, var(--navy) 80%, transparent);
  margin: 0 28px 0 64px;
  opacity: 0.3;
}
.choices { padding: 16px 28px 28px 64px; display: flex; flex-direction: column; gap: 12px; }

.choice-btn {
  background: none; border: none; cursor: pointer; text-align: left;
  font-family: 'Special Elite', serif; font-size: 0.98rem; line-height: 1.5;
  color: var(--ink);
  padding: 4px 0 4px 30px;
  position: relative;
  transition: color 0.15s;
}
.choice-btn::before {
  content: attr(data-num) '.';
  position: absolute; left: 0;
  font-family: 'Cinzel', serif; font-weight: 900; color: var(--terracotta);
}
.choice-btn:hover, .choice-btn:focus-visible { color: var(--terracotta); outline: none; }
.choice-hint { font-size: 0.75rem; color: var(--muted); display: block; font-family: 'Courier Prime', monospace; }

/* Go back */
.back-row { padding: 0 28px 22px 64px; }
.back-btn {
  background: none; border: none; cursor: pointer;
  font-family: 'Courier Prime', monospace; font-size: 0.85rem;
  color: var(--muted); text-decoration: underline; text-underline-offset: 3px;
  padding: 4px 0;
}
.back-btn:hover, .back-btn:focus-visible { color: var(--navy); outline: none; }
.btn-row + .back-row { text-align: center; padding-left: 28px; }

/* ─── Title screen ──────────────────────────────────────────────────────── */
.title-area { text-align: center; padding: 26px 32px 28px 56px; }
.book-number {
  display: inline-block; border: 2px solid var(--navy); padding: 2px 10px;
  font-size: 0.8rem; color: var(--navy); margin-bottom: 18px;
}
.book-title {
  font-family: 'Cinzel', serif; font-weight: 900;
  font-size: 1.75rem; line-height: 1.2; color: var(--navy); margin-bottom: 6px;
}
.book-subtitle { font-family: 'Special Elite', serif; font-size: 0.85rem; color: var(--muted); font-style: italic; margin-bottom: 18px; }
.title-area .story-text { text-align: left; }

.big-btn {
  background: var(--navy); color: var(--gold);
  border: 2px solid var(--gold);
  font-family: 'Cinzel', serif; font-weight: 700; letter-spacing: 0.12em;
  font-size: 1rem; padding: 12px 28px; margin-top: 10px; cursor: pointer;
  transition: all 0.15s;
}
.big-btn:hover { background: var(--gold); color: var(--navy); }

.ghost-btn {
  background: none; border: 2px solid var(--navy); color: var(--navy);
  font-family: 'Special Elite', serif; font-size: 0.9rem;
  padding: 8px 22px; cursor: pointer; transition: all 0.15s;
}
.ghost-btn:hover { background: var(--navy); color: var(--parchment); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; padding: 8px 28px 28px 64px; }

/* ─── Endings ───────────────────────────────────────────────────────────── */
.ending-label {
  text-align: center;
  font-family: 'Cinzel', serif; font-weight: 900; letter-spacing: 0.12em;
  font-size: 1.05rem; padding: 10px;
  color: var(--parchment);
}
.ending-label.good   { background: var(--olive); }
.ending-label.bad    { background: var(--terracotta); }
.ending-label.secret { background: linear-gradient(90deg, var(--navy), var(--gold), var(--navy)); }
.the-end { font-family: 'Cinzel', serif; font-weight: 900; text-align: center; font-size: 1.3rem; color: var(--navy); margin-top: 8px; }

/* ─── Get-well card ─────────────────────────────────────────────────────── */
.card-msg {
  border: 1px solid rgba(31,47,74,0.25);
  background: rgba(255,255,255,0.4);
  padding: 10px 14px;
  margin-bottom: 12px;
}
.card-msg p { font-family: 'Special Elite', serif; line-height: 1.6; color: var(--ink); }
.card-msg .from { font-family: 'Cinzel', serif; font-weight: 700; font-size: 0.8rem; color: var(--olive); margin-top: 4px; text-align: right; }


/* ─── Acts, outcomes, gifts, Treasury ───────────────────────────────────── */
.act-label {
  font-family: 'Cinzel', serif; font-weight: 700; font-size: 0.72rem;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--terracotta);
  border-bottom: 1px solid rgba(181,83,47,0.35); padding-bottom: 6px; margin-bottom: 14px;
}
.outcome {
  font-family: 'Courier Prime', monospace; font-style: italic; font-size: 0.9rem;
  line-height: 1.6; color: var(--navy);
  background: rgba(201,162,39,0.12); border: 1px dashed rgba(201,162,39,0.7);
  padding: 8px 12px; margin-bottom: 16px;
}
.treasury, .treasures {
  border: 2px solid var(--gold); background: rgba(201,162,39,0.08);
  padding: 12px 14px; margin: 6px 0 16px; text-align: left;
}
.t-head {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px;
  font-family: 'Cinzel', serif; font-weight: 700; font-size: 0.8rem; letter-spacing: 0.12em; color: var(--navy);
}
.t-count { color: var(--muted); font-family: 'Courier Prime', monospace; letter-spacing: 0; font-weight: 400; }
.t-slots { display: grid; grid-template-columns: repeat(6, minmax(0, 52px)); justify-content: center; gap: 8px; margin: 10px 0 6px; }
.t-slot {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 1;
  border: 1px solid rgba(31,47,74,0.3); background: var(--parchment);
  font-family: 'Cinzel', serif; font-weight: 700; color: rgba(31,47,74,0.35); font-size: 1rem;
}
.t-slot.found { font-size: 1.5rem; color: var(--ink); border-color: var(--gold); background: #fffaf0; }
.t-note { font-size: 0.78rem; color: var(--muted); font-style: italic; margin-top: 6px; }
.treasures-head { font-family: 'Cinzel', serif; font-weight: 700; font-size: 0.85rem; letter-spacing: 0.1em; color: var(--navy); margin-bottom: 8px; }
.gift-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.gift-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 0.85rem; line-height: 1.45; color: var(--ink); }
.g-emoji { font-size: 1.4rem; line-height: 1; }
.gift-empty { font-size: 0.85rem; }
.ending-label.tricycle { background: linear-gradient(90deg, var(--terracotta), var(--olive)); }
.favour-bar { flex-wrap: wrap; }

/* ─── Greek key footer ──────────────────────────────────────────────────── */
.greek-key {
  height: 18px;
  background-color: var(--navy);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='18'%3E%3Cpath d='M0 15h12V3h12v9h-6V9' fill='none' stroke='%23c9a227' stroke-width='2'/%3E%3Cpath d='M24 15h12' stroke='%23c9a227' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
}

/* ─── Mobile ────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  body { padding: 12px 8px; }
  .cyoa-header h1 { font-size: 0.85rem; letter-spacing: 0.08em; }
  .story-area, .choices, .btn-row, .back-row { padding-left: 40px; padding-right: 18px; }
  .favour-bar { padding-left: 40px; flex-direction: column; gap: 2px; }
  .t-slots { grid-template-columns: repeat(6, minmax(0, 44px)); gap: 5px; }
  .divider { margin-left: 40px; margin-right: 18px; }
  .book-page::before { left: 28px; }
  .story-text { font-size: 0.93rem; }
  .book-title { font-size: 1.4rem; }
  .title-area { padding-left: 36px; padding-right: 18px; }
}
