:root {
  color-scheme: light;
  --ink: #101217;
  --paper: #f3ecdc;
  --white: #fffdf5;
  --gold: #f5c84b;
  --lime: #d7ff3f;
  --blue: #3677e0;
  --red: #e45745;
  --green: #13a6a1;
  --muted: #55584f;
  --shadow: 6px 6px 0 var(--ink);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(90deg, rgba(16, 18, 23, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(16, 18, 23, 0.06) 1px, transparent 1px),
    linear-gradient(135deg, rgba(54, 119, 224, 0.14), transparent 38%),
    var(--paper);
  background-size: 28px 28px, 28px 28px, auto, auto;
}

button,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

.desk-header,
.desk-shell {
  width: min(1500px, calc(100vw - 28px));
  margin: 0 auto;
}

.desk-header {
  padding: 22px 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
}

.desk-header span,
.desk-copy > span,
.frame-head span,
.frame-card span,
.agent-scorebook-copy span,
.share-card-copy > span,
.gallery-head span,
.gallery-card span,
.desk-metric span,
.run-sheet span,
.column-head span,
.archive-card span,
.empty-card span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.desk-header h1 {
  margin: 2px 0 0;
  max-width: 980px;
  font-size: clamp(2.35rem, 7vw, 7.4rem);
  line-height: 0.84;
  letter-spacing: 0;
}

.desk-header nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.desk-header a,
.desk-actions button,
.gallery-actions button,
.archive-card button {
  border: 3px solid var(--ink);
  background: var(--white);
  color: var(--ink);
  min-height: 40px;
  padding: 0 11px;
  box-shadow: 3px 3px 0 var(--ink);
  font-weight: 950;
  text-decoration: none;
  text-transform: uppercase;
}

.desk-header a {
  display: grid;
  place-items: center;
}

.desk-shell {
  display: grid;
  gap: 14px;
  padding-bottom: 32px;
}

.desk-hero,
.run-sheet,
.season-report,
.share-card,
.report-gallery,
.wall-column,
.watch-frames,
.agent-scorebook,
.desk-metric {
  border: 4px solid var(--ink);
  background: var(--white);
  box-shadow: var(--shadow);
}

.desk-hero {
  min-height: 420px;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(300px, 0.92fr) minmax(420px, 1.08fr);
}

.desk-copy {
  padding: clamp(18px, 4vw, 42px);
  display: grid;
  align-content: end;
  gap: 12px;
  background:
    linear-gradient(135deg, rgba(245, 200, 75, 0.42), transparent 42%),
    var(--white);
}

.desk-copy strong {
  max-width: 720px;
  font-size: clamp(2.1rem, 6vw, 5.8rem);
  line-height: 0.86;
  letter-spacing: 0;
}

.desk-copy p,
.share-card-copy p,
.run-sheet p,
.archive-card p,
.empty-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 850;
  line-height: 1.28;
}

.desk-copy p {
  max-width: 720px;
  font-size: clamp(1rem, 2vw, 1.25rem);
}

.desk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.desk-actions button:first-child {
  background: var(--lime);
}

.desk-actions button:nth-child(2) {
  background: var(--gold);
}

.desk-actions button:nth-child(3) {
  background: color-mix(in srgb, var(--blue) 18%, var(--white));
}

.desk-copy output {
  width: fit-content;
  max-width: 100%;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--white);
  padding: 6px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 950;
}

.noun-rack {
  position: relative;
  min-height: 420px;
  background:
    linear-gradient(90deg, rgba(228, 87, 69, 0.2), transparent 38%, rgba(54, 119, 224, 0.22)),
    repeating-linear-gradient(0deg, rgba(16, 18, 23, 0.08) 0 2px, transparent 2px 24px),
    #fffdf5;
}

.noun-rack img {
  position: absolute;
  width: 23%;
  image-rendering: pixelated;
  filter: drop-shadow(7px 9px 0 rgba(16, 18, 23, 0.24));
}

.noun-rack img:nth-child(1) { left: 3%; top: 12%; width: 26%; }
.noun-rack img:nth-child(2) { left: 24%; top: 2%; width: 31%; }
.noun-rack img:nth-child(3) { right: 8%; top: 10%; width: 28%; }
.noun-rack img:nth-child(4) { left: 8%; bottom: 5%; width: 30%; }
.noun-rack img:nth-child(5) { left: 38%; bottom: 9%; width: 24%; }
.noun-rack img:nth-child(6) { right: 5%; bottom: 0; width: 32%; }

.desk-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.desk-metric {
  min-width: 0;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.desk-metric strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(1.4rem, 3vw, 2.6rem);
  line-height: 0.92;
}

.watch-frames,
.agent-scorebook {
  min-width: 0;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.watch-frames {
  background:
    linear-gradient(135deg, rgba(19, 166, 161, 0.18), transparent 46%),
    var(--white);
}

.agent-scorebook {
  grid-template-columns: minmax(260px, 0.34fr) minmax(0, 1fr) auto;
  align-items: end;
  background:
    linear-gradient(135deg, rgba(139, 92, 246, 0.14), transparent 48%),
    var(--white);
}

.frame-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.frame-head div,
.agent-scorebook-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.frame-head strong,
.agent-scorebook-copy strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(1.4rem, 3.4vw, 3.2rem);
  line-height: 0.92;
}

.frame-head p,
.agent-scorebook-copy p {
  margin: 0;
  color: var(--muted);
  font-weight: 850;
  line-height: 1.28;
}

.frame-head p {
  max-width: 470px;
  text-align: right;
}

.frame-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.frame-card {
  min-width: 0;
  border: 3px solid var(--ink);
  padding: 12px;
  display: grid;
  gap: 9px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--frame-color, var(--gold)) 26%, #fffdf5), transparent 62%),
    #fffdf5;
}

.frame-card strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(1.05rem, 2vw, 1.45rem);
  line-height: 1;
}

.frame-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
  line-height: 1.25;
}

.frame-card em {
  color: var(--ink);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 950;
}

.frame-actions,
.agent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.frame-actions a,
.frame-actions button,
.agent-actions a,
.agent-actions button {
  min-height: 34px;
  border: 2px solid var(--ink);
  background: var(--white);
  color: var(--ink);
  padding: 0 9px;
  box-shadow: 2px 2px 0 var(--ink);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 950;
  text-decoration: none;
  text-transform: uppercase;
}

.frame-actions a:first-child,
.agent-actions button {
  background: var(--lime);
}

.agent-scorebook pre {
  width: 100%;
  max-height: 220px;
  margin: 0;
  border: 3px solid var(--ink);
  background: #101217;
  color: #fffdf5;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 800 0.82rem/1.35 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.run-sheet {
  padding: 14px;
  display: grid;
  gap: 8px;
  background:
    linear-gradient(90deg, rgba(215, 255, 63, 0.3), transparent 52%),
    var(--white);
}

.run-sheet strong {
  font-size: clamp(1.2rem, 3vw, 2.2rem);
  line-height: 0.98;
}

.season-report {
  padding: 14px;
  display: grid;
  gap: 12px;
  background:
    linear-gradient(135deg, rgba(245, 200, 75, 0.2), transparent 44%),
    #fffdf5;
}

.report-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.report-head div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.report-head span,
.report-grid article > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.report-head strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(1.55rem, 4vw, 3.6rem);
  line-height: 0.92;
}

.report-head p,
.report-summary,
.report-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 850;
  line-height: 1.28;
}

.report-head p {
  max-width: 340px;
  text-align: right;
}

.report-summary {
  max-width: 1000px;
  font-size: 1rem;
}

.report-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) repeat(2, minmax(260px, 1fr));
  gap: 10px;
}

.report-grid article {
  min-width: 0;
  border: 3px solid var(--ink);
  padding: 10px;
  display: grid;
  align-content: start;
  gap: 8px;
  background: rgba(255, 253, 245, 0.92);
}

.report-table,
.report-stack {
  display: grid;
  gap: 7px;
}

.report-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  border-bottom: 2px solid rgba(16, 18, 23, 0.16);
  padding-bottom: 6px;
  font-size: 0.82rem;
  font-weight: 900;
}

.report-row b {
  border: 2px solid var(--ink);
  background: var(--gold);
  text-align: center;
}

.report-row strong {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.report-row em {
  color: var(--muted);
  font-style: normal;
}

.report-card {
  border: 2px solid var(--ink);
  padding: 8px;
  background: #fffdf5;
  display: grid;
  gap: 5px;
}

.report-card strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
  line-height: 1;
}

.report-card p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  font-size: 0.8rem;
}

.share-card {
  min-width: 0;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(260px, 0.34fr) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  background:
    linear-gradient(135deg, rgba(54, 119, 224, 0.16), transparent 46%),
    var(--white);
}

.share-card-copy {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.share-card-copy strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(1.55rem, 4vw, 3.8rem);
  line-height: 0.9;
}

.share-card canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 4px solid var(--ink);
  background: var(--paper);
  box-shadow: 4px 4px 0 var(--ink);
}

.report-gallery {
  min-width: 0;
  padding: 14px;
  display: grid;
  gap: 12px;
  background:
    linear-gradient(135deg, rgba(215, 255, 63, 0.2), transparent 46%),
    var(--white);
}

.gallery-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
}

.gallery-head div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.gallery-head strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(1.4rem, 3.4vw, 3.1rem);
  line-height: 0.92;
}

.gallery-head p {
  margin: 0;
  max-width: 420px;
  color: var(--muted);
  font-weight: 850;
  line-height: 1.28;
  text-align: right;
}

.gallery-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.gallery-card {
  min-width: 0;
  border: 3px solid var(--ink);
  padding: 8px;
  display: grid;
  gap: 8px;
  background: #fffdf5;
}

.gallery-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 2px solid var(--ink);
  background: var(--paper);
}

.gallery-card div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.gallery-card strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.95rem;
  line-height: 1;
}

.gallery-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.2;
}

.gallery-actions {
  display: flex !important;
  flex-wrap: wrap;
  gap: 7px;
}

.gallery-actions button {
  min-height: 32px;
  border-width: 2px;
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 0.7rem;
}

.card-view {
  background:
    linear-gradient(135deg, rgba(54, 119, 224, 0.18), transparent 45%),
    var(--paper);
}

.card-view .desk-header {
  align-items: center;
}

.card-view .desk-header h1 {
  max-width: 760px;
  font-size: clamp(2rem, 5vw, 5.6rem);
}

.card-view .desk-header nav,
.card-view .noun-rack,
.card-view .desk-metrics,
.card-view .watch-frames,
.card-view .agent-scorebook,
.card-view .run-sheet,
.card-view .season-report,
.card-view .report-gallery,
.card-view .wall-grid {
  display: none !important;
}

.card-view .desk-hero {
  min-height: auto;
  grid-template-columns: 1fr;
}

.card-view .desk-copy {
  align-content: start;
}

.card-view .desk-copy strong {
  max-width: 100%;
  font-size: clamp(1.8rem, 5vw, 4.4rem);
}

.card-view .share-card {
  grid-template-columns: 1fr;
}

.card-view .share-card-copy {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.card-view .share-card-copy p {
  text-align: right;
}

.frame-view .desk-header h1 {
  max-width: 820px;
  font-size: clamp(2rem, 5.4vw, 5.8rem);
}

.frame-view .desk-hero {
  min-height: auto;
  grid-template-columns: 1fr;
}

.frame-view .noun-rack {
  display: none;
}

.frame-view .desk-copy {
  align-content: start;
}

.scoreboard-view .watch-frames,
.scoreboard-view .agent-scorebook,
.scoreboard-view .run-sheet,
.scoreboard-view .share-card,
.scoreboard-view .report-gallery,
.scoreboard-view .wall-grid {
  display: none !important;
}

.scoreboard-view .season-report {
  min-height: 58vh;
}

.scoreboard-view .report-grid {
  grid-template-columns: minmax(320px, 0.72fr) minmax(320px, 1fr) minmax(320px, 1fr);
}

.scoreboard-view .report-row {
  min-height: 46px;
  font-size: 1rem;
}

.story-view .desk-metrics,
.story-view .watch-frames,
.story-view .agent-scorebook,
.story-view .season-report,
.story-view .share-card,
.story-view .report-gallery {
  display: none !important;
}

.story-view .run-sheet {
  min-height: 180px;
  align-content: center;
}

.story-view .run-sheet strong {
  font-size: clamp(1.7rem, 4.6vw, 4rem);
}

.story-view .run-sheet p {
  max-width: 1040px;
  font-size: clamp(1rem, 2vw, 1.3rem);
}

.agent-view .desk-metrics,
.agent-view .watch-frames,
.agent-view .run-sheet,
.agent-view .season-report,
.agent-view .share-card,
.agent-view .report-gallery,
.agent-view .wall-grid {
  display: none !important;
}

.agent-view .agent-scorebook {
  min-height: 52vh;
  align-items: stretch;
}

.agent-view .agent-scorebook pre {
  max-height: none;
  min-height: 360px;
}

.wall-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.wall-column {
  min-width: 0;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.column-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.column-head strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(1.05rem, 2vw, 1.45rem);
  line-height: 1;
  text-align: right;
}

.card-list {
  display: grid;
  gap: 9px;
}

.archive-card,
.empty-card {
  min-width: 0;
  border: 3px solid var(--ink);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.archive-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--card-color, var(--gold)) 22%, #fffdf5), transparent 56%),
    #fffdf5;
}

.archive-card div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.archive-card strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1;
}

.archive-card p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 0.82rem;
}

.archive-card button {
  min-height: 34px;
  border-width: 2px;
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 0.72rem;
}

.empty-card {
  background: rgba(16, 18, 23, 0.04);
}

@media (max-width: 980px) {
  .desk-header,
  .desk-hero,
  .report-grid,
  .share-card,
  .frame-grid,
  .agent-scorebook,
  .gallery-list,
  .wall-grid {
    grid-template-columns: 1fr;
  }

  .desk-header {
    display: grid;
    align-items: stretch;
  }

  .desk-header nav {
    justify-content: flex-start;
  }

  .desk-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .archive-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .report-head {
    display: grid;
  }

  .gallery-head {
    display: grid;
  }

  .frame-head {
    display: grid;
  }

  .frame-head p {
    max-width: none;
    text-align: left;
  }

  .gallery-head p {
    max-width: none;
    text-align: left;
  }

  .card-view .share-card-copy {
    grid-template-columns: 1fr;
  }

  .card-view .share-card-copy p {
    text-align: left;
  }

  .report-head p {
    max-width: none;
    text-align: left;
  }
}

@media (max-width: 560px) {
  .desk-metrics {
    grid-template-columns: 1fr;
  }

  .desk-hero,
  .noun-rack {
    min-height: 340px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .desk-header,
  .desk-shell {
    width: 100%;
  }

  .desk-header {
    padding: 0 0 10px;
  }

  .desk-header nav,
  .desk-actions,
  .desk-copy output,
  .noun-rack,
  .desk-metrics,
  .watch-frames,
  .agent-scorebook,
  .share-card,
  .report-gallery,
  .wall-grid {
    display: none !important;
  }

  .desk-shell {
    gap: 10px;
    padding: 0;
  }

  .desk-hero,
  .run-sheet,
  .season-report {
    box-shadow: none;
    break-inside: avoid;
  }

  .desk-hero {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .desk-copy {
    padding: 14px;
  }

  .desk-copy strong {
    font-size: 38px;
    line-height: 0.95;
  }

  .season-report {
    border-width: 3px;
  }

  .report-grid {
    grid-template-columns: 1fr;
  }

  .report-card p {
    display: block;
    overflow: visible;
  }
}
