:root {
  color-scheme: light;
  --paper: #fafcfd;
  --card: #fff;
  --ink: #273a50;
  --muted: #4f6276;
  --line: #d8e0e7;
  --brand: #37648a;
  --gold: #f8e4bb;
  --light: #eaf2f9;
  --accent: #be241a;
  --alert: #952d24;
  --radius: 6px;
  font-family: system-ui,-apple-system,sans-serif;
  color: var(--ink);
  background: var(--paper);
}

*,*::before,*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
}

a {
  color: var(--brand);
}

button,input,select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: .65;
}

a:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible {
  outline: 3px solid #2e6ca3;
  outline-offset: 3px;
}

h1,h2,h3,p {
  margin: 0;
}

h1,h2 {
  letter-spacing: -.03em;
  line-height: 1.14;
}

h1 {
  font-size: clamp(2.2rem,6.5vw,4.65rem);
}

h2 {
  font-size: clamp(1.4rem,3vw,1.85rem);
  color: var(--brand);
  font-weight: 650;
}

h3 {
  font-size: 1.05rem;
}

p {
  line-height: 1.55;
}

.wrap {
  max-width: 1170px;
  width: calc(100% - 48px);
  margin-inline: auto;
}

.masthead {
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.masthead-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  color: var(--ink);
  font-size: 1.07rem;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  letter-spacing: -.045em;
  line-height: 1.1;
}

.brand b {
  font-weight: 750;
}

.masthead-context {
  display: flex;
  align-items: center;
  gap: 16px;
}

#session-label {
  color: var(--brand);
  font-size: .88rem;
}

.quiet {
  font-weight: 650;
  font-size: .86rem;
  text-underline-offset: 4px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -80px;
  background: var(--card);
  padding: 10px;
  z-index: 10;
}

.skip:focus {
  top: 10px;
}

main {
  min-height: calc(100vh - 155px);
  padding-block: 35px 48px;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-block: 20px;
  font-size: .78rem;
  color: var(--muted);
}

.footer span:first-child,.kicker {
  font-size: .73rem;
  font-weight: 800;
  letter-spacing: .14em;
}

.kicker {
  color: var(--brand);
  margin-bottom: 8px;
}

.lead {
  max-width: 60ch;
  color: var(--muted);
}

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

.actions,.chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 44px;
  border-radius: 4px;
  padding: 9px 16px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: white;
  text-decoration: none;
  font-weight: 720;
  line-height: 1.2;
}

.button:hover {
  background: #971c15;
}

.button.secondary {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line);
}

.button.secondary:hover {
  background: var(--light);
}

.button.small {
  min-height: 39px;
  font-size: .9rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 29px;
  padding: 3px 9px;
  border-radius: 8px;
  background: var(--light);
  color: var(--ink);
  font-size: .78rem;
  font-weight: 730;
}

.chip.gold {
  background: var(--gold);
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  align-items: end;
  gap: 28px;
  background: var(--light);
  color: var(--ink);
  padding: clamp(20px,4vw,45px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.hero h1 {
  max-width: 12ch;
}

.hero .kicker {
  color: var(--brand);
}

.hero .lead {
  color: var(--muted);
  margin-top: 14px;
}

.hero-mark {
  align-self: center;
  justify-self: end;
  width: min(100%,345px);
  color: var(--brand);
}

.hero-mark svg {
  display: block;
  width: 100%;
  height: auto;
}

.launch {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 18px;
  align-items: start;
  margin-top: 20px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(15px,2.4vw,26px);
  min-width: 0;
}

.panel h2+p,.panel h3+p {
  margin-top: 7px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.field>label,.field>span:first-child {
  font-size: .87rem;
  font-weight: 750;
}

.field small,.small-print,.help {
  font-size: .81rem;
  color: var(--muted);
  line-height: 1.42;
}

.field input:not([type=radio]):not([type=range]),.field select {
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #aebcaf;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  width: 100%;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid>.full {
  grid-column: 1/-1;
}

.setup {
  display: grid;
  gap: 15px;
}

.setup details summary,.report-details summary {
  font-weight: 740;
  cursor: pointer;
  min-height: 35px;
  display: list-item;
}

.setup details .form-grid {
  margin-top: 8px;
}

.scenarios {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
  display: grid;
  gap: 7px;
}

.scenarios legend {
  font-size: .87rem;
  font-weight: 750;
  margin-bottom: 8px;
}

.scenario-option {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}

.scenario-option:has(input:checked) {
  background: var(--light);
  border-color: var(--brand);
}

.scenario-option input {
  accent-color: var(--brand);
}

.scenario-option b,.scenario-option small {
  display: block;
}

.scenario-option small {
  font-size: .77rem;
  color: var(--muted);
}

.scenario-option b {
  font-size: .91rem;
}

.error {
  color: var(--alert);
  font-weight: 650;
  min-height: 0;
}

.error:empty {
  display: none;
}

.page-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
}

.page-title h1 {
  font-size: clamp(2rem,5.6vw,3.9rem);
}

.game-grid {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1.08fr);
  gap: clamp(24px, 6vw, 80px);
  align-items: start;
}

.forecast {
  color: var(--muted);
}

.forecast-values {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 12px;
  padding-block: 6px;
}

.forecast-values span {
  display: block;
  color: var(--brand);
  font-size: .9rem;
}

.forecast-values strong {
  font-size: clamp(1.45rem,4vw,1.95rem);
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.policy-fields {
  display: grid;
  gap: 18px;
}

.number-control {
  position: relative;
}

.field .number-control input[type=number] {
  padding-right: 58px;
}

.number-control>span {
  position: absolute;
  right: 23px;
  top: 50%;
  transform: translateY(-50%);
  font-size: .76rem;
  color: var(--muted);
  pointer-events: none;
}

.turns {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.turns li {
  text-align: center;
  background: #e8edf2;
  border-radius: 5px;
  padding: 4px 1px;
  font-size: .72rem;
  font-weight: 700;
}

.turns li.done {
  background: #dcebf6;
  color: var(--brand);
}

.turns li[aria-current=step] {
  background: #fbe3df;
  color: var(--accent);
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
}

.tabs button {
  background: transparent;
  border: 0;
  border-bottom: 4px solid transparent;
  color: var(--muted);
  padding: 10px 17px 7px;
  font-weight: 650;
  min-height: 48px;
  font-size: .82rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.tabs button[aria-pressed=true] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5,1fr);
  gap: 9px;
}

.metric {
  min-width: 0;
  padding: 12px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  display: grid;
  gap: 3px;
}

.metric strong {
  font-size: clamp(1.2rem,3.1vw,1.7rem);
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}

.metric span {
  font-size: .78rem;
  font-weight: 690;
}

.metric small {
  font-size: .74rem;
  color: var(--muted);
}

.report-scroll {
  overflow-x: auto;
}

.report {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: .85rem;
}

.report th,.report td {
  border-bottom: 1px solid var(--line);
  padding: 8px 9px;
  text-align: right;
  white-space: nowrap;
}

.report th:first-child,.report td:first-child {
  text-align: left;
}

.report thead th {
  background: var(--light);
  color: var(--ink);
}

.report td:first-child,.report th:first-child {
  white-space: normal;
  min-width: 125px;
}

.advisor {
  background: var(--light);
  border-radius: 12px;
  padding: 13px 16px;
}

.advisor ul {
  padding-left: 18px;
  margin: 6px 0 0;
}

.advisor li {
  margin-block: 4px;
}

.class-grid {
  display: grid;
  grid-template-columns: minmax(215px,.72fr) minmax(0,1.8fr);
  gap: 16px;
  align-items: start;
}

.qr {
  width: min(100%,240px);
  height: auto;
  display: block;
  margin: auto;
  aspect-ratio: 1;
}

.join-link {
  word-break: break-all;
  font-size: .83rem;
}

.class-code {
  font-size: 2rem;
  letter-spacing: .15em;
  font-weight: 800;
  text-align: center;
}

.class-table th:first-child,.class-table td:first-child {
  min-width: 120px;
}

.teacher-detail summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--brand);
}

.teacher-detail>div {
  margin-top: 8px;
  max-width: 100%;
}

.report select {
  max-width: 100%;
}

.guide p,.guide li {
  max-width: 78ch;
}

.guide li {
  margin-block: 8px;
}

.guide ul,.guide ol {
  margin-block: 0;
  padding-left: 24px;
}

.mini-chart {
  width: 100%;
  height: auto;
  display: block;
  max-height: 130px;
}

.chart-line {
  stroke: var(--brand);
  stroke-width: 2.4;
  fill: none;
  vector-effect: non-scaling-stroke;
}

.chart-grid {
  stroke: var(--line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart-dot {
  fill: var(--brand);
}

@media(max-width:820px) {
  .game-grid,.launch {
    grid-template-columns: 1fr;
  }
  .class-grid {
    grid-template-columns: minmax(180px,.75fr) minmax(0,1.25fr);
  }
  .metrics {
    grid-template-columns: repeat(3,1fr);
  }
}

@media(max-width:590px) {
  .wrap {
    width: calc(100% - 24px);
  }
  .masthead-inner {
    min-height: 60px;
  }
  .brand {
    font-size: .93rem;
  }
  .brand img {
    width: 33px;
    height: 33px;
  }
  main {
    padding-block: 20px 30px;
  }
  .hero {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .hero-mark {
    display: none;
  }
  .class-grid {
    grid-template-columns: 1fr;
  }
  .metrics {
    grid-template-columns: repeat(2,1fr);
  }
  .policy-fields {
    gap: 10px;
  }
  .footer {
    font-size: .68rem;
  }
  .table-actions {
    align-items: stretch;
  }
  .table-actions .button {
    flex: 1;
  }
}

@media(prefers-reduced-motion:no-preference) {
  .button,.tabs button {
    transition: background-color .15s;
  }
}

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

.trend {
  min-width: 0;
  margin: 0;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.trend figcaption {
  color: var(--brand);
  font-weight: 650;
}

.chart-label {
  font-size: 10px;
  fill: var(--muted);
}

.event-setting {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  cursor: pointer;
}

.event-setting input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--brand);
}

.event-setting small {
  display: block;
  color: var(--muted);
}

.event-card,
.end-summary {
  padding: 16px;
  border-radius: 12px;
}

.event-card {
  background: #fbefdb;
  border: 1px solid #e2c68c;
}

.end-summary {
  background: var(--light);
}

.event-card h3 + p,
.end-summary h2 + p {
  margin-top: 6px;
}

.end-summary dl {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  margin-block: 12px;
}

.end-summary dd {
  margin: 0;
  font-weight: 700;
}

.end-summary dd span {
  color: var(--muted);
}

.end-summary p + p {
  margin-top: 3px;
}

main:has(.game-shell) {
  padding-top: 0;
}

.game-title h1 {
  font-size: clamp(1.35rem, 3.5vw, 2rem);
}

.game-title .kicker {
  margin-bottom: 3px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.section-heading span {
  color: var(--muted);
  font-size: .88rem;
}

.prepare-steps {
  margin: 0;
  padding-left: 1.25rem;
  line-height: 1.65;
}

.outlook-icon {
  width: 55px;
  height: 55px;
}

.decision-form {
  display: grid;
  gap: 20px;
}

.decision-control.with-slider {
  display: grid;
  grid-template-columns: minmax(0,1fr) 98px;
  align-items: start;
  gap: 12px;
}

.decision-control.with-slider input[type=number] {
  padding-right: 32px;
}

.decision-control.with-slider .number-control > span {
  right: 17px;
}

.policy-fields label {
  color: var(--brand);
}

.slider input {
  appearance: none;
  display: block;
  width: 100%;
  height: 29px;
  margin: 0;
  cursor: pointer;
  background: transparent;
}

.slider input::-webkit-slider-runnable-track {
  height: 7px;
  border-radius: 8px;
  background: linear-gradient(to right, #cc2876 var(--fill, 0%), #dce3e9 var(--fill, 0%));
}

.slider input::-webkit-slider-thumb {
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -7.5px;
  border: 1px solid #899cab;
  border-radius: 50%;
  background: #fff;
}

.slider input::-moz-range-track {
  height: 7px;
  border-radius: 8px;
  background: #dce3e9;
}

.slider input::-moz-range-progress {
  height: 7px;
  border-radius: 8px;
  background: #cc2876;
}

.slider input::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 1px solid #899cab;
  border-radius: 50%;
  background: #fff;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: .75rem;
}

.decision-submit {
  text-align: center;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(200px, 1fr);
  align-items: start;
  gap: 24px;
}

.trend-value {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 8px;
  margin-block: 5px;
}

.score-marker {
  padding: 3px 7px;
  border-radius: 4px;
  font-size: .72rem;
  background: #fbe3df;
  color: #812019;
}

.score-10 {
  background: #fff0ca;
  color: #644400;
}

.score-25 {
  background: #e0f2e9;
  color: #20543d;
}

.average-rating {
  display: grid;
  justify-items: center;
  padding-block: 14px;
  border-block: 1px solid var(--line);
  color: var(--brand);
}

.average-rating strong {
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.2;
  font-weight: 450;
  font-variant-numeric: tabular-nums;
}

.admin-entry {
  max-width: 580px;
  margin-inline: auto;
}

.team-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding-block: 12px;
  border-block: 1px solid var(--line);
}

.team-form .error,
.team-status {
  grid-column: 1 / -1;
}

.team-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 16px;
  padding: 12px;
  background: var(--light);
  border-radius: var(--radius);
  overflow-wrap: anywhere;
}

.team-status:empty {
  margin: 0;
  min-height: 0;
}

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

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

@media(max-width:430px) {
  #session-label {
    display: none;
  }

  .tabs button {
    flex: 1;
    padding-inline: 5px;
    font-size: .72rem;
  }

  .masthead-context {
    gap: 4px 9px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .masthead-context .quiet {
    font-size: .74rem;
  }

  .team-strip,
  .team-form {
    grid-template-columns: 1fr;
  }

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