/* New Salem — the website. The same deep blues as the game's menu. */
:root {
  --bg: #0b0b16;
  --bg2: #14142b;
  --panel: #151528;
  --panel-2: #1b1b34;
  --edge: #2c2c4a;
  --edge-2: #3c3c5c;
  --ink: #e8e6f0;
  --sheet: #1f1f3e;
  --sheet-edge: #3e3e66;
  --muted: #9a96b4;
  --accent: #f8b800;
  --accent-ink: #1a1200;
  --blue: #24243e;
  --blue-hover: #30304f;
  --ok: #58d854;
  --danger: #f05050;
  --pixel: 'Press Start 2P', ui-monospace, monospace;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font: 16px/1.6 var(--body);
  background: #0b0b20; /* the sky itself is .backdrop (assets/backdrop.css) */
}
a { color: var(--accent); }
a:hover { color: #ffd850; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--pixel); font-weight: 400; line-height: 1.4; letter-spacing: 0.02em; }
h1 { font-size: clamp(20px, 4vw, 30px); margin: 0 0 16px; }
h2 { font-size: clamp(15px, 2.6vw, 20px); margin: 0 0 18px; color: var(--accent); }
h3 { font-size: 12px; margin: 0 0 10px; }

/* ---------- header ---------- */
.site-top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px clamp(16px, 4vw, 40px);
  background: rgba(16, 16, 32, 0.94);
  border-bottom: 2px solid var(--edge);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--accent); font: 16px/1 var(--pixel); }
.brand img { width: 40px; height: 40px; }
.site-nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.site-nav a {
  padding: 8px 12px;
  color: var(--ink);
  text-decoration: none;
  font: 10px/1 var(--pixel);
  border: 2px solid transparent;
}
.site-nav a:hover { border-color: var(--edge-2); background: var(--blue); }
.site-nav a[aria-current='page'] { color: var(--accent); border-color: var(--edge); background: var(--panel); }
.site-nav .nav-deluxe { color: var(--accent-ink); background: var(--accent); }
.site-nav .nav-deluxe:hover { background: #ffd040; color: var(--accent-ink); }

.site-main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: clamp(20px, 4vw, 48px) 16px; }
.site-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 18px clamp(16px, 4vw, 40px);
  border-top: 2px solid var(--edge);
  background: rgba(16, 16, 32, 0.94);
  color: var(--muted);
  font-size: 13px;
}
.foot-links { margin-left: auto; display: flex; gap: 16px; }

.flash { max-width: 1120px; margin: 16px auto 0; padding: 12px 16px; border: 2px solid var(--ok); background: #102414; color: #c8f8c0; width: calc(100% - 32px); }
.flash.error { border-color: var(--danger); background: #2a1010; color: #ffd0d0; }

/* ---------- the content boxes: lighter, so the page doesn't sit right on the pattern ---------- */
.sheet {
  background: linear-gradient(180deg, #23234a 0%, var(--sheet) 120px);
  border: 2px solid var(--sheet-edge);
  box-shadow: inset 0 0 0 2px #15152c, inset 0 4px 0 2px rgba(255, 255, 255, 0.04), 0 0 0 4px rgba(5, 5, 14, 0.55), 0 18px 40px rgba(0, 0, 0, 0.45);
  padding: clamp(20px, 4vw, 40px);
}
.sheet .panel, .sheet .compare { background: #161630; }
/* a narrow page (log in, sign up…): the box is the form's own size, with no box inside it */
.sheet:has(> .narrow) { max-width: 660px; margin-inline: auto; }
.sheet > .narrow { max-width: none !important; }
.sheet > .narrow > .panel { background: none; border: 0; box-shadow: none; padding: 0; }

/* ---------- panels, buttons, forms ---------- */
.panel {
  background: var(--panel);
  border: 2px solid var(--edge);
  box-shadow: inset 0 0 0 2px #0b0b16, 0 10px 30px rgba(0, 0, 0, 0.35);
  padding: clamp(18px, 3vw, 28px);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  font: 11px/1.2 var(--pixel);
  color: var(--ink);
  background: var(--blue);
  border: 2px solid var(--edge-2);
  box-shadow: 3px 3px 0 #000;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--blue-hover); color: var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: none; }
.btn.primary { color: var(--accent-ink); background: var(--accent); border-color: #fcd860; }
.btn.primary:hover { background: #ffd040; color: var(--accent-ink); }
.btn.danger { border-color: #8a2a2a; }
.btn.danger:hover { background: #5a1c1c; }
.btn.small { padding: 7px 10px; font-size: 9px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

form.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 14px; }
input, select, textarea {
  font: 15px/1.4 var(--body);
  color: var(--ink);
  background: #0b0b16;
  border: 2px solid var(--edge);
  padding: 10px 12px;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.narrow { max-width: 460px; margin: 0 auto; }
.row-gap { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ---------- home: the hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(20px, 4vw, 48px); align-items: center; }
.hero-logo { width: 100%; height: auto; object-fit: contain; max-width: 460px; justify-self: center; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.55)); }
.hero .kicker { font: 10px/1.6 var(--pixel); color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; margin: 0 0 14px; }
.hero h1 { color: var(--ink); }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lead { font-size: 18px; color: #d0cee0; margin: 0 0 24px; }
.hero .row-gap { margin-top: 8px; }

.section { margin-top: clamp(24px, 4vw, 40px); }
.section > .section-intro { max-width: 720px; color: #d0cee0; margin: -6px 0 26px; }

/* features */
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.feature { padding: 20px; }
.feature img { width: 64px; height: 64px; image-rendering: pixelated; display: block; margin-bottom: 12px; }
.feature p { margin: 0; color: #cfcde0; font-size: 15px; }

/* screenshots and videos: shown when the files are there, placeholders until then */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.media-box { position: relative; aspect-ratio: 16 / 9; border: 2px solid var(--edge); background: #0b0b16; overflow: hidden; }
.media-box img, .media-box video, .media-box iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; display: block; }
.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
  background: repeating-linear-gradient(45deg, #121226 0 12px, #16162c 12px 24px);
  font-size: 13px;
  padding: 12px;
}
.placeholder b { font: 10px/1.4 var(--pixel); color: var(--ink); }
.placeholder code { font: 12px var(--mono); color: var(--accent); }
.videos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.media-caption { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.media-caption b { color: var(--ink); font-weight: 600; }

/* thumbnails that open the viewer */
.thumb { display: block; width: 100%; padding: 0; cursor: zoom-in; font: inherit; color: inherit; transition: border-color .15s, transform .15s; }
.thumb:hover, .thumb:focus-visible { border-color: var(--accent); transform: translateY(-2px); outline: none; }
.thumb img { transition: transform .3s; }
.thumb:hover img { transform: scale(1.03); }
.video-thumb { cursor: pointer; }
.video-thumb video { pointer-events: none; }
.play { position: absolute; left: 50%; top: 50%; width: 68px; height: 68px; margin: -34px 0 0 -34px; border-radius: 50%; background: rgba(10, 10, 24, 0.72); border: 2px solid var(--accent); transition: transform .15s, background .15s; }
.play::after { content: ''; position: absolute; left: 27px; top: 20px; border: 14px solid transparent; border-left: 22px solid var(--accent); border-right: 0; }
.video-thumb:hover .play, .video-thumb:focus-visible .play { transform: scale(1.1); background: rgba(10, 10, 24, 0.9); }

/* the pop-up viewer */
body.viewer-open { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 1000; background: rgba(6, 6, 14, 0.94); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 16px 16px; }
.viewer[hidden] { display: none; }
.viewer-stage { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; }
.viewer-img, .viewer-video { max-width: min(100%, 1400px); max-height: 100%; border: 2px solid var(--edge); background: #000; display: block; }
.viewer-video { width: min(100%, 1400px); }
.viewer-img[hidden], .viewer-video[hidden] { display: none; }
.viewer-cap { margin: 12px 0 0; color: var(--ink); text-align: center; font-size: 15px; }
.viewer-count { color: var(--muted); margin-left: 8px; font-size: 13px; }
.viewer-btn { position: absolute; background: rgba(20, 20, 40, 0.8); color: var(--ink); border: 2px solid var(--edge-2); width: 48px; height: 48px; font-size: 26px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.viewer-btn:hover, .viewer-btn:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
.viewer-btn[hidden] { display: none; }
.viewer-close { top: 10px; right: 12px; font-size: 20px; }
.viewer-prev { left: 12px; top: 50%; margin-top: -24px; }
.viewer-next { right: 12px; top: 50%; margin-top: -24px; }
@media (max-width: 600px) { .viewer-prev, .viewer-next { top: auto; bottom: 10px; margin: 0; } .viewer { padding-bottom: 68px; } }

/* the two versions, side by side */
.compare { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border: 2px solid var(--edge); }
.compare th, .compare td { padding: 14px 16px; border-bottom: 1px solid var(--edge); text-align: left; vertical-align: middle; }
.compare thead th { font: 11px/1.5 var(--pixel); background: var(--panel-2); }
.compare thead th small { display: block; font: 13px var(--body); color: var(--muted); margin-top: 4px; }
.compare thead th.deluxe { color: var(--accent); background: #24203a; }
.compare td.deluxe { background: rgba(248, 184, 0, 0.05); }
.compare th.c, .compare td.c { text-align: center; width: 22%; }
.compare tbody tr:last-child td, .compare tbody tr:last-child th { border-bottom: 0; }
.compare tbody th { font-weight: 400; color: #d8d6e8; }
.yes { color: var(--ok); font-weight: 700; }
.no { color: #6a6888; }
.price { font: 18px/1 var(--pixel); color: var(--accent); }
.compare tfoot td { padding: 18px 16px; background: var(--panel-2); border-top: 2px solid var(--edge); }

.cta { text-align: center; }
/* home: the educational discount */
.edu { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: clamp(16px, 3vw, 28px); align-items: start; border-color: #6a5a2a; background: linear-gradient(180deg, #2a2640 0%, var(--sheet) 160px); }
.edu-icon { width: 88px; height: 88px; image-rendering: pixelated; background: #0f0f22; border: 2px solid var(--edge); padding: 10px; }
.edu p { color: #d0cee0; margin: 0 0 14px; max-width: 760px; }
.edu .btn { margin-top: 8px; }
/* the contact form's hidden field (only robots fill it in) */
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.cta p { color: #d0cee0; margin: 0 0 20px; }

/* ---------- account ---------- */
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.badge { display: inline-block; padding: 5px 9px; font: 9px/1 var(--pixel); border: 2px solid var(--edge-2); background: var(--blue); }
.badge.deluxe { color: var(--accent-ink); background: var(--accent); border-color: #fcd860; }
.badge.admin { color: #fff; background: #4a3a8a; border-color: #6a5ab8; }
.badge.off { color: #ffd0d0; background: #5a1c1c; border-color: #8a2a2a; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 16px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; word-break: break-all; }
.checklist { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 6px; }
.checklist li::before { content: '✓  '; color: var(--ok); font-weight: 700; }

/* ---------- admin ---------- */
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 10px 10px; border-bottom: 1px solid var(--edge); text-align: left; white-space: nowrap; }
.admin-table th { font: 9px/1.4 var(--pixel); color: var(--muted); background: var(--panel-2); }
.admin-table tr.sel td { background: #1f1f3c; }
.admin-table form { display: inline; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { padding: 14px 16px; }
.stat b { display: block; font: 18px/1.3 var(--pixel); color: var(--accent); }
.stat span { color: var(--muted); font-size: 13px; }

/* home: the real New Salem — the history, and how the game tells it */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.timeline li {
  display: grid;
  grid-template-columns: 64px minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 18px;
  background: #161630;
  border: 2px solid var(--edge);
}
.tl-icon { width: 64px; height: 64px; object-fit: contain; image-rendering: pixelated; background: #0f0f22; border: 2px solid var(--edge); padding: 6px; }
.tl-when { display: block; font: 9px/1.4 var(--pixel); color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 6px; }
.tl-fact h3 { color: var(--ink); margin-bottom: 8px; }
.tl-fact p, .tl-game p { margin: 0; font-size: 15px; color: #cfcde0; }
.tl-game { padding: 12px 14px; background: rgba(248, 184, 0, 0.06); border-left: 3px solid var(--accent); }
.tl-game b { display: block; font: 9px/1.4 var(--pixel); color: var(--accent); margin-bottom: 6px; }
.history-note { margin-top: 18px; max-width: 760px; }

@media (max-width: 760px) {
  .timeline li { grid-template-columns: 48px minmax(0, 1fr); gap: 12px; padding: 14px; }
  .tl-icon { width: 48px; height: 48px; padding: 4px; }
  .tl-game { grid-column: 1 / -1; }
  .edu { grid-template-columns: 1fr; }
  .edu-icon { width: 64px; height: 64px; padding: 6px; }
  .hero { grid-template-columns: 1fr; }
  .hero-logo { max-width: 300px; order: -1; }
  .brand span { display: none; }
  .compare th, .compare td { padding: 10px 8px; font-size: 14px; }
  .compare thead th { font-size: 9px; }
}

/* admin: a save slot and its backup copies */
.save-slot { margin-bottom: 10px; }
.save-slot .hint { margin-bottom: 4px; }
details.backups { margin: 0 0 6px; }
details.backups summary { cursor: pointer; color: var(--accent); font-size: 0.9em; }
details.backups table { margin-top: 6px; font-size: 0.85em; }
details.backups td form { display: inline; }

/* admin: messages from the contact form */
.message { padding: 12px 0; border-top: 1px solid var(--edge); }
.message.new { border-left: 3px solid var(--accent); padding-left: 12px; }
.message-body { margin: 8px 0 0; color: #d8d6e8; white-space: normal; overflow-wrap: anywhere; }
