:root {
  --ink: #18222b;
  --muted: #5c6872;
  --quiet: #7b8791;
  --line: #dbe2e7;
  --soft: #f4f6f8;
  --softer: #fafbfc;
  --panel: #ffffff;
  --teal: #0c6572;
  --blue: #315f89;
  --rust: #9a4d2f;
  --gold: #a9781d;
  --green: #286b49;
  --red: #a23f3f;
  --shadow: 0 18px 42px rgba(24, 34, 43, .08);
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}
.prose, .card, .metadata, .url, .export-preview, table td { overflow-wrap: anywhere; }
pre { overflow-x: auto; white-space: pre; }
code { overflow-wrap: normal; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family: var(--sans);
}

button,
input,
select,
textarea {
  font: inherit;
  max-width: 100%;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 20px;
  color: #f8fbfc;
  background: #17232d;
  border-right: 1px solid #0f1921;
}

.brand {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .42);
  background: rgba(255, 255, 255, .08);
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, .68);
  font-size: 12px;
}

.nav-stack {
  display: grid;
  gap: 4px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 8px;
  border: 0;
  border-left: 3px solid transparent;
  color: rgba(255, 255, 255, .84);
  background: transparent;
  text-align: left;
  font: inherit;
  text-decoration: none;
}

.nav-item span {
  width: 28px;
  color: rgba(255, 255, 255, .56);
  font-size: 12px;
  font-weight: 800;
}

.nav-item.active,
.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, .08);
  border-left-color: #d8eff2;
}

.nav-external {
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, .14);
}

.readiness,
.source-note {
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, .14);
}

.readiness h2,
.source-note h2 {
  margin: 0 0 10px;
  color: rgba(255, 255, 255, .65);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.source-note p,
.readiness p {
  margin: 0;
  color: rgba(255, 255, 255, .72);
  font-size: 13px;
  line-height: 1.45;
}

.readiness-meter {
  height: 10px;
  margin-bottom: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, .14);
}

.readiness-meter span {
  display: block;
  width: 0;
  height: 100%;
  background: #d8eff2;
  transition: width .25s ease;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
}

.section-label {
  margin: 0 0 6px;
  color: var(--rust);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  letter-spacing: 0;
}

.topbar h1 {
  max-width: 1020px;
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: clamp(34px, 4vw, 58px);
  line-height: 1.02;
}

.lede {
  max-width: 940px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.45;
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.source-links a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  color: var(--teal);
  background: #fff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.source-links a:hover {
  border-color: rgba(12, 101, 114, .4);
  background: var(--softer);
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--panel);
}

.primary-button {
  color: #fff;
  border-color: var(--teal);
  background: var(--teal);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.panel-heading,
.toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-heading.compact {
  padding-bottom: 12px;
}

.panel-heading h2,
.toolbar h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 25px;
  line-height: 1.1;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.defense-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .55fr);
  gap: 18px;
  align-items: stretch;
}

.argument-board {
  min-height: 610px;
}

.constellation {
  position: relative;
  min-height: 520px;
  margin: 18px 20px 0;
  background:
    linear-gradient(#ecf0f3 1px, transparent 1px),
    linear-gradient(90deg, #ecf0f3 1px, transparent 1px);
  background-size: 42px 42px;
  background-color: var(--softer);
  border: 1px solid var(--line);
}

.lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.lines path {
  fill: none;
  stroke: #b8c6cf;
  stroke-width: 2;
}

.node {
  position: absolute;
  z-index: 1;
  width: 210px;
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  text-align: left;
  box-shadow: 0 12px 28px rgba(24, 34, 43, .10);
}

.node strong,
.node span {
  display: block;
}

.node strong {
  margin-bottom: 7px;
  font-size: 16px;
  line-height: 1.15;
}

.node span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.node.central {
  top: 210px;
  left: 50%;
  width: 250px;
  min-height: 108px;
  transform: translateX(-50%);
  border-color: #0c6572;
  color: #fff;
  background: #0c6572;
}

.node.central span {
  color: rgba(255, 255, 255, .78);
}

.node-a {
  top: 48px;
  left: 8%;
}

.node-b {
  top: 52px;
  right: 7%;
}

.node-c {
  bottom: 44px;
  left: 5%;
}

.node-d {
  bottom: 44px;
  right: 4%;
}

.node.active {
  outline: 3px solid rgba(12, 101, 114, .24);
}

.node-detail {
  margin: 18px 20px 20px;
  padding: 15px;
  color: var(--muted);
  background: var(--softer);
  border: 1px solid var(--line);
  line-height: 1.45;
}

.node-detail strong {
  color: var(--ink);
}

.rehearsal-card {
  display: flex;
  flex-direction: column;
}

.prompt {
  margin: 0;
  padding: 20px;
  color: var(--muted);
  line-height: 1.5;
}

textarea {
  width: calc(100% - 40px);
  min-height: 250px;
  margin: 0 20px 18px;
  padding: 14px;
  resize: vertical;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--softer);
  line-height: 1.45;
}

.timer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding: 18px 20px 20px;
  border-top: 1px solid var(--line);
}

#timerOutput {
  font-variant-numeric: tabular-nums;
  font-size: 28px;
  font-weight: 800;
}

.evidence-rail {
  margin-top: 18px;
}

.sequence {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
}

.sequence-step {
  min-height: 164px;
  padding: 17px;
  border-right: 1px solid var(--line);
}

.sequence-step:last-child {
  border-right: 0;
}

.sequence-step strong {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
}

.sequence-step p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--softer);
  font-size: 12px;
  font-weight: 800;
}

.status-chip.verified {
  color: var(--green);
  border-color: rgba(40, 107, 73, .25);
  background: rgba(40, 107, 73, .08);
}

.status-chip.review,
.status-chip.caution {
  color: #8c6014;
  border-color: rgba(169, 120, 29, .28);
  background: rgba(169, 120, 29, .09);
}

.claim-layout,
.history-layout,
.committee-layout,
.challenge-layout,
.methods-support-grid {
  display: grid;
  grid-template-columns: minmax(320px, .75fr) minmax(0, 1.25fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.challenge-layout {
  grid-template-columns: minmax(240px, .45fr) minmax(0, 1.55fr);
}

.claim-list,
.timeline,
.question-list {
  overflow: hidden;
}

.challenge-categories {
  overflow: hidden;
}

.challenge-category {
  width: 100%;
  padding: 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.challenge-category:hover,
.challenge-category.active {
  background: var(--softer);
  box-shadow: inset 4px 0 0 var(--teal);
}

.challenge-category strong,
.challenge-category span {
  display: block;
}

.challenge-category span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.challenge-body {
  padding: 24px;
}

.challenge-question {
  max-width: 900px;
  margin: 0 0 22px;
  font-family: var(--serif);
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.18;
}

.challenge-answer {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.challenge-answer[hidden] {
  display: none;
}

.challenge-answer section {
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--softer);
}

.challenge-answer h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 21px;
}

.challenge-answer p,
.challenge-answer li {
  color: var(--muted);
  line-height: 1.5;
}

.challenge-answer li + li {
  margin-top: 9px;
}

.challenge-answer strong {
  color: var(--ink);
}

.challenge-controls {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-top: 1px solid var(--line);
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.claim-button,
.source-button,
.question-button {
  width: 100%;
  padding: 15px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.claim-button:hover,
.claim-button.active,
.source-button:hover,
.source-button.active,
.question-button:hover,
.question-button.active {
  background: var(--softer);
}

.claim-button strong,
.source-button strong,
.question-button strong {
  display: block;
  margin-bottom: 5px;
  line-height: 1.25;
}

.claim-button span,
.source-button span,
.question-button span {
  color: var(--muted);
  font-size: 12px;
}

.claim-detail,
.source-detail {
  min-height: 520px;
  padding: 24px;
}

.claim-detail h3,
.source-detail h3 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 32px;
  line-height: 1.08;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.detail-box {
  padding: 15px;
  border: 1px solid var(--line);
  background: var(--softer);
}

.detail-box strong {
  display: block;
  margin-bottom: 8px;
}

.detail-box p,
.source-detail p,
.claim-detail p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.toolbar-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar input,
.toolbar select,
.select-label select {
  min-height: 40px;
  border: 1px solid var(--line);
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
}

.select-label {
  display: inline-grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.method-matrix {
  margin-top: 18px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 15px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  background: var(--softer);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

td {
  line-height: 1.4;
}

.check-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 18px 20px 22px;
  list-style: none;
}

.check-list li {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: start;
  color: var(--muted);
  line-height: 1.45;
}

.check-list input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.boundary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 20px 22px;
}

.boundary-item {
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--softer);
}

.boundary-item strong {
  display: block;
  margin-bottom: 7px;
}

.boundary-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

#committeeNotes {
  min-height: 520px;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

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

  .defense-grid,
  .claim-layout,
  .history-layout,
  .committee-layout,
  .challenge-layout,
  .methods-support-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .workspace {
    padding: 18px;
  }

  .topbar,
  .panel-heading,
  .toolbar {
    flex-direction: column;
  }

  .top-actions,
  .toolbar-controls {
    justify-content: flex-start;
  }

  .nav-stack,
  .sequence,
  .detail-grid,
  .boundary-grid {
    grid-template-columns: 1fr;
  }

  .constellation {
    min-height: 760px;
  }

  .node {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    width: calc(100% - 28px);
    margin: 14px;
    transform: none;
  }

  .node.central {
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    width: calc(100% - 28px);
    transform: none;
  }

  .lines {
    display: none;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
  }
}

@media print {
  .sidebar,
  .top-actions,
  .toolbar-controls,
  .select-label,
  button {
    display: none !important;
  }

  .app-shell,
  .defense-grid,
  .claim-layout,
  .history-layout,
  .committee-layout,
  .challenge-layout,
  .methods-support-grid {
    display: block;
  }

  .workspace {
    padding: 0;
  }

  .view {
    display: block;
    page-break-after: always;
  }

  .panel {
    box-shadow: none;
    margin-bottom: 18px;
  }
}
