/* BananaMax Game Manual: one shared stylesheet. Colours follow the game's candy palette (plum sheets, banana yellow,
   mint, sky, coral, the player's orange and the rival's purple: game/ui/theme/ramps.gd). Works offline: the titles use
   the game's own font (Lilita One, OFL), the body system fonts. Dark (plum) by default, light on request or by the system. */
@font-face {
  font-family: "Lilita One";
  /* lilita.ttf is copied beside the page by tools/export_web.sh; the second path works when the page is opened from the repo. */
  src: url("lilita.ttf") format("truetype"), url("../../game/assets/third_party/fonts/LilitaOne-Regular.ttf") format("truetype");
  font-display: swap;
}
:root {
  --bg: #1d0835; --bg2: #250a42; --panel: #3a1160; --panel2: #2c0d4d; --text: #fff6da; --muted: #d7c6ee; --accent: #ffc21a;
  --accent-soft: rgba(255, 194, 26, .16); --line: #6a3985; --link: #ffe066; --shadow: 0 6px 22px rgba(18, 2, 31, .5);
  --banana: #ffc21a; --banana-hi: #fff04a; --banana-lo: #ff8a00; --mint: #4de36a; --sky: #2fa8ff; --coral: #ff4d5e;
  --lilac: #b26bff; --player: #ff8c1a; --rival: #9e4cd9; --ink: #1f1429; --cream: #fff6da; --gold: #ffd23a;
  --svg-ink: #fff6da; --svg-dim: #b9a3d6; --svg-floor: #2c0d4d;
  --title: "Lilita One", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #fbf5ff; --bg2: #f3e9ff; --panel: #fff; --panel2: #f1e6ff; --text: #1f1429; --muted: #5b4a70; --accent: #b4500a;
    --accent-soft: rgba(255, 138, 0, .12); --line: #dcc9f2; --link: #7a3dff; --shadow: 0 4px 16px rgba(58, 17, 96, .12);
    --svg-ink: #1f1429; --svg-dim: #8a7f99; --svg-floor: #efe3ff; color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #fbf5ff; --bg2: #f3e9ff; --panel: #fff; --panel2: #f1e6ff; --text: #1f1429; --muted: #5b4a70; --accent: #b4500a;
  --accent-soft: rgba(255, 138, 0, .12); --line: #dcc9f2; --link: #7a3dff; --shadow: 0 4px 16px rgba(58, 17, 96, .12);
  --svg-ink: #1f1429; --svg-dim: #8a7f99; --svg-floor: #efe3ff; color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.6 system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%; }
a { color: var(--link); }
img { max-width: 100%; }

/* ---------- layout and the table of contents ---------- */
.layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; }
nav.toc { position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; padding: 18px 14px 40px;
  background: var(--bg2); border-right: 1px solid var(--line); }
nav.toc .brand { display: flex; align-items: center; gap: 10px; margin: 0 0 2px; font: 26px/1 var(--title); color: var(--banana); letter-spacing: .01em;
  text-shadow: 2px 2px 0 var(--ink); }
nav.toc .brand img { width: 40px; height: 40px; border-radius: 10px; }
nav.toc .sub { color: var(--muted); font-size: 13px; margin: 4px 0 10px 50px; }
nav.toc .part { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 16px 8px 4px; font-weight: 700; }
nav.toc ol { list-style: none; margin: 0; padding: 0; }
nav.toc a { display: flex; gap: 8px; padding: 4px 8px; border-radius: 8px; text-decoration: none; color: var(--text); font-size: 14.5px; line-height: 1.35; }
nav.toc a .n { color: var(--muted); min-width: 1.6em; text-align: right; font-variant-numeric: tabular-nums; }
nav.toc a:hover { background: var(--panel); }
nav.toc a.here { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--banana); }
nav.toc a.sub2 { padding-left: 38px; font-size: 13.5px; color: var(--muted); }
nav.toc details > summary { display: none; }
main { min-width: 0; padding: 24px clamp(16px, 4vw, 56px) 80px; max-width: 1060px; }

/* ---------- headings and text ---------- */
h1, h2, h3 { font-family: var(--title); font-weight: 400; letter-spacing: .01em; }
h1 { font-size: clamp(34px, 6vw, 52px); line-height: 1.05; color: var(--banana); margin: 0 0 8px; }
h2 { font-size: 30px; line-height: 1.2; color: var(--text); margin: 60px 0 10px; padding-top: 16px; border-top: 2px dashed var(--line);
  display: flex; align-items: center; gap: 12px; }
h2 .n { flex: none; display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; font: 20px var(--title);
  color: var(--ink); background: linear-gradient(180deg, var(--banana-hi), var(--banana) 50%, var(--banana-lo)); border: 2px solid var(--ink);
  box-shadow: 0 3px 0 #b4500a; }
h3 { font-size: 22px; line-height: 1.25; margin: 30px 0 6px; color: var(--accent); }
h4 { margin: 18px 0 4px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
p { margin: 8px 0; } ul, ol { padding-left: 22px; } li { margin: 4px 0; }
.intro { font-size: 18px; color: var(--muted); margin-top: 0; }
.partline { margin: 70px 0 -46px; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.ui { font: 0.95em var(--title); letter-spacing: .02em; white-space: nowrap; }

/* ---------- the banner ---------- */
.banner { position: relative; border-radius: 18px; overflow: hidden; margin: 0 0 18px; box-shadow: var(--shadow); border: 2px solid var(--ink); }
.banner img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 7; object-fit: cover; object-position: 50% 40%; }
.banner .over { position: absolute; inset: auto 0 0 0; padding: 70px clamp(14px, 3vw, 28px) 18px;
  background: linear-gradient(to top, rgba(29, 8, 53, .95), rgba(29, 8, 53, .65) 60%, transparent); color: #fff6da; }
.banner h1 { margin: 0; color: #ffc21a; text-shadow: 3px 3px 0 #2b0147; }
.banner p { margin: 4px 0 0; color: #f3e9ff; font-size: 17px; max-width: 760px; }

/* ---------- boxes ---------- */
.tldr, .tip, .warn, .new, .why { background: var(--panel); padding: 10px 16px; border-radius: 12px; margin: 14px 0; border-left: 5px solid var(--banana); }
.tldr strong:first-child { color: var(--accent); }
.tip { border-left-color: var(--mint); } .warn { border-left-color: var(--coral); } .new { border-left-color: var(--lilac); } .why { border-left-color: var(--sky); }
.tip::before { content: "Tip. "; font-weight: 800; color: var(--mint); }
.warn::before { content: "Careful. "; font-weight: 800; color: var(--coral); }
.why::before { content: "Why. "; font-weight: 800; color: var(--sky); }
.new h3 { margin: 4px 0 6px; font-size: 20px; color: var(--lilac); }
.new ul { margin: 4px 0; }

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; margin: 12px 0; border-radius: 12px; border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; font-size: 15px; background: var(--panel); }
th, td { padding: 8px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { background: var(--panel2); color: var(--accent); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.k { font-weight: 700; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- chips and keys ---------- */
.chip { display: inline-block; padding: 1px 10px; border-radius: 999px; font: 13.5px/1.55 var(--title); letter-spacing: .03em; color: var(--ink);
  white-space: nowrap; border: 1.5px solid var(--ink); vertical-align: 1px; }
.c-banana { background: linear-gradient(180deg, #fff04a, #ffc21a 50%, #ff8a00); }
.c-mint { background: linear-gradient(180deg, #c8ff4d, #4de36a 50%, #10a85a); }
.c-sky { background: linear-gradient(180deg, #5ce8ff, #2fa8ff 50%, #2f5bff); }
.c-coral { background: linear-gradient(180deg, #ff7aa8, #ff4d5e 50%, #ff3a1f); color: #fff; }
.c-lilac { background: linear-gradient(180deg, #e7b8ff, #b26bff 50%, #7a3dff); color: #fff; }
.c-off { background: linear-gradient(180deg, #fff, #f1e6ff); }
.c-player { background: linear-gradient(180deg, #ffbf66, #ff8c1a 50%, #e75b00); }
.c-rival { background: linear-gradient(180deg, #d99bff, #9e4cd9 50%, #6727b0); color: #fff; }
.c-gold { background: linear-gradient(180deg, #fff200, #ffc400 40%, #ff9a00 75%, #ff4a00); }
kbd { background: var(--panel2); border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 6px; padding: 0 6px; font: 600 14px ui-monospace, monospace; }
.stars { color: var(--gold); letter-spacing: 1px; white-space: nowrap; }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin: 14px 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.card h4 { margin: 2px 0 4px; color: var(--text); text-transform: none; letter-spacing: .01em; font: 19px/1.25 var(--title); }
.card p { font-size: 15px; margin: 4px 0; }
.card .tag { display: block; color: var(--muted); font-size: 13px; }
.card img { display: block; width: 100%; border-radius: 8px; margin: 0 0 8px; }

/* ---------- screenshots ---------- */
figure { margin: 16px 0; }
figure img { display: block; width: 100%; height: auto; border-radius: 12px; border: 2px solid var(--ink); box-shadow: var(--shadow); cursor: zoom-in; }
figcaption { color: var(--muted); font-size: 14.5px; margin-top: 6px; }
figure.half { max-width: 620px; }
.shots2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin: 14px 0; }
.shots2 figure { margin: 0; }
.shot { position: relative; }
.shot .pin { position: absolute; transform: translate(-50%, -50%); width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font: 15px var(--title); color: #1f1429;
  background: radial-gradient(circle at 35% 30%, #fff6b0, #ffc21a 70%); border: 2px solid #1f1429;
  box-shadow: 0 0 0 2px #ffc21a, 0 2px 8px rgba(0, 0, 0, .6); pointer-events: none; }
ol.legend { list-style: none; padding: 0; margin: 10px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 6px 18px; counter-reset: lg; }
ol.legend li { counter-increment: lg; display: flex; gap: 10px; align-items: flex-start; margin: 0; font-size: 15.5px; }
ol.legend li::before { content: counter(lg); flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font: 13px var(--title); color: #1f1429; background: #ffc21a; border: 1.5px solid #1f1429; margin-top: 1px; }

/* ---------- steps ---------- */
ol.steps { list-style: none; padding: 0; margin: 12px 0; counter-reset: st; }
ol.steps > li { counter-increment: st; position: relative; padding: 2px 0 10px 46px; margin: 0; }
ol.steps > li::before { content: counter(st); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center; font: 17px var(--title); color: var(--ink); background: var(--mint); border: 2px solid var(--ink); }
ol.steps > li:not(:last-child)::after { content: ""; position: absolute; left: 15px; top: 34px; bottom: 0; width: 2px; background: var(--line); }

/* ---------- diagrams ---------- */
.diagram { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px; margin: 14px 0; }
.diagram svg { display: block; width: 100%; height: auto; max-height: 420px; }
.diagram svg text { fill: var(--svg-ink); font: 600 13px system-ui, sans-serif; }
.diagram svg text.dim { fill: var(--svg-dim); font-weight: 500; }
.diagram svg text.big { font: 17px var(--title); }
.diagram .floor { fill: var(--svg-floor); }
.diagram .ink { stroke: var(--svg-ink); }
.diagram .dimline { stroke: var(--svg-dim); }
.diagram figcaption { margin: 6px 4px 0; }

/* ---------- questions ---------- */
details.q { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin: 8px 0; padding: 0 14px; }
details.q > summary { cursor: pointer; padding: 10px 0; font-weight: 700; list-style: none; display: flex; gap: 10px; align-items: baseline; }
details.q > summary::-webkit-details-marker { display: none; }
details.q > summary::before { content: "+"; color: var(--accent); font-weight: 800; width: 14px; flex: none; }
details.q[open] > summary::before { content: "\2212"; }
details.q > div { padding: 0 0 12px 24px; }
.qgroup { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin: 22px 0 4px; font-weight: 700; }

/* ---------- misc ---------- */
footer { margin-top: 60px; padding-top: 14px; border-top: 2px dashed var(--line); color: var(--muted); font-size: 14px; }
.theme, .totop { position: fixed; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 12px; cursor: pointer; font-size: 14px; z-index: 5; text-decoration: none; }
.theme { top: 10px; right: 12px; }
.totop { right: 12px; bottom: 12px; }
/* Inside the game (its manual viewer sets html.in-game): the viewer's round close button holds the top-right corner. */
@media (min-width: 901px) { html.in-game .theme { right: 76px; } }
nav.toc .playlink { display: inline-block; margin: 0 0 6px 50px; padding: 3px 14px; border-radius: 10px; text-decoration: none; font: 15px var(--title);
  letter-spacing: .03em; color: #1f1429; border: 2px solid #1f1429; background: linear-gradient(180deg, #c8ff4d, #4de36a 50%, #10a85a); }
.lightbox { position: fixed; inset: 0; background: rgba(18, 2, 31, .94); display: none; place-items: center; z-index: 20; cursor: zoom-out; padding: 12px; }
.lightbox.on { display: grid; }
.lightbox img { max-width: 100%; max-height: 88vh; border-radius: 10px; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); }
.lightbox p { color: #f3e9ff; text-align: center; margin: 8px auto 0; font-size: 15px; max-width: 900px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  nav.toc { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; }
  nav.toc details > summary { display: block; cursor: pointer; font-weight: 700; color: var(--accent); padding: 6px 0; }
  nav.toc .inner { columns: 2; column-gap: 14px; }
  nav.toc .part { break-after: avoid; }
  nav.toc li { break-inside: avoid; }
  nav.toc a.sub2 { display: none; }
  .theme { top: auto; bottom: 12px; right: auto; left: 12px; }
  h2 { font-size: 26px; }
}
@media (max-width: 560px) {
  nav.toc .inner { columns: 1; }
  body { font-size: 16px; }
  .banner img { aspect-ratio: 16 / 9; }
  .banner .over { position: static; padding: 12px 14px 14px; background: #1d0835; }
}
@media print {
  nav.toc, .theme, .totop, .lightbox { display: none !important; }
  .layout { display: block; }
  figure img { box-shadow: none; }
}
