:root {
  --bg: #f6f4f1;
  --surface: #ffffff;
  --surface-2: #f0ede8;
  --text: #1d1b19;
  --muted: #6b655d;
  --line: #e1dcd4;
  --accent: #7a2433;
  --accent-text: #ffffff;
  --accent-soft: #f3e3e5;
  --ok: #2f6b3a;
  --ok-soft: #e2f0e4;
  --bad: #9a2a1d;
  --bad-soft: #f8e1dc;
  --focus: #b0475a;
  --radius: 10px;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141213;
    --surface: #1d1a1b;
    --surface-2: #262223;
    --text: #ece7e3;
    --muted: #a39b94;
    --line: #36302f;
    --accent: #c9566a;
    --accent-text: #160c0e;
    --accent-soft: #3a2026;
    --ok: #8fd19b;
    --ok-soft: #1f3324;
    --bad: #f0a091;
    --bad-soft: #3d221d;
    --focus: #e07a8c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141213; --surface: #1d1a1b; --surface-2: #262223; --text: #ece7e3; --muted: #a39b94; --line: #36302f;
  --accent: #c9566a; --accent-text: #160c0e; --accent-soft: #3a2026; --ok: #8fd19b; --ok-soft: #1f3324;
  --bad: #f0a091; --bad-soft: #3d221d; --focus: #e07a8c; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

header.site { padding: 40px 0 20px; }
h1 { margin: 0 0 8px; font-size: 28px; letter-spacing: -0.01em; }
.lede { margin: 0; max-width: 70ch; color: var(--muted); }
footer.site { color: var(--muted); font-size: 13px; padding-top: 24px; padding-bottom: 40px; }

/* landing page: one card per game */
.game-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 8px 0 16px; }
.game-card {
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
.game-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-text { display: grid; gap: 2px; padding: 10px 14px 12px; border-top: 1px solid var(--line); }
.card-text span { font-size: 12.5px; color: var(--muted); }
/* the logos sit on a light "title-screen mist", as on the games' own title screens */
.tab-logo, .hero-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 45%, #ffffff 0%, #f1f1f4 55%, #d9d9e0 100%);
}
.tab-logo { height: 130px; padding: 10px 14px; }
.tab-logo img, .hero-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* game pages */
.game-head { padding-top: 20px; }
.crumbs { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; margin-bottom: 14px; }
.crumbs > a { color: var(--muted); text-decoration: none; }
.crumbs > a::before { content: "\2190  "; }
.crumbs > a:hover { color: var(--text); }
.others { display: flex; gap: 8px; }
.others a {
  display: flex; align-items: center; height: 34px; padding: 4px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: #f1f1f4; opacity: 0.8;
}
.others a:hover { opacity: 1; border-color: var(--accent); }
.others img { max-height: 100%; max-width: 120px; }
.hero-logo { height: 150px; padding: 14px 20px; border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 18px; }

.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 24px 0; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.panel { display: grid; gap: 16px; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.step h2 { margin: 0 0 4px; font-size: 17px; }
.hint { margin: 0 0 12px; color: var(--muted); font-size: 13px; }

.discs { display: grid; gap: 10px; }
.drop {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface-2);
  cursor: pointer;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-label { font-weight: 600; }
.file-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.drop-action { color: var(--accent); font-weight: 600; font-size: 13px; }
.badge { font-size: 12px; border-radius: 999px; padding: 2px 10px; }
.badge:empty { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.wait { background: var(--surface); color: var(--muted); }

.field-row { display: flex; gap: 10px; align-items: end; margin-bottom: 8px; }
.field-row label { flex: 1; display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input[type="text"], input[type="number"], select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  min-width: 0;
}
.mono { font-family: var(--mono); font-size: 14px; }
button { font: inherit; }
button.ghost, a.download {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  text-decoration: none;
}
button.primary, a.download.primary {
  background: var(--accent);
  color: var(--accent-text);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 9px 22px;
  font-weight: 600;
  cursor: pointer;
}
button:disabled { opacity: 0.55; cursor: default; }

.groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.group { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 12px; margin: 0; min-width: 0; }
.group.wide { grid-column: 1 / -1; }
.group legend { padding: 0 4px; }
.group-title { display: none; }
.group-body { display: grid; gap: 8px; margin-top: 4px; }
.check { display: flex; gap: 8px; align-items: flex-start; }
.check input { margin-top: 3px; }
.master { font-weight: 600; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ctl { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ctl select { max-width: 240px; }
.num { width: 80px; }
.suffix { color: var(--muted); font-size: 13px; white-space: nowrap; }
.note { margin: 10px 0 0; color: var(--muted); font-size: 12.5px; }
.group :disabled + * { color: var(--muted); }

.go-row { display: flex; align-items: center; gap: 14px; }
.bar { flex: 1; height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.status { margin-top: 10px; font-size: 13px; color: var(--muted); font-family: var(--mono); overflow-wrap: anywhere; }
.results { margin-top: 14px; }
.downloads { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.downloads .size { margin-left: 8px; opacity: 0.8; font-weight: 400; }
.spoiler {
  max-height: 420px; overflow: auto; background: var(--surface-2); border-radius: 8px; padding: 12px;
  font: 12px/1.45 var(--mono); white-space: pre;
}
details summary { cursor: pointer; color: var(--muted); }

@media (max-width: 720px) {
  .game-cards { grid-template-columns: 1fr; }
  .tab-logo { height: 100px; }
  .hero-logo { height: 110px; }
  .groups { grid-template-columns: 1fr; }
  .drop { grid-template-columns: 1fr auto; }
  .drop .file-name { grid-column: 1 / -1; grid-row: 2; }
  .field-row { flex-wrap: wrap; }
}
