:root {
  --bg: #EFEBDF;
  --panel: #FFFDF7;
  --ink: #1B1830;
  --muted: #5E5878;
  --line: #1B1830;
  --rule: #CFC8B6;
  --shadow: #1B1830;
  --pink: #E8338F;
  --cyan: #1F8FD6;
  --gold: #F2B705;
  --on-color: #14121F;
  --focus: #1F8FD6;
  --arcade: "Press Start 2P", "Courier New", monospace;
  --pixel: "Pixelify Sans", "Trebuchet MS", sans-serif;
  --head: "Chakra Petch", "Trebuchet MS", sans-serif;
  --label: "Silkscreen", "Courier New", monospace;
  --body: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E0C1D;
    --panel: #18152C;
    --ink: #F1EEFF;
    --muted: #A49EC8;
    --line: #3B3563;
    --rule: #2A2548;
    --shadow: #000000;
    --pink: #FF4FD8;
    --cyan: #3CF2FF;
    --gold: #FFD23F;
    --focus: #3CF2FF;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 4rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.5;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.page {
  max-width: 78rem;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 4rem;
}

/* Masthead */

.ears {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 1.5rem;
}

.ear {
  margin: 0 0 0.5rem;
  font-family: var(--label);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--muted);
}
.ear-right { text-align: right; }

.nameplate {
  margin: 0;
  font-family: var(--arcade);
  font-weight: 400;
  font-size: clamp(1.5rem, 4.6vw, 3.25rem);
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0.06em 0.06em 0 var(--pink), 0.12em 0.12em 0 var(--cyan);
}
.nameplate a { text-decoration: none; }

.dateline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
  padding: 0.5rem 0.75rem;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--label);
  font-size: 0.8125rem;
}
.dateline p { margin: 0; text-align: center; }

.cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 0.4em;
  vertical-align: -0.12em;
  background: var(--gold);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.dateline button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0.125rem 0;
  cursor: pointer;
  white-space: nowrap;
  opacity: 0.75;
}
.dateline button:hover:not(:disabled) { opacity: 1; color: var(--gold); }
.dateline button:disabled { opacity: 0.25; cursor: default; }

.latest[hidden] { display: none; }
.latest {
  display: block;
  margin-top: 0.5rem;
  font-family: var(--label);
  font-size: 0.75rem;
  text-align: center;
}

/* Release countdown */

.countdown[hidden] { display: none; }
.countdown {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  margin-top: 1rem;
}

.countdown-label {
  flex: none;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0 0.75rem;
  background: var(--pink);
  color: var(--on-color);
  font-family: var(--arcade);
  font-size: 0.625rem;
  font-weight: 400;
  line-height: 1.6;
  text-transform: uppercase;
}

.countdown-list {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  scrollbar-width: thin;
  list-style: none;
  margin: 0;
  padding: 0 0.375rem 0.5rem 0;
}

.countdown-list a {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "days name" "days date";
  column-gap: 0.625rem;
  align-items: center;
  min-width: 13rem;
  max-width: 18rem;
  padding: 0.5rem 0.75rem 0.5rem 0.625rem;
  background: var(--panel);
  border: 2px solid var(--line);
  border-left: 6px solid var(--c);
  box-shadow: 3px 3px 0 var(--shadow);
  text-decoration: none;
}
.countdown-list a:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--shadow); }

.cd-days {
  grid-area: days;
  font-family: var(--arcade);
  font-size: 0.6875rem;
  line-height: 1.5;
  color: var(--c);
  white-space: nowrap;
}
.cd-name {
  grid-area: name;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-family: var(--head);
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.2;
}
.cd-date {
  grid-area: date;
  font-family: var(--label);
  font-size: 0.6875rem;
  color: var(--muted);
}

/* Section index */

.sections {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 1rem -1.5rem 0;
  padding: 0.625rem 1.5rem 0.75rem;
  background: var(--bg);
  border-bottom: 2px solid var(--line);
}
.sections::-webkit-scrollbar { display: none; }

.tab {
  flex: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--label);
  font-size: 0.8125rem;
  color: var(--ink);
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: 3px 3px 0 var(--shadow);
  padding: 0.375rem 0.75rem;
  cursor: pointer;
}
.tab:hover { border-color: var(--c, var(--pink)); }
.tab .count { color: var(--muted); font-size: 0.6875rem; }
.tab[aria-pressed="true"] {
  background: var(--c, var(--ink));
  color: var(--on-color);
  box-shadow: none;
  transform: translate(3px, 3px);
}
.tab[aria-pressed="true"]:not([style]) { color: var(--bg); }
.tab[aria-pressed="true"] .count { color: inherit; opacity: 0.75; }

/* Stories */

.story { position: relative; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin: 0 0 0.5rem;
}

.kicker,
.tag {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  font-family: var(--label);
  font-size: 0.6875rem;
  line-height: 1.4;
  color: var(--on-color);
  background: var(--c);
}
.tag--pick { background: var(--gold); }
.sym { font-family: var(--body); margin-right: 0.35em; }
.tag--new { background: var(--cyan); }

.headline {
  margin: 0;
  font-family: var(--head);
  font-weight: 600;
  font-size: 1.1875rem;
  line-height: 1.2;
  text-wrap: balance;
}
.headline a { text-decoration: none; }
.headline a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: var(--c); }

.summary {
  margin: 0.4rem 0 0;
  font-size: 0.9375rem;
  line-height: 1.55;
}

.byline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.125rem 0.75rem;
  margin: 0.5rem 0 0;
  font-family: var(--label);
  font-size: 0.6875rem;
  color: var(--muted);
}
.byline .src { color: var(--ink); }
.byline a { text-underline-offset: 2px; }

.related { margin-top: 0.5rem; font-size: 0.8125rem; }
.related summary { cursor: pointer; color: var(--muted); font-family: var(--label); font-size: 0.6875rem; }
.related summary:hover { color: var(--ink); }
.related ul { margin: 0.5rem 0 0; padding-left: 1.125rem; }
.related li { margin: 0.25rem 0; }
.related .src { color: var(--muted); }

.story.is-read { opacity: 0.5; }
.story.is-read:hover { opacity: 1; }

/* Size variants */

.story--lead {
  padding: 1.5rem 1.75rem 1.75rem;
  background: var(--panel);
  border: 3px solid var(--line);
  box-shadow: 7px 7px 0 var(--c);
}
.story--lead .headline {
  font-size: clamp(1.875rem, 3.8vw, 3rem);
  font-weight: 700;
  line-height: 1.05;
}
.story--lead .summary {
  margin-top: 1rem;
  font-size: 1.125rem;
  line-height: 1.6;
  max-width: 40em;
}
.dropcap::first-letter {
  float: left;
  margin: 0.08em 0.4em 0 0;
  padding: 0.12em 0.22em;
  font-family: var(--arcade);
  font-size: 2.1em;
  line-height: 1;
  color: var(--on-color);
  background: var(--c);
}

.story--major .headline { font-size: 1.4375rem; line-height: 1.15; }

.story--brief .headline { font-size: 1.0625rem; font-weight: 600; }

.story.is-pick:not(.story--lead) .headline a { text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 3px; text-underline-offset: 4px; }

/* Front page */

.front {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 2.25rem;
  padding: 2rem 0 0.5rem;
}
.front.no-rail { grid-template-columns: 1fr; }

.front-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.75rem 2rem;
  margin-top: 2.25rem;
}
.front-grid > .story {
  padding-top: 1rem;
  border-top: 3px solid var(--c);
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.box {
  position: relative;
  padding: 1.25rem 1.25rem 1.125rem;
  background: var(--panel);
  border: 3px solid var(--line);
  box-shadow: 5px 5px 0 var(--shadow);
}
.box-head {
  position: absolute;
  top: -0.85rem;
  left: 0.875rem;
  margin: 0;
  padding: 0.25rem 0.5rem;
  font-family: var(--arcade);
  font-size: 0.625rem;
  font-weight: 400;
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--on-color);
  background: var(--cyan);
}
.box-text { margin: 0.375rem 0 0; font-size: 0.9375rem; line-height: 1.6; }

.box--dialog {
  border-radius: 6px;
  border-width: 4px;
  border-style: double;
  border-color: var(--ink);
  padding-bottom: 1.5rem;
}
.box--dialog .box-text { margin-top: 0.5rem; }
.dialog-arrow {
  position: absolute;
  right: 0.875rem;
  bottom: 0.25rem;
  font-size: 0.75rem;
  color: var(--pink);
  animation: blink 1.1s steps(1) infinite;
}

.box--pick { box-shadow: 5px 5px 0 var(--gold); }
.box--pick .box-head { background: var(--gold); }
.box-title {
  display: block;
  margin-top: 0.5rem;
  font-family: var(--head);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.2;
  text-decoration: none;
}
.box-title:hover { text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; }

.box--shop { box-shadow: 5px 5px 0 var(--pink); }
.box--shop .box-head { background: var(--pink); }
.shop-list { list-style: none; margin: 0.375rem 0 0; padding: 0; }
.shop-list li { padding: 0.75rem 0; border-top: 2px dashed var(--rule); }
.shop-list li:first-child { padding-top: 0.25rem; border-top: 0; }
.shop-list li:last-child { padding-bottom: 0; }
.shop-list a {
  font-family: var(--head);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.25;
  text-decoration: none;
}
.shop-list a:hover { text-decoration: underline; }
.shop-list p { margin: 0.25rem 0 0; font-size: 0.875rem; line-height: 1.5; color: var(--muted); }

/* Sections */

.section { margin-top: 3.5rem; }

.section-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0;
  padding: 0.625rem 1rem;
  background: var(--c);
  color: var(--on-color);
  box-shadow: 5px 5px 0 var(--shadow);
}
.stage {
  font-family: var(--arcade);
  font-size: 0.625rem;
  font-weight: 400;
  line-height: 1.5;
  text-transform: uppercase;
  white-space: nowrap;
}
.section-name {
  font-family: var(--pixel);
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.1;
}
.section-head .count {
  margin-left: auto;
  font-family: var(--label);
  font-size: 0.75rem;
  font-weight: 400;
  white-space: nowrap;
}

.section-top {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 2rem;
  padding: 1.75rem 0 1.5rem;
  border-bottom: 2px dashed var(--rule);
}
.section-top.solo { grid-template-columns: 1fr; }
.section-top > .story--major .headline { font-size: clamp(1.5rem, 2.6vw, 2.125rem); line-height: 1.1; }
.section-top > .story--major .summary { font-size: 1.0625rem; line-height: 1.6; max-width: 38em; }

.briefs {
  display: flex;
  flex-direction: column;
  padding-left: 2rem;
  border-left: 2px dashed var(--rule);
}
.briefs > .story { padding: 0.75rem 0; border-top: 2px dashed var(--rule); }
.briefs > .story:first-child { padding-top: 0; border-top: 0; }
.briefs > .story:last-child { padding-bottom: 0; }

.columns {
  columns: 16rem;
  column-gap: 2.5rem;
  column-rule: 2px dashed var(--rule);
  padding-top: 1.5rem;
}
.columns > .story {
  break-inside: avoid;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 2px dashed var(--rule);
}

/* Misc */

.empty {
  margin: 3rem auto 0;
  max-width: 32em;
  font-size: 1.0625rem;
  text-align: center;
}
.empty p { margin: 0 0 0.5rem; }
.empty .hint { color: var(--muted); font-size: 0.9375rem; }

.footer {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 2px solid var(--line);
  font-family: var(--label);
  font-size: 0.6875rem;
  color: var(--muted);
  text-align: center;
}
.footer p { margin: 0; }
.footer p::after { content: " · Game over? Come back tomorrow."; }
.footer p:empty::after { content: none; }
.failed { margin-top: 0.5rem; }
.failed summary { cursor: pointer; }
.failed p { margin: 0.5rem 0 0; }

@media (max-width: 52rem) {
  .front, .section-top { grid-template-columns: 1fr; }
  .briefs { padding: 1rem 0 0; border-left: 0; border-top: 2px dashed var(--rule); }
  .briefs > .story:first-child { padding-top: 0; }
  .sections { justify-content: flex-start; }
}

@media (max-width: 36rem) {
  .page { padding: 1.25rem 1rem 3rem; }
  .sections { margin: 1rem -1rem 0; padding: 0.625rem 1rem 0.75rem; }
  .ears { grid-template-columns: 1fr; gap: 0; }
  .ear { display: none; }
  .nameplate { font-size: clamp(1.125rem, 6.2vw, 1.625rem); }
  .dateline { font-size: 0.6875rem; padding: 0.5rem; }
  .countdown { flex-direction: column; gap: 0.5rem; }
  .countdown-label { align-self: flex-start; padding: 0.375rem 0.625rem; }
  .story--lead { padding: 1.125rem 1.125rem 1.25rem; box-shadow: 5px 5px 0 var(--c); }
  .story--lead .summary { font-size: 1.0625rem; }
  .front-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .story--major .headline { font-size: 1.3125rem; }
  .section-head { flex-wrap: wrap; gap: 0.25rem 0.75rem; padding: 0.5rem 0.75rem; }
  .section-name { font-size: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; animation: none !important; }
}
