:root {
  --ink: #111310;
  --ink-soft: #1a1d19;
  --panel: #20231f;
  --paper: #e8e5dc;
  --paper-dim: #b7b4aa;
  --brass: #d0a85d;
  --brass-bright: #efc978;
  --oxide: #71867f;
  --signal: #b75c49;
  --line: rgba(232, 229, 220, 0.16);
  --line-strong: rgba(232, 229, 220, 0.3);
  --font-sans: "Manrope", sans-serif;
  --font-serif: "Newsreader", serif;
  --font-mono: "DM Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-sans);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    var(--ink);
  background-size: 72px 72px;
}

button,
input,
textarea {
  color: inherit;
  font: inherit;
}

button {
  cursor: pointer;
}

.noise {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  height: 68px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 32px;
  background: rgba(17, 19, 16, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--paper);
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--brass);
  color: var(--brass-bright);
  font: 500 11px var(--font-mono);
}

.prototype-nav {
  height: 100%;
  display: flex;
  align-items: stretch;
}

.nav-tab {
  position: relative;
  padding: 0 18px;
  border: 0;
  background: transparent;
  color: var(--paper-dim);
  font-size: 12px;
}

.nav-tab::after {
  position: absolute;
  right: 18px;
  bottom: -1px;
  left: 18px;
  height: 2px;
  content: "";
  background: transparent;
}

.nav-tab.is-active {
  color: var(--paper);
}

.nav-tab.is-active::after {
  background: var(--brass);
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
}

.daily-limit {
  color: var(--paper-dim);
  font: 10px var(--font-mono);
  text-transform: uppercase;
}

.daily-limit b {
  color: var(--brass-bright);
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--panel);
  color: var(--paper);
  font: 10px var(--font-mono);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.view[data-view="library"] {
  width: min(1420px, calc(100% - 64px));
  margin: 0 auto;
  padding: 72px 0 96px;
}

.library-heading {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  align-items: end;
  gap: 80px;
  padding-bottom: 58px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--brass);
  font: 10px var(--font-mono);
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

.library-heading h1,
.briefing-title h1 {
  margin-bottom: 0;
  font: 500 clamp(52px, 7vw, 106px)/0.88 var(--font-serif);
}

.library-intro {
  padding-bottom: 8px;
}

.library-intro > p {
  max-width: 490px;
  color: var(--paper-dim);
  font-size: 15px;
  line-height: 1.7;
}

.search-shell {
  height: 50px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line-strong);
}

.search-shell > span {
  color: var(--brass);
  font-size: 24px;
}

.search-shell input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
}

kbd {
  padding: 2px 5px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--paper-dim);
  font: 9px var(--font-mono);
}

.filter-rail {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.filter {
  flex: none;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: var(--paper-dim);
  font-size: 11px;
}

.filter span {
  margin-left: 8px;
  color: #71756e;
  font: 9px var(--font-mono);
}

.filter.is-active {
  background: var(--paper);
  color: var(--ink);
}

.filter.is-active span {
  color: #686c65;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-left: 1px solid var(--line);
}

.scenario {
  position: relative;
  min-height: 340px;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(26, 29, 25, 0.72);
  transition: background 180ms ease, transform 180ms ease;
}

.scenario:hover {
  z-index: 2;
  background: #232620;
}

.scenario[hidden] {
  display: none;
}

.scenario-featured {
  min-height: 580px;
  grid-column: span 2;
  grid-row: span 2;
  padding: 0;
  overflow: hidden;
}

.case-index {
  color: #797d74;
  font: 9px var(--font-mono);
}

.scenario-featured > .case-index {
  position: absolute;
  z-index: 2;
  top: 22px;
  left: 24px;
  color: var(--paper);
}

.scenario-visual {
  position: relative;
  min-height: 330px;
  overflow: hidden;
}

.scenario-visual img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center 28%;
  filter: saturate(0.78) contrast(1.06);
  transition: transform 600ms cubic-bezier(0.2, 0.7, 0, 1);
}

.scenario-featured:hover img {
  transform: scale(1.025);
}

.scenario-visual::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, rgba(17, 19, 16, 0.3), transparent 55%),
    linear-gradient(0deg, rgba(17, 19, 16, 0.82), transparent 45%);
}

.visual-scan {
  position: absolute;
  z-index: 1;
  inset: 12px;
  border: 1px solid rgba(232, 229, 220, 0.16);
  pointer-events: none;
}

.opponent-label {
  position: absolute;
  z-index: 2;
  right: 24px;
  bottom: 24px;
  display: grid;
  gap: 2px;
  text-align: right;
}

.opponent-label span {
  color: var(--brass-bright);
  font: 8px var(--font-mono);
}

.opponent-label strong {
  font: 500 18px var(--font-serif);
}

.scenario-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 26px 28px 28px;
}

.scenario-meta,
.briefing-stamps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--paper-dim);
  font: 9px var(--font-mono);
  text-transform: uppercase;
}

.scenario-meta span::after {
  margin-left: 8px;
  content: "/";
  color: #5d615a;
}

.scenario-meta span:last-child::after {
  content: "";
}

.scenario-copy h2,
.scenario > h2 {
  margin: 18px 0 10px;
  font: 500 38px/0.94 var(--font-serif);
}

.scenario-copy > p,
.scenario > p {
  color: var(--paper-dim);
  font-size: 12px;
  line-height: 1.6;
}

.scenario-footer,
.compact-card-bottom {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.skill-stack {
  display: flex;
  gap: 6px;
}

.skill-stack span,
.difficulty {
  padding: 5px 7px;
  border: 1px solid var(--line);
  color: var(--paper-dim);
  font: 8px var(--font-mono);
  text-transform: uppercase;
}

.round-action,
.back-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--brass);
  border-radius: 50%;
  background: transparent;
  color: var(--brass-bright);
  font-size: 18px;
  transition: background 160ms ease, color 160ms ease;
}

.round-action:hover,
.back-button:hover {
  background: var(--brass);
  color: var(--ink);
}

.round-action.locked {
  border-color: var(--line);
  color: #73766e;
}

.compact-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 28px 0 42px;
}

.category-sigil {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  color: var(--brass);
  font: 9px var(--font-mono);
}

.difficulty.amber {
  color: var(--brass-bright);
}

.difficulty.green {
  color: #8eb8a6;
}

.difficulty.red {
  color: #d27a68;
}

.compact-card-bottom {
  color: #858980;
  font: 9px var(--font-mono);
}

.briefing-shell {
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: minmax(360px, 0.78fr) minmax(620px, 1.22fr);
}

.briefing-opponent {
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
  overflow: hidden;
  background: #18201f;
}

.briefing-opponent > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 52% center;
  filter: saturate(0.75);
}

.portrait-shade,
.room-portrait-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 12, 10, 0.1), rgba(10, 12, 10, 0.12) 40%, rgba(10, 12, 10, 0.92));
}

.back-button {
  position: absolute;
  top: 28px;
  left: 28px;
  z-index: 2;
}

.portrait-code {
  position: absolute;
  top: 38px;
  right: 28px;
  color: rgba(232, 229, 220, 0.72);
  font: 8px var(--font-mono);
}

.opponent-card {
  position: absolute;
  right: 42px;
  bottom: 42px;
  left: 42px;
}

.opponent-card > p,
.room-person > p {
  margin-bottom: 8px;
  color: var(--brass-bright);
  font: 8px var(--font-mono);
  text-transform: uppercase;
}

.opponent-card h2,
.room-person h2 {
  margin-bottom: 4px;
  font: 500 44px/1 var(--font-serif);
}

.opponent-card > span,
.room-person > span {
  color: var(--paper-dim);
  font-size: 11px;
}

.trait-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 28px;
  border-top: 1px solid var(--line-strong);
}

.trait-list div {
  display: grid;
  gap: 6px;
  padding: 16px 8px 0 0;
}

.trait-list b {
  color: var(--paper);
  font: 500 18px var(--font-mono);
}

.trait-list span {
  color: var(--paper-dim);
  font: 8px var(--font-mono);
  text-transform: uppercase;
}

.briefing-content {
  padding: 72px clamp(40px, 7vw, 110px) 50px;
  background: #171916;
}

.briefing-title {
  padding-bottom: 50px;
  border-bottom: 1px solid var(--line);
}

.briefing-title h1 {
  font-size: clamp(58px, 7vw, 102px);
}

.briefing-stamps {
  margin-top: 28px;
}

.briefing-stamps span {
  padding: 7px 9px;
  border: 1px solid var(--line);
}

.briefing-sections article {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 24px;
  padding: 36px 0;
  border-bottom: 1px solid var(--line);
}

.section-number {
  color: var(--brass);
  font: 10px var(--font-mono);
}

.briefing-sections h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
}

.briefing-sections p {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--paper-dim);
  font-size: 13px;
  line-height: 1.75;
}

.objective-lines {
  display: grid;
  gap: 9px;
  margin-top: 20px;
}

.objective-lines span {
  color: var(--paper-dim);
  font-size: 11px;
}

.objective-lines b {
  width: 22px;
  display: inline-block;
  color: var(--brass);
  font: 9px var(--font-mono);
}

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

.role-option {
  min-height: 120px;
  display: grid;
  align-content: end;
  gap: 5px;
  padding: 16px;
  border: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.role-option.is-selected {
  border-color: var(--brass);
  background: rgba(208, 168, 93, 0.06);
}

.role-option > span {
  color: var(--brass);
  font: 8px var(--font-mono);
}

.role-option strong {
  font-size: 12px;
}

.role-option small {
  color: var(--paper-dim);
  font-size: 10px;
}

.briefing-launch {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding-top: 32px;
}

.briefing-launch p {
  margin: 0;
  color: var(--paper-dim);
  font: 9px var(--font-mono);
  text-transform: uppercase;
}

.status-dot,
.live-label span {
  width: 6px;
  height: 6px;
  display: inline-block;
  margin-right: 7px;
  border-radius: 50%;
  background: #77a890;
  box-shadow: 0 0 0 5px rgba(119, 168, 144, 0.12);
}

.primary-button {
  min-height: 52px;
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  gap: 42px;
  padding: 0 18px;
  border: 1px solid var(--brass);
  background: var(--brass);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--brass-bright);
}

.room-view {
  height: calc(100vh - 68px);
  overflow: hidden;
}

.room-grid {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(270px, 0.72fr) minmax(480px, 1.28fr) minmax(230px, 0.58fr);
}

.room-opponent {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: #18201f;
}

.room-opponent > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 54% center;
  filter: saturate(0.7) contrast(1.04);
}

.live-label {
  position: absolute;
  z-index: 3;
  top: 24px;
  left: 24px;
  font: 8px var(--font-mono);
}

.room-person {
  position: absolute;
  z-index: 2;
  right: 24px;
  bottom: 154px;
  left: 24px;
}

.room-person h2 {
  font-size: 36px;
}

.tension-panel {
  position: absolute;
  z-index: 2;
  right: 24px;
  bottom: 28px;
  left: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line-strong);
}

.tension-heading,
.tension-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tension-heading span {
  font: 8px var(--font-mono);
  text-transform: uppercase;
}

.tension-heading strong {
  font: 500 18px var(--font-mono);
}

.tension-track {
  height: 4px;
  margin: 12px 0 7px;
  background: rgba(232, 229, 220, 0.18);
}

.tension-track i {
  width: 46%;
  height: 100%;
  display: block;
  background: linear-gradient(90deg, #789c8d, var(--brass), var(--signal));
  transition: width 350ms ease;
}

.tension-labels {
  color: rgba(232, 229, 220, 0.48);
  font: 7px var(--font-mono);
  text-transform: uppercase;
}

.conversation {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #e4e1d8;
  color: var(--ink);
}

.conversation-header {
  min-height: 68px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(17, 19, 16, 0.15);
}

.conversation-header .eyebrow {
  margin: 0 0 5px;
  color: #6e6046;
}

.room-clock {
  color: #777970;
  font: 9px var(--font-mono);
}

.end-button {
  padding: 9px 12px;
  border: 1px solid rgba(17, 19, 16, 0.18);
  background: transparent;
  color: #6c3c32;
  font: 9px var(--font-mono);
  text-transform: uppercase;
}

.end-button.is-ready {
  border-color: #7e6740;
  background: rgba(208, 168, 93, 0.12);
  color: #684c1d;
}

.message-stream {
  min-height: 0;
  overflow-y: auto;
  padding: 22px clamp(20px, 4vw, 54px) 30px;
}

.exchange-marker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 28px;
  color: #8a887f;
  font: 8px var(--font-mono);
}

.exchange-marker::before,
.exchange-marker::after {
  height: 1px;
  flex: 1;
  content: "";
  background: rgba(17, 19, 16, 0.12);
}

.message {
  max-width: 76%;
  margin-bottom: 28px;
  animation: message-in 280ms ease both;
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.message-label {
  margin-bottom: 9px;
  color: #86847c;
  font: 8px var(--font-mono);
  text-transform: uppercase;
}

.message p {
  margin-bottom: 9px;
  font: 500 18px/1.55 var(--font-serif);
}

.typing-message {
  opacity: 0.72;
}

.typing-dots {
  display: flex;
  gap: 5px;
  padding: 6px 0;
}

.typing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #777970;
  animation: typing-pulse 900ms ease-in-out infinite;
}

.typing-dots i:nth-child(2) {
  animation-delay: 140ms;
}

.typing-dots i:nth-child(3) {
  animation-delay: 280ms;
}

@keyframes typing-pulse {
  50% {
    opacity: 0.24;
    transform: translateY(-2px);
  }
}

.quality-note {
  width: fit-content;
  margin-top: 12px;
  padding: 6px 8px;
  border: 1px solid rgba(17, 19, 16, 0.16);
  color: #6d6d65;
  font: 8px var(--font-mono);
  text-transform: uppercase;
}

.quality-note.strong {
  border-color: rgba(58, 111, 86, 0.32);
  color: #426d58;
}

.quality-note.risk {
  border-color: rgba(145, 65, 50, 0.3);
  color: #914132;
}

.user-message {
  margin-left: auto;
  padding: 18px 20px;
  border-left: 2px solid var(--brass);
  background: #d4d0c5;
}

.user-message .message-label {
  color: #786239;
}

.tactic-note {
  width: fit-content;
  margin-top: 14px;
  padding: 6px 8px;
  border: 1px solid rgba(117, 72, 58, 0.22);
  color: #75483a;
  font: 8px var(--font-mono);
  text-transform: uppercase;
}

.tactic-note span {
  margin-right: 7px;
  color: #9a9184;
}

.composer {
  margin: 0 clamp(16px, 3vw, 40px) 22px;
  padding: 13px 14px;
  border: 1px solid rgba(17, 19, 16, 0.22);
  background: #efede6;
  box-shadow: 0 12px 28px rgba(17, 19, 16, 0.08);
}

.composer-meta,
.composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.composer-meta {
  color: #807e76;
  font: 8px var(--font-mono);
  text-transform: uppercase;
}

.composer textarea {
  width: 100%;
  resize: none;
  margin: 12px 0 8px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: 500 17px/1.45 var(--font-serif);
}

.composer textarea:disabled {
  opacity: 0.45;
}

.coach-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #7b7c74;
  font: 8px var(--font-mono);
  text-transform: uppercase;
}

.coach-toggle span {
  width: 18px;
  height: 9px;
  display: inline-block;
  border-radius: 10px;
  background: #b7b4aa;
}

.coach-toggle.is-on span {
  background: #758f83;
}

.send-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 18px;
}

.intel-rail {
  min-width: 0;
  overflow-y: auto;
  padding: 0 22px 28px;
  border-left: 1px solid var(--line);
  background: #171916;
}

.intel-heading {
  height: 68px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  font: 9px var(--font-mono);
  text-transform: uppercase;
}

.intel-heading button {
  border: 0;
  background: transparent;
  color: var(--paper-dim);
  font-size: 17px;
}

.intel-rail section {
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.intel-label {
  margin-bottom: 16px;
  color: #7e8279;
  font: 8px var(--font-mono);
  text-transform: uppercase;
}

.mandate-score {
  display: grid;
  margin-bottom: 18px;
}

.mandate-score strong {
  color: var(--brass-bright);
  font: 500 35px var(--font-serif);
}

.mandate-score span {
  color: var(--paper-dim);
  font-size: 9px;
}

.intel-rail ul {
  display: grid;
  gap: 11px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.intel-rail li {
  position: relative;
  padding-left: 16px;
  color: var(--paper-dim);
  font-size: 9px;
  line-height: 1.5;
}

.intel-rail li::before {
  position: absolute;
  top: 6px;
  left: 0;
  width: 4px;
  height: 4px;
  content: "";
  background: var(--brass);
}

.intel-rail li.is-met {
  color: #a6c7b7;
}

.intel-rail li.is-met::before {
  background: #78a18c;
  box-shadow: 0 0 0 4px rgba(120, 161, 140, 0.1);
}

.intel-rail li.is-failed {
  color: #d18a7a;
}

.intel-rail li.is-failed::before {
  background: var(--signal);
}

.coach-panel > p:last-child {
  margin: 0;
  color: #b8c8c0;
  font: 500 12px/1.6 var(--font-serif);
}

.signal {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  margin-bottom: 15px;
}

.signal > span {
  color: var(--brass);
  font: 8px var(--font-mono);
}

.signal p {
  margin: 0;
  color: #92958c;
  font-size: 9px;
  line-height: 1.5;
}

.signal b {
  display: block;
  margin-bottom: 2px;
  color: var(--paper);
  font-size: 9px;
}

.private-note textarea {
  width: 100%;
  min-height: 80px;
  resize: vertical;
  padding: 10px;
  border: 1px solid var(--line);
  outline: 0;
  background: rgba(255, 255, 255, 0.025);
  color: var(--paper);
  font-size: 9px;
  line-height: 1.5;
}

.analysis-overlay {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 9, 7, 0.78);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(10px);
  transition: opacity 180ms ease;
}

.analysis-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.analysis-sheet {
  position: relative;
  width: min(720px, 100%);
  padding: 46px;
  border: 1px solid var(--line-strong);
  background: #1a1d19;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.analysis-close {
  position: absolute;
  top: 18px;
  right: 18px;
  border: 0;
  background: transparent;
  color: var(--paper-dim);
  font-size: 18px;
}

.analysis-sheet h2 {
  margin-bottom: 30px;
  font: 500 58px/1 var(--font-serif);
}

.score-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.score-row div {
  display: grid;
  gap: 4px;
  padding: 20px 8px;
  border-right: 1px solid var(--line);
}

.score-row div:last-child {
  border-right: 0;
}

.score-row strong {
  color: var(--brass-bright);
  font: 500 28px var(--font-serif);
}

.score-row span {
  color: var(--paper-dim);
  font: 8px var(--font-mono);
  text-transform: uppercase;
}

.analysis-summary {
  margin: 24px 0;
  color: var(--paper-dim);
  font-size: 13px;
  line-height: 1.7;
}

.analysis-takeaways {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0 0 26px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.analysis-takeaways > div {
  min-width: 0;
  padding: 18px 14px 18px 0;
  border-right: 1px solid var(--line);
}

.analysis-takeaways > div + div {
  padding-left: 14px;
}

.analysis-takeaways > div:last-child {
  border-right: 0;
}

.analysis-takeaways span {
  display: block;
  margin-bottom: 8px;
  color: var(--brass);
  font: 8px var(--font-mono);
  text-transform: uppercase;
}

.analysis-takeaways p {
  margin: 0;
  color: var(--paper-dim);
  font-size: 10px;
  line-height: 1.55;
}

.scenario-empty {
  min-height: 320px;
  grid-column: 1 / -1;
  display: grid;
  place-content: center;
  gap: 10px;
  padding: 40px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.scenario-empty[hidden] {
  display: none;
}

.scenario-empty span,
.history-empty span {
  color: var(--brass);
  font: 8px var(--font-mono);
}

.scenario-empty strong {
  font: 500 26px var(--font-serif);
}

.dialog-overlay {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 9, 7, 0.78);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(10px);
  transition: opacity 180ms ease;
}

.dialog-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.dialog-sheet {
  position: relative;
  width: min(520px, 100%);
  padding: 38px;
  border: 1px solid var(--line-strong);
  background: #1a1d19;
}

.dialog-sheet h2 {
  margin: 0 0 15px;
  font: 500 42px/1 var(--font-serif);
}

.dialog-sheet > p:not(.eyebrow) {
  margin-bottom: 26px;
  color: var(--paper-dim);
  font-size: 12px;
  line-height: 1.7;
}

.dialog-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: 0;
  background: transparent;
  color: var(--paper-dim);
  font-size: 18px;
}

.history-drawer {
  position: fixed;
  z-index: 45;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100%);
  padding: 32px;
  background: #171916;
  border-left: 1px solid var(--line-strong);
  box-shadow: -30px 0 70px rgba(0, 0, 0, 0.34);
  transform: translateX(102%);
  transition: transform 220ms ease;
}

.history-drawer.is-open {
  transform: translateX(0);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.history-header h2 {
  margin: 0;
  font: 500 38px var(--font-serif);
}

.history-header button {
  border: 0;
  background: transparent;
  color: var(--paper-dim);
  font-size: 19px;
}

.history-list {
  display: grid;
}

.history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.history-row div {
  display: grid;
  gap: 6px;
}

.history-row span {
  color: #7f837a;
  font: 8px var(--font-mono);
  text-transform: uppercase;
}

.history-row strong {
  font: 500 16px var(--font-serif);
}

.history-row > b {
  color: var(--brass-bright);
  font: 500 30px var(--font-serif);
}

.history-empty {
  padding: 40px 0;
}

.history-empty p {
  color: var(--paper-dim);
  font-size: 11px;
}

.toast {
  position: fixed;
  z-index: 60;
  right: 24px;
  bottom: 24px;
  max-width: min(380px, calc(100% - 48px));
  padding: 12px 15px;
  border: 1px solid var(--line-strong);
  background: #272a25;
  color: var(--paper);
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .scenario-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .room-grid {
    grid-template-columns: 260px minmax(440px, 1fr);
  }

  .intel-rail {
    display: none;
  }
}

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 0 18px;
  }

  .prototype-nav {
    position: fixed;
    z-index: 15;
    right: 0;
    bottom: 0;
    left: 0;
    height: 54px;
    justify-content: center;
    background: rgba(17, 19, 16, 0.96);
    border-top: 1px solid var(--line);
  }

  .top-actions {
    display: none;
  }

  .view[data-view="library"] {
    width: min(100% - 32px, 720px);
    padding: 48px 0 92px;
  }

  .library-heading {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-bottom: 36px;
  }

  .library-heading h1 {
    font-size: clamp(48px, 15vw, 74px);
  }

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

  .scenario-featured {
    grid-column: span 2;
  }

  .briefing-shell {
    display: block;
  }

  .briefing-opponent {
    position: relative;
    top: 0;
    height: 64vh;
    min-height: 480px;
  }

  .briefing-content {
    padding: 48px 24px 90px;
  }

  .room-view {
    height: auto;
    min-height: calc(100vh - 68px);
    padding-bottom: 54px;
    overflow: visible;
  }

  .room-grid {
    min-height: calc(100vh - 122px);
    display: block;
  }

  .room-opponent {
    height: 250px;
  }

  .room-opponent > img {
    object-position: 50% 27%;
  }

  .room-person {
    bottom: 28px;
  }

  .tension-panel {
    right: 20px;
    bottom: 28px;
    left: auto;
    width: 180px;
  }

  .conversation {
    min-height: 700px;
  }
}

@media (max-width: 560px) {
  .brand > span:last-child {
    display: none;
  }

  .nav-tab {
    flex: 1;
    padding: 0 8px;
  }

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

  .scenario-featured {
    min-height: 600px;
    grid-column: auto;
  }

  .scenario {
    min-height: 310px;
  }

  .scenario-visual {
    min-height: 330px;
  }

  .skill-stack {
    display: none;
  }

  .opponent-card {
    right: 24px;
    bottom: 26px;
    left: 24px;
  }

  .opponent-card h2 {
    font-size: 38px;
  }

  .briefing-title h1 {
    font-size: 52px;
  }

  .briefing-sections article {
    grid-template-columns: 32px 1fr;
    gap: 10px;
  }

  .role-options {
    grid-template-columns: 1fr;
  }

  .briefing-launch {
    align-items: stretch;
    flex-direction: column;
  }

  .briefing-launch .primary-button {
    width: 100%;
  }

  .room-opponent {
    height: 210px;
  }

  .room-person h2 {
    font-size: 30px;
  }

  .tension-panel {
    top: 24px;
    right: 18px;
    bottom: auto;
    width: 130px;
  }

  .message-stream {
    padding-right: 18px;
    padding-left: 18px;
  }

  .message {
    max-width: 92%;
  }

  .message p {
    font-size: 17px;
  }

  .analysis-sheet {
    padding: 36px 22px 24px;
  }

  .analysis-sheet h2 {
    font-size: 42px;
  }

  .analysis-takeaways {
    grid-template-columns: 1fr;
  }

  .analysis-takeaways > div,
  .analysis-takeaways > div + div {
    padding: 14px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .analysis-takeaways > div:last-child {
    border-bottom: 0;
  }

  .score-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .score-row div:nth-child(2) {
    border-right: 0;
  }

  .score-row div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .toast {
    right: 16px;
    bottom: 70px;
  }
}
