/* Game-style title/pause menu. Handmade CSS only: system fonts, no CDN, no stock icons. */

/* Paper, night, and sepia tokens used by the menu and reading surface. */
body.theme-paper{
  --bg:#f4efe3;
  --panel:#faf6ec;
  --ink:#2a2118;
  --gold:#8a5a1c;
  --rule:#2a21184d;
  --accent-gold:#a67c2a;
  --accent-blue:#1a335c;
  --bleed:#2a2118;
  --neon:#8a5a1c;
}
body.theme-night{
  --bg:#10151c;
  --panel:#171e28;
  --ink:#e6e0d4;
  --gold:#d4a24c;
  --rule:#d4a24c55;
  --accent-gold:#d4a24c;
  --accent-blue:#8fa4c8;
  --bleed:#f0e6d0;
  --neon:var(--gold);
}
body.theme-sepia{
  --bg:#e0c58a;
  --panel:#f3d7a4;
  --ink:#3b2a17;
  --gold:#7a4e14;
  --rule:#3b2a1740;
  --accent-gold:#7a4e14;
  --accent-blue:#1f3a5f;
  --bleed:#3b2a17;
  --neon:#7a4e14;
}

/* Paper tooth: layered gradients + SVG grain, no external asset. */
body.theme-paper,
body.theme-sepia{
  background-color:var(--bg);
  background-image:
    radial-gradient(ellipse at 12% 0%, rgba(120,80,30,.07), transparent 50%),
    radial-gradient(ellipse at 90% 100%, rgba(40,30,10,.06), transparent 45%),
    repeating-linear-gradient(0deg, rgba(80,50,20,.035) 0 1px, transparent 1px 3px),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.25  0 0 0 0 0.18  0 0 0 0 0.1  0 0 0 0.14 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
body.theme-night{
  background-color:var(--bg);
  background-image:
    radial-gradient(ellipse at 50% -10%, rgba(212,162,76,.08), transparent 42%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.9  0 0 0 0 0.85  0 0 0 0 0.7  0 0 0 0.08 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

body.font-serif,
body.f-serif{--menu-font:Georgia,"Times New Roman",Times,serif}
body.font-sans,
body.f-sans{--menu-font:system-ui,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif}
body.font-dyslexia,
body.f-dyslexia{--menu-font:"Comic Sans MS","Trebuchet MS",Arial,Verdana,sans-serif}
body{--lh:1.65}
article{line-height:var(--lh,1.65)}
body.f-dyslexia article,
body.font-dyslexia article{font-family:"Comic Sans MS","Trebuchet MS",Arial,Verdana,sans-serif}

/* Ink-bleed headings (menu and reading titles). */
.menu-title,
.menu-book h2,
.menu-book h3{
  font-family:Georgia,"Times New Roman",Times,serif;
  font-weight:600;
  letter-spacing:.04em;
  color:var(--bleed,var(--gold));
  text-shadow:
    .35px 0 currentColor,
    -.25px 0 rgba(20,10,0,.28),
    0 .6px .7px rgba(40,20,0,.3);
}


@media (prefers-reduced-motion:reduce){
  .menu-root, .menu-book, .menu-backdrop, .cover img, article, .autosave{
    animation:none !important;
    transition:none !important;
  }
}
body.reduce-motion .menu-root,
body.reduce-motion .menu-book,
body.reduce-motion .menu-backdrop,
body.reduce-motion .cover img,
body.reduce-motion article,
body.reduce-motion .autosave{
  animation:none !important;
  transition:none !important;
}

/* Running head: keep the existing bar, quiet it. */
#bar #home,
#menuOpen{
  min-height:44px;
  min-width:44px;
}
#bar button:focus-visible,
.menu-book button:focus-visible,
.menu-book select:focus-visible,
.menu-book input:focus-visible,
.menu-book textarea:focus-visible,
.menu-book a:focus-visible{
  outline:3px solid var(--gold);
  outline-offset:3px;
}

.autosave{
  position:fixed;
  right:max(1rem,env(safe-area-inset-right));
  bottom:max(1rem,env(safe-area-inset-bottom));
  z-index:60;
  font-family:Georgia,"Times New Roman",Times,serif;
  font-size:.9rem;
  letter-spacing:.06em;
  color:var(--ink);
  background:var(--panel);
  border:1px solid var(--gold);
  padding:.35rem .7rem;
  opacity:0;
  pointer-events:none;
  transition:opacity .35s ease;
}
.autosave.on{opacity:1}

/* Overlay */
.menu-root[hidden]{display:none !important}
.menu-root{
  position:fixed;
  inset:0;
  z-index:80;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:max(.8rem,env(safe-area-inset-top)) max(1rem,env(safe-area-inset-right)) max(.8rem,env(safe-area-inset-bottom)) max(1rem,env(safe-area-inset-left));
}
.menu-backdrop{
  position:absolute;
  inset:0;
  background:rgba(12,10,8,.45);
}
body.theme-night .menu-backdrop{background:rgba(4,6,10,.62)}

.menu-book{
  position:relative;
  width:min(36rem,100%);
  max-height:100%;
  overflow:auto;
  color:var(--ink);
  background-color:var(--panel);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(120,80,30,.06), transparent 50%),
    repeating-linear-gradient(0deg, rgba(80,50,20,.03) 0 1px, transparent 1px 4px);
  padding:1.6rem 1.5rem 1.4rem;
  /* Border ink sits on a decorative frame so body text stays aligned. */
  border:2px solid var(--ink);
  box-shadow:
    inset 0 0 0 1px var(--gold),
    0 18px 40px rgba(20,12,4,.28);
  font-family:var(--menu-font,Georgia,"Times New Roman",Times,serif);
}
body.theme-night .menu-book{
  box-shadow:inset 0 0 0 1px var(--gold), 0 18px 50px rgba(0,0,0,.5);
}
body.cover-gold .menu-book{box-shadow:inset 0 0 0 2px var(--accent-gold), 0 18px 40px rgba(20,12,4,.28)}
body.cover-blue .menu-book{box-shadow:inset 0 0 0 2px var(--accent-blue), 0 18px 40px rgba(20,12,4,.28)}

.menu-kicker{
  margin:0 0 .2rem;
  font-size:.78rem;
  letter-spacing:.16em;
  text-transform:uppercase;
  opacity:.75;
}
.menu-title{
  margin:0 0 1rem;
  font-size:2.05rem;
  line-height:1.15;
  text-align:center;
}

.menu-list{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:.45rem;
}
.menu-list > li{margin:0}
.menu-book button,
.menu-book .menu-item,
.cover-pick{
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  min-height:44px;
  padding:.65rem .9rem;
  text-align:center;
  font:inherit;
  color:var(--ink);
  background:transparent;
  border:1px solid var(--ink);
  border-radius:0;
  cursor:pointer;
  letter-spacing:.03em;
}
.menu-book button.primary{
  background:transparent;
  color:var(--ink);
  border-color:var(--gold);
  box-shadow:inset 0 0 0 1px var(--gold);
}
.menu-book button:hover,
.menu-book .menu-item:hover,
.cover-pick:hover{
  background:rgba(212,162,76,.12);
}
.menu-book button[disabled],
.menu-book button[aria-disabled="true"]{
  opacity:.42;
  cursor:not-allowed;
  background:transparent;
}
.menu-back{
  width:auto;
  margin-bottom:.8rem;
}

.menu-pane[hidden]{display:none !important}
.menu-note{
  margin:.4rem 0 1rem;
  font-size:.95rem;
  line-height:1.5;
  opacity:.85;
}

/* New Journey covers: 2035, 1893, and Infinite Lux faces of the same book. */
.cover-row{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:.8rem;
  margin:1rem 0;
}
@media (max-width: 520px){
  .menu-book{padding-left:.85rem;padding-right:.85rem}
  .cover-row{grid-template-columns:repeat(3, minmax(0, 1fr));gap:.35rem}
  .cover-pick{padding:.45rem .2rem .5rem;min-height:0}
  .cover-face{width:100%;max-width:4.4rem;height:6.4rem;margin:0 auto}
  .cover-pick b{font-size:.85em;line-height:1.2}
}
body.cover-lux .menu-book{box-shadow:inset 0 0 0 2px var(--accent-gold), 0 18px 40px rgba(20,12,4,.28)}
.cover-pick{
  flex-direction:column;
  gap:.6rem;
  min-height:12rem;
  padding:1rem .6rem .8rem;
}
.cover-face{
  width:5.4rem;
  height:8rem;
  position:relative;
  border:1px solid var(--ink);
  box-shadow:2px 3px 0 rgba(20,10,0,.2);
}
.cover-face.gold{
  background:
    linear-gradient(160deg,#c9a24a 0%,#8a5a1c 70%,#5c3a10 100%);
}
.cover-face.blue{
  background:
    linear-gradient(160deg,#2a4a7a 0%,#152a4a 70%,#0c1a30 100%);
}
.cover-face::after{
  content:"";
  position:absolute;
  left:.45rem;
  top:.6rem;
  bottom:.6rem;
  width:1px;
  background:rgba(255,240,200,.35);
}
.cover-face img{
  position:absolute;inset:0;
  width:100%;height:100%;
  object-fit:cover;
  display:block;
}
.cover-face.lux{
  background:linear-gradient(160deg,#3a2a18 0%,#1a120c 70%,#0a0806 100%);
}
.cover-pick b{font-weight:600}

/* Load slots */
.slot-list{display:flex;flex-direction:column;gap:.5rem}
.slot-btn{
  flex-direction:column;
  align-items:flex-start;
  gap:.15rem;
  text-align:left;
}
.slot-btn .slot-name{font-weight:600}
.slot-btn .slot-meta{font-size:.85rem;opacity:.8}
.slot-btn.empty{opacity:.7}

/* Notes + Codex: ledger / ruled paper */
.notes-pad,
.codex-ledger{
  width:100%;
  min-height:12rem;
  padding:.8rem 1rem;
  border:1px solid var(--ink);
  background:
    repeating-linear-gradient(var(--panel) 0 1.7rem, rgba(80,50,20,.08) 1.7rem calc(1.7rem + 1px));
  color:var(--ink);
  font-family:Georgia,"Times New Roman",Times,serif;
  font-size:1.05rem;
  line-height:1.7rem;
  resize:vertical;
}
.codex-ledger{
  list-style:none;
  margin:0;
  padding:.6rem 1rem 1rem;
}
.codex-ledger li{
  min-height:1.7rem;
  border-bottom:1px solid rgba(80,50,20,.18);
  padding:.1rem 0;
}
.codex-ledger li.blank{color:transparent}

/* Settings */
.menu-settings label{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:.3rem;
  margin:0 0 .85rem;
  font-size:.95rem;
}
.menu-settings select,
.menu-settings input[type="range"]{
  width:100%;
  min-height:44px;
  font:inherit;
  color:var(--ink);
  background:var(--bg);
  border:1px solid var(--ink);
  padding:.4rem .5rem;
}
.menu-settings .check{
  flex-direction:row;
  align-items:center;
  gap:.6rem;
  min-height:44px;
}
.menu-settings .check input{
  width:1.4rem;
  height:1.4rem;
  accent-color:var(--gold);
}

/* Account / library */
.owned-list{list-style:none;margin:0 0 1rem;padding:0}
.owned-list li{
  display:flex;
  justify-content:space-between;
  gap:1rem;
  min-height:44px;
  align-items:center;
  border-bottom:1px solid var(--rule);
  padding:.3rem 0;
}
.owned-list .spine{opacity:.65;font-style:italic}
#menu-account-panel .pay{
  background:transparent;
  border:none;
  padding:0;
  text-align:left;
}

/* Confirm slip */
.confirm-slip[hidden]{display:none !important}
.confirm-slip{
  position:fixed;
  inset:0;
  z-index:90;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:1rem;
  background:rgba(12,10,8,.45);
}
.confirm-slip .slip{
  width:min(26rem,100%);
  background:var(--panel);
  color:var(--ink);
  border:2px solid var(--ink);
  box-shadow:inset 0 0 0 1px var(--gold);
  padding:1.2rem 1.1rem;
  font-family:Georgia,"Times New Roman",Times,serif;
  filter:url(#menu-ink-edge);
}
.confirm-slip .slip-actions{display:flex;gap:.6rem;margin-top:1rem}
.confirm-slip .slip-actions button{flex:1}

#menuSvgFilters{position:absolute;width:0;height:0;overflow:hidden}

.menu-book::before,
.confirm-slip .slip::before{
  content:"";
  position:absolute;
  inset:-3px;
  border:2px solid var(--ink);
  pointer-events:none;
  filter:url(#menu-ink-edge);
}
.confirm-slip .slip{position:relative;filter:none}


/* Satchel and The Record */
.satchel-list,.record-marks,.legacy-list,.recap-list{
  list-style:none;margin:0 0 1rem;padding:0;
}
.satchel-list li,.record-marks li,.legacy-list li,.recap-list li{
  display:flex;align-items:center;gap:.6em;
  background:var(--panel);
  border:2px solid var(--ink);
  padding:.45em .7em;
  margin:.4rem 0;
  min-height:44px;
  font-weight:700;
}
.satchel-list li.empty,.record-marks li.empty,.recap-list li.empty{
  font-weight:400;opacity:.75;font-style:italic;border-style:dashed;
}
.menu-sub{font-size:1rem;margin:1rem 0 .4rem}
.tally-line{display:flex;gap:1.4rem;margin:.2rem 0 1rem;font-size:1.15rem;letter-spacing:.04em}
.quiet-form{display:flex;flex-direction:column;gap:.4rem;margin:1rem 0}
.quiet-form label{display:flex;flex-direction:column;gap:.3rem}
.quiet-form input{
  min-height:44px;font:inherit;color:var(--ink);background:var(--bg);
  border:1px solid var(--ink);padding:.4rem .5rem;
}
.quiet-form button{min-height:44px;margin-top:.2rem}
.reward-slot{
  list-style:none;border:2px dashed var(--gold);min-height:44px;
  display:flex;align-items:center;justify-content:center;margin:.6rem 0;
}
.slip-actions{display:flex;gap:.6rem;margin-top:1rem}
.slip-actions button{flex:1;min-height:44px}

/* Owner ink theme and cover frame (cosmetic only) */
body.owner-ink{
  --gold:#c9a24a;
}
body.owner-ink .menu-book{
  box-shadow:0 0 0 3px var(--gold), 0 0 0 6px var(--ink), inset 0 0 0 2px var(--gold);
}
body.owner-ink .cover-face{
  box-shadow:0 0 0 3px var(--gold), 0 0 0 5px var(--ink);
}
body.owner-ink .menu-kicker{color:var(--gold)}
.camp-pool{list-style:none;margin:0 0 .75rem;padding:0}
.camp-pool li{padding:.25rem 0}
.camp-picks{margin:0 0 1rem}
.camp-owned button[aria-disabled="true"]{opacity:.6;cursor:default}
