:root {
  --bg: #f6f1e7;
  --paper: #fffdf8;
  --ink: #23211c;
  --muted: #6b6558;
  --line: #ddd4c2;
  --accent: #1d5c8c;
  --accent-ink: #fff;
  --ok: #2f6b3a;
  --err: #a2321f;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1a17;
    --paper: #24221e;
    --ink: #ece6d8;
    --muted: #a59d8c;
    --line: #3b3830;
    --accent: #6fb0e3;
    --accent-ink: #10202c;
    --ok: #8fd19b;
    --err: #f08b78;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-bottom: 48px; }
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); line-height: 1.2; margin: 24px 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; margin: 40px 0 12px; }
h3 { font-size: 1.05rem; margin: 24px 0 8px; }
.lede { font-size: 1.12rem; color: var(--muted); max-width: 46em; margin-top: 0; }
.answer { font-size: 1.12rem; max-width: 46em; margin-top: 0; }
.muted { color: var(--muted); }
.crumbs { font-size: 0.9rem; color: var(--muted); margin-top: 20px; }
.crumbs a { color: inherit; }

/* header / footer */
.site-header { border-bottom: 1px solid var(--line); background: var(--paper); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 16px; }
.logo { font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.1rem; }
.logo-mark { color: var(--accent); }
.site-header nav { display: flex; gap: 18px; font-size: 0.95rem; }
.site-header nav a { color: var(--ink); text-decoration: none; white-space: nowrap; }
.site-header nav a:hover { color: var(--accent); }
.site-footer { border-top: 1px solid var(--line); background: var(--paper); padding: 24px 0 32px; font-size: 0.92rem; }
.footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 24px; }
.site-footer h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 12px 0 6px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 3px 0; }
.footer-legal { color: var(--muted); margin-top: 20px; }
.footer-tools ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 24px; }

/* tool */
.tool { margin: 20px 0 8px; }
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 36px 16px; text-align: center; cursor: pointer;
  background: var(--paper); border: 2px dashed var(--line); border-radius: var(--radius);
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.drag { border-color: var(--accent); }
.drop.drag { background: color-mix(in srgb, var(--accent) 8%, var(--paper)); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:focus-within { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.drop-main { font-size: 1.25rem; font-weight: 600; }
.drop-sub { color: var(--muted); font-family: var(--mono); font-size: 0.9rem; word-break: break-word; }
.drop .btn { margin-top: 10px; }
.privacy-line { font-size: 0.9rem; color: var(--muted); margin: 8px 0 0; text-align: center; }

.btn {
  display: inline-block; border: 0; border-radius: 8px; padding: 10px 18px;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; font-size: 0.98rem;
  cursor: pointer; text-decoration: none; line-height: 1.3;
}
.btn:disabled { opacity: .6; cursor: progress; }
.btn-secondary { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }

.status { margin: 16px 0 0; padding: 12px 14px; border-radius: 8px; background: var(--paper); border: 1px solid var(--line); }
.status-error { border-color: var(--err); color: var(--err); }
.status-info { border-color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 0; }
.actions:empty { display: none; }
.result { margin-top: 16px; }
.summary, .note { color: var(--muted); font-size: 0.92rem; }

/* tables (spreadsheets, archive listings) */
.table-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
table.sheet, table.files { border-collapse: collapse; font-size: 0.88rem; min-width: 100%; }
table.sheet td, table.sheet th { border: 1px solid var(--line); padding: 3px 8px; white-space: nowrap; }
table.sheet thead th { position: sticky; top: 0; background: var(--bg); color: var(--muted); font-weight: 600; }
table.sheet tbody th { position: sticky; left: 0; background: var(--bg); color: var(--muted); font-weight: 500; text-align: right; }
table.files th, table.files td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; }
table.files .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.files .path { font-family: var(--mono); font-size: 0.85rem; word-break: break-all; }
table.files .row-actions { white-space: nowrap; text-align: right; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.tab { border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 6px; padding: 4px 12px; font: inherit; font-size: 0.9rem; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* documents */
.doc-page {
  background: #fff; color: #111; padding: clamp(16px, 5vw, 56px); border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,.15); max-width: 816px; margin: 0 auto;
  font-family: "Times New Roman", Times, serif; font-size: 12pt; line-height: 1.35; overflow-wrap: break-word;
}
.doc-page p { margin: 0 0 0.2em; white-space: pre-wrap; tab-size: 8; }
.doc-header { color: #666; font-size: 0.9em; border-bottom: 1px dashed #ccc; margin-bottom: 1em; padding-bottom: .5em; }
.wri-picture { color: #888; font-style: italic; font-family: system-ui, sans-serif; font-size: 10pt; }
.chm { display: grid; grid-template-columns: minmax(180px, 280px) 1fr; gap: 12px; height: 75vh; }
.chm-toc { overflow: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 8px 4px; font-size: 0.9rem; }
.chm-toc ul { list-style: none; margin: 0; padding-left: 14px; }
.chm-toc > ul { padding-left: 6px; }
.chm-toc a { text-decoration: none; display: block; padding: 2px 4px; border-radius: 4px; }
.chm-toc a:hover { background: var(--bg); }
.chm-frame { width: 100%; height: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.chm-title { margin-top: 0; }
@media (max-width: 700px) {
  .chm { grid-template-columns: 1fr; grid-template-rows: 30vh 70vh; height: auto; }
}
.xps-pages { display: flex; flex-direction: column; gap: 16px; align-items: center; }
.xps-page { position: relative; width: 100%; max-width: 900px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.xps-page img { display: block; width: 100%; height: auto; }
.page-num { position: absolute; bottom: -1.4em; right: 0; font-size: 0.8rem; color: var(--muted); }
.picture { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; text-align: center; }
.picture svg { max-width: 100%; height: auto; }

/* players */
.player { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.player-title { font-weight: 600; margin-bottom: 4px; word-break: break-word; }
.player-meta { color: var(--muted); font-size: 0.9rem; margin-bottom: 8px; }
.player-controls { display: flex; align-items: center; gap: 12px; }
.player-controls input[type=range] { flex: 1; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.swf-stage { background: #000; border-radius: 8px; overflow: hidden; }
.swf-player { display: block; width: 100%; aspect-ratio: 4 / 3; max-height: 80vh; }
.password-form { margin: 12px 0; }
.password-form input { font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); }

/* content */
.steps { padding-left: 1.3em; }
.steps li { margin: 6px 0; }
.era { font-style: italic; color: var(--muted); }
.faq details { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; padding: 0 14px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 12px 0; }
.faq details p { margin: 0 0 14px; }
.related { padding-left: 1.2em; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.card { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink); height: 100%; }
.card:hover { border-color: var(--accent); }
.card-ext { font-family: var(--mono); font-size: 0.85rem; color: var(--accent); }
.card-name { font-weight: 600; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 32px; }
.plain { padding-left: 1.2em; }
.prose { max-width: 42em; }

/* consent banner */
#consent { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--paper); border-top: 1px solid var(--line); padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: center; font-size: 0.92rem; box-shadow: 0 -2px 8px rgba(0,0,0,.08); }
#consent p { margin: 0; max-width: 40em; }
body.consent-open { padding-bottom: 96px; }

.doc-frame { display: block; width: 100%; max-width: 860px; margin: 0 auto; min-height: 60vh; border: 1px solid var(--line); border-radius: 4px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.hlp-search { width: calc(100% - 8px); margin: 0 4px 8px; padding: 6px 8px; font: inherit; font-size: 0.9rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); }
.chm-toc li.current > a { background: var(--bg); font-weight: 600; }
.hlp-topic { overflow: auto; max-width: none; height: 100%; margin: 0; padding: 20px 28px; font-family: Arial, Helvetica, sans-serif; font-size: 11pt; }
.hlp-topic p { white-space: pre-wrap; margin: 0 0 .5em; }
.hlp-topic a { color: #1a5d1a; }
.hlp-table td { border: 1px solid #ccc; padding: 4px 8px; vertical-align: top; }
.media-out { display: block; width: 100%; max-width: 860px; margin: 0 auto; background: #000; border-radius: 8px; }
audio.media-out { background: transparent; }
.doc-mono { font-family: "Courier New", Courier, monospace; font-size: 11pt; }
.doc-mono p { white-space: pre-wrap; margin: 0; }
.page-break { border: 0; border-top: 1px dashed #bbb; margin: 1.5em 0; }
.c64-screen { background: #40318d; color: #7869c4; border: 18px solid #7869c4; border-radius: 6px; padding: 12px 16px; font: 15px/1.35 "Courier New", monospace; text-transform: uppercase; overflow-x: auto; white-space: pre; margin: 0 0 16px; }
.wri-img { max-width: 100%; height: auto; }

/* after a file opens */
.after { margin: 14px 0 0; font-size: 0.95rem; color: var(--muted); }
.vote { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 2px 10px; margin: 0 2px; font-size: 1rem; cursor: pointer; }
.vote:hover { border-color: var(--accent); }
.status-error a { color: inherit; font-weight: 600; }

/* hubs and the extension index */
.cards-wide { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card-desc { color: var(--muted); font-size: 0.88rem; line-height: 1.45; margin-top: 4px; }
h3 a, .site-footer h3 a { color: inherit; text-decoration: none; }
h3 a:hover { color: var(--accent); }
.letters { font-family: var(--mono); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.table-tall { max-height: none; }
.ext-table th.path { font-weight: 600; white-space: nowrap; }
@media (max-width: 560px) { .site-header nav { gap: 12px; font-size: 0.88rem; } }
@media (max-width: 430px) { .site-header .nav-about { display: none; } }

/* ZX Spectrum tapes */
.zx-figure { margin: 0 0 16px; text-align: center; }
.zx-screen { width: 100%; max-width: 512px; image-rendering: pixelated; border: 24px solid #000; border-radius: 4px; background: #000; }
.tape-info { display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; margin: 0 0 12px; font-size: 0.92rem; }
.tape-info dt { color: var(--muted); }
.tape-info dd { margin: 0; white-space: pre-line; }
.tape-listing { margin: 12px 0; }
.tape-listing summary { cursor: pointer; font-weight: 600; }
.zx-listing { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; white-space: pre; }
.tape-files .path { word-break: normal; white-space: nowrap; }
.sample-line { font-size: 0.9rem; color: var(--muted); margin: 4px 0 0; text-align: center; }
.updated { font-size: 0.85rem; margin-top: 2rem; }
