@font-face {
  font-family: "Inter Variable";
  src: url("/static/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "C64 Keyboard";
  src: url("/static/fonts/C64Keyboard-Regular.ttf") format("truetype");
  font-display: swap;
}

/* Theme: light by default; dark follows the OS unless the user picked a
   theme (html[data-theme], set by theme.js before first paint). */
:root {
  color-scheme: light;
  --bg: #fbfaf7;
  --fg: #1c1b18;
  --muted: #6b6860;
  --line: #e7e3d8;
  --card: #ffffff;
  --accent: #F7CA54;          /* fills: primary buttons, highlights */
  --accent-hover: #f0bb2f;
  --accent-fg: #1c1b18;       /* text on accent fills */
  --link: #8a6300;            /* accent-derived text color with AA contrast on light */
  --focus: #b07f00;
  --ok: #18794e;
  --warn: #9a5500;
  --bad: #c62828;
  --code: #f3f0e7;
  --radius: 8px;
  --sans: "Inter Variable", Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --fg: #edebe5; --muted: #9c998f; --line: #2d2b27; --card: #1b1a18;
    --accent-hover: #ffd76f; --link: #F7CA54; --focus: #F7CA54;
    --ok: #4cc38a; --warn: #f0a050; --bad: #ff6b6b; --code: #24221f;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --fg: #edebe5; --muted: #9c998f; --line: #2d2b27; --card: #1b1a18;
  --accent-hover: #ffd76f; --link: #F7CA54; --focus: #F7CA54;
  --ok: #4cc38a; --warn: #f0a050; --bad: #ff6b6b; --code: #24221f;
}
/* C64 theme: the boot-screen palette (light blue on blue, yellow accent) and
   the C64 keyboard font. Text is lightened from the stock palette for
   contrast; the font has one weight, so no synthetic bold, and it sets small,
   so the base size goes up a step. */
:root[data-theme="c64"] {
  color-scheme: dark;
  --bg: #40318d; --fg: #d2ccff; --muted: #a39ae8; --line: #6c5eb5; --card: #352879;
  --accent: #F7CA54; --accent-hover: #ffd76f; --accent-fg: #352879;
  --link: #F7CA54; --focus: #F7CA54;
  --ok: #9ad284; --warn: #e0a070; --bad: #ff9a90; --code: #2c2266;
  --sans: "C64 Keyboard", ui-monospace, monospace;
  --mono: "C64 Keyboard", ui-monospace, monospace;
}
:root[data-theme="c64"] body { font-size: 16px; line-height: 1.6; font-synthesis: none; }
:root[data-theme="c64"] * { letter-spacing: 0 !important; border-radius: 0 !important; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
/* Column layout keeps the footer at the bottom of short pages. */
body { min-height: 100vh; display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; width: 100%; }
body { font: 15px/1.5 var(--sans); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
input, select, textarea, button { font-family: var(--sans); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
code, pre, .mono { font-family: var(--mono); font-size: .88em; }
code { background: var(--code); padding: .1em .35em; border-radius: 4px; }

.top { display: flex; align-items: center; gap: 1.5rem; padding: .75rem 1rem; border-bottom: 1px solid var(--line);
  flex-wrap: wrap; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.brand-row { display: flex; align-items: center; gap: .6rem; }
.logo { display: block; height: 1.5rem; width: auto; border-radius: 4px; }
.brand { font-weight: 700; color: var(--fg); letter-spacing: -.01em; }
.brand span { background: var(--accent); color: var(--accent-fg); margin-left: .3em; padding: .05em .4em; border-radius: 5px; }
.brand:hover { text-decoration: none; }
nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; flex: 1; }
nav a { color: var(--muted); }
nav a.active { color: var(--fg); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
nav a.active:hover { text-decoration: none; }
nav .spacer { flex: 1; }
nav .who { color: var(--muted); font-size: .85rem; }

main { max-width: 1040px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
main.narrow { max-width: 560px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.stat .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.35rem; font-weight: 650; margin-top: .15rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

.btn, button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--fg);
  padding: .4rem .8rem; border-radius: 6px; display: inline-block; line-height: 1.4; }
.btn:hover, button:hover { border-color: var(--muted); text-decoration: none; }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.btn.primary:hover, button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
button.link { border: 0; background: none; color: var(--link); padding: 0; }
button.link.danger { color: var(--bad); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.table-wrap { overflow-x: auto; }

form.stack { display: grid; gap: .9rem; max-width: 520px; }
label { display: grid; gap: .3rem; font-size: .9rem; }
label .hint { color: var(--muted); font-size: .8rem; }
input, select, textarea { font: inherit; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 6px;
  background: var(--card); color: var(--fg); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: -1px; }
input[type=checkbox] { width: auto; }
.inline { display: flex; gap: .5rem; align-items: end; flex-wrap: wrap; }
.inline label { flex: 1; min-width: 120px; }

.badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .78rem; border: 1px solid var(--line);
  color: var(--muted); white-space: nowrap; }
.badge.running, .badge.active, .badge.paid { color: var(--ok); border-color: currentColor; }
.badge.paused, .badge.draining, .badge.pending, .badge.creating, .badge.starting, .badge.stopping,
.badge.provisioning, .badge.registered, .badge.deleting, .badge.terminating { color: var(--warn); border-color: currentColor; }
.badge.error, .badge.disabled { color: var(--bad); border-color: currentColor; }

pre.console { background: #0f0f0e; color: #d9d9d2; padding: .9rem; border-radius: var(--radius); max-height: 420px;
  overflow: auto; white-space: pre-wrap; word-break: break-all; margin: 0; }
pre.script { background: var(--code); padding: .9rem; border-radius: var(--radius); overflow-x: auto; }
.error-box { border: 1px solid var(--bad); color: var(--bad); border-radius: var(--radius); padding: .6rem .8rem; margin: .5rem 0; }
.note { border-left: 3px solid var(--accent); padding: .3rem .8rem; color: var(--muted); margin: .75rem 0; }

.hero { padding: 3rem 0 2rem; max-width: 640px; }
.hero h1 { font-size: 2.2rem; line-height: 1.15; letter-spacing: -.02em; }
.hero p { font-size: 1.1rem; color: var(--muted); }
table.plans { max-width: 760px; }
table.plans tbody th { text-transform: none; letter-spacing: 0; font-size: inherit; color: var(--muted); font-weight: 400; }
table.plans tr.group th { color: var(--fg); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; padding-top: 1.1rem; }
table.plans thead th:not(:first-child) { color: var(--fg); font-weight: 650; font-size: .95rem; text-transform: none; letter-spacing: 0; }
table.plans .current { background: color-mix(in srgb, var(--accent) 12%, transparent); }

.toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg);
  padding: .6rem 1rem; border-radius: 6px; max-width: calc(100% - 2rem); z-index: 10; }
.toast.bad { background: var(--bad); color: #fff; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }

@media (max-width: 640px) {
  .hide-sm { display: none; }
  .hero h1 { font-size: 1.7rem; }
  /* Row 1: brand + theme picker; row 2: navigation, scrollable if needed. */
  .top { gap: .5rem 1rem; padding-bottom: 0; }
  .theme-select { margin-left: auto; }
  .brand-row { gap: .45rem; }
  nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; gap: 1.1rem; overflow-x: auto; padding: .35rem 0 .6rem; white-space: nowrap; }
  nav .spacer { flex: 1 0 0; }
}
.mt { margin-top: 1rem; }
.my { margin: 1rem 0; }
.bad { color: var(--bad); }

/* Theme switcher */
.theme-select { width: auto; padding: .25rem .4rem; font-size: .85rem; color: var(--muted); background: var(--card); }

/* Footer */
.foot { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 1rem; padding: 0 1rem 1.5rem; font-size: .85rem; }
.foot a { color: var(--muted); }
.badge.beta { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 650;
  text-transform: uppercase; letter-spacing: .08em; font-size: .7rem; padding: .1rem .55rem; }
.card.new-key { border: 2px solid var(--accent); }
.card.domain { margin: .5rem 0; }
.card.domain details { margin-top: .5rem; }
.dns-records { margin: .5rem 0 0; }
.dns-records dd { word-break: normal; }
.dns-records code { word-break: break-all; }

/* Help page */
.help { max-width: 760px; }
.help h2 { scroll-margin-top: 4.5rem; }
.help li { margin: .3rem 0; }
.help .kv { margin-bottom: 1rem; }
.help .kv dd { word-break: normal; }
.toc { display: flex; flex-wrap: wrap; gap: .4rem 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--line); }
@media (max-width: 640px) { .help h2 { scroll-margin-top: 6.5rem; } .help .kv { grid-template-columns: 1fr; gap: .1rem; } .help .kv dd { margin-bottom: .5rem; } }
