:root {
  --paper: #f4ecd8;
  --paper-deep: #ece2c5;
  --paper-soft: rgba(255, 250, 235, 0.55);
  --ink: #1c1815;
  --ink-soft: rgba(28, 24, 21, 0.7);
  --ink-mute: rgba(28, 24, 21, 0.42);
  --rule: rgba(28, 24, 21, 0.22);
  --rule-soft: rgba(28, 24, 21, 0.12);
  --accent: #b1122a;
  --accent-deep: #841020;
}

body[data-ceo="jensen"] { --accent: #5a8a00; --accent-deep: #3f6300; }
body[data-ceo="elon"]   { --accent: #1c1815; --accent-deep: #000000; }
body[data-ceo="sam"]    { --accent: #4a4a4a; --accent-deep: #1c1815; }
body[data-ceo="dimon"]  { --accent: #003087; --accent-deep: #021c50; }
body[data-ceo="lisa"]   { --accent: #c30013; --accent-deep: #840010; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse 60rem 40rem at 18% 8%, rgba(28, 24, 21, 0.045), transparent 70%),
    radial-gradient(ellipse 60rem 40rem at 88% 92%, rgba(28, 24, 21, 0.04), transparent 72%);
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 16px;
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.paper {
  width: min(74rem, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 2.6rem 0 4rem;
}

/* ───────── Banner / masthead ───────── */

.banner-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  padding: 0.4rem 0.1rem;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.banner-cell--right { margin-left: auto; }

.masthead {
  text-align: center;
  padding: 2.6rem 0 1.4rem;
}

.kicker {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.title {
  margin: 0.6rem 0 0.55rem;
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  font-weight: 600;
  font-size: clamp(3rem, 9.5vw, 6.4rem);
  line-height: 0.98;
  letter-spacing: -0.012em;
}

.tagline {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.05rem;
  color: var(--ink-soft);
}

.tagline em { font-style: italic; }

.double-rule {
  margin-top: 1.1rem;
  height: 5px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

/* ───────── Layout ───────── */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  grid-template-areas:
    "lede selector"
    "cover cover"
    "archive archive";
  gap: 3rem 4rem;
  margin-top: 3.2rem;
}

.lede-block      { grid-area: lede; }
.selector-block  { grid-area: selector; }
.cover-block     { grid-area: cover; }
.archive-block   { grid-area: archive; }

/* ───────── Common labels ───────── */

.dept-label {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}

/* ───────── Lede & form ───────── */

.lede-title {
  margin: 0.6rem 0 0;
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  font-weight: 600;
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  line-height: 1.02;
  letter-spacing: -0.005em;
}

.lede {
  margin: 1.05rem 0 0;
  font-size: 1.06rem;
  line-height: 1.85;
  max-width: 32rem;
}

.prompt-form {
  margin-top: 2rem;
  border-top: 1px solid var(--rule);
  padding-top: 1.6rem;
}

.prompt-label {
  display: block;
  margin: 0 0 0.7rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

textarea {
  display: block;
  width: 100%;
  min-height: 9rem;
  padding: 1.05rem 1.1rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper-soft);
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.72;
  resize: vertical;
  transition: border-color 160ms ease, background 160ms ease;
}

textarea::placeholder {
  color: var(--ink-mute);
  font-style: italic;
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 252, 240, 0.85);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.1rem;
}

button {
  border: 0;
  cursor: pointer;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  padding: 0.85rem 1.5rem;
  font-size: 0.74rem;
  border-radius: 0;
}

.primary-btn {
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
}
.primary-btn:hover { background: var(--accent); border-color: var(--accent); }

.secondary-btn,
.ghost-btn {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
}
.secondary-btn:hover,
.ghost-btn:hover { background: var(--ink); color: var(--paper); }

button:disabled { opacity: 0.45; cursor: progress; }

.status-line, .auth-hint, .error-line {
  margin: 0.85rem 0 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  line-height: 1.55;
  color: var(--ink-soft);
}
.auth-hint { color: var(--ink-mute); font-size: 0.68rem; }
.error-line {
  color: var(--accent);
  min-height: 1.2em;
  font-style: italic;
  font-family: "Cormorant Garamond", serif;
  font-size: 0.95rem;
  letter-spacing: 0;
  text-transform: none;
}

/* ───────── Editorial selector (name roll) ───────── */

.selector-title {
  margin: 0.6rem 0 0;
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  font-weight: 600;
  font-size: clamp(1.9rem, 3.6vw, 2.6rem);
  line-height: 1.02;
  letter-spacing: -0.005em;
}

.selector-sub {
  margin: 0.75rem 0 1.4rem;
  font-size: 0.94rem;
  line-height: 1.7;
  color: var(--ink-soft);
  max-width: 22rem;
}

.name-roll {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--ink);
}

.name-card {
  display: grid;
  grid-template-columns: 2.8rem 1fr auto;
  align-items: baseline;
  gap: 0.8rem;
  padding: 0.95rem 0.5rem;
  border-bottom: 1px solid var(--rule);
  position: relative;
  transition: background 200ms ease, padding-left 220ms ease;
}

.name-card .num {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--ink-mute);
  transition: color 160ms ease;
}

.name-card .surname {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: 1.7rem;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--ink);
  transition: color 160ms ease, transform 220ms ease;
}

.name-card .accent-tag {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-mute);
  transition: color 160ms ease;
}

.name-card.is-active {
  background: var(--ink);
  padding-left: 1rem;
}

.name-card.is-active .num,
.name-card.is-active .accent-tag {
  color: rgba(244, 236, 216, 0.6);
}

.name-card.is-active .surname {
  color: var(--paper);
  transform: translateX(0.25rem);
}

.name-card.is-final {
  background: var(--ink);
  padding-left: 1.1rem;
}
.name-card.is-final .num,
.name-card.is-final .accent-tag {
  color: rgba(244, 236, 216, 0.7);
}
.name-card.is-final .surname {
  color: var(--paper);
  transform: translateX(0.3rem);
}

.ghost-btn { margin-top: 1.6rem; }

.picked-badge {
  margin-top: 1.7rem;
  padding-top: 1.05rem;
  border-top: 1px solid var(--rule);
}
.picked-label {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
#pickedName {
  display: block;
  margin-top: 0.35rem;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: 1.18rem;
  line-height: 1.4;
}

/* ───────── Cover (result) ───────── */

.cover-block {
  border-top: 1px solid var(--ink);
  padding-top: 2.2rem;
}

.cover-section-label {
  margin: 0 0 1.4rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: center;
}

.result-card {
  position: relative;
  padding: 2.4rem 2.2rem 2.6rem;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  transition: background 240ms ease, color 240ms ease, border-color 240ms ease;
}

.result-card.is-empty {
  border-style: dashed;
  border-color: var(--rule);
  background: transparent;
}

.result-card[data-ceo="neutral"] {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--ink);
}
.result-card[data-ceo="jensen"] {
  background: #76b900;
  color: #0a1500;
  border-color: #0a1500;
}
.result-card[data-ceo="elon"] {
  background: #0c0c0c;
  color: #f4ecd8;
  border-color: #0c0c0c;
}
.result-card[data-ceo="sam"] {
  background: #ffffff;
  color: #1c1815;
  border-color: #1c1815;
}
.result-card[data-ceo="dimon"] {
  background: #003087;
  color: #f4ecd8;
  border-color: #003087;
}
.result-card[data-ceo="lisa"] {
  background: #e0001b;
  color: #fff5ed;
  border-color: #840010;
}

.result-topline {
  display: flex;
  justify-content: space-between;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.cover-rule {
  margin: 0.8rem 0 1.5rem;
  height: 5px;
  border-top: 2px solid currentColor;
  border-bottom: 1px solid currentColor;
}

.cover-masthead {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-size: clamp(1.8rem, 4.4vw, 2.6rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: center;
}

.cover-mini-strip {
  margin: 0.45rem 0 2rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-align: center;
  opacity: 0.75;
}

.cover-slug {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  line-height: 1.55;
  text-align: center;
  opacity: 0.85;
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}

.ceo-name {
  margin: 1rem 0 0.4rem;
  text-align: center;
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  font-weight: 700;
  font-size: clamp(3.4rem, 8vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: -0.012em;
}

.ceo-accent {
  margin: 0;
  font-size: 1rem;
  line-height: 1.7;
  text-align: center;
  font-style: italic;
  font-family: "Cormorant Garamond", serif;
  opacity: 0.78;
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
}

.cover-blurb-grid {
  margin-top: 2.2rem;
  padding-top: 1.5rem;
  border-top: 1px solid currentColor;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.2rem;
}

.cover-blurb {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.72;
}

.scenario-block,
.response-block {
  margin-top: 1.8rem;
  padding-top: 1.3rem;
  border-top: 1px solid currentColor;
}

.scenario-label,
.response-label {
  margin: 0 0 0.6rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  opacity: 0.7;
}

.scenario-echo {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.8;
}

.response-text {
  margin: 0;
  padding: 0;
  border: 0;
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  line-height: 1.55;
}

.response-text::before { content: "“"; margin-right: 0.06em; }
.response-text::after  { content: "”"; margin-left: 0.06em; }

.cover-foot {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid currentColor;
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.7;
}

/* ───────── Archive ───────── */

.archive-block {
  border-top: 1px solid var(--ink);
  padding-top: 2.2rem;
}

.archive-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.text-btn {
  background: none;
  border: 0;
  color: var(--accent);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 0.3em;
}
.text-btn:hover { color: var(--accent-deep); }

.archive-title {
  margin: 0.55rem 0 0;
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  font-weight: 600;
  font-size: clamp(1.9rem, 3.4vw, 2.4rem);
  line-height: 1.05;
  letter-spacing: -0.005em;
}

.archive-sub {
  margin: 0.75rem 0 1.4rem;
  font-size: 0.94rem;
  line-height: 1.7;
  color: var(--ink-soft);
}

.history-empty {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  color: var(--ink-mute);
  text-align: center;
  padding: 1.4rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.history-list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--ink);
}

.history-item {
  display: grid;
  gap: 0.4rem;
  padding: 1.05rem 0.3rem;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  font-family: inherit;
  letter-spacing: normal;
  text-transform: none;
}

.history-item:hover { background: rgba(28, 24, 21, 0.04); }

.history-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.history-ceo {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1;
}

.history-scenario {
  font-size: 0.94rem;
  line-height: 1.6;
}

.history-response {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 0.96rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

/* ───────── Colophon ───────── */

.colophon {
  margin-top: 4.2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--ink);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.64rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* ───────── Responsive ───────── */

@media (max-width: 64rem) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "lede"
      "selector"
      "cover"
      "archive";
    gap: 2.6rem;
  }

  .selector-sub { max-width: none; }
}

@media (max-width: 44rem) {
  .paper {
    width: min(100% - 1.4rem, 40rem);
    padding: 1.6rem 0 3rem;
  }

  .masthead { padding: 1.6rem 0 1rem; }

  .banner-strip {
    font-size: 0.6rem;
    gap: 0.85rem;
  }
  .banner-cell--right { margin-left: 0; }

  .result-card {
    padding: 1.5rem 1.2rem 1.7rem;
  }

  .cover-blurb-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .name-card {
    grid-template-columns: 2.2rem 1fr;
    grid-template-rows: auto auto;
  }
  .name-card .accent-tag {
    grid-column: 2;
    grid-row: 2;
    margin-top: 0.2rem;
  }

  .action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .colophon {
    flex-direction: column;
    gap: 0.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
