:root {
  --ink: #171714;
  --paper: #f3f0e8;
  --card: #fbfaf6;
  --muted: #6f6d65;
  --line: #d9d5ca;
  --yellow: #e9bd2f;
  --blue: #367dcc;
  --red: #df4b40;
  --green: #3b9256;
  --white: #f4f1e7;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #171714; outline-offset: 3px; }

.topbar {
  min-height: 72px;
  padding: 0 clamp(20px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  font-size: .82rem;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.brand, .back-link { color: inherit; text-decoration: none; }
.eyebrow {
  margin: 0 0 10px;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}
h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: 24px;
  font-size: clamp(3rem, 7vw, 7.3rem);
  line-height: .88;
  letter-spacing: -.07em;
}
h1 em { color: var(--muted); font-family: Georgia, serif; font-weight: 400; }
.intro { max-width: 700px; color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.35rem); line-height: 1.5; }

.start-main { padding: clamp(54px, 8vw, 120px) clamp(20px, 6vw, 96px) 80px; }
.start-hero { margin-bottom: clamp(52px, 8vw, 110px); }
.session-card { max-width: 1180px; }
.session-card > label { display: block; margin-bottom: 8px; font-weight: 750; }
.session-entry { display: flex; gap: 10px; max-width: 620px; }
input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 14px 16px;
  background: var(--card);
  color: var(--ink);
}
.small-button, .secondary-button {
  border: 1px solid var(--ink);
  border-radius: 4px;
  padding: 12px 16px;
  background: transparent;
  color: var(--ink);
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}
.field-note, .score-help { color: var(--muted); font-size: .88rem; }
.route-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 38px; }
.route-card {
  position: relative;
  container-type: inline-size;
  min-width: 0;
  min-height: 285px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: clamp(24px, 4vw, 44px);
  border: 1px solid var(--line);
  overflow: hidden;
  background: var(--card);
  color: inherit;
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease;
}
.route-card > div { min-width: 0; }
.route-card:hover { transform: translateY(-4px); box-shadow: 0 22px 50px rgba(23,23,20,.09); }
.route-number { color: var(--muted); font-size: .75rem; font-weight: 800; }
.route-card h2 { max-width: 100%; margin: 0 0 12px; font-size: clamp(2rem, 10cqi, 3.7rem); line-height: .96; letter-spacing: -.05em; }
.route-card p:last-child { max-width: 390px; color: var(--muted); line-height: 1.5; }
.route-arrow {
  position: absolute;
  right: clamp(22px, 3vw, 38px);
  bottom: clamp(22px, 3vw, 34px);
  font-size: 2.4rem;
  line-height: 1;
}
.test-route { border-top: 8px solid var(--green); }
.participant-route { border-top: 8px solid var(--yellow); }
.screen-route { border-top: 8px solid var(--blue); }

.test-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(243,240,232,.96);
  backdrop-filter: blur(14px);
}
.test-progress-summary { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.progress-track { width: min(220px, 24vw); height: 6px; overflow: hidden; background: var(--line); }
.progress-track i { display: block; width: 0; height: 100%; background: var(--green); transition: width .25s ease; }
.test-main { width: min(1040px, calc(100% - 40px)); margin: 0 auto; padding: clamp(52px, 8vw, 100px) 0 90px; }
.test-hero { margin-bottom: clamp(60px, 9vw, 120px); }
.test-hero h1 { font-size: clamp(3.3rem, 8vw, 7rem); }
.test-section { margin-bottom: 90px; scroll-margin-top: 100px; }
.test-section-heading {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: start;
  padding: 0 0 26px;
  border-bottom: 3px solid var(--ink);
}
.section-number { color: var(--muted); font-size: .78rem; font-weight: 850; }
.test-section-heading h2, .results-copy h2 {
  margin: 0 0 8px;
  font-size: clamp(2.8rem, 6vw, 5.2rem);
  line-height: .9;
  letter-spacing: -.06em;
}
.test-section-heading p:last-child { margin: 0; max-width: 620px; color: var(--muted); }
.test-section-heading > strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.question-list { display: grid; }
.question-pair {
  min-width: 0;
  margin: 0;
  padding: 24px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
}
.question-pair legend {
  width: 100%;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.question-pair legend span { display: inline-block; width: 34px; color: var(--ink); }
.answer-option {
  display: grid;
  grid-template-columns: 30px 32px 1fr;
  gap: 10px;
  align-items: start;
  padding: 13px 14px;
  border: 1px solid transparent;
  border-radius: 4px;
  line-height: 1.45;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.answer-option:hover { background: rgba(255,255,255,.48); }
.answer-option:has(input:checked) { border-color: #79ae87; background: #e1eee3; }
.answer-option input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--green); }
.answer-letter { font-weight: 900; }
.question-pair.is-answered legend span { color: var(--green); }
.test-results { scroll-margin-top: 100px; }
.results-copy { padding-bottom: 26px; border-bottom: 3px solid var(--ink); }
.results-copy > p:last-child { color: var(--muted); }
.test-result-rows { margin: 20px 0 50px; border: 1px solid var(--line); background: var(--card); }
.test-result-row {
  display: grid;
  grid-template-columns: 1fr 150px 150px;
  gap: 20px;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  box-shadow: inset 8px 0 0 var(--result-color);
}
.test-result-row:last-child { border-bottom: 0; }
.test-result-row > strong { padding-left: 12px; font-size: 1.2rem; }
.test-result-row span { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); }
.test-result-row b { color: var(--ink); font-size: 1.3rem; }
.share-result-card { padding: clamp(22px, 4vw, 42px); background: var(--ink); color: white; }
.share-result-card h3 { margin: 0 0 8px; font-size: clamp(1.8rem, 4vw, 3rem); letter-spacing: -.04em; }
.share-result-card > div:first-child > p:last-child { color: #aaa89f; }
.share-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; }
.share-fields label { display: grid; gap: 7px; color: #c9c6bd; font-size: .74rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.share-fields input { border-color: #504f49; background: #272723; color: white; }
.share-result-card .primary-button { background: white; color: var(--ink); }
.share-result-card .text-link { color: white; }
.share-result-card .status { color: #f2b544; }

.form-main { width: min(1080px, calc(100% - 40px)); margin: 0 auto; padding: clamp(52px, 8vw, 100px) 0 80px; }
.form-intro h1 { font-size: clamp(3rem, 7vw, 6.4rem); }
.form-intro p:last-child { color: var(--muted); font-size: 1.1rem; }
.score-form { display: grid; gap: 18px; }
.identity-card, .score-card { border: 1px solid var(--line); background: var(--card); padding: clamp(20px, 4vw, 42px); }
.identity-card { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.identity-card label { display: grid; gap: 8px; font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.score-card-heading { display: flex; justify-content: space-between; gap: 28px; align-items: start; margin-bottom: 28px; }
.score-card-heading h2 { margin: 0; font-size: clamp(2rem, 5vw, 4rem); letter-spacing: -.05em; }
.sum-key { min-width: 225px; display: grid; gap: 8px; }
.sum-key span { display: flex; justify-content: space-between; gap: 20px; color: var(--muted); }
.sum-key strong { color: var(--ink); }
.sum-key strong.is-complete { color: var(--green); }
.score-grid { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(90px, 140px) minmax(90px, 140px); gap: 12px; align-items: center; }
.score-grid-head { padding: 0 18px 10px; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; text-align: center; }
.score-grid-head span:first-child { text-align: left; }
.color-row { padding: 13px 18px; border-top: 1px solid var(--line); }
.color-row input { padding: 12px; text-align: center; font-size: 1.25rem; font-weight: 800; }
.color-label { display: flex; align-items: center; gap: 13px; font-size: 1.1rem; }
.color-label i { width: 30px; height: 30px; border-radius: 50%; background: var(--swatch); border: 1px solid rgba(23,23,20,.18); }
.score-help { margin: 18px 0 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; padding: 12px 0; }
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  border: 0;
  border-radius: 4px;
  padding: 16px 20px;
  background: var(--ink);
  color: white;
  font-weight: 780;
  text-decoration: none;
  cursor: pointer;
}
.primary-button:disabled { opacity: .55; cursor: wait; }
.text-link { color: inherit; font-weight: 750; }
.status { flex-basis: 100%; min-height: 1.4em; color: var(--red); }

.dashboard-page { background: #eae7df; }
.dashboard-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  padding: 24px clamp(20px, 3vw, 52px);
  background: var(--ink);
  color: white;
}
.dashboard-header h1 { margin: 12px 0 0; font-size: clamp(2rem, 4vw, 4.8rem); line-height: .94; }
.dashboard-header h1 em { color: #aaa89f; }
.back-link { color: #c5c2b9; font-size: .78rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.dashboard-controls { display: flex; align-items: end; gap: 10px; }
.dashboard-controls .secondary-button { color: white; border-color: #77756d; }
.compact-field { display: grid; gap: 6px; color: #aaa89f; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.compact-field input { width: 230px; padding: 11px 12px; border-color: #4c4b47; background: #272723; color: white; }
.dashboard-main { padding: 18px clamp(16px, 3vw, 52px) 52px; }
.live-strip { min-height: 38px; display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: .83rem; }
.live-strip strong { color: var(--ink); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #42a866; box-shadow: 0 0 0 5px rgba(66,168,102,.13); }
.board-legend { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.board-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.board-legend i { width: 15px; height: 15px; display: inline-block; }
.legend-high { background: #bfe7c8; border: 1px solid #77b887; }
.legend-gap { background: var(--card); border: 2px solid #d3463c; }
.legend-total, .total-warning {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f2b544;
  color: #4d3100;
  font-style: normal;
  font-size: .7rem;
  font-weight: 900;
}
#status { margin-left: auto; }
.board { border: 1px solid #c8c4b9; background: var(--card); }
.board-scroll { overflow: auto; max-height: min(72vh, 900px); position: relative; }
table { width: 100%; min-width: 1050px; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
th, td { padding: 13px 10px; border-right: 1px solid #d7d3c8; border-bottom: 1px solid #d7d3c8; text-align: center; }
thead th { position: sticky; top: 0; z-index: 4; }
.color-head th { padding: 16px 10px; font-size: 1.05rem; }
.yellow-head { background: var(--yellow); }
.blue-head { background: var(--blue); color: white; }
.red-head { background: var(--red); color: white; }
.green-head { background: var(--green); color: white; }
.white-head { background: var(--white); }
.sub-head th { top: 53px; padding: 7px; background: #252521; color: #d5d2ca; font-size: .68rem; letter-spacing: .04em; text-transform: uppercase; }
.name-column {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 190px;
  max-width: 260px;
  padding-left: 18px;
  background: var(--card);
  text-align: left;
}
thead .name-column { z-index: 6; background: var(--ink); color: white; }
tbody .name-column { font-size: 1rem; }
tbody tr:nth-child(even) td, tbody tr:nth-child(even) .name-column { background-color: #f3f0e8; }
tbody td { font-size: 1.05rem; font-weight: 700; }
tbody td.is-highest {
  position: relative;
  background: #bfe7c8;
  color: #145c2d;
  box-shadow: inset 0 0 0 1px #77b887;
  font-weight: 900;
}
tbody tr:nth-child(even) td.is-highest { background: #bfe7c8; }
tbody td.has-thinking-doing-gap {
  position: relative;
  border-top: 3px solid #d3463c;
  border-bottom: 3px solid #d3463c;
}
tbody td.gap-thinking {
  border-left: 3px solid #d3463c;
  border-right: 2px solid #d3463c;
}
tbody td.gap-doing {
  border-right: 3px solid #d3463c;
}
tbody td.is-highest.has-thinking-doing-gap {
  box-shadow: inset 0 0 0 1px #77b887;
}
.action-column { width: 96px; border-right: 0; }
thead .action-column { background: var(--ink); }
.row-cues { display: flex; align-items: center; justify-content: center; gap: 5px; }
.total-warning {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  cursor: help;
  box-shadow: 0 0 0 2px rgba(242,181,68,.2);
}
.total-warning:focus-visible { outline: 2px solid #7d5200; outline-offset: 2px; }
.edit-button, .delete-button, .save-edit-button, .cancel-edit-button {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #8f8c84;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.edit-button:hover { background: #e1ded5; color: var(--ink); }
.delete-button:hover { background: #f2d9d6; color: #9c352d; }
.save-edit-button { background: #d8ebdc; color: #17612d; }
.cancel-edit-button { background: #e5e2da; color: #625f58; }
.save-edit-button:disabled { opacity: .45; cursor: wait; }
.editing-score-cell { padding: 6px; background: #fff9e7; }
tbody tr:nth-child(even) td.editing-score-cell { background: #fff9e7; }
.score-edit-input {
  width: 54px;
  min-width: 0;
  padding: 8px 4px;
  border: 2px solid #9c9688;
  border-radius: 3px;
  background: white;
  text-align: center;
  font-size: 1rem;
  font-weight: 850;
}
tfoot th, tfoot td { position: sticky; z-index: 4; font-weight: 850; }
.average-row th, .average-row td { bottom: 0; background: #dad6cc; }
.total-row th, .total-row td { bottom: 47px; background: var(--ink); color: white; }
tfoot .name-column { z-index: 5; }
.empty-state { padding: 80px 20px; text-align: center; color: var(--muted); }
.empty-state span { display: block; color: var(--ink); font-size: 1.8rem; font-weight: 800; letter-spacing: -.03em; }
.team-profile { margin-top: 18px; padding: clamp(22px, 3vw, 38px); background: var(--card); border: 1px solid #c8c4b9; }
.profile-heading { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 30px; }
.profile-heading h2 { margin: 0; font-size: clamp(1.8rem, 3vw, 3rem); letter-spacing: -.04em; }
.profile-heading > p { max-width: 420px; margin: 0; color: var(--muted); font-size: .86rem; }
.profile-bars { display: grid; grid-template-columns: repeat(5, 1fr); gap: clamp(14px, 2vw, 32px); }
.profile-label { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.profile-label span { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.bar-track { height: 12px; margin-top: 7px; background: #e0ddd4; overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--color); transition: width .5s ease; }
.thinking-bar i { opacity: .38; }
.dashboard-footer-actions { display: flex; gap: 12px; margin-top: 18px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 800px) {
  .route-grid, .identity-card, .share-fields { grid-template-columns: 1fr; }
  .route-card { min-height: 230px; }
  .score-card-heading, .dashboard-header, .profile-heading { align-items: stretch; flex-direction: column; }
  .dashboard-controls { flex-wrap: wrap; }
  .compact-field { flex: 1 1 100%; }
  .compact-field input { width: 100%; }
  .profile-bars { grid-template-columns: 1fr; }
  .live-strip { flex-wrap: wrap; padding: 8px 0; }
  .board-legend { width: 100%; margin-left: 21px; }
  #status { margin-left: 0; }
  .test-section-heading { grid-template-columns: auto 1fr; }
  .test-section-heading > strong { grid-column: 2; }
}

@media (max-width: 520px) {
  .topbar > span { display: none; }
  .session-entry { flex-direction: column; }
  .route-card { grid-template-columns: auto minmax(0, 1fr); padding-right: clamp(24px, 4vw, 44px); }
  .route-arrow { display: none; }
  .score-grid { grid-template-columns: minmax(110px, 1fr) 76px 76px; gap: 8px; }
  .score-grid-head, .color-row { padding-left: 8px; padding-right: 8px; }
  .color-label i { width: 22px; height: 22px; }
  .sum-key { min-width: 0; }
  .dashboard-footer-actions { flex-direction: column; }
  .test-progress-summary { font-size: .72rem; }
  .progress-track { width: 90px; }
  .test-result-row { grid-template-columns: 1fr 90px 90px; gap: 8px; padding: 16px 12px; }
  .test-result-row > strong { padding-left: 8px; }
  .test-result-row span { display: grid; gap: 2px; font-size: .7rem; }
}

:fullscreen .dashboard-header { padding-top: 14px; padding-bottom: 14px; }
:fullscreen .dashboard-header .back-link, :fullscreen .dashboard-controls { display: none; }
:fullscreen .dashboard-header h1 { margin-top: 0; font-size: 3rem; }
:fullscreen .board-scroll { max-height: min(82vh, 960px); }
