/* Math Adventure World — player and admin guides (standalone pages, also shown inside the game). */
:root {
  --ink: #23263a;
  --muted: #5d6478;
  --line: #d9deea;
  --paper: #ffffff;
  --bg: #eef3fb;
  --accent: #3a6fd8;
  --accent-soft: #e6eefc;
  --good: #2f9e5a;
  --warn: #c9741f;
  --warn-soft: #fff3e3;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font: 16px/1.65 "Sarabun", "Noto Sans Thai", "Leelawadee UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
body.lang-th .en, body.lang-en .th { display: none !important; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 18px; margin: 0; flex: 1; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang-switch button {
  border: 0; background: transparent; padding: 5px 14px; font: inherit; font-size: 14px; cursor: pointer; color: var(--muted);
}
.lang-switch button.on { background: var(--accent); color: #fff; }
.print-btn { border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 5px 12px; font: inherit; font-size: 14px; cursor: pointer; }

.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; max-width: 1120px; margin: 0 auto; padding: 24px 20px 64px; }
nav.toc { position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 96px); overflow: auto; font-size: 14px; }
nav.toc ol { list-style: none; margin: 0; padding: 0; }
nav.toc a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--muted); text-decoration: none; }
nav.toc a:hover { background: var(--accent-soft); color: var(--accent); }

main { min-width: 0; }
.hero {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 26px; margin-bottom: 20px;
}
.hero h2 { margin: 0 0 6px; font-size: 26px; }
.hero p { margin: 0; color: var(--muted); }

section.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 26px; margin-bottom: 18px; scroll-margin-top: 72px;
}
section.card h2 { font-size: 20px; margin: 0 0 10px; display: flex; gap: 10px; align-items: baseline; }
section.card h2 .num { color: var(--accent); font-size: 15px; font-weight: 700; }
section.card h3 { font-size: 16px; margin: 18px 0 6px; }
p, li { max-width: 72ch; }
ul, ol { padding-left: 22px; }
li { margin: 3px 0; }

table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 15px; }
th, td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
th { background: var(--accent-soft); font-weight: 600; }
td.ico, th.ico { width: 48px; text-align: center; font-size: 20px; }

kbd {
  display: inline-block; min-width: 22px; padding: 0 6px; border: 1px solid #b9c0d2; border-bottom-width: 2px;
  border-radius: 5px; background: #f7f8fb; font: 13px/20px ui-monospace, Menlo, monospace; text-align: center;
}
code { font: 14px ui-monospace, Menlo, monospace; background: #f2f4f9; padding: 1px 5px; border-radius: 4px; }
pre { background: #1f2333; color: #e8ecf7; padding: 12px 14px; border-radius: 10px; overflow: auto; font-size: 14px; }
pre code { background: none; color: inherit; padding: 0; }

.tip, .warn {
  border-radius: 10px; padding: 10px 14px; margin: 12px 0;
  border-left: 4px solid var(--good); background: #eaf7ef;
}
.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.steps { counter-reset: s; list-style: none; padding-left: 0; }
.steps > li { counter-increment: s; position: relative; padding-left: 38px; margin: 8px 0; }
.steps > li::before {
  content: counter(s); position: absolute; left: 0; top: 1px;
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 14px; font-weight: 700; text-align: center; line-height: 26px;
}
.btnchip { display: inline-block; padding: 0 7px; border: 1px solid var(--line); border-radius: 6px; background: #f7f8fb; white-space: nowrap; }
footer { color: var(--muted); font-size: 13px; text-align: center; margin-top: 30px; }

/* Inside the game's guide overlay: no side menu, compact. */
body.embedded .layout { grid-template-columns: 1fr; padding-top: 14px; }
body.embedded nav.toc { position: static; max-height: none; }
body.embedded nav.toc ol { display: flex; flex-wrap: wrap; gap: 4px; }
body.embedded nav.toc a { border: 1px solid var(--line); background: var(--paper); padding: 3px 10px; }
body.embedded .print-btn { display: none; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  nav.toc { position: static; max-height: none; }
  nav.toc ol { display: flex; flex-wrap: wrap; gap: 4px; }
  nav.toc a { border: 1px solid var(--line); background: var(--paper); padding: 3px 10px; }
  section.card { padding: 16px 16px; }
}
@media print {
  .topbar, nav.toc { display: none; }
  .layout { display: block; padding: 0; }
  body { background: #fff; }
  section.card { break-inside: avoid; border: 0; padding: 0 0 12px; }
}
