:root {
  --bg: #f4efe4;
  --paper: rgba(255, 250, 242, 0.9);
  --card: #fffdf8;
  --ink: #17212b;
  --muted: #5a6774;
  --line: rgba(23, 33, 43, 0.14);
  --accent: #174742;
  --accent-strong: #0d2f2d;
  --frontline: #9b4d29;
  --leadership: #1f4d68;
  --facilitator: #5f3e8d;
  --good: #2f6f46;
  --warn: #b76a1c;
  --bad: #9d3434;
  --shadow: 0 24px 60px rgba(30, 28, 18, 0.12);
  --radius: 22px;
  --metric-1: #1f6f66;
  --metric-2: #315b8b;
  --metric-3: #946c18;
  --metric-4: #934454;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(23, 71, 66, 0.11), transparent 34%),
    radial-gradient(circle at top right, rgba(159, 93, 29, 0.11), transparent 28%),
    linear-gradient(180deg, #efe6d6 0%, #f7f3ea 44%, #ebe2d3 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(17, 24, 39, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 24, 39, 0.03) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 80%);
}

.shell {
  width: min(1320px, calc(100vw - 32px));
  margin: 24px auto 40px;
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.masthead,
.setup,
.overview,
.stage {
  position: relative;
}

.masthead > div,
.setup,
.overview,
.stage {
  border: 1px solid rgba(23, 33, 43, 0.12);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.92), rgba(255, 250, 241, 0.84));
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.masthead > div {
  padding: 26px 28px;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  font-size: clamp(40px, 7vw, 68px);
  line-height: 0.92;
  letter-spacing: -0.04em;
}

.tagline,
.masthead-note p,
.setup p,
.helper {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
}

.setup {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  padding: 24px 26px;
  margin-bottom: 18px;
}

.setup-block h2,
.overview h2,
.stage h2,
.panel h3,
.lane h3,
.timeline h3,
.debrief h3 {
  margin: 0 0 10px;
  font-size: 16px;
  letter-spacing: 0.02em;
}

.setup-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 190px;
}

.field label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input {
  height: 46px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(23, 33, 43, 0.18);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font: inherit;
}

.button-row,
.role-switches,
.open-links,
.role-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button,
.role-link {
  height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(23, 33, 43, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 150ms ease,
    background-color 150ms ease,
    border-color 150ms ease;
}

button:hover,
.role-link:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.96);
}

button.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  border-color: transparent;
}

button.secondary {
  background: rgba(23, 71, 66, 0.08);
}

button.danger {
  background: rgba(157, 52, 52, 0.08);
}

button.selected,
.role-link.selected {
  border-color: rgba(23, 71, 66, 0.48);
  background: rgba(23, 71, 66, 0.12);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

a.role-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.is-hidden {
  display: none !important;
}

.workspace {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.tabletop-shell {
  display: grid;
  gap: 18px;
  padding: 24px 26px;
  border: 1px solid rgba(23, 33, 43, 0.12);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.92), rgba(255, 250, 241, 0.84));
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.tabletop-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.tabletop-meta {
  display: grid;
  gap: 6px;
}

.tabletop-meta h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.tabletop-meta p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.tabletop-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-radius: 22px;
  border: 1px solid rgba(23, 33, 43, 0.1);
  background: rgba(255, 255, 255, 0.76);
}

.tabletop-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tabletop-card h3 {
  margin: 0;
  font-size: 18px;
}

.tabletop-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.tabletop-frame {
  width: 100%;
  min-height: 1120px;
  height: calc(100vh - 230px);
  border: 1px solid rgba(23, 33, 43, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.overview,
.stage {
  padding: 24px 26px;
}

.overview {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 18px;
}

.role-chip,
.round-chip,
.chip,
.tag,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.role-chip.frontline {
  background: rgba(155, 77, 41, 0.12);
  color: var(--frontline);
}

.role-chip.leadership {
  background: rgba(31, 77, 104, 0.12);
  color: var(--leadership);
}

.role-chip.facilitator {
  background: rgba(95, 62, 141, 0.12);
  color: var(--facilitator);
}

.round-chip {
  background: rgba(23, 33, 43, 0.06);
  color: var(--muted);
}

.metric-grid {
  display: grid;
  gap: 12px;
}

.metric-card {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(23, 33, 43, 0.1);
  background: rgba(255, 255, 255, 0.68);
}

.metric-card .metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.metric-card strong {
  font-size: 13px;
}

.metric-card span {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.meter {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(23, 33, 43, 0.08);
}

.meter > i {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.metric-delivery .meter > i {
  background: linear-gradient(90deg, #2c8777, #4db19d);
}

.metric-safety .meter > i {
  background: linear-gradient(90deg, #255b8b, #4a86be);
}

.metric-candour .meter > i {
  background: linear-gradient(90deg, #b98219, #d9a743);
}

.metric-repeatability .meter > i {
  background: linear-gradient(90deg, #9a4458, #c86a7f);
}

.summary-grid {
  display: grid;
  gap: 12px;
}

.summary-card,
.panel,
.lane,
.timeline,
.debrief,
.story,
.current-round,
.waiting-card {
  border: 1px solid rgba(23, 33, 43, 0.1);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  padding: 18px 18px 16px;
}

.summary-card p,
.panel p,
.lane p,
.timeline p,
.debrief p,
.story p,
.waiting-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.52;
}

.status-pill {
  background: rgba(23, 71, 66, 0.1);
  color: var(--accent);
}

.status-pill.warn {
  background: rgba(183, 106, 28, 0.12);
  color: var(--warn);
}

.status-pill.bad {
  background: rgba(157, 52, 52, 0.12);
  color: var(--bad);
}

.world-grid {
  display: grid;
  gap: 10px;
}

.world-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(23, 33, 43, 0.08);
}

.world-row strong {
  font-size: 13px;
}

.world-row span {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

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

.current-round h2 {
  margin-bottom: 6px;
}

.round-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.story {
  display: grid;
  gap: 16px;
}

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

.story-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(23, 33, 43, 0.08);
}

.story-card.frontline {
  border-color: rgba(155, 77, 41, 0.18);
}

.story-card.leadership {
  border-color: rgba(31, 77, 104, 0.18);
}

.story-card ul,
.panel ul,
.timeline ul,
.debrief ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

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

.lane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.lane.frontline .lane-title {
  color: var(--frontline);
}

.lane.leadership .lane-title {
  color: var(--leadership);
}

.option-list {
  display: grid;
  gap: 12px;
}

.option-card {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(23, 33, 43, 0.1);
  background: rgba(255, 255, 255, 0.84);
}

.option-card.selected {
  border-color: rgba(23, 71, 66, 0.36);
  box-shadow: inset 0 0 0 1px rgba(23, 71, 66, 0.2);
}

.option-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.option-card h4 {
  margin: 0;
  font-size: 16px;
}

.option-card p {
  margin: 8px 0 12px;
  font-size: 14px;
  color: var(--muted);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.tag {
  background: rgba(23, 33, 43, 0.06);
  color: var(--muted);
}

.chip.frontline {
  background: rgba(155, 77, 41, 0.12);
  color: var(--frontline);
}

.chip.leadership {
  background: rgba(31, 77, 104, 0.12);
  color: var(--leadership);
}

.decision-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.decision-status {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.waiting-card {
  display: grid;
  gap: 12px;
}

.timeline-list {
  display: grid;
  gap: 12px;
}

.timeline-item {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(23, 33, 43, 0.08);
}

.timeline-item header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.timeline-item h4 {
  margin: 0;
  font-size: 15px;
}

.timeline-item .delta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.delta {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(23, 33, 43, 0.06);
  color: var(--muted);
}

.debrief-grid {
  display: grid;
  gap: 12px;
}

.debrief-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(23, 33, 43, 0.1);
  background: rgba(255, 255, 255, 0.8);
}

.debrief-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
}

.empty-note {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px dashed rgba(23, 33, 43, 0.12);
  color: var(--muted);
}

.inline-code {
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
  font-size: 12px;
  background: rgba(23, 33, 43, 0.07);
  border-radius: 999px;
  padding: 2px 8px;
}

body.embed-mode {
  background:
    radial-gradient(circle at top left, rgba(23, 71, 66, 0.09), transparent 36%),
    linear-gradient(180deg, #f3ecdf 0%, #f8f4eb 100%);
}

body.embed-mode::before {
  opacity: 0.45;
}

body.embed-mode .shell {
  width: min(100vw, 100%);
  margin: 0;
}

body.embed-mode .masthead,
body.embed-mode .setup,
body.embed-mode .tabletop-shell {
  display: none !important;
}

body.embed-mode .workspace {
  grid-template-columns: 1fr;
  gap: 0;
}

body.embed-mode .overview,
body.embed-mode .stage {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  background: transparent;
}

body.embed-mode .overview {
  position: static;
  padding: 18px 18px 10px;
}

body.embed-mode .stage {
  padding: 8px 18px 18px;
}

@media (max-width: 1080px) {
  .workspace,
  .setup,
  .masthead,
  .story-grid,
  .lane-grid,
  .tabletop-grid {
    grid-template-columns: 1fr;
  }

  .overview {
    position: static;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 18px, 100%);
    margin: 10px auto 26px;
  }

  .masthead > div,
  .setup,
  .tabletop-shell,
  .overview,
  .stage {
    padding: 18px;
    border-radius: 22px;
  }

  h1 {
    font-size: 44px;
  }

  .decision-actions {
    flex-direction: column;
    align-items: stretch;
  }

  button,
  .role-link {
    width: 100%;
  }

  .tabletop-toolbar,
  .tabletop-card header {
    align-items: stretch;
    flex-direction: column;
  }

  .tabletop-frame {
    min-height: 820px;
    height: 820px;
  }
}
