:root {
  color-scheme: light;
  --bg: #f5f7f2;
  --surface: #ffffff;
  --surface-2: #eef2ea;
  --text: #17201a;
  --muted: #667064;
  --border: #d8ded2;
  --accent: #236a5a;
  --accent-2: #9b4f2f;
  --warn: #a15d00;
  --danger: #9f2e2e;
  --shadow: 0 16px 40px rgba(23, 32, 26, 0.08);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  min-width: 0;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.app-shell {
  min-height: 100vh;
}

.skin-game {
  --bg: #10151f;
  --surface: #192231;
  --surface-2: #243044;
  --text: #f4f0de;
  --muted: #b9c0cc;
  --border: #3a4962;
  --accent: #70d6a8;
  --accent-2: #f0b35f;
  --warn: #f0b35f;
  --danger: #ff8888;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(16px, 4vw, 48px) 16px;
}

.eyeline {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 6px;
  font-size: 24px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.25;
}

h4,
h5 {
  margin-bottom: 6px;
}

p,
li {
  line-height: 1.5;
}

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

.runway-control {
  display: grid;
  grid-template-columns: auto 64px auto;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.runway-control input {
  width: 64px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  color: var(--text);
  background: var(--surface);
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 0 clamp(16px, 4vw, 48px) 16px;
  overflow-x: auto;
}

.tab,
.button,
.segment {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.tab {
  flex: 0 0 auto;
  padding: 10px 14px;
  white-space: nowrap;
}

.tab.active,
.segment.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 13px;
}

.button.ghost {
  background: transparent;
}

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

.button.small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

.button.tiny {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 12px;
}

.button.choose {
  width: 100%;
  margin-top: 16px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.file-button input {
  display: none;
}

main {
  padding: 0 clamp(16px, 4vw, 48px) 48px;
}

.stack {
  display: grid;
  gap: 18px;
}

.start-screen {
  display: grid;
  gap: 18px;
}

.start-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.75fr);
  gap: 18px;
  align-items: stretch;
}

.hero-copy,
.progress-card,
.play-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-copy {
  min-height: 300px;
  padding: clamp(24px, 5vw, 56px);
  background:
    linear-gradient(135deg, rgba(35, 106, 90, 0.1), transparent 42%),
    var(--surface);
}

.hero-copy h2 {
  max-width: 760px;
  margin-bottom: 16px;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 0.98;
}

.hero-copy p:not(.eyeline) {
  max-width: 640px;
  color: var(--muted);
  font-size: 18px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.progress-card {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 24px;
}

.progress-ring {
  display: grid;
  width: 150px;
  aspect-ratio: 1;
  place-items: center;
  justify-self: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--surface) 0 57%, transparent 58%),
    conic-gradient(var(--accent) var(--progress), var(--surface-2) 0);
}

.progress-ring span {
  font-size: 38px;
  font-weight: 900;
  line-height: 1;
}

.progress-ring small {
  margin-top: -48px;
  color: var(--muted);
  font-weight: 800;
}

.guided-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) repeat(2, minmax(240px, 0.75fr));
  gap: 18px;
  align-items: start;
}

.play-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.main-choice {
  min-height: 100%;
}

.start-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.start-choice {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-2);
}

.start-choice h4 {
  font-size: 18px;
}

.start-choice p {
  color: var(--muted);
  font-size: 14px;
}

.versus {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  align-self: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-weight: 900;
}

.quick-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-stats span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mini-fit {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.mini-fit > span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--accent);
  font-weight: 900;
}

.mini-fit small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

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

.step-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 10px;
  align-items: center;
  min-height: 92px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  box-shadow: var(--shadow);
}

.step-card span {
  grid-row: span 2;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.step-card small {
  color: var(--muted);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 400px);
  gap: 18px;
  align-items: start;
}

.panel,
.role-card,
.choice-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow-wrap: anywhere;
}

.panel {
  padding: 18px;
}

.context-panel {
  display: grid;
  gap: 16px;
}

.context-drawer > summary {
  margin-bottom: 14px;
  font-size: 16px;
}

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

.meta-block {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.section-heading,
.role-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.section-heading p,
.role-card-header p {
  margin-bottom: 0;
  color: var(--muted);
}

.metric-strip,
.score-pair,
.reason-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.metric-strip span,
.score-pair span,
.reason-list span,
.category,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.badge.verify {
  background: rgba(161, 93, 0, 0.12);
  color: var(--warn);
}

.badge.todo {
  background: rgba(35, 106, 90, 0.12);
  color: var(--accent);
}

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

.role-card,
.choice-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  min-width: 0;
}

.role-card > p {
  color: var(--muted);
}

.role-facts {
  display: grid;
  gap: 10px;
}

.fact {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.fact > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.fact p,
.mini-panel p,
.evidence-entry p,
.report-role p {
  margin-bottom: 6px;
}

.muted,
.evidence-empty {
  color: var(--muted);
  font-size: 13px;
}

.source-list {
  display: grid;
  gap: 4px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

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

summary {
  cursor: pointer;
  font-weight: 800;
}

.mini-panel {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  background: var(--surface-2);
}

.mini-panel ul,
.cut-list p {
  margin-bottom: 8px;
}

.evidence-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.evidence-form input,
.manual-load input,
.journal {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

.evidence-list {
  display: grid;
  gap: 8px;
}

.evidence-entry {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}

.override-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.pair-grid,
.texture-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.attribute-bars {
  display: grid;
  gap: 8px;
}

.attribute-bar {
  display: grid;
  grid-template-columns: minmax(120px, 0.4fr) minmax(120px, 1fr);
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.attribute-bar div {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.attribute-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.slider-list {
  display: grid;
  gap: 14px;
}

.slider-row {
  display: grid;
  grid-template-columns: minmax(135px, 1fr) minmax(120px, 1.1fr) 48px auto;
  gap: 10px;
  align-items: center;
}

.slider-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.slider-row input {
  width: 100%;
  accent-color: var(--accent);
}

.texture-card {
  display: grid;
  gap: 14px;
}

.texture-items {
  display: grid;
  gap: 12px;
}

.texture-item {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.texture-item p {
  margin-bottom: 0;
}

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

.segment {
  min-height: 34px;
  padding: 7px;
  font-size: 13px;
}

.report-role {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding: 14px 0;
}

.report-role:first-of-type {
  border-top: 0;
}

.warning-panel {
  border-color: rgba(161, 93, 0, 0.35);
}

.log-list {
  max-height: 300px;
  overflow: auto;
}

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

.logistics-item {
  display: grid;
  gap: 8px;
}

.journal {
  min-height: 420px;
  resize: vertical;
}

.markdown-preview {
  max-height: 560px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.load-fallback {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.manual-load {
  display: grid;
  gap: 12px;
  min-width: min(460px, 90vw);
}

@media (max-width: 1180px) {
  .guided-grid {
    grid-template-columns: 1fr;
  }

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

  .logistics-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .topbar,
  .section-heading,
  .role-card-header,
  .two-column {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-heading,
  .role-card-header {
    display: grid;
  }

  .two-column,
  .start-hero,
  .context-grid,
  .report-grid,
  .pair-grid,
  .start-pair,
  .texture-grid,
  .role-grid {
    grid-template-columns: 1fr;
  }

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

  .versus {
    justify-self: center;
  }

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

  .evidence-form,
  .override-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .topbar {
    padding-top: 16px;
  }

  h1 {
    font-size: 28px;
  }

  .hero-copy h2 {
    font-size: 38px;
  }

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

  .slider-row,
  .attribute-bar {
    grid-template-columns: 1fr;
  }
}
