:root {
  --paper: #f6f3ec;
  --card: #fbf9f4;
  --ink: #1b1a17;
  --muted: #5c574d;
  --line: #d6cfbf;
  --rule: #1b1a17;
  --accent: #a92e1c;
  --on: #efe8da;
  --serif: 'Alegreya', Georgia, 'Times New Roman', serif;
  --label: 'Alegreya Sans SC', 'Gill Sans', 'Trebuchet MS', sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151411;
    --card: #1b1a16;
    --ink: #ece6d8;
    --muted: #a8a091;
    --line: #38342c;
    --rule: #ece6d8;
    --accent: #ec7a62;
    --on: #24221d;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 18px/1.5 var(--serif); }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
h1:focus { outline: none; }
[hidden] { display: none !important; }

.top, .foot { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.top { padding-top: 14px; padding-bottom: 12px; border-bottom: 3px double var(--rule); }
.mark {
  font: 800 1.3rem/1 var(--label); letter-spacing: .06em; text-decoration: none; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
}
.mark::before {
  content: ''; width: 22px; height: 24px; background: var(--accent);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.foot { padding-top: 32px; padding-bottom: 40px; color: var(--muted); font-size: .95rem; }

/* One screen at a time, like an app. */
.screen { max-width: 680px; margin: 0 auto; padding: 32px 20px 8px; }
.screen.wide { max-width: 1100px; }
.sheet-bar { max-width: 680px; }
h1 { font-weight: 700; font-size: clamp(1.75rem, 5vw, 2.3rem); line-height: 1.12; margin: 0 0 16px; }
h1.display { font-size: clamp(2.1rem, 7vw, 3rem); line-height: 1.05; letter-spacing: -.01em; }
.eyebrow { font: 500 .95rem/1.2 var(--label); letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.eyebrow a { text-decoration: none; border-bottom: 1px solid var(--line); }
.eyebrow a:hover { border-color: var(--ink); }
.lede { font-size: 1.1rem; margin: 0 0 22px; }
.fine { color: var(--muted); font-size: .95rem; }
.center { text-align: center; }
.section-title { font: 800 1rem/1 var(--label); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 40px 0 0; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.stack > * + * { margin-top: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px;
  font: 500 1.02rem/1 var(--label); letter-spacing: .05em; text-decoration: none; cursor: pointer;
  background: transparent; color: var(--ink); border: 1.5px solid var(--ink); border-radius: 0;
}
.btn:hover { background: var(--card); }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: var(--ink); opacity: .88; }
.link { font: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; color: inherit; min-height: 44px; }
.danger { color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.nav-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }
.nav-row .btn { min-width: 120px; }
.toast { min-height: 1.5em; color: var(--muted); font-style: italic; margin: 10px 0 0; }

.field { display: grid; gap: 6px; }
.field > span, legend { font: 500 .95rem/1.2 var(--label); letter-spacing: .05em; color: var(--muted); }
.field.slim { margin-bottom: 18px; }
input[type="text"], textarea {
  font: inherit; color: var(--ink); background: var(--card); width: 100%;
  border: 1px solid var(--line); border-bottom: 2px solid var(--ink); border-radius: 0; padding: 10px 12px; min-height: 48px;
}
textarea { resize: vertical; line-height: 1.4; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 10px; }

/* Home */
.hack-list { list-style: none; padding: 0; margin: 0; }
.hack-card { border-bottom: 1px solid var(--line); padding: 14px 0; display: grid; gap: 4px; }
.hack-main { text-decoration: none; display: grid; gap: 2px; min-height: 44px; }
.hack-name { font-weight: 700; font-size: 1.3rem; }
.hack-main:hover .hack-name { text-decoration: underline; }
.hack-meta { color: var(--muted); font-size: .98rem; }
.hack-actions { display: flex; flex-wrap: wrap; gap: 4px 20px; font: 500 .98rem/1 var(--label); letter-spacing: .04em; }
.hack-actions a, .hack-actions button { min-height: 44px; display: inline-flex; align-items: center; font: inherit; }

/* Choosing a base game */
.base-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.base-grid legend { grid-column: 1 / -1; }
.base-card {
  display: grid; gap: 3px; padding: 12px 14px; border: 1px solid var(--line); background: var(--card);
  cursor: pointer; position: relative; border-left: 3px solid var(--line);
}
.base-card input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.base-card:has(input:checked) { border-color: var(--ink); border-left-color: var(--accent); background: var(--on); }
.base-card:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
.base-name { font-weight: 700; line-height: 1.2; }
.base-blurb { color: var(--muted); font-size: .92rem; line-height: 1.35; }

/* Picking aspects */
.aspect-group { margin-top: 26px; }
.aspect-group legend { font: 800 .95rem/1 var(--label); letter-spacing: .14em; text-transform: uppercase; padding-bottom: 10px; border-bottom: 1px solid var(--line); width: 100%; margin-bottom: 0; }
.aspect { display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start; padding: 12px 6px; border-bottom: 1px solid var(--line); cursor: pointer; min-height: 48px; }
.aspect:hover { background: var(--card); }
.aspect input { width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--accent); cursor: pointer; }
.aspect-body { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.aspect-title { font-weight: 700; flex-basis: 100%; }
.aspect-ask { color: var(--muted); }
.tag {
  font: 800 .72rem/1 var(--label); letter-spacing: .1em; text-transform: uppercase; color: var(--accent);
  border: 1.5px solid var(--accent); padding: 4px 6px 5px; white-space: nowrap; vertical-align: 2px;
}
.tag.done { color: var(--muted); border-color: var(--line); }

/* One question */
.choices { display: grid; }
.choice {
  display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start; cursor: pointer;
  padding: 13px 12px 13px 10px; border: 1px solid var(--line); border-left: 3px solid var(--line);
  margin-bottom: -1px; background: transparent;
}
.choice:hover { background: var(--card); }
.choice.is-on { background: var(--on); border-left-color: var(--accent); position: relative; z-index: 1; border-color: var(--ink); border-left-color: var(--accent); }
.choice.keep { background: var(--card); }
.choice.keep.is-on { background: var(--on); }
.choice input {
  appearance: none; margin: 4px 0 0; width: 18px; height: 18px; border: 1.5px solid var(--ink); border-radius: 50%;
  display: grid; place-content: center; cursor: pointer; background: var(--card);
}
.choice input::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); transform: scale(0); }
.choice input:checked::before { transform: scale(1); }
.choice input:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.choice-body { display: grid; gap: 3px; min-width: 0; }
.choice-name { font-weight: 700; }
.choice-gist { color: var(--muted); }
.choice-full { display: none; gap: 6px; }
.choice.is-on .choice-full { display: grid; }
.choice.is-on .choice-gist { display: none; }
.choice-rules { color: var(--ink); }
.choice-seen { font: 500 .86rem/1.35 var(--label); letter-spacing: .03em; color: var(--muted); }
.choice textarea { margin-top: 4px; }
.or { font: 800 .85rem/1 var(--label); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 24px 0 10px; }
.note { margin-top: 24px; }

/* Extra rules */
.extra-row { display: grid; gap: 10px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.extra-row .link { justify-self: start; font-size: .95rem; }

@media (forced-colors: active) {
  .choice input { appearance: auto; }
  .choice input::before { display: none; }
}

/* ---- The rules sheet: a newspaper page of clippings. It stays paper-colored in dark mode, because it is what you print. ---- */
.paper {
  --ink: #16140f; --muted: #57514a; --line: #b9b0a0; --accent: #a92e1c;
  color: var(--ink); background: #fbf8f1; margin-top: 28px; padding: 28px 28px 20px;
  border: 1px solid #d9d1c1; box-shadow: 0 1px 0 #d9d1c1, 0 6px 22px rgba(0, 0, 0, .08);
  font-size: 16px; line-height: 1.42;
}
.masthead { text-align: center; margin-bottom: 18px; }
.ear, .dateline {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; margin: 0;
  font: 500 .82rem/1.3 var(--label); letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.ear { border-bottom: 1px solid var(--ink); padding-bottom: 6px; }
.title { font: 800 clamp(2rem, 7vw, 3.6rem)/1 var(--serif); letter-spacing: -.01em; margin: 14px 0 12px; text-wrap: balance; }
.dateline { border-top: 3px double var(--ink); border-bottom: 1px solid var(--ink); padding: 6px 0; }

.clips { columns: 3 240px; column-gap: 18px; }
.clip {
  break-inside: avoid; display: block; margin: 0 0 18px;
  border: 1px solid var(--ink); background: #fffdf8; padding: 12px 14px 12px;
}
.clip p { margin: 0 0 .5em; }
.clip p:last-child { margin-bottom: 0; }
.kicker { font: 800 .72rem/1 var(--label) !important; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px !important; }
.clip h3 { margin: 0 0 4px; font-family: var(--serif); text-wrap: balance; }
.clip.w3 { border-top: 5px solid var(--ink); }
.clip.w3 h3 { font-size: 1.85rem; line-height: 1.02; font-weight: 800; }
.clip.w2 h3 { font-size: 1.38rem; line-height: 1.1; font-weight: 700; }
.clip.w1 h3 { font: 800 1rem/1.15 var(--label); letter-spacing: .06em; text-transform: uppercase; }
.deck { font-style: italic; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.addendum { border-left: 2px solid var(--accent); padding-left: 10px; margin: 8px 0; }
.was { font: 500 .8rem/1.3 var(--label); letter-spacing: .04em; color: var(--muted); border-top: 1px dotted var(--line); padding-top: 6px; margin-top: 8px !important; }
.empty { text-align: center; color: var(--muted); font-style: italic; padding: 30px 0; }
.colophon { text-align: center; font: 500 .78rem/1 var(--label); letter-spacing: .08em; color: var(--muted); border-top: 1px solid var(--ink); padding-top: 8px; margin-top: 4px; }

@media (max-width: 560px) {
  body { font-size: 17px; }
  .screen { padding-top: 24px; }
  .paper { padding: 18px 14px 14px; margin-left: -6px; margin-right: -6px; }
  .ear, .dateline { justify-content: center; }
  .nav-row .btn { flex: 1; min-width: 0; }
}

@media print {
  @page { margin: 12mm; }
  body { background: #fff; }
  .top, .foot, .sheet-bar, .screen > :not(.paper) { display: none !important; }
  .screen { max-width: none; padding: 0; }
  .paper { margin: 0; padding: 0 1px 0 0; border: 0; box-shadow: none; background: #fff; font-size: 9.6pt; }
  .clip { background: #fff; }
  .title { font-size: 30pt; }
  .clips { columns: 3; column-gap: 5mm; }
  .clip { margin-bottom: 5mm; }
  .clip.w3 h3 { font-size: 17pt; }
  .clip.w2 h3 { font-size: 13pt; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
