/* Design tokens and page chrome shared by the landing page and both drills.
   Every page links this before its own stylesheet, so a page can override
   anything here — note-reading widens the column by setting --app-width. */

:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1b1d21;
  --muted: #6b7280;
  --line: #d9dce1;
  --accent: #2f5fd0;
  --accent-ink: #ffffff;
  --radius: 12px;
  --app-width: 440px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --panel: #1d2026;
    --ink: #eceef2;
    --muted: #9aa1ad;
    --line: #333944;
    --accent: #6f9bff;
    --accent-ink: #0f1115;
  }
}

* {
  box-sizing: border-box;
}

/* An author `display` on a flex or grid container beats the browser's own
   rule for [hidden], so hiding one has to be said here or it does nothing. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    16px/1.45 system-ui,
    -apple-system, "Segoe UI", Roboto,
    "PingFang TC", "Noto Sans TC", "Microsoft JhengHei",
    sans-serif;
  -webkit-text-size-adjust: 100%;
}

.app {
  max-width: var(--app-width);
  margin: 0 auto;
  padding: 20px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* One line, always: the title on the left, the language toggle on the right
   border. App-specific controls live in their own row below the header. */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.01em;
}

/* The way back to the landing page, a slim row above each drill's header. */
.site-nav {
  display: flex;
  margin-bottom: -8px;
}

.home-link {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}

.home-link:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* The EN / 中文 toggle every page shows; shared/lang.js builds its buttons.
   Two ordinary buttons joined into one: outer corners rounded, one shared
   border between them, so it matches the other buttons rather than a pill. */
.lang-pick {
  display: inline-flex;
}

.lang {
  padding: 6px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.lang:first-child {
  border-radius: 10px 0 0 10px;
}

.lang:last-child {
  border-radius: 0 10px 10px 0;
  border-left: 0;
}

.lang.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.levels {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
