:root {
  --bg: #0b1020; --text: #e8e8f0; --muted: #9aa3b8;
  --accent: #7ff0a8; --accent-soft: rgba(127,240,168,.14);
  --panel: #111827;
  color-scheme: light dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f7; --text: #1b1f26; --muted: #5a6472;
    --accent: #0e7a4a; --accent-soft: rgba(14,122,74,.12);
    --panel: #e9ebef;
  }
}
html[data-theme="dark"] {
  --bg: #0b1020; --text: #e8e8f0; --muted: #9aa3b8;
  --accent: #7ff0a8; --accent-soft: rgba(127,240,168,.14);
  --panel: #111827;
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #f4f5f7; --text: #1b1f26; --muted: #5a6472;
  --accent: #0e7a4a; --accent-soft: rgba(14,122,74,.12);
  --panel: #e9ebef;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
body.center { display: flex; align-items: center; justify-content: center; }

main { padding: 1rem; }
h1 { font-size: clamp(2.25rem, 9vw, 3rem); font-weight: 700; margin: 0; letter-spacing: -.02em; }
p  { font-size: 1.15rem; color: var(--muted); margin-top: .75rem; }

/* About page */
.page { max-width: 60ch; margin: 0 auto; padding: 3rem 1.25rem 7rem; }
.page.center { text-align: center; }
.page h1 { font-size: clamp(2rem, 7vw, 2.75rem); margin: 0 0 1.25rem; }
.page h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; color: var(--text); }
.page p {
  font-size: 1.05rem; line-height: 1.65; margin: 0 0 1rem;
  color: var(--muted);
}
.page ul { margin: 0 0 1rem; padding-left: 1.25rem; font-size: 1rem; color: var(--muted); }
.page p.intro { color: var(--text); }
.page p.muted { margin: 0 0 1rem; font-size: 1rem; color: var(--muted); }
.link { color: var(--text); text-underline-offset: 3px; }

/* Shared chrome */
#menu-btn {
  position: fixed; top: .75rem; right: .75rem;
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 1px solid var(--muted); border-radius: 10px;
  background: transparent; color: var(--text);
  cursor: pointer; touch-action: manipulation;
}
#menu-btn span {
  width: 16px; height: 16px; display: block;
  background: repeating-linear-gradient(to bottom, currentColor 0 2px, transparent 2px 6px);
  border-radius: 1px;
  pointer-events: none;
}
#menu {
  position: fixed; top: 4.55rem; right: .75rem;
  background: var(--panel); border: 1px solid var(--muted);
  border-radius: 12px; padding: .8rem 1rem; min-width: 210px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35); color: var(--text);
  display: none; max-width: calc(100vw - 1.5rem);
}
#menu.open { display: block; }
#menu .sec { margin: 0 0 .55rem; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
#menu .msg { margin: 0; margin-top: .5rem; font-size: .8rem; color: var(--muted); }
#menu .links { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .75rem; }
#menu .links a:link, #menu .links a:visited {
  color: var(--muted); text-decoration: none;
}
.row { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: .75rem; }
.row button, button.rowbtn {
  font: inherit; font-size: .875rem; padding: .45rem .6rem;
  border: 1px solid var(--muted); border-radius: 8px;
  background: transparent; color: var(--text); cursor: pointer;
  min-height: 2.5rem; touch-action: manipulation;
}
.row button[aria-pressed="true"] {
  color: var(--accent); border-color: var(--accent); background: var(--accent-soft);
}
.code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: .95rem; line-height: 1.35; word-break: break-all;
  color: var(--accent); margin: .4rem 0; user-select: all;
}
.credlist { display: flex; flex-direction: column; gap: .35rem; }
.credrow { align-items: center; gap: .5rem; }
.credlbl { font-size: .875rem; color: var(--text); }
#ap-recover input[type="text"] {
  font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--muted); border-radius: 8px;
  padding: .45rem .6rem; min-height: 2.5rem; width: 100%;
}
#ap-recover-link {
  background: transparent; border: none; color: var(--muted);
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer; padding: .35rem; font-size: .875rem;
}
#ap-recover { margin-top: .5rem; }
button:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Footer */
.footer {
  position: fixed; bottom: 0; left: .75rem; right: .75rem;
  text-align: center; padding: .5rem 0;
  font-size: .875rem; line-height: 1.6;
  color: var(--muted); background: var(--bg);
  border-top: 1px solid var(--muted);
}
.footer a, .footer a:link, .footer a:visited,
.footer a:hover, .footer a:active, .footer a:focus {
  color: var(--muted); text-decoration: none;
}
.footer .footlink { font-size: 1.25rem; }