:root {
  color-scheme: light;
  --ink: #161512;
  --muted: #6d665d;
  --paper: #f5f0e6;
  --paper-deep: #e7dcc9;
  --line: #cbbca3;
  --red: #9f2f24;
  --teal: #1f6f68;
  --gold: #bd8c36;
  --white: #fffaf1;
  --shadow: 0 24px 80px rgba(52, 40, 24, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(22, 21, 18, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(22, 21, 18, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 34px 34px;
  font-family: Georgia, "Times New Roman", serif;
}

button,
a {
  font: inherit;
}

a {
  color: var(--teal);
}

.shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(245, 240, 230, 0.9);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--white);
  background: var(--ink);
  border: 2px solid var(--red);
  font-size: 15px;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.brand-name,
.brand-subtitle {
  display: block;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-button,
.slot-button,
.choice-button,
.archive-button {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.nav-button {
  min-height: 38px;
  padding: 8px 13px;
}

.nav-button:hover,
.slot-button:hover,
.choice-button:hover,
.archive-button:hover {
  transform: translateY(-1px);
  border-color: var(--ink);
}

.brief-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 32vw);
  align-items: stretch;
  min-height: 320px;
  border-bottom: 1px solid var(--line);
}

.brief-copy {
  padding: clamp(42px, 8vw, 96px) clamp(22px, 7vw, 112px);
}

.eyebrow,
.section-label {
  margin: 0 0 13px;
  color: var(--red);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 840px;
  font-size: clamp(40px, 7vw, 86px);
  line-height: 0.92;
  letter-spacing: 0;
}

.deck {
  max-width: 720px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.45;
}

.brief-visual {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 34% 26%, rgba(189, 140, 54, 0.36), transparent 32%),
    linear-gradient(135deg, var(--ink), #4b241f 48%, var(--teal));
}

.brief-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(45deg, transparent 44%, rgba(255, 250, 241, 0.22) 45%, rgba(255, 250, 241, 0.22) 48%, transparent 49%),
    linear-gradient(-45deg, transparent 44%, rgba(255, 250, 241, 0.14) 45%, rgba(255, 250, 241, 0.14) 48%, transparent 49%);
  background-size: 54px 54px;
  mix-blend-mode: screen;
}

.signal-grid {
  position: absolute;
  inset: auto 36px 36px auto;
  display: grid;
  grid-template-columns: repeat(4, 34px);
  gap: 8px;
}

.signal-grid span {
  aspect-ratio: 1;
  border: 1px solid rgba(255, 250, 241, 0.52);
  background: rgba(255, 250, 241, 0.1);
}

.signal-grid span:nth-child(3n) {
  background: var(--gold);
}

.signal-grid span:nth-child(5n) {
  background: var(--red);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(250px, 360px) minmax(0, 1fr);
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.source-panel,
.problem-panel {
  background: rgba(255, 250, 241, 0.78);
}

.source-panel {
  padding: clamp(20px, 4vw, 36px);
}

.problem-panel {
  padding: clamp(24px, 5vw, 64px);
}

.slot-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.slot-button {
  min-height: 36px;
  padding: 8px 12px;
}

.slot-button[aria-selected="true"] {
  color: var(--white);
  background: var(--red);
  border-color: var(--red);
}

.meta-list {
  display: grid;
  gap: 18px;
  margin: 0;
}

.meta-list div {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.meta-list dt {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.meta-list dd {
  margin: 5px 0 0;
  font-size: 17px;
}

.source-summary {
  margin: 26px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.stimulus {
  margin: 0;
  max-width: 940px;
  font-size: clamp(21px, 2.4vw, 31px);
  line-height: 1.34;
}

.question-stem {
  max-width: 920px;
  margin: 34px 0 18px;
  font-size: clamp(22px, 2.8vw, 36px);
  line-height: 1.12;
}

.choices {
  display: grid;
  gap: 12px;
  max-width: 980px;
}

.choice-button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  min-height: 68px;
  width: 100%;
  padding: 16px;
  text-align: left;
  line-height: 1.35;
  border-left: 5px solid var(--line);
}

.choice-letter {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--white);
  background: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
}

.choice-button[data-state="selected"] {
  border-color: var(--teal);
  background: #edf5ed;
}

.choice-button[data-state="correct"] {
  border-color: var(--teal);
  background: #e5f2ea;
}

.choice-button[data-state="incorrect"] {
  border-color: var(--red);
  background: #f7e9e2;
}

.result {
  max-width: 900px;
  margin-top: 22px;
  padding: 16px 18px;
  background: var(--ink);
  color: var(--white);
  line-height: 1.45;
}

.explanation-band {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(260px, 0.7fr);
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.explanation-band > div {
  padding: clamp(22px, 4vw, 42px);
  background: var(--paper);
}

.explanation-band p {
  line-height: 1.55;
}

.answer-review {
  display: grid;
  gap: 12px;
}

.answer-review details {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.answer-review summary {
  cursor: pointer;
  font-weight: 700;
}

.archive-band {
  padding: clamp(28px, 5vw, 60px) clamp(22px, 7vw, 112px);
}

.archive-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.archive-heading h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 46px);
}

.archive-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.archive-button {
  min-height: 78px;
  padding: 15px;
  text-align: left;
}

.archive-button strong,
.archive-button span {
  display: block;
}

.archive-button span {
  color: var(--muted);
  margin-top: 4px;
  font-size: 14px;
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 860px) {
  .topbar,
  .brief-band,
  .workspace,
  .explanation-band {
    display: block;
  }

  .topbar {
    position: static;
  }

  .topnav {
    flex: 0 0 auto;
  }

  .brief-visual {
    min-height: 180px;
  }

  .source-panel {
    border-bottom: 1px solid var(--line);
  }

  .archive-heading {
    display: block;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-subtitle {
    max-width: 220px;
  }

  .choice-button {
    grid-template-columns: 30px minmax(0, 1fr);
    padding: 13px;
  }
}
