:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #64707d;
  --line: #d7dde2;
  --paper: #fffaf0;
  --panel: #ffffff;
  --panel-strong: #f2f7f4;
  --accent: #0d766c;
  --accent-dark: #084c45;
  --warning: #cf3e2f;
  --success: #178450;
  --shadow: 0 24px 70px rgba(33, 42, 54, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    linear-gradient(90deg, rgba(13, 118, 108, 0.09) 0 1px, transparent 1px 100%),
    linear-gradient(0deg, rgba(13, 118, 108, 0.07) 0 1px, transparent 1px 100%),
    #f7efe1;
  background-size: 36px 36px;
}

button {
  font: inherit;
}

.asset-loader {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 18%),
    radial-gradient(circle at 78% 22%, rgba(255, 191, 61, 0.42), rgba(255, 191, 61, 0) 24%),
    linear-gradient(135deg, #073b30 0%, #0f766e 46%, #102033 100%);
  backdrop-filter: blur(10px);
}

body.is-loading .asset-loader {
  display: flex;
}

.loader-card {
  width: min(520px, 100%);
  padding: clamp(20px, 5vw, 34px);
  text-align: center;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  box-shadow: 0 26px 80px rgba(8, 37, 26, 0.28);
}

.brand-loader {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 253, 247, 0.92));
  border-color: rgba(255, 255, 255, 0.74);
}

.brand-loader::before {
  content: "";
  position: absolute;
  inset: -45% -18% auto;
  height: 140px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.78), transparent);
  transform: rotate(-8deg) translateX(-55%);
  animation: loader-sweep 2.2s ease-in-out infinite;
  pointer-events: none;
}

.loader-eyebrow {
  margin: 0 0 12px;
  color: #0e6b40;
  font-size: 11px;
  font-weight: 950;
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.loader-brand {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 0;
  width: 100%;
  max-width: 100%;
  margin: 0;
  overflow: visible;
  color: #0f2438;
  font-size: clamp(28px, 10vw, 58px);
  font-weight: 950;
  line-height: 1.08;
  white-space: nowrap;
}

.loader-brand span {
  flex: 0 0 auto;
  display: inline-block;
  color: transparent;
  background: linear-gradient(135deg, #102033 0%, #0f766e 52%, #ffbf3d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  opacity: 0;
  transform: translateX(-28px) translateY(8px) rotate(-5deg);
  animation: brand-letter-in 0.68s cubic-bezier(0.18, 0.86, 0.25, 1.18) forwards;
  animation-delay: calc(var(--i) * 0.075s);
}

.loader-card p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.loader-bar {
  height: 10px;
  margin-top: 18px;
  overflow: hidden;
  background: #dceee7;
  border-radius: 999px;
}

.loader-bar span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #1f8a4c, #27c6a1, #ffbf3d);
  border-radius: inherit;
  transition: width 0.25s ease;
}

.main-menu {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.7fr);
  align-items: center;
  gap: clamp(18px, 5vw, 70px);
  padding: clamp(18px, 5vw, 70px);
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 28%, rgba(242, 200, 75, 0.34), transparent 28%),
    radial-gradient(circle at 18% 82%, rgba(13, 118, 108, 0.22), transparent 30%),
    var(--paper);
}

.main-menu::before {
  content: "";
  position: absolute;
  inset: clamp(10px, 2vw, 22px);
  border: 2px solid #202a32;
  border-radius: 8px;
  pointer-events: none;
}

.menu-copy {
  position: relative;
  z-index: 1;
  max-width: 690px;
}

.menu-kicker {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: clamp(0.78rem, 2.2vh, 1rem);
  font-weight: 950;
  text-transform: uppercase;
}

.menu-copy h1 {
  max-width: 8.5em;
  font-size: clamp(2.35rem, 12vw, 6.8rem);
  line-height: 0.92;
}

.menu-subtitle {
  max-width: 460px;
  margin: clamp(10px, 2vh, 18px) 0 clamp(18px, 4vh, 36px);
  color: #4f5d6b;
  font-size: clamp(1rem, 3vh, 1.45rem);
  font-weight: 850;
}

.menu-start-button {
  min-height: clamp(46px, 7vh, 62px);
  padding: 0 clamp(22px, 4vw, 42px);
  color: #ffffff;
  font-size: clamp(1rem, 2.7vh, 1.35rem);
  font-weight: 950;
  background: var(--accent);
  border: 2px solid #202a32;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 10px 0 rgba(32, 42, 50, 0.18);
}

.menu-orbit {
  position: relative;
  z-index: 1;
  width: min(34vw, 46vh, 360px);
  aspect-ratio: 1;
  justify-self: center;
  display: grid;
  place-items: center;
}

.menu-spinner {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #fffdf7;
  border: clamp(6px, 1.3vw, 10px) solid #202a32;
  border-radius: 50%;
  box-shadow: 0 28px 60px rgba(32, 42, 50, 0.22);
  animation: menu-spin 8s linear infinite;
}

.menu-spinner span {
  position: absolute;
  width: 50%;
  height: 50%;
  transform-origin: 100% 100%;
}

.slice-one {
  background: #c43f63;
}

.slice-two {
  background: #255fd0;
  transform: rotate(90deg);
}

.slice-three {
  background: #18a65a;
  transform: rotate(180deg);
}

.slice-four {
  background: #f2c84b;
  transform: rotate(270deg);
}

.menu-spinner::after {
  content: "";
  position: absolute;
  inset: 42%;
  background: #fffdf7;
  border: clamp(4px, 0.8vw, 7px) solid #202a32;
  border-radius: 50%;
}

.menu-pointer {
  position: absolute;
  top: -3%;
  left: 50%;
  width: 0;
  height: 0;
  border-right: clamp(18px, 3vw, 30px) solid transparent;
  border-left: clamp(18px, 3vw, 30px) solid transparent;
  border-top: clamp(36px, 6vw, 58px) solid #202a32;
  transform: translateX(-50%);
  filter: drop-shadow(0 10px 10px rgba(32, 42, 50, 0.24));
}

.game-shell {
  visibility: hidden;
}

body.is-playing .main-menu {
  display: none;
}

body.is-playing .game-shell {
  visibility: visible;
}

.game-shell {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  padding: clamp(6px, 1.2vw, 14px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
  border: 2px solid #202a32;
  border-radius: 0;
  box-shadow: var(--shadow);
}

.topbar,
.section-heading,
.action-row,
.round-panel,
.history-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  min-height: 0;
  padding: 0 0 clamp(5px, 1vh, 9px);
  border-bottom: 2px solid #202a32;
}

.eyebrow {
  display: none;
  margin: 0;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(1.25rem, 4vh, 2.15rem);
  line-height: 1;
}

h2 {
  font-size: clamp(1rem, 2.4vh, 1.35rem);
  line-height: 1.1;
}

.round-panel {
  flex-wrap: wrap;
  color: var(--muted);
  font-size: clamp(0.78rem, 2.1vh, 0.95rem);
  font-weight: 800;
  justify-content: flex-end;
}

.play-area {
  display: grid;
  grid-template-columns: minmax(0, 0.46fr) minmax(0, 0.54fr);
  gap: clamp(6px, 1vw, 12px);
  flex: 1;
  min-height: 0;
  padding-top: clamp(6px, 1vh, 10px);
}

.builder-panel,
.chart-panel {
  min-width: 0;
  min-height: 0;
  padding: clamp(7px, 1.2vw, 13px);
  background: var(--panel);
  border: 2px solid #202a32;
  border-radius: 8px;
}

.builder-panel {
  display: grid;
  grid-template-columns: minmax(105px, 34%) minmax(0, 1fr);
  grid-template-rows: auto auto auto auto auto;
  gap: clamp(5px, 1vh, 9px) clamp(7px, 1vw, 12px);
  overflow: hidden;
}

.builder-panel .section-heading {
  grid-column: 1 / -1;
}

.chart-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(6px, 1vh, 10px);
  overflow: hidden;
  background: var(--panel-strong);
}

.rotate-gate {
  display: none;
}

.pill {
  display: inline-flex;
  min-height: clamp(24px, 4.8vh, 32px);
  align-items: center;
  justify-content: center;
  padding: 0 clamp(8px, 1vw, 12px);
  color: #ffffff;
  font-size: clamp(0.74rem, 2vh, 0.88rem);
  font-weight: 900;
  white-space: nowrap;
  background: #20323c;
  border-radius: 999px;
}

.spinner-stage {
  position: relative;
  grid-column: 1;
  grid-row: 2 / 6;
  width: min(100%, 180px, 32vmin);
  aspect-ratio: 1;
  margin: 0 auto;
  display: grid;
  align-self: center;
  place-items: center;
}

.wheel-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 14px 24px rgba(32, 42, 50, 0.18));
}

.wheel-layer {
  transform-box: view-box;
  transform-origin: 160px 160px;
}

.wheel-layer.is-spinning {
  animation: spin-wheel 2.15s cubic-bezier(0.18, 0.8, 0.2, 1) both;
}

.wheel-layer.is-failing {
  animation: fail-shake 0.42s ease-in-out;
}

.wheel-slice-fill {
  stroke: none;
}

.wheel-slice-fill.is-empty {
  fill: #fffdf7;
}

.wheel-hit-slice {
  cursor: pointer;
  fill: transparent;
  stroke: transparent;
  stroke-width: 0;
  pointer-events: fill;
  transition:
    filter 140ms ease,
    opacity 140ms ease,
    transform 140ms ease;
}

.wheel-hit-slice:hover,
.wheel-hit-slice:focus {
  outline: none;
}

.wheel-hit-slice:hover {
  fill: rgba(255, 255, 255, 0.12);
}

.wheel-hit-slice:focus {
  stroke: #ffffff;
  stroke-width: 5;
}

.wheel-divider,
.wheel-outline {
  fill: none;
  stroke: #202a32;
  stroke-linecap: round;
  stroke-width: 4;
  pointer-events: none;
}

.wheel-outline {
  stroke-width: 6;
}

.wheel-cap {
  fill: #ffffff;
  stroke: #202a32;
  stroke-width: 5;
  pointer-events: none;
}

.pointer {
  position: absolute;
  top: -2px;
  left: 50%;
  z-index: 2;
  width: 0;
  height: 0;
  border-right: 18px solid transparent;
  border-left: 18px solid transparent;
  border-top: 34px solid #202a32;
  transform: translateX(-50%);
}

.control-group {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 4px;
  padding: clamp(4px, 0.9vh, 7px) 0;
  border-top: 1px solid var(--line);
}

.control-label {
  color: var(--muted);
  font-size: clamp(0.62rem, 1.7vh, 0.74rem);
  font-weight: 900;
  text-transform: uppercase;
}

.segmented,
.palette {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(4px, 0.75vw, 7px);
}

.segment-button,
.swatch-button,
.small-button,
.secondary-button,
.primary-button {
  min-height: clamp(28px, 5vh, 36px);
  border: 2px solid #202a32;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    background 120ms ease;
}

.segment-button:active,
.swatch-button:active,
.small-button:active,
.secondary-button:active,
.primary-button:active {
  transform: translateY(1px);
}

.segment-button {
  min-width: clamp(30px, 4.4vw, 38px);
  padding: 0 clamp(5px, 0.8vw, 9px);
  color: var(--ink);
  background: #ffffff;
}

.segment-button.is-active {
  color: #ffffff;
  background: #20323c;
}

.swatch-button {
  width: clamp(31px, 4.8vw, 40px);
  padding: 0;
  background: var(--swatch);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.34);
}

.swatch-button.is-active {
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.54),
    0 0 0 4px rgba(13, 118, 108, 0.28);
}

.percentage-strip {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(4px, 0.8vw, 6px);
  align-content: start;
  min-height: clamp(30px, 5vh, 38px);
  margin: 0;
}

.percent-chip {
  position: relative;
  display: grid;
  min-width: 0;
  width: clamp(34px, 5vw, 42px);
  height: clamp(30px, 5vh, 36px);
  place-items: center;
  padding: 0;
  color: #ffffff;
  background: var(--chip);
  border: 2px solid #202a32;
  border-radius: 8px;
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.22),
    inset 0 -8px 0 rgba(0, 0, 0, 0.08);
}

.percent-chip::before {
  content: none;
}

.percent-chip.is-light {
  color: #202a32;
}

.percent-chip span {
  display: none;
}

.percent-chip strong {
  padding: 2px 3px;
  color: #202a32;
  font-size: clamp(0.66rem, 1.8vh, 0.78rem);
  line-height: 1;
  background: rgba(255, 255, 255, 0.86);
  border-radius: 5px;
}

.primary-button,
.secondary-button,
.small-button {
  padding: 0 clamp(9px, 1.2vw, 14px);
}

.primary-button {
  min-width: clamp(86px, 11vw, 118px);
  color: #ffffff;
  background: var(--accent);
}

.secondary-button,
.small-button {
  color: var(--ink);
  background: #ffffff;
}

.finish-button {
  color: #ffffff;
  background: #20323c;
}

.primary-button:hover,
.secondary-button:hover,
.small-button:hover,
.segment-button:hover {
  box-shadow: 0 8px 0 rgba(32, 42, 50, 0.14);
}

.chart-svg {
  width: 100%;
  min-height: 0;
  height: 100%;
  align-self: stretch;
  background: #ffffff;
  border: 2px solid #202a32;
  border-radius: 8px;
}

.chart-grid {
  stroke: #d5dce0;
  stroke-width: 2;
}

.chart-axis {
  stroke: #202a32;
  stroke-width: 3;
}

.chart-label,
.chart-value,
.axis-label {
  fill: #202a32;
  font-weight: 900;
}

.chart-label {
  font-size: 17px;
}

.chart-value {
  font-size: 18px;
}

.axis-label {
  font-size: 14px;
}

.chart-bar {
  stroke: #202a32;
  stroke-width: 3;
}

.result-card {
  min-height: clamp(34px, 7vh, 50px);
  padding: clamp(7px, 1vh, 10px) clamp(9px, 1vw, 12px);
  background: #ffffff;
  border: 2px solid #202a32;
  border-radius: 8px;
}

.result-card.is-success {
  background: #eaf8ef;
  border-color: var(--success);
}

.result-card.is-error {
  background: #fff0ed;
  border-color: var(--warning);
}

.result-label,
.history-label {
  display: none;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.result-text {
  margin: 0;
  font-size: clamp(0.78rem, 2.2vh, 1rem);
  font-weight: 850;
}

.history-panel {
  display: none;
  min-height: 0;
}

.history-label {
  margin: 0;
}

.history-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.history-dot,
.score-count {
  min-width: 34px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 950;
  background: #ffffff;
  border: 2px solid #202a32;
  border-radius: 8px;
}

.history-dot.is-complete {
  background: var(--success);
}

.score-count {
  background: var(--success);
}

.summary-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(31, 41, 51, 0.62);
}

.summary-overlay.is-visible {
  display: flex;
}

.summary-dialog {
  width: min(460px, 100%);
  padding: clamp(18px, 3vw, 28px);
  color: var(--ink);
  background: var(--paper);
  border: 2px solid #202a32;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.summary-dialog .eyebrow {
  display: block;
  margin: 0 0 6px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.summary-item {
  display: grid;
  min-height: 86px;
  align-content: center;
  gap: 6px;
  padding: 12px;
  text-align: center;
  background: #ffffff;
  border: 2px solid #202a32;
  border-radius: 8px;
}

.summary-item span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.summary-item strong {
  font-size: clamp(2rem, 7vw, 3rem);
  line-height: 1;
}

.summary-item.is-correct {
  border-color: var(--success);
}

.summary-item.is-wrong {
  border-color: var(--warning);
}

.summary-item.is-skipped {
  border-color: #8b4f9f;
}

@keyframes spin-wheel {
  0% {
    transform: rotate(0deg);
  }
  72% {
    transform: rotate(1540deg);
  }
  100% {
    transform: rotate(1620deg);
  }
}

@keyframes fail-shake {
  0%,
  100% {
    transform: translateX(0) rotate(0deg);
  }
  25% {
    transform: translateX(-9px) rotate(-3deg);
  }
  50% {
    transform: translateX(8px) rotate(3deg);
  }
  75% {
    transform: translateX(-5px) rotate(-1deg);
  }
}

@keyframes turn-phone {
  0%,
  100% {
    transform: rotate(0deg);
  }

  50% {
    transform: rotate(90deg);
  }
}

@keyframes menu-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes brand-letter-in {
  0% {
    opacity: 0;
    transform: translateX(-28px) translateY(8px) rotate(-5deg);
  }

  68% {
    opacity: 1;
    transform: translateX(3px) translateY(0) rotate(1deg);
  }

  100% {
    opacity: 1;
    transform: translateX(0) translateY(0) rotate(0);
  }
}

@keyframes loader-sweep {
  0%,
  18% {
    transform: rotate(-8deg) translateX(-62%);
  }

  62%,
  100% {
    transform: rotate(-8deg) translateX(62%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .main-menu {
    grid-template-columns: minmax(0, 1fr) minmax(110px, 0.42fr);
    gap: 14px;
    padding: 18px 26px;
  }

  .menu-copy h1 {
    font-size: clamp(2rem, 12vh, 3.8rem);
  }

  .menu-subtitle {
    margin: 8px 0 14px;
    font-size: clamp(0.9rem, 4vh, 1.1rem);
  }

  .menu-start-button {
    min-height: 42px;
    padding: 0 24px;
    font-size: 1rem;
  }

  .menu-orbit {
    width: min(26vw, 58vh, 210px);
  }
}

@media (max-width: 720px) and (orientation: portrait) {
  .brand-loader {
    padding-inline: 14px;
  }

  .loader-brand {
    font-size: clamp(24px, 9.6vw, 42px);
  }

  .main-menu {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(130px, 1fr);
    text-align: center;
  }

  .menu-copy {
    justify-self: center;
  }

  .menu-copy h1,
  .menu-subtitle {
    margin-right: auto;
    margin-left: auto;
  }

  .menu-orbit {
    width: min(62vw, 270px);
  }
}

@media (orientation: portrait) and (max-width: 900px) {
  body.is-playing .game-shell {
    display: none;
  }

  body.is-playing .rotate-gate {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    text-align: center;
    background: var(--paper);
  }

  .phone-turn {
    width: 74px;
    height: 118px;
    border: 5px solid #202a32;
    border-radius: 18px;
    box-shadow: inset 0 -14px 0 rgba(13, 118, 108, 0.16);
    animation: turn-phone 1.55s ease-in-out infinite;
  }

  .rotate-gate p {
    margin: 10px 0 0;
    font-size: clamp(1.8rem, 8vw, 3rem);
    font-weight: 950;
    line-height: 1;
  }

  .rotate-gate span {
    max-width: 280px;
    color: var(--muted);
    font-weight: 800;
  }
}

@media (max-width: 900px) and (orientation: portrait) {
  .game-shell {
    width: min(100% - 20px, 680px);
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .play-area {
    grid-template-columns: 1fr;
  }

  .chart-panel {
    grid-template-rows: auto auto auto auto;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .game-shell {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    padding: 7px;
    border: 0;
    border-radius: 0;
  }

  .topbar {
    flex-direction: row;
    align-items: center;
    min-height: 0;
    padding: 0 0 6px;
    border-bottom-width: 1px;
  }

  .topbar .eyebrow {
    display: none;
  }

  h1 {
    font-size: clamp(1rem, 3vw, 1.35rem);
    line-height: 1;
  }

  h2 {
    font-size: 0.95rem;
  }

  .round-panel {
    flex-direction: row;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
  }

  .play-area {
    grid-template-columns: minmax(250px, 0.94fr) minmax(258px, 1.06fr);
    gap: 7px;
    min-height: 0;
    padding-top: 7px;
  }

  .builder-panel,
  .chart-panel {
    padding: 7px;
    border-width: 1px;
    border-radius: 6px;
  }

  .builder-panel {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    gap: 5px 7px;
  }

  .builder-panel .section-heading {
    grid-column: 1 / -1;
  }

  .section-heading {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .section-heading .eyebrow {
    display: none;
  }

  .pill {
    min-height: 24px;
    padding: 0 8px;
    font-size: 0.68rem;
  }

  .spinner-stage {
    grid-column: 1;
    grid-row: 2 / 6;
    width: min(88px, calc(100dvh - 92px));
    margin: 0 auto;
    align-self: center;
  }

  .pointer {
    border-right-width: 10px;
    border-left-width: 10px;
    border-top-width: 20px;
  }

  .wheel-outline {
    stroke-width: 5;
  }

  .wheel-divider {
    stroke-width: 3;
  }

  .wheel-cap {
    stroke-width: 4;
  }

  .control-group {
    grid-template-columns: 1fr;
    gap: 3px;
    padding: 3px 0;
  }

  .control-label {
    font-size: 0.62rem;
  }

  .segmented,
  .palette {
    gap: 3px;
  }

  .segment-button,
  .swatch-button,
  .small-button,
  .secondary-button,
  .primary-button {
    min-height: 28px;
    border-width: 1px;
    border-radius: 6px;
    font-size: 0.72rem;
  }

  .segment-button {
    min-width: 26px;
    padding: 0 5px;
  }

  .swatch-button {
    width: 28px;
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.34);
  }

  .percentage-strip {
    display: flex;
    gap: 3px;
    min-height: 28px;
    margin: 0;
  }

  .percent-chip {
    width: 28px;
    height: 26px;
    padding: 0;
    border-width: 1px;
    border-radius: 6px;
  }

  .percent-chip span {
    display: none;
  }

  .percent-chip strong {
    padding: 1px 2px;
    font-size: 0.58rem;
  }

  .action-row {
    flex-direction: row;
    gap: 6px;
  }

  .primary-button,
  .secondary-button,
  .small-button {
    min-width: 0;
    padding: 0 8px;
  }

  .summary-overlay {
    padding: 8px;
  }

  .summary-dialog {
    width: min(430px, 100%);
    padding: 12px;
  }

  .summary-grid {
    gap: 6px;
    margin: 10px 0;
  }

  .summary-item {
    min-height: 58px;
    padding: 7px;
    border-width: 1px;
  }

  .summary-item span {
    font-size: 0.62rem;
  }

  .summary-item strong {
    font-size: 1.65rem;
  }

  .chart-panel {
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 6px;
  }

  .chart-svg {
    min-height: 0;
    height: 100%;
    border-width: 1px;
    border-radius: 6px;
  }

  .chart-grid {
    stroke-width: 1;
  }

  .chart-axis,
  .chart-bar {
    stroke-width: 2;
  }

  .chart-label {
    font-size: 14px;
  }

  .chart-value {
    font-size: 15px;
  }

  .axis-label {
    font-size: 12px;
  }

  .result-card {
    min-height: 34px;
    padding: 6px 8px;
    border-width: 1px;
    border-radius: 6px;
  }

  .result-label {
    display: none;
  }

  .result-text {
    font-size: 0.76rem;
    line-height: 1.15;
  }

  .history-panel {
    display: none;
  }
}

@media (max-width: 560px) and (orientation: portrait) {
  .game-shell {
    margin: 10px auto;
    min-height: calc(100vh - 20px);
  }

  .builder-panel,
  .chart-panel {
    padding: 12px;
  }

  .section-heading,
  .action-row,
  .round-panel,
  .history-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .pill {
    align-self: flex-start;
  }

  .control-group {
    grid-template-columns: 1fr;
  }

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

  .primary-button,
  .secondary-button,
  .small-button {
    width: 100%;
  }
}
