:root {
  --navy: #0a2242;
  --navy-soft: #123963;
  --blue: #246bfe;
  --blue-soft: #eaf2ff;
  --cyan: #27aebb;
  --cyan-soft: #e8f8f7;
  --canvas: #f4f6f9;
  --paper: #ffffff;
  --ink: #152238;
  --muted: #68758a;
  --line: #dbe3ed;
  --green: #16805f;
  --green-soft: #e7f6ef;
  --red: #b43c50;
  --red-soft: #faecef;
  --shadow: 0 24px 70px rgba(10, 34, 66, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 8%, rgba(36, 107, 254, 0.07), transparent 24rem),
    radial-gradient(circle at 94% 28%, rgba(39, 174, 187, 0.06), transparent 22rem),
    var(--canvas);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  color: inherit;
}

a {
  text-decoration: none;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(36, 107, 254, 0.34);
  outline-offset: 3px;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.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;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 12px;
  width: min(1180px, calc(100% - 40px));
  height: 64px;
  margin: 12px auto 0;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(210, 221, 234, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 9px 30px rgba(10, 34, 66, 0.06);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand > span:last-child {
  display: grid;
}

.brand strong {
  color: var(--navy);
  font-size: 17px;
  letter-spacing: -0.45px;
}

.brand small {
  color: #758196;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.85px;
  text-transform: uppercase;
}

.brand-mark {
  width: 35px;
  height: 35px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  border-radius: 10px;
  background: var(--navy);
  box-shadow: 0 7px 18px rgba(10, 34, 66, 0.18);
}

.brand-mark i {
  border-radius: 2px;
  background: #fff;
}

.brand-mark i:nth-child(2),
.brand-mark i:nth-child(5) {
  background: #50d0d3;
}

.how-link {
  min-height: 40px;
  padding: 0 5px 0 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #536176;
  font-size: 13px;
  font-weight: 750;
}

.how-link:hover {
  background: #f1f5fa;
  color: var(--navy);
}

.how-link span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
}

main {
  overflow: hidden;
}

.intro {
  position: relative;
  max-width: 850px;
  margin: 0 auto;
  padding: 38px 24px 28px;
  text-align: center;
}

.intro::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  top: -20px;
  width: min(720px, 92vw);
  height: 210px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(36, 107, 254, 0.1), transparent 68%);
  filter: blur(12px);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 11px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 1.55px;
  text-transform: uppercase;
}

.intro h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(42px, 5.3vw, 64px);
  font-weight: 800;
  letter-spacing: -3.2px;
  line-height: 1;
}

.intro h1 span {
  color: var(--blue);
}

.intro > p:last-child {
  max-width: 620px;
  margin: 15px auto 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.game-shell {
  position: relative;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto 58px;
  overflow: hidden;
  border: 1px solid #d4deea;
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--shadow), 0 0 80px rgba(36, 107, 254, 0.05);
}

.setup-panel {
  padding: 18px 22px;
  display: grid;
  grid-template-columns: minmax(175px, 0.55fr) minmax(0, 2.45fr);
  align-items: center;
  gap: 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(145deg, #fbfcfe, #f1f5f9);
}

.panel-heading h2 {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 18px;
  letter-spacing: -0.45px;
}

.panel-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.setup-controls {
  display: grid;
  grid-template-columns: minmax(300px, 1.25fr) minmax(250px, 1fr) minmax(170px, 0.62fr);
  align-items: end;
  gap: 16px;
}

.control-label,
.mix-label {
  min-height: 20px;
  margin: 0 0 7px;
  color: #526075;
  font-size: 12px;
  font-weight: 800;
}

.control-label {
  display: block;
}

.mix-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mix-label span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 750;
}

.mode-control,
.segment-control {
  padding: 4px;
  display: grid;
  gap: 4px;
  border: 1px solid #d7e0eb;
  border-radius: 12px;
  background: #e9eef4;
}

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

.mode-control button {
  min-height: 50px;
  padding: 7px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #647186;
  text-align: left;
  transition: background 0.18s, color 0.18s, transform 0.18s;
}

.mode-control button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.7);
}

.mode-control button.selected {
  background: var(--navy);
  color: #fff;
}

.mode-control strong,
.mode-control small {
  display: block;
}

.mode-control strong {
  font-size: 12px;
}

.mode-control small {
  margin-top: 3px;
  color: inherit;
  font-size: 10px;
  line-height: 1.25;
  opacity: 0.76;
}

.segment-control {
  grid-template-columns: repeat(5, 1fr);
}

.segment-control button {
  min-height: 50px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #647186;
  font-size: 13px;
  font-weight: 850;
}

.segment-control button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.72);
  color: var(--navy);
}

.segment-control button.selected {
  background: var(--blue);
  color: #fff;
}

.mode-control button:disabled,
.segment-control button:disabled {
  opacity: 0.68;
}

.mode-control button.selected:disabled,
.segment-control button.selected:disabled {
  opacity: 0.88;
}

.primary-button {
  width: 100%;
  min-height: 58px;
  padding: 0 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  transition: transform 0.18s, background 0.18s, box-shadow 0.18s;
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-2px);
  background: var(--blue);
  box-shadow: 0 10px 22px rgba(36, 107, 254, 0.22);
}

.primary-button:hover:not(:disabled) svg {
  transform: translateX(3px);
}

.primary-button svg {
  transition: transform 0.18s;
}

.primary-button:disabled {
  background: #66758a;
  opacity: 0.72;
}

.play-panel {
  position: relative;
  padding: 22px 40px 38px;
  background: #fff;
}

.countdown-overlay {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 0 0 24px 24px;
  background: rgba(10, 34, 66, 0.93);
  color: #fff;
  backdrop-filter: blur(7px);
}

.countdown-overlay[hidden] {
  display: none;
}

.countdown-overlay strong {
  font-size: clamp(72px, 12vw, 128px);
  letter-spacing: -6px;
  animation: countdown-pop 0.6s ease both;
}

.game-topbar {
  min-height: 34px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
}

.round-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #617086;
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #a3aebd;
  box-shadow: 0 0 0 5px #edf0f4;
}

.round-status.playing .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 5px var(--green-soft);
}

.round-status.finished .status-dot {
  background: var(--red);
  box-shadow: 0 0 0 5px var(--red-soft);
}

.session-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  color: #7a8798;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.45px;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.has-stats .session-stats {
  opacity: 1;
}

.session-stats span + span {
  padding-left: 13px;
  border-left: 1px solid var(--line);
}

.session-stats strong {
  margin-left: 3px;
  color: var(--navy);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
}

.timer {
  justify-self: end;
  display: flex;
  align-items: baseline;
  color: #778397;
}

.timer span {
  margin-right: 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.timer strong {
  color: var(--navy);
  font-size: 26px;
  letter-spacing: -1px;
}

.timer strong.urgent {
  color: var(--red);
  animation: timer-pulse 1s ease-in-out infinite;
}

.timer small {
  font-size: 11px;
}

.timer-track {
  height: 4px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: #edf1f5;
}

.timer-track i {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  transform-origin: left;
  transition: width 1s linear;
}

.target-area {
  position: relative;
  min-height: 148px;
  margin: 18px 0 20px;
  padding: 19px;
  display: grid;
  place-items: center;
  align-content: center;
  overflow: hidden;
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 130%, rgba(39, 174, 187, 0.34), transparent 38%),
    radial-gradient(circle at 96% -20%, rgba(36, 107, 254, 0.36), transparent 34%),
    linear-gradient(145deg, var(--navy), #07182e);
  color: #fff;
}

.target-area::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, #000, transparent);
  pointer-events: none;
}

.target-meta,
.target-area > strong,
.target-preview,
.target-prompt {
  position: relative;
  z-index: 1;
}

.target-meta {
  display: flex;
  align-items: center;
  gap: 9px;
}

.target-meta span {
  color: #a7bdd5;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.target-meta em {
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
  color: #c9f1ef;
  font-size: 8px;
  font-style: normal;
  font-weight: 850;
  letter-spacing: 0.45px;
  text-transform: uppercase;
}

.target-area > strong {
  margin-top: 5px;
  font-size: 70px;
  letter-spacing: 4px;
  line-height: 0.98;
}

.pre-round .target-area > strong {
  margin-top: 11px;
  color: #7f95ad;
  font-size: 28px;
  letter-spacing: 7px;
}

.target-preview {
  margin-top: 10px;
  display: flex;
  gap: 6px;
}

.target-preview i {
  width: 28px;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.22);
}

.target-prompt {
  margin: 9px 0 0;
  color: #9fb0c4;
  font-size: 11px;
}

body:not(.pre-round) .target-preview,
body:not(.pre-round) .target-prompt {
  display: none;
}

.answer-area {
  padding-top: 19px;
  border-top: 1px solid #e7ebf1;
}

.values-heading,
.builder-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.values-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.builder-kicker {
  color: var(--blue);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.9px;
  text-transform: uppercase;
}

.round-progress {
  padding: 7px 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #e0e6ee;
  border-radius: 10px;
  background: #f7f9fc;
  white-space: nowrap;
}

.round-progress strong {
  color: #526075;
  font-size: 11px;
  font-weight: 800;
}

.round-progress span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #9ba7b6;
}

.working-values {
  min-height: 83px;
  margin-top: 11px;
  padding: 9px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: stretch;
  gap: 8px;
  border: 1px solid #d8e1ec;
  border-radius: 14px;
  background: #f4f7fb;
}

.working-values:empty::before {
  content: "Your six values will appear here";
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  color: #8290a4;
  font-size: 13px;
}

.working-tile {
  min-width: 0;
  min-height: 62px;
  padding: 7px 5px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: #fff;
  color: var(--navy);
  box-shadow: 0 5px 14px rgba(10, 34, 66, 0.06);
  transition: transform 0.16s, border-color 0.16s, background 0.16s, box-shadow 0.16s;
}

.working-tile strong,
.working-tile small {
  display: block;
}

.working-tile strong {
  font-size: 21px;
}

.working-tile small {
  margin-top: 3px;
  font-size: 9px;
  font-weight: 750;
}

.working-tile.original.small-number {
  border-color: #8ed4d9;
  background: var(--cyan);
  color: #062e35;
}

.working-tile.original.large-number {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}

.working-tile.original.small-number small {
  color: #0c5960;
}

.working-tile.original.large-number small {
  color: #afc1d5;
}

.working-tile.result {
  border-color: #a9d6ee;
  background: #eaf7ff;
  color: #0e5b86;
}

.working-tile.result small {
  color: #477a98;
}

.working-tile:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 9px 18px rgba(10, 34, 66, 0.12);
}

.working-tile.selected {
  border-color: #ffb54d;
  box-shadow: 0 0 0 3px rgba(255, 181, 77, 0.28), 0 9px 18px rgba(10, 34, 66, 0.12);
}

.working-tile.is-new {
  animation: result-in 0.24s ease both;
}

.working-tile:disabled {
  opacity: 0.56;
}

.operator-row {
  margin: 10px 0 0;
  display: grid;
  grid-template-columns: repeat(4, 48px);
  gap: 8px;
}

.operator-row button {
  height: 45px;
  border: 1px solid #d5deea;
  border-radius: 10px;
  background: #fff;
  color: #40516a;
  font-size: 17px;
  font-weight: 850;
  transition: border-color 0.16s, background 0.16s, color 0.16s, transform 0.16s;
}

.operator-row button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #96b2d6;
  color: var(--blue);
}

.operator-row button.selected {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.operator-row button:disabled {
  background: #f1f4f8;
  color: #9aa5b4;
  opacity: 0.78;
}

.builder-heading {
  margin-top: 17px;
}

.builder-heading h3 {
  margin: 4px 0 0;
  color: var(--navy);
  font-size: 18px;
  letter-spacing: -0.35px;
}

.player-steps {
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
  list-style: none;
}

.player-steps li {
  min-height: 42px;
  padding: 8px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #e0e6ee;
  border-radius: 10px;
  background: #fafbfd;
}

.player-steps li > span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font-size: 10px;
  font-weight: 850;
}

.player-steps li strong {
  color: #34455e;
  font-size: 13px;
}

.player-steps .empty-step {
  min-height: 45px;
  justify-content: center;
  border-style: dashed;
  background: #fff;
  color: #8793a4;
  font-size: 12px;
}

.edit-row {
  margin-top: 9px;
  display: flex;
  gap: 8px;
}

.edit-row button {
  min-width: 108px;
  min-height: 42px;
  border: 1px solid #d6dee8;
  border-radius: 10px;
  background: #fff;
  color: #526075;
  font-size: 12px;
  font-weight: 750;
}

.edit-row button:hover:not(:disabled) {
  border-color: #9db4d2;
  color: var(--blue);
}

.edit-row button:disabled {
  color: #9aa5b3;
  opacity: 0.62;
}

.answer-actions {
  margin-top: 13px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.answer-actions.can-submit {
  grid-template-columns: 1fr 1fr;
}

.answer-actions button,
.result-actions button,
.secondary-button {
  min-height: 48px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 850;
  transition: transform 0.16s, box-shadow 0.16s, border-color 0.16s, background 0.16s;
}

.answer-actions button:hover:not(:disabled),
.result-actions button:hover:not(:disabled),
.secondary-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.check-button,
.play-again-button {
  border: 0;
  background: var(--blue);
  color: #fff;
}

.check-button:hover:not(:disabled),
.play-again-button:hover:not(:disabled) {
  box-shadow: 0 9px 20px rgba(36, 107, 254, 0.22);
}

.solution-button,
.retry-button,
.secondary-button {
  border: 1px solid #c7d2e0;
  background: #fff;
  color: var(--navy);
}

.solution-button {
  color: #743848;
}

.answer-actions button:disabled {
  background: #e6ebf1;
  color: #8792a1;
  opacity: 0.72;
}

.feedback {
  min-height: 52px;
  margin-top: 13px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 12px;
}

.feedback-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 900;
}

.feedback p {
  margin: 0;
  line-height: 1.45;
}

.feedback.neutral {
  border-color: #e2e7ed;
  background: #f3f6f9;
  color: #617086;
}

.feedback.neutral .feedback-icon {
  background: #e1e7ee;
  color: #617086;
}

.feedback.success {
  border-color: #ccebdd;
  background: #eaf8f2;
  color: #176b53;
}

.feedback.success .feedback-icon {
  background: #caebdd;
}

.feedback.error {
  border-color: #f1d1d7;
  background: #fdf0f2;
  color: #963045;
}

.feedback.error .feedback-icon {
  background: #f3d6dc;
}

.feedback.solution {
  border-color: #d1e0fa;
  background: #edf4ff;
  color: #245492;
}

.feedback.solution .feedback-icon {
  background: #d5e4ff;
}

.results-panel {
  margin-top: 0;
  padding: 20px;
  scroll-margin-top: 86px;
  border: 1px solid #dce4ed;
  border-radius: 15px;
  background: #fff;
}

.results-panel[hidden] {
  display: none;
}

.results-panel:focus {
  outline: none;
}

.results-heading {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-radius: 12px;
  background: #f1f4f8;
  color: var(--navy);
}

.results-heading span,
.solution-steps > span,
.result-player-steps > span {
  color: #718096;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.9px;
  text-transform: uppercase;
}

.results-heading h3 {
  margin: 4px 0 0;
  font-size: 24px;
  letter-spacing: -0.6px;
}

.results-heading > strong {
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
}

.results-panel[data-outcome="exact"] .results-heading {
  background: var(--green-soft);
  color: #145d49;
}

.results-panel[data-outcome="exact"] .results-heading span {
  color: #397b68;
}

.results-panel[data-outcome="exact"] .results-heading > strong {
  background: var(--green);
}

.results-panel[data-outcome="close"] .results-heading {
  background: var(--blue-soft);
  color: #184f9a;
}

.results-panel[data-outcome="close"] .results-heading > strong {
  background: var(--blue);
}

.results-panel[data-outcome="miss"] .results-heading,
.results-panel[data-outcome="revealed"] .results-heading {
  background: var(--red-soft);
  color: #8f2f40;
}

.results-panel[data-outcome="miss"] .results-heading span,
.results-panel[data-outcome="revealed"] .results-heading span {
  color: #a85b68;
}

.results-panel[data-outcome="miss"] .results-heading > strong,
.results-panel[data-outcome="revealed"] .results-heading > strong {
  background: #a74254;
}

.result-player-steps {
  margin-top: 14px;
}

.result-player-steps[hidden] {
  display: none;
}

.result-player-steps ol {
  margin: 9px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
  list-style: none;
}

.result-player-steps li {
  min-height: 48px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #c9d8ea;
  border-radius: 10px;
  background: #f1f6fc;
}

.result-player-steps li strong {
  color: var(--navy);
  font-size: 13px;
}

.result-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid #e0e6ee;
  border-radius: 11px;
  background: #fafbfd;
}

.result-grid > div {
  padding: 12px 13px;
}

.result-grid > div + div {
  border-left: 1px solid #e0e6ee;
}

.result-grid span {
  display: block;
  color: #758297;
  font-size: 10px;
}

.result-grid strong {
  display: block;
  margin-top: 5px;
  color: var(--navy);
  font-size: 14px;
}

.solution-steps {
  margin-top: 15px;
  padding-top: 14px;
  border-top: 1px solid #e2e8f0;
}

.solution-steps ol {
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  list-style: none;
}

.solution-steps li {
  min-height: 52px;
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  border: 1px solid #e0e7f0;
  border-radius: 10px;
  background: #fafbfd;
}

.step-number {
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 20px;
}

.solution-steps li strong {
  display: block;
  color: var(--navy);
  font-size: 14px;
}

.solution-steps li small {
  display: block;
  margin-top: 3px;
  color: #748196;
  font-size: 11px;
  font-weight: 650;
}

.result-actions {
  margin-top: 15px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.result-actions button {
  margin: 0;
  padding: 0 15px;
}

.play-again-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.play-again-button span {
  transition: transform 0.18s;
}

.play-again-button:hover span {
  transform: translateX(3px);
}

.results-visible .values-heading,
.results-visible .builder-heading,
.results-visible .working-values,
.results-visible .answer-area > .operator-row,
.results-visible .player-steps,
.results-visible .edit-row,
.results-visible .answer-actions,
.results-visible .feedback {
  display: none;
}

.rules {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto 58px;
  padding: 34px 36px;
  display: grid;
  grid-template-columns: minmax(210px, 0.7fr) minmax(0, 1.8fr);
  align-items: center;
  gap: 34px;
  border-radius: 22px;
  background: var(--navy);
  color: #fff;
}

.rules .eyebrow {
  color: #6bd7d8;
}

.rules h2 {
  margin: 0;
  font-size: clamp(27px, 3vw, 40px);
  letter-spacing: -1.5px;
  line-height: 1.05;
}

.rule-flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.rule-flow > div {
  min-height: 84px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.06);
}

.rule-flow span {
  color: #77dcdd;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.8px;
}

.rule-flow strong {
  font-size: 13px;
  line-height: 1.35;
}

.rule-flow > i {
  color: #6bd7d8;
  font-style: normal;
  font-weight: 800;
}

.rule-note {
  grid-column: 2;
  margin: -18px 0 0;
  color: #a9bdd2;
  font-size: 11px;
  line-height: 1.55;
}

.tutorial-dialog {
  width: min(600px, calc(100% - 28px));
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 20px;
  background: transparent;
}

.tutorial-dialog::backdrop {
  background: rgba(5, 20, 38, 0.7);
  backdrop-filter: blur(5px);
}

.tutorial-card {
  position: relative;
  padding: 30px;
  border: 1px solid #dbe3ed;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(5, 20, 38, 0.28);
}

.tutorial-card h2 {
  margin: 0;
  color: var(--navy);
  font-size: 30px;
  letter-spacing: -1px;
}

.tutorial-card > p:not(.eyebrow) {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid #dce3eb;
  border-radius: 10px;
  background: #f6f8fb;
  color: #5d697b;
  font-size: 23px;
  line-height: 1;
}

.tutorial-example {
  margin: 22px 0;
  padding: 20px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: 14px;
  background: #f0f5fb;
}

.tutorial-example span,
.tutorial-example strong {
  min-width: 62px;
  padding: 13px 10px;
  border-radius: 11px;
  background: var(--navy);
  color: #fff;
  text-align: center;
  font-size: 20px;
}

.tutorial-example strong {
  background: var(--cyan-soft);
  color: #08747b;
}

.tutorial-example b {
  color: var(--blue);
}

.tutorial-card ol {
  margin: 0;
  padding-left: 22px;
  color: #435269;
  font-size: 13px;
  line-height: 1.65;
}

.tutorial-actions {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 9px;
}

.secondary-button {
  padding: 0 14px;
}

.tutorial-actions .primary-button {
  min-height: 50px;
}

footer {
  width: min(1180px, calc(100% - 40px));
  min-height: 78px;
  margin: 0 auto;
  padding: 18px 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: #778397;
  font-size: 12px;
}

footer p {
  margin: 0;
}

.footer-brand .brand-mark {
  width: 31px;
  height: 31px;
}

@keyframes result-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes countdown-pop {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes timer-pulse {
  50% {
    transform: scale(1.08);
  }
}

@media (max-width: 980px) {
  .setup-panel {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .setup-controls {
    grid-template-columns: 1fr 1fr;
  }

  .primary-button {
    grid-column: 1 / -1;
    min-height: 52px;
  }

  .rules {
    grid-template-columns: 1fr;
    gap: 25px;
  }

  .rule-note {
    grid-column: 1;
    margin-top: -10px;
  }
}

@media (max-width: 720px) {
  body {
    background: var(--canvas);
  }

  .site-header {
    top: 8px;
    width: calc(100% - 20px);
    height: 56px;
    margin-top: 8px;
    padding: 0 12px;
    border-radius: 14px;
  }

  .brand-mark {
    width: 31px;
    height: 31px;
  }

  .brand strong {
    font-size: 15px;
  }

  .brand small {
    font-size: 8px;
  }

  .how-link {
    font-size: 11px;
  }

  .intro {
    padding: 20px 18px 17px;
  }

  .intro .eyebrow {
    display: none;
  }

  .intro h1 {
    font-size: 32px;
    letter-spacing: -1.8px;
    line-height: 1.03;
  }

  .intro > p:last-child {
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.48;
  }

  .game-shell {
    width: calc(100% - 20px);
    margin-bottom: 42px;
    border-radius: 18px;
  }

  .setup-panel {
    padding: 16px;
    gap: 12px;
  }

  .panel-heading h2 {
    font-size: 17px;
  }

  .panel-heading p {
    font-size: 11px;
  }

  .setup-controls {
    display: block;
  }

  .control-label {
    margin-bottom: 6px;
  }

  .mode-control button {
    min-height: 52px;
  }

  .mode-control strong {
    font-size: 13px;
  }

  .mode-control small {
    font-size: 9px;
  }

  .mix-control {
    margin-top: 13px;
  }

  .mix-label {
    font-size: 13px;
  }

  .segment-control button {
    min-height: 47px;
  }

  .primary-button {
    min-height: 49px;
    margin-top: 12px;
  }

  .play-panel {
    padding: 17px 16px 23px;
  }

  .game-topbar {
    grid-template-columns: 1fr auto;
    gap: 14px;
  }

  .session-stats {
    display: none;
  }

  .timer-track {
    margin-top: 10px;
  }

  .target-area {
    min-height: 122px;
    margin: 12px 0 17px;
    padding: 13px;
    border-radius: 13px;
  }

  .target-area > strong {
    font-size: 58px;
  }

  .pre-round .target-area > strong {
    font-size: 23px;
  }

  .target-prompt {
    font-size: 10px;
  }

  .values-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .values-heading p {
    font-size: 12px;
  }

  .round-progress {
    width: 100%;
    justify-content: center;
  }

  .working-values {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-height: 0;
    padding: 7px;
    gap: 6px;
  }

  .working-tile {
    min-height: 59px;
  }

  .working-tile strong {
    font-size: 20px;
  }

  .working-tile small {
    font-size: 9px;
  }

  .operator-row {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .operator-row button {
    height: 49px;
  }

  .builder-heading {
    margin-top: 15px;
  }

  .builder-heading h3 {
    font-size: 17px;
  }

  .player-steps li {
    min-height: 46px;
  }

  .edit-row button {
    min-height: 47px;
    flex: 1;
  }

  .answer-actions {
    grid-template-columns: 1fr;
  }

  .answer-actions button {
    min-height: 49px;
  }

  .feedback {
    font-size: 12px;
  }

  body.round-preparing .site-header,
  body.round-running .site-header,
  body.round-preparing .intro,
  body.round-running .intro,
  body.round-preparing .setup-panel,
  body.round-running .setup-panel,
  body.results-visible .site-header,
  body.results-visible .intro,
  body.results-visible .setup-panel {
    display: none;
  }

  body.round-preparing .game-shell,
  body.round-running .game-shell,
  body.results-visible .game-shell {
    width: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  body.round-preparing .play-panel,
  body.round-running .play-panel,
  body.results-visible .play-panel {
    min-height: 100svh;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(22px, env(safe-area-inset-bottom));
  }

  .results-panel {
    margin: 0 -16px -23px;
    padding: 18px 16px 24px;
    border-radius: 18px 18px 0 0;
  }

  .results-heading {
    padding: 14px;
  }

  .results-heading h3 {
    font-size: 22px;
  }

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

  .result-player-steps ol {
    grid-template-columns: 1fr;
  }

  .result-grid > div + div {
    border-top: 1px solid #e0e6ee;
    border-left: 0;
  }

  .solution-steps li {
    min-height: 58px;
  }

  .result-actions {
    grid-template-columns: 1fr;
  }

  .result-actions button {
    min-height: 50px;
  }

  .rules {
    width: calc(100% - 20px);
    margin-bottom: 36px;
    padding: 30px 20px;
    gap: 20px;
    border-radius: 18px;
  }

  .rules h2 {
    font-size: 31px;
  }

  .rule-flow {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .rule-flow > div {
    min-height: 70px;
  }

  .rule-flow > i {
    justify-self: center;
    transform: rotate(90deg);
  }

  .rule-note {
    margin-top: 0;
    font-size: 12px;
  }

  .tutorial-card {
    padding: 25px 18px 20px;
  }

  .tutorial-card h2 {
    padding-right: 35px;
    font-size: 25px;
  }

  .tutorial-example {
    gap: 7px;
  }

  .tutorial-example span,
  .tutorial-example strong {
    min-width: 51px;
    padding: 12px 7px;
    font-size: 17px;
  }

  .tutorial-actions {
    grid-template-columns: 1fr;
  }

  .tutorial-actions .primary-button {
    grid-column: auto;
  }

  footer {
    width: calc(100% - 32px);
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
