

:root {
  --ink: #173553;
  --muted: #65758a;
  --paper: #fffdf8;
  --line: rgba(23, 53, 83, 0.13);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: #eaf6f2;
  color: var(--ink);
  font-family: "Avenir Next", Avenir, "Trebuchet MS", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 4px solid #275f9a;
  outline-offset: 4px;
}

.home-screen,
.subject-screen {
  height: 100dvh;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow-y: scroll;
  scrollbar-gutter: stable;
  padding: clamp(20px, 5vw, 56px);
  background:
    radial-gradient(circle at 12% 10%, rgba(103, 213, 188, 0.46), transparent 28%),
    radial-gradient(circle at 88% 88%, rgba(255, 211, 111, 0.58), transparent 32%),
    #f8fbfa;
}

.home-panel {
  width: min(1240px, 100%);
  text-align: center;
}

.subject-panel {
  width: min(980px, 100%);
  text-align: center;
}

.subject-grid {
  display: grid;
  place-items: center;
}

.subject-card {
  --subject-accent: #67d5bc;
  width: min(760px, 100%);
  min-height: 310px;
  display: grid;
  grid-template-columns: minmax(230px, 0.85fr) minmax(280px, 1.15fr);
  grid-template-rows: 1fr auto;
  gap: clamp(18px, 4vw, 38px);
  align-items: center;
  padding: clamp(22px, 4vw, 40px);
  border: 3px solid var(--ink);
  border-radius: clamp(28px, 5vw, 44px);
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 14px 0 color-mix(in srgb, var(--subject-accent) 72%, transparent), 0 28px 60px rgba(23, 53, 83, 0.12);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.subject-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 0 color-mix(in srgb, var(--subject-accent) 72%, transparent), 0 34px 70px rgba(23, 53, 83, 0.14);
}

.subject-card:active {
  transform: translateY(4px);
  box-shadow: 0 8px 0 color-mix(in srgb, var(--subject-accent) 72%, transparent), 0 20px 40px rgba(23, 53, 83, 0.11);
}

.subject-visual {
  min-height: 210px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 22px;
  padding: 24px;
  border-radius: 28px;
  background: color-mix(in srgb, var(--subject-accent) 34%, white);
}

.subject-equation {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: clamp(6px, 1.4vw, 12px);
  white-space: nowrap;
}

.subject-equation b {
  font-size: clamp(2.1rem, 5vw, 3.45rem);
  line-height: 1;
}

.subject-equation i {
  color: #2d7f70;
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-style: normal;
  font-weight: 950;
}

.subject-ten-dots {
  display: grid;
  grid-template-columns: repeat(5, 20px);
  gap: 9px;
  padding: 12px;
  border: 2px solid rgba(23, 53, 83, 0.16);
  border-radius: 16px;
  background: white;
}

.subject-ten-dots i {
  width: 20px;
  aspect-ratio: 1;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #73c8f1;
}

.subject-ten-dots i.second {
  background: #ff9b72;
}

.subject-copy {
  display: grid;
  gap: 9px;
}

.subject-copy small {
  width: fit-content;
  padding: 7px 11px;
  border-radius: 999px;
  background: #e9f8f5;
  color: #247164;
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.subject-copy strong {
  font-size: clamp(2.7rem, 7vw, 5rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
}

.subject-copy > span {
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 750;
  line-height: 1.4;
}

.subject-action {
  grid-column: 1 / -1;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 2px solid var(--ink);
  border-radius: 17px;
  background: var(--subject-accent);
  font-size: 1.08rem;
  font-weight: 950;
  box-shadow: inset 0 -4px 0 rgba(23, 53, 83, 0.12);
}

.subject-hint {
  margin: 30px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.subject-back {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  padding: 10px 14px;
  border: 1.5px solid rgba(23, 53, 83, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 900;
  box-shadow: 0 5px 14px rgba(23, 53, 83, 0.08);
  cursor: pointer;
}

.brand-mark {
  display: inline-flex;
  gap: 9px;
  margin-bottom: 18px;
}

.brand-mark span {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #67d5bc;
  box-shadow: 0 4px 0 rgba(23, 53, 83, 0.12);
}

.brand-mark span:nth-child(2) {
  background: #ffd36f;
}

.brand-mark span:nth-child(3) {
  background: #ff9b72;
}

.eyebrow {
  margin: 0 0 8px;
  color: #2d7f70;
  font-size: clamp(0.8rem, 2vw, 1rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  max-width: 780px;
  margin: 0 auto;
  font-size: clamp(2.15rem, 7vw, 5.2rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.name-highlight {
  background: linear-gradient(120deg, #ed4ca8 10%, #8b5cf6 90%);
  background-clip: text;
  color: transparent;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.intro {
  max-width: 630px;
  margin: 20px auto 34px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.learning-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 24px;
  padding: 12px 14px 12px 18px;
  border: 1.5px solid rgba(23, 53, 83, 0.14);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  text-align: left;
}

.learning-filters > span {
  display: grid;
  gap: 2px;
}

.learning-filters small {
  color: var(--muted);
}

.learning-filters > div {
  display: flex;
  gap: 5px;
  padding: 4px;
  border-radius: 14px;
  background: #eef3f4;
}

.learning-filters button {
  padding: 9px 13px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
}

.learning-filters button.active {
  background: white;
  box-shadow: 0 3px 9px rgba(23, 53, 83, 0.12);
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: clamp(16px, 3vw, 28px);
}

.mode-card {
  --accent: #67d5bc;
  min-height: 260px;
  display: grid;
  grid-template-columns: 96px 1fr;
  grid-template-rows: 1fr auto;
  align-items: center;
  gap: 22px;
  padding: clamp(20px, 2.4vw, 30px);
  border: 2px solid var(--ink);
  border-radius: 28px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 10px 0 color-mix(in srgb, var(--accent) 70%, transparent);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.mode-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 0 color-mix(in srgb, var(--accent) 70%, transparent);
}

.mode-preview {
  width: 92px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: color-mix(in srgb, var(--accent) 42%, white);
}

.mode-copy {
  display: grid;
  gap: 10px;
}

.game-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.game-meta b {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  font-size: 0.75rem;
}

.game-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.game-progress > span {
  color: #e79a19;
  font-size: 1rem;
  letter-spacing: 0.06em;
}

.mode-copy strong {
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.mode-copy small {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.range-picker {
  width: fit-content;
  display: flex;
  gap: 5px;
  margin-top: 4px;
  padding: 5px;
  border: 1.5px solid rgba(23, 53, 83, 0.15);
  border-radius: 16px;
  background: #f3f6f7;
}

.operation-picker {
  width: fit-content;
  display: flex;
  gap: 4px;
  margin-top: 4px;
  padding: 5px;
  border: 1.5px solid rgba(23, 53, 83, 0.15);
  border-radius: 16px;
  background: #f3f6f7;
}

.operation-picker button {
  min-width: 54px;
  padding: 9px 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.operation-picker button.active {
  background: var(--accent);
  box-shadow: inset 0 -3px 0 rgba(23, 53, 83, 0.13);
}

.stage-pill {
  width: fit-content;
  margin-top: 4px;
  padding: 10px 14px;
  border: 1.5px solid rgba(23, 53, 83, 0.15);
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 42%, white);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 900;
}

.range-picker button {
  min-width: 76px;
  padding: 9px 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
}

.range-picker button.active {
  background: var(--accent);
  box-shadow: inset 0 -3px 0 rgba(23, 53, 83, 0.13);
}

.start-button {
  grid-column: 1 / -1;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--accent);
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 900;
  box-shadow: 0 5px 0 rgba(23, 53, 83, 0.16);
  cursor: pointer;
}

.start-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(23, 53, 83, 0.16);
}

.mini-dots {
  display: grid;
  grid-template-columns: repeat(3, 18px);
  gap: 12px;
}

.mini-dots i {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink);
}

.mini-number {
  font-size: 5rem;
  font-weight: 900;
  line-height: 1;
}

.mini-number.compact-number {
  font-size: clamp(3.2rem, 4.4vw, 4.15rem);
  letter-spacing: -0.09em;
  text-indent: -0.05em;
}

.mini-math {
  display: grid;
  gap: 7px;
  text-align: center;
}

.mini-math b {
  font-size: 1.55rem;
}

.mini-math.compact-math b {
  font-size: clamp(1.05rem, 2vw, 1.38rem);
  white-space: nowrap;
}

.mini-math i {
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
}

.home-hint {
  margin: 30px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.game-screen {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: var(--paper);
}

.game-toolbar {
  position: absolute;
  z-index: 5;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  pointer-events: none;
}

.game-toolbar > * {
  pointer-events: auto;
}

.icon-button {
  width: 52px;
  height: 52px;
  border: 1.5px solid rgba(23, 53, 83, 0.2);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-size: 1.55rem;
  font-weight: 800;
  box-shadow: 0 8px 28px rgba(23, 53, 83, 0.1);
  backdrop-filter: blur(12px);
  cursor: pointer;
}

.mode-label {
  justify-self: center;
  display: grid;
  gap: 2px;
  padding: 8px 18px;
  border: 1.5px solid rgba(23, 53, 83, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  text-align: center;
  backdrop-filter: blur(12px);
}

.mode-label strong {
  font-size: 0.94rem;
}

.mode-label span {
  color: var(--muted);
  font-size: 0.72rem;
}

.play-card {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    var(--paper);
  background-size: 44px 44px;
  color: var(--ink);
}

.play-card::before {
  content: "";
  position: absolute;
  width: min(76vw, 76vh);
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(103, 213, 188, 0.14);
  filter: blur(1px);
}

.round-panel {
  position: relative;
  z-index: 3;
  width: min(620px, calc(100vw - 32px));
  display: grid;
  place-items: center;
  gap: 13px;
  padding: clamp(26px, 5vw, 52px);
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: clamp(28px, 5vw, 48px);
  background: rgba(255, 255, 255, 0.97);
  text-align: center;
  box-shadow: 0 18px 0 rgba(103, 213, 188, 0.45), 0 34px 70px rgba(23, 53, 83, 0.14);
}

.round-kicker {
  color: #2d7f70;
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.round-panel h2 {
  margin: 0;
  font-size: clamp(2.1rem, 6vw, 4rem);
  line-height: 1;
  letter-spacing: -0.045em;
}

.round-panel > strong {
  font-size: clamp(1.15rem, 2.6vw, 1.65rem);
}

.round-panel p {
  max-width: 470px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.98rem, 2vw, 1.12rem);
  font-weight: 750;
  line-height: 1.45;
}

.round-badge {
  width: clamp(84px, 16vw, 116px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: #ffd36f;
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  font-weight: 950;
  line-height: 1;
  box-shadow: inset 0 -8px 0 rgba(23, 53, 83, 0.11), 0 8px 0 rgba(23, 53, 83, 0.1);
}

.round-dots {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: clamp(4px, 1vw, 8px);
  margin: 5px 0 3px;
}

.round-dots i {
  width: clamp(10px, 2vw, 16px);
  aspect-ratio: 1;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #67d5bc;
}

.round-primary,
.round-final-actions button {
  min-height: 54px;
  padding: 11px 22px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: #f3f6f7;
  color: var(--ink);
  font-weight: 950;
  cursor: pointer;
}

.round-primary {
  background: #67d5bc !important;
  box-shadow: inset 0 -4px 0 rgba(23, 53, 83, 0.13);
}

.round-final {
  box-shadow: 0 18px 0 rgba(255, 211, 111, 0.62), 0 34px 70px rgba(23, 53, 83, 0.14);
}

.final-reward {
  position: relative;
  z-index: 2;
  min-height: 92px;
  display: grid;
  place-items: center;
}

.reward-crown,
.reward-thumb,
.reward-sprout {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: #ffd36f;
  font-size: 3.25rem;
  box-shadow: 0 8px 0 rgba(23, 53, 83, 0.12);
}

.reward-crown { animation: reward-pop 650ms cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.reward-thumb { background: #9dd982; animation: thumb-celebrate 900ms ease-in-out both; }
.reward-sprout { background: #e8f8f4; animation: sprout-grow 900ms cubic-bezier(0.2, 1.4, 0.4, 1) both; }

.final-stars {
  position: relative;
  z-index: 2;
  display: flex;
  gap: clamp(6px, 2vw, 14px);
  color: #d5dde0;
  font-size: clamp(2.6rem, 8vw, 5rem);
  line-height: 1;
}

.final-stars .earned {
  color: #f2a81d;
  filter: drop-shadow(0 5px 0 rgba(23, 53, 83, 0.14));
  animation: star-arrive 520ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.final-stars .earned:nth-child(2) { animation-delay: 150ms; }
.final-stars .earned:nth-child(3) { animation-delay: 300ms; }

.round-final-actions {
  position: relative;
  z-index: 2;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 9px;
  margin-top: 7px;
}

.confetti {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti i {
  position: absolute;
  top: -14%;
  left: var(--x);
  width: 10px;
  height: 18px;
  border-radius: 3px;
  background: var(--confetti-color);
  transform: rotate(var(--rotation));
  animation: confetti-fall 2.8s var(--delay) ease-in infinite;
}

@keyframes reward-pop {
  from { opacity: 0; transform: scale(0.2) rotate(-25deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes thumb-celebrate {
  0% { opacity: 0; transform: scale(0.25) rotate(-18deg); }
  55% { opacity: 1; transform: scale(1.18) rotate(10deg); }
  75% { transform: scale(0.96) rotate(-4deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes sprout-grow {
  from { opacity: 0; transform: translateY(28px) scale(0.35); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes star-arrive {
  from { opacity: 0; transform: translateY(25px) scale(0.2) rotate(-30deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}

@keyframes confetti-fall {
  0% { opacity: 0; transform: translateY(-20px) rotate(var(--rotation)); }
  12% { opacity: 1; }
  100% { opacity: 0.9; transform: translateY(650px) rotate(620deg); }
}

.mode-numbers .play-card::before {
  background: rgba(255, 211, 111, 0.2);
}

.mode-doubles .play-card::before {
  background: rgba(115, 200, 241, 0.18);
}

.mode-neighbors .play-card::before {
  background: rgba(157, 217, 130, 0.2);
}

.mode-math .play-card::before {
  background: rgba(255, 155, 114, 0.14);
}

.mode-minus10 .play-card::before {
  background: rgba(185, 156, 242, 0.16);
}

.mode-tens100 .play-card::before {
  background: rgba(241, 139, 178, 0.16);
}

.mode-cross100 .play-card::before {
  background: rgba(126, 208, 196, 0.18);
}

.tens-solution {
  box-shadow: 0 18px 0 rgba(241, 139, 178, 0.4), 0 34px 70px rgba(23, 53, 83, 0.12);
}

.tens-board {
  width: min(78vw, 720px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(10px, 2vw, 20px);
}

.tens-board > b {
  font-size: clamp(1.7rem, 4vw, 3rem);
}

.tens-group {
  min-height: 118px;
  display: grid;
  grid-template-columns: repeat(5, minmax(34px, 1fr));
  align-content: center;
  gap: clamp(5px, 1vw, 9px);
  padding: clamp(10px, 1.8vw, 16px);
  border: 3px solid rgba(23, 53, 83, 0.24);
  border-radius: 20px;
  background: white;
}

.ten-tile {
  min-width: 0;
  aspect-ratio: 0.72;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 9px;
  background: #73c8f1;
  font-size: clamp(0.68rem, 1.7vw, 1rem);
  font-style: normal;
  font-weight: 950;
  box-shadow: inset 0 -5px 0 rgba(23, 53, 83, 0.12), 0 4px 0 rgba(23, 53, 83, 0.09);
}

.orange-tens .ten-tile {
  background: #ff9b72;
}

.removed-tens .ten-tile {
  position: relative;
}

.removed-tens .ten-tile::after {
  content: "";
  position: absolute;
  top: 47%;
  left: -8%;
  width: 116%;
  height: 3px;
  border-radius: 99px;
  background: var(--ink);
  transform: rotate(-42deg);
}

.tens-words {
  padding: 8px 16px;
  border-radius: 999px;
  background: #fff0e7;
  color: #8c462f;
  font-size: clamp(1rem, 2.4vw, 1.45rem);
  text-align: center;
}

.hundred-bridge-solution {
  box-shadow: 0 18px 0 rgba(126, 208, 196, 0.45), 0 34px 70px rgba(23, 53, 83, 0.12);
}

.bridge-split {
  padding: 8px 16px;
  border-radius: 999px;
  background: #e9f8f5;
  color: #247164;
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  font-weight: 900;
}

.hundred-bridge {
  width: min(80vw, 720px);
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  align-items: end;
  gap: clamp(7px, 1.5vw, 14px);
  padding: clamp(14px, 2.5vw, 24px);
  border: 3px solid rgba(23, 53, 83, 0.2);
  border-radius: 24px;
  background: white;
}

.hundred-bridge > b {
  min-width: clamp(56px, 10vw, 92px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: #fffdf8;
  font-size: clamp(1.35rem, 3.5vw, 2.4rem);
  box-shadow: 0 6px 0 rgba(23, 53, 83, 0.1);
}

.hundred-bridge > b:nth-of-type(2) {
  background: #ffd36f;
}

.hundred-bridge > b:last-child {
  background: #67d5bc;
}

.hundred-bridge > span {
  display: grid;
  grid-template-rows: auto auto;
  place-items: center;
  color: #9aa7b2;
}

.hundred-bridge > span i {
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef2f3;
  font-size: clamp(0.78rem, 2vw, 1rem);
  font-style: normal;
  font-weight: 950;
}

.hundred-bridge > span em {
  width: 100%;
  color: currentColor;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-style: normal;
  line-height: 0.8;
  text-align: center;
}

.hundred-bridge > span.active {
  color: #e86f4e;
  animation: bridge-highlight 650ms ease-out both;
}

.hundred-bridge > span.active i {
  background: #ffe3d8;
}

.hundred-bridge > span.done {
  color: #2d8e7d;
}

.hundred-bridge > span.waiting {
  opacity: 0.45;
}

@keyframes bridge-highlight {
  from { opacity: 0.3; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.math-problem {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  gap: clamp(20px, 4vh, 38px);
  text-align: center;
}

.math-prompt {
  padding: 9px 17px;
  border-radius: 999px;
  background: #fff0e7;
  color: #9a482e;
  font-size: clamp(0.85rem, 2vw, 1.1rem);
  font-weight: 900;
}

.math-problem strong {
  font-size: min(19vw, 19vh, 11rem);
  line-height: 0.9;
  letter-spacing: -0.065em;
  text-shadow: 0 min(1vw, 9px) 0 rgba(23, 53, 83, 0.12);
}

.math-problem strong i {
  color: #e86f4e;
  font-style: normal;
}

.math-solution {
  position: relative;
  z-index: 2;
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100dvh - 158px);
  display: grid;
  place-items: center;
  gap: clamp(7px, 1.4vh, 15px);
  overflow-y: scroll;
  scrollbar-gutter: stable;
  padding: clamp(14px, 2.4vw, 28px);
  border: 2px solid var(--ink);
  border-radius: clamp(22px, 4vw, 40px);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 16px 0 rgba(255, 155, 114, 0.4), 0 32px 66px rgba(23, 53, 83, 0.12);
}

.home-screen,
.subject-screen,
.math-solution {
  scrollbar-width: auto;
  scrollbar-color: #67d5bc rgba(23, 53, 83, 0.1);
}

.home-screen::-webkit-scrollbar,
.subject-screen::-webkit-scrollbar,
.math-solution::-webkit-scrollbar {
  width: 14px;
}

.home-screen::-webkit-scrollbar-track,
.subject-screen::-webkit-scrollbar-track,
.math-solution::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(23, 53, 83, 0.08);
}

.home-screen::-webkit-scrollbar-thumb,
.subject-screen::-webkit-scrollbar-thumb,
.math-solution::-webkit-scrollbar-thumb {
  min-height: 48px;
  border: 3px solid transparent;
  border-radius: 999px;
  background: #67d5bc;
  background-clip: padding-box;
}

.home-screen::-webkit-scrollbar-thumb:hover,
.subject-screen::-webkit-scrollbar-thumb:hover,
.math-solution::-webkit-scrollbar-thumb:hover {
  background: #42bba0;
  background-clip: padding-box;
}

.math-strategy {
  font-size: clamp(1.3rem, 3.2vw, 2.25rem);
  letter-spacing: -0.025em;
  text-align: center;
}

.math-step-solution {
  position: relative;
  z-index: 2;
  width: min(880px, calc(100vw - 32px));
  max-height: calc(100dvh - 160px);
  display: grid;
  place-items: center;
  gap: clamp(10px, 1.8vh, 20px);
  overflow-y: auto;
  padding: clamp(18px, 3vw, 34px);
  border: 2px solid var(--ink);
  border-radius: clamp(24px, 4vw, 42px);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 18px 0 rgba(255, 155, 114, 0.38), 0 34px 70px rgba(23, 53, 83, 0.12);
}

.step-ten-frame {
  width: min(60vw, 580px);
  min-height: min(33vw, 280px);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(2, 1fr);
  align-items: center;
  justify-items: center;
  gap: clamp(8px, 1.6vw, 20px);
  padding: clamp(14px, 2.4vw, 28px);
  border: clamp(3px, 0.5vw, 6px) solid rgba(23, 53, 83, 0.16);
  border-radius: clamp(18px, 3vw, 32px);
  background: white;
}

.step-dot {
  position: relative;
  width: min(7vw, 7vh, 68px);
  aspect-ratio: 1;
  border: clamp(2px, 0.35vw, 4px) solid rgba(23, 53, 83, 0.13);
  border-radius: 50%;
  background: transparent;
}

.step-dot.blue {
  border-color: var(--ink);
  background: #4ea5d9;
  box-shadow: inset 0 -6px 0 rgba(23, 53, 83, 0.12), 0 6px 0 rgba(23, 53, 83, 0.08);
}

.step-dot.orange {
  border-color: var(--ink);
  background: #ff9b72;
  box-shadow: inset 0 -6px 0 rgba(23, 53, 83, 0.1), 0 6px 0 rgba(23, 53, 83, 0.08);
}

.step-dot.removed::after {
  content: "";
  position: absolute;
  top: 47%;
  left: -12%;
  width: 124%;
  height: clamp(3px, 0.45vw, 6px);
  border-radius: 99px;
  background: var(--ink);
  transform: rotate(-42deg);
}

.ten-and-ones {
  min-height: min(30vw, 250px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 4vw, 44px);
}

.subtraction-split {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 16px;
  background: #fff7f1;
}

.split-part {
  display: grid;
  place-items: center;
  gap: 4px;
}

.split-dots {
  display: flex;
  gap: 5px;
}

.split-dots i {
  width: 14px;
  aspect-ratio: 1;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #ff9b72;
}

.split-part.later .split-dots i {
  background: #b99cf2;
}

.split-part small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
}

.subtraction-split > b {
  color: var(--muted);
  font-size: 1rem;
}

.subtraction-split + .ten-and-ones {
  min-height: min(23vw, 190px);
}

.double-board {
  width: min(76vw, 620px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 4vw, 42px);
  padding: clamp(20px, 3vw, 34px);
  border: clamp(3px, 0.5vw, 6px) solid rgba(23, 53, 83, 0.15);
  border-radius: clamp(20px, 3vw, 34px);
  background: white;
}

.double-pair {
  display: grid;
  gap: clamp(14px, 2.8vh, 28px);
}

.double-row {
  display: flex;
  align-items: center;
  gap: clamp(9px, 1.7vw, 20px);
}

.double-dot {
  width: min(9vw, 9vh, 76px);
  aspect-ratio: 1;
  border: clamp(2px, 0.35vw, 4px) solid var(--ink);
  border-radius: 50%;
  background: #4ea5d9;
  box-shadow: inset 0 -6px 0 rgba(23, 53, 83, 0.12), 0 6px 0 rgba(23, 53, 83, 0.08);
}

.double-extra {
  display: grid;
  place-items: center;
  gap: 8px;
  padding-left: clamp(16px, 3vw, 30px);
  border-left: 3px dashed rgba(23, 53, 83, 0.28);
}

.double-extra b {
  color: #9a482e;
  font-size: clamp(1.1rem, 2.7vw, 1.7rem);
}

.double-extra .double-dot {
  background: #ff9b72;
}

.solid-ten {
  min-width: clamp(116px, 18vw, 180px);
  min-height: clamp(116px, 18vw, 180px);
  display: grid;
  place-items: center;
  border: clamp(4px, 0.55vw, 7px) solid var(--ink);
  border-radius: clamp(22px, 3vw, 34px);
  background: rgba(78, 165, 217, 0.18);
  color: #4ea5d9;
  font-size: clamp(3.5rem, 9vw, 6.5rem);
  line-height: 1;
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  box-shadow: 0 9px 0 rgba(23, 53, 83, 0.1);
}

.loose-ones {
  max-width: 370px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(10px, 1.7vw, 20px);
}

.step-equation {
  font-size: clamp(2rem, 5vw, 3.6rem);
  letter-spacing: -0.04em;
}

.step-sentence {
  max-width: 680px;
  color: var(--muted);
  font-size: clamp(0.95rem, 2vw, 1.18rem);
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
}

.math-board {
  width: min(82vw, 720px);
  display: flex;
  justify-content: center;
  gap: clamp(12px, 2vw, 22px);
}

.math-ten {
  position: relative;
  flex: 1 1 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(7px, 1vw, 12px);
  padding: clamp(8px, 1.4vw, 14px) clamp(8px, 1.4vw, 14px) 25px;
  border: 3px solid rgba(23, 53, 83, 0.42);
  border-radius: 20px;
  background: #fff;
}

.math-ten > small {
  position: absolute;
  right: 0;
  bottom: 3px;
  left: 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-align: center;
}

.math-five {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  justify-items: center;
  gap: clamp(3px, 0.55vw, 7px);
  padding: clamp(5px, 0.8vw, 8px);
  border-radius: 12px;
}

.math-five.first-five {
  background: rgba(78, 165, 217, 0.13);
}

.math-five.second-five {
  background: rgba(255, 155, 114, 0.14);
}

.math-dot {
  position: relative;
  width: clamp(17px, 2.4vw, 24px);
  aspect-ratio: 1;
  border: 2px solid rgba(23, 53, 83, 0.13);
  border-radius: 50%;
  background: transparent;
}

.math-dot.start {
  border-color: var(--ink);
  background: #4ea5d9;
  box-shadow: inset 0 -4px 0 rgba(23, 53, 83, 0.13);
}

.math-dot.change {
  border-color: var(--ink);
  background: #ff9b72;
}

.math-dot.removed::after {
  content: "";
  position: absolute;
  top: 47%;
  left: -12%;
  width: 124%;
  height: 4px;
  border-radius: 99px;
  background: var(--ink);
  transform: rotate(-42deg);
}

.math-split {
  padding: 7px 15px;
  border-radius: 999px;
  background: #fff0e7;
  color: #9a482e;
  font-size: clamp(0.85rem, 2vw, 1.05rem);
  text-align: center;
}

.math-steps {
  width: min(760px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.math-steps > span {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 9px;
  min-height: 56px;
  padding: 8px 12px;
  border-radius: 15px;
  background: #f3f7f7;
  color: var(--ink);
  font-size: clamp(0.95rem, 2.3vw, 1.35rem);
  font-weight: 850;
  line-height: 1.25;
}

.math-steps b {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 0.9rem;
}

.math-steps strong {
  letter-spacing: -0.025em;
}

.number-card-value {
  position: relative;
  z-index: 1;
  font-size: min(68vw, 68vh);
  font-weight: 900;
  line-height: 0.8;
  letter-spacing: -0.11em;
  text-indent: -0.08em;
  -webkit-text-stroke: min(0.65vw, 6px) var(--ink);
  paint-order: stroke fill;
  filter: drop-shadow(0 min(1.1vw, 10px) 0 rgba(23, 53, 83, 0.14));
}

.ten-grid {
  position: relative;
  z-index: 1;
  width: min(80vw, 860px);
  height: min(54vw, 58vh);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: clamp(12px, 2.6vw, 34px);
  align-items: center;
  justify-items: center;
  padding: clamp(20px, 4vw, 48px);
  border: clamp(5px, 0.75vw, 10px) solid rgba(23, 53, 83, 0.16);
  border-radius: clamp(28px, 5vw, 66px);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 20px 60px rgba(23, 53, 83, 0.08);
}

.ten-grid.twenty-grid {
  height: min(69vw, 67vh);
  grid-template-rows: repeat(4, 1fr);
}

.ten-grid.twenty-grid .dot:nth-child(11),
.ten-grid.twenty-grid .dot:nth-child(12),
.ten-grid.twenty-grid .dot:nth-child(13),
.ten-grid.twenty-grid .dot:nth-child(14),
.ten-grid.twenty-grid .dot:nth-child(15) {
  margin-top: clamp(9px, 1.6vw, 22px);
}

.dot {
  width: min(11vw, 11vh, 112px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: transparent;
  transform: scale(0.72);
}

.dot.active {
  border: clamp(3px, 0.45vw, 6px) solid var(--ink);
  transform: scale(1);
  box-shadow: inset 0 -8px 0 rgba(23, 53, 83, 0.12), 0 9px 0 rgba(23, 53, 83, 0.1);
  animation: pop 180ms ease-out both;
}

.dot.active.base-group {
  background: #4ea5d9;
}

.dot.active.rest-group {
  background: #ff9b72;
}

@keyframes pop {
  from { transform: scale(0.7); opacity: 0.2; }
  to { transform: scale(1); opacity: 1; }
}

.guess-state {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
}

.guess-state strong {
  font-size: min(52vw, 52vh);
  line-height: 0.8;
  color: #67d5bc;
  -webkit-text-stroke: min(0.6vw, 6px) var(--ink);
  paint-order: stroke fill;
}

.guess-state small {
  margin-bottom: 24px;
  color: var(--ink);
  font-size: clamp(1.1rem, 3vw, 2rem);
  font-weight: 800;
}

.solution-view {
  position: relative;
  z-index: 2;
  width: min(880px, calc(100vw - 32px));
  max-height: calc(100dvh - 170px);
  display: grid;
  place-items: center;
  gap: clamp(10px, 2vh, 22px);
  padding: clamp(18px, 3vw, 34px);
  border: 2px solid var(--ink);
  border-radius: clamp(24px, 4vw, 42px);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 18px 0 rgba(103, 213, 188, 0.45), 0 34px 70px rgba(23, 53, 83, 0.12);
}

.solution-kicker {
  color: #2d7f70;
  font-size: clamp(0.75rem, 1.8vw, 1rem);
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ten-grid.compact-grid {
  width: min(60vw, 580px);
  height: min(33vw, 280px);
  gap: clamp(7px, 1.4vw, 18px);
  padding: clamp(12px, 2vw, 24px);
  border-width: clamp(3px, 0.5vw, 6px);
  border-radius: clamp(16px, 3vw, 30px);
  box-shadow: none;
}

.ten-grid.compact-grid.twenty-grid {
  height: min(45vw, 350px);
}

.compact-grid .dot {
  width: min(7vw, 7vh, 68px);
}

.solution-equation {
  font-size: clamp(1.65rem, 5vw, 3.5rem);
  letter-spacing: -0.035em;
}

.solution-explanation {
  max-width: 680px;
  color: var(--muted);
  font-size: clamp(0.95rem, 2vw, 1.25rem);
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

.duration-control {
  position: absolute;
  z-index: 6;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(98px, calc(env(safe-area-inset-bottom) + 92px));
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px;
  border: 1.5px solid rgba(23, 53, 83, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 34px rgba(23, 53, 83, 0.1);
  backdrop-filter: blur(12px);
}

.card-actions {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(160px, 1.15fr);
  gap: 10px;
  width: min(470px, calc(100vw - 28px));
  padding: 7px;
  border: 1.5px solid rgba(23, 53, 83, 0.14);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 36px rgba(23, 53, 83, 0.14);
  backdrop-filter: blur(14px);
}

.card-actions button {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
}

.solution-button {
  background: #fff7de;
}

.solution-button.open {
  background: #e8eef2;
}

.next-button {
  background: #67d5bc;
  box-shadow: inset 0 -4px 0 rgba(23, 53, 83, 0.13);
}

.card-actions button:active {
  transform: translateY(2px);
}

.answer-dock {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: max(98px, calc(env(safe-area-inset-bottom) + 92px));
  width: min(620px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: 1.25fr 0.85fr;
  gap: 8px;
  padding: 7px;
  border: 1.5px solid rgba(23, 53, 83, 0.14);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 36px rgba(23, 53, 83, 0.13);
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
}

.answer-dock button {
  min-height: 46px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  font-weight: 900;
  cursor: pointer;
}

.microphone-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: #e8f8f4;
  touch-action: none;
}

.microphone-button > span {
  color: #e05271;
  font-size: 1.1rem;
}

.microphone-button.listening {
  background: #ffdbe5;
  box-shadow: 0 0 0 6px rgba(237, 76, 168, 0.18);
}

.microphone-button.listening > span {
  animation: microphone-pulse 700ms ease-in-out infinite alternate;
}

.microphone-button:disabled {
  border-color: rgba(23, 53, 83, 0.24);
  color: var(--muted);
  cursor: not-allowed;
}

.keypad-button {
  background: #fff7de;
}

.answer-dock small {
  grid-column: 1 / -1;
  min-height: 16px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
}

@keyframes microphone-pulse {
  to { transform: scale(1.35); }
}

.answer-feedback {
  position: relative;
  z-index: 3;
  width: min(620px, calc(100vw - 32px));
  display: grid;
  place-items: center;
  gap: 13px;
  padding: clamp(24px, 5vw, 48px);
  border: 3px solid var(--ink);
  border-radius: clamp(26px, 5vw, 46px);
  background: white;
  text-align: center;
  box-shadow: 0 18px 0 rgba(103, 213, 188, 0.42), 0 34px 70px rgba(23, 53, 83, 0.14);
}

.answer-feedback.incorrect {
  box-shadow: 0 18px 0 rgba(255, 211, 111, 0.68), 0 34px 70px rgba(23, 53, 83, 0.14);
}

.feedback-symbol {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #67d5bc;
  font-size: 3rem;
  font-weight: 950;
}

.incorrect .feedback-symbol {
  background: #ffd36f;
}

.answer-feedback > strong {
  font-size: clamp(1.8rem, 5vw, 3.4rem);
}

.answer-feedback > span:not(.feedback-symbol):not(.feedback-actions) {
  font-size: clamp(1rem, 2vw, 1.25rem);
}

.answer-feedback > small {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 800;
}

.feedback-actions {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 9px;
  margin-top: 8px;
}

.feedback-actions button {
  min-height: 50px;
  padding: 10px 15px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: #f3f6f7;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.feedback-actions button.primary {
  background: #67d5bc;
}

.keypad-overlay {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(23, 53, 83, 0.3);
  backdrop-filter: blur(8px);
}

.keypad-card {
  width: min(390px, 100%);
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 3px solid var(--ink);
  border-radius: 28px;
  background: white;
  box-shadow: 0 22px 60px rgba(23, 53, 83, 0.24);
}

.keypad-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.keypad-head button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #e8eef2;
  font-size: 1.4rem;
  font-weight: 900;
  cursor: pointer;
}

.keypad-card output {
  min-height: 78px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #f3f7f7;
  font-size: 3rem;
  font-weight: 950;
}

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

.keypad-grid button {
  min-height: 58px;
  border: 2px solid var(--ink);
  border-radius: 15px;
  background: #fffdf8;
  font-size: 1.35rem;
  font-weight: 950;
  cursor: pointer;
}

.keypad-grid button.submit {
  background: #67d5bc;
}

.keypad-grid button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.duration-control span {
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.duration-control button {
  min-width: 45px;
  padding: 8px 9px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.duration-control button.active {
  background: #67d5bc;
  box-shadow: inset 0 -3px 0 rgba(23, 53, 83, 0.13);
}

@media (max-width: 760px) {
  .home-screen,
  .subject-screen {
    align-items: start;
    overflow-y: scroll;
    padding: 24px 18px 40px;
  }

  .subject-card {
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 18px;
    padding: 20px;
    border-radius: 26px;
  }

  .subject-visual {
    min-height: 160px;
    gap: 17px;
    padding: 19px;
    border-radius: 21px;
  }

  .subject-copy {
    text-align: center;
  }

  .subject-copy small {
    justify-self: center;
  }

  .subject-action {
    grid-column: 1;
  }

  .brand-mark {
    margin-top: 10px;
    margin-bottom: 12px;
  }

  .intro {
    margin: 14px auto 22px;
  }

  .learning-filters {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .learning-filters > div {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .learning-filters button {
    padding: 9px 5px;
  }

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

  .mode-card {
    min-height: 260px;
    grid-template-columns: 84px 1fr;
    border-radius: 22px;
  }

  .round-panel {
    width: min(94vw, 560px);
    max-height: calc(100dvh - 112px);
    gap: 10px;
    overflow-y: auto;
    padding: 22px 18px;
  }

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

  .mode-preview {
    width: 82px;
    border-radius: 18px;
  }

  .mini-number {
    font-size: 3.6rem;
  }

  .mini-number.compact-number {
    font-size: 3.15rem;
  }

  .mini-dots {
    grid-template-columns: repeat(3, 13px);
    gap: 8px;
  }

  .mini-dots i {
    width: 13px;
    height: 13px;
  }

  .ten-grid {
    width: 90vw;
    height: min(64vw, 48vh);
    gap: 10px;
    padding: 18px;
  }

  .ten-grid.twenty-grid {
    width: 82vw;
    height: min(104vw, 61vh);
  }

  .ten-grid.compact-grid {
    width: min(78vw, 480px);
    height: min(46vw, 250px);
  }

  .ten-grid.compact-grid.twenty-grid {
    height: min(76vw, 360px);
  }

  .dot {
    width: min(14vw, 9vh);
  }

  .duration-control {
    left: 50%;
    right: auto;
    bottom: max(96px, calc(env(safe-area-inset-bottom) + 90px));
    transform: translateX(-50%);
  }

  .duration-control span {
    display: none;
  }

  .solution-view {
    max-height: calc(100dvh - 174px);
    gap: 10px;
    padding: 16px;
  }

  .solution-explanation {
    max-width: 92%;
  }

  .math-problem strong {
    font-size: min(20vw, 16vh);
  }

  .math-solution {
    max-height: calc(100dvh - 164px);
    padding: 13px;
  }

  .math-step-solution {
    max-height: calc(100dvh - 164px);
    gap: 10px;
    padding: 16px;
  }

  .step-ten-frame {
    width: min(82vw, 480px);
    min-height: min(48vw, 260px);
  }

  .tens-board {
    width: min(88vw, 520px);
    gap: 7px;
  }

  .hundred-bridge {
    width: min(90vw, 520px);
    gap: 4px;
    padding: 10px 7px;
    border-radius: 17px;
  }

  .hundred-bridge > b {
    min-width: clamp(45px, 14vw, 64px);
    border-width: 2px;
    font-size: clamp(1.05rem, 5vw, 1.5rem);
  }

  .hundred-bridge > span i {
    padding: 4px 6px;
    font-size: 0.68rem;
  }

  .tens-group {
    min-height: 92px;
    grid-template-columns: repeat(5, minmax(21px, 1fr));
    gap: 4px;
    padding: 8px;
    border-radius: 14px;
  }

  .ten-tile {
    border-radius: 6px;
    font-size: 0.62rem;
  }

  .double-board {
    width: min(86vw, 500px);
    gap: 12px;
    padding: 18px 12px;
  }

  .double-pair {
    gap: 12px;
  }

  .double-row {
    gap: 7px;
  }

  .double-extra {
    padding-left: 12px;
  }

  .double-dot {
    width: min(11vw, 8.5vh, 54px);
  }

  .ten-and-ones {
    min-height: 180px;
    gap: 18px;
  }

  .subtraction-split + .ten-and-ones {
    min-height: 150px;
  }

  .loose-ones {
    max-width: 46vw;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .loose-ones .step-dot {
    width: min(11vw, 54px);
  }

  .answer-dock {
    grid-template-columns: 1fr 0.78fr;
    bottom: max(96px, calc(env(safe-area-inset-bottom) + 90px));
  }

  .answer-dock button {
    min-height: 44px;
    font-size: 0.8rem;
  }

  .answer-dock small {
    font-size: 0.65rem;
  }

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

  .feedback-actions button:first-child:nth-last-child(3) {
    grid-column: 1 / -1;
  }

  .math-board {
    width: min(82vw, 420px);
    flex-direction: column;
  }

  .math-ten {
    width: 100%;
  }

  .math-steps {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

@media (max-height: 540px) and (orientation: landscape) {
  .game-toolbar {
    grid-template-columns: 44px 1fr 44px;
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }

  .mode-label {
    padding: 5px 14px;
  }

  .ten-grid {
    width: min(76vw, 760px);
    height: 56vh;
  }

  .ten-grid.twenty-grid {
    width: min(66vw, 650px);
    height: 66vh;
  }

  .solution-view {
    width: min(720px, calc(100vw - 160px));
    max-height: calc(100dvh - 40px);
    grid-template-columns: 1.15fr 0.85fr;
    grid-template-rows: auto auto auto;
    gap: 8px 18px;
  }

  .solution-kicker {
    grid-column: 1 / -1;
  }

  .solution-view .compact-grid {
    grid-row: 2 / span 2;
    width: min(45vw, 430px);
    height: 42vh;
  }

  .solution-view .compact-grid.twenty-grid {
    height: 55vh;
  }

  .solution-equation,
  .solution-explanation {
    grid-column: 2;
  }

  .duration-control {
    right: 14px;
    left: auto;
    bottom: 82px;
    transform: none;
  }

  .math-solution {
    width: min(780px, calc(100vw - 140px));
    max-height: calc(100dvh - 30px);
  }

  .math-board {
    width: min(68vw, 660px);
  }
}

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

.subject-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.subject-panel { width: min(1100px, 100%); }
.subject-card { width: 100%; min-height: 390px; grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; gap: 22px; padding: 28px; }
.subject-visual { min-height: 172px; }
.subject-copy { text-align: center; }
.subject-copy small { justify-self: center; }
.subject-copy strong { font-size: clamp(2.7rem, 6vw, 4.4rem); }
.subject-german { --subject-accent: #b99cf2; }
.subject-word { display: flex; align-items: center; font-size: 2rem; font-weight: 900; }
.subject-word span { margin: 0 3px; padding: 2px 7px; border: 2px solid var(--ink); border-radius: 11px; background: #ffccaf; }
.de-preview { font-size: clamp(1.05rem, 2.2vw, 1.4rem); font-weight: 900; white-space: nowrap; }
.de-home { background: radial-gradient(circle at 12% 10%, rgba(185,156,242,.35), transparent 30%), radial-gradient(circle at 88% 88%, rgba(255,211,111,.4), transparent 32%), #f8fbfa; }
.de-home .mode-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.de-game { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: linear-gradient(rgba(23,53,83,.06) 1px,transparent 1px),linear-gradient(90deg,rgba(23,53,83,.06) 1px,transparent 1px),var(--paper); background-size: 44px 44px; }
.de-toolbar { flex: 0 0 auto; display: grid; grid-template-columns: 52px minmax(0,1fr) 52px; align-items: center; gap: 10px; padding: max(12px,env(safe-area-inset-top)) 14px 10px; }
.de-toolbar .mode-label { max-width: 100%; }
.de-stage { min-height: 0; flex: 1; display: grid; align-items: safe center; justify-items: center; overflow-y: auto; scrollbar-gutter: stable; padding: 20px 20px 38px; }
.de-task-card { width: min(900px,100%); display: grid; justify-items: center; gap: 22px; padding: clamp(22px,4vw,42px); border: 2px solid var(--ink); border-radius: 32px; background: rgba(255,255,255,.97); box-shadow: 0 14px 0 color-mix(in srgb,var(--accent) 45%,transparent),0 28px 60px rgba(23,53,83,.1); text-align: center; }
.de-task-card h2 { margin: 0; font-size: clamp(1.35rem,3.5vw,2.3rem); line-height: 1.16; letter-spacing: -.025em; }
.de-task-card p { max-width: 630px; margin: 0; color: var(--muted); font-size: clamp(1rem,2vw,1.18rem); line-height: 1.5; }
.de-word-board { width: 100%; display: flex; align-items: center; justify-content: center; flex-wrap: nowrap; gap: clamp(4px,1vw,11px); }
.de-letter { min-width: 0; flex: 0 1 auto; display: grid; place-items: center; padding: clamp(7px,1.4vw,15px); border: 2px solid transparent; border-radius: 17px; color: var(--ink); font-size: clamp(2rem,7vw,5rem); font-weight: 850; line-height: 1.12; background: #f0f4f5; }
button.de-letter { cursor: pointer; border-color: rgba(23,53,83,.25); box-shadow: 0 4px 0 rgba(23,53,83,.12); }
.de-letter.de-selected { background: #fff0b3; border-color: var(--ink); transform: translateY(-3px); box-shadow: 0 7px 0 rgba(23,53,83,.15); }
.de-letter.de-highlight { border-color: var(--ink); box-shadow: 0 5px 0 rgba(23,53,83,.13); }
.de-letter.de-sort { background: #73c8f1; }
.de-letter.de-umlaut { background: #cbb5f7; }
.de-letter.de-diphthong { background: #ffbc99; }
.de-letter.de-inspect { background: #9be2d0; }
.de-letter.de-underlined { text-decoration: underline; text-decoration-thickness: 4px; text-underline-offset: 8px; }
.de-letter.de-gap { min-width: 1.1em; border: 3px dashed #7d8798; background: white; color: #7d8798; }
.de-audio { min-height: 44px; padding: 10px 17px; border: 1.5px solid rgba(23,53,83,.22); border-radius: 14px; background: #eef6f4; color: var(--ink); font-size: .93rem; font-weight: 850; cursor: pointer; }
.de-choices { width: min(600px,100%); display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.de-choices button { flex: 1 1 100px; min-height: 66px; padding: 12px 15px; border: 2px solid var(--ink); border-radius: 17px; background: #fff8df; color: var(--ink); font-size: clamp(1.2rem,3vw,1.8rem); font-weight: 900; box-shadow: 0 5px 0 rgba(23,53,83,.15); cursor: pointer; }
.de-explanation { width: 100%; display: grid; justify-items: center; gap: 19px; }
.de-rule { display: grid; gap: 6px; padding: 14px 20px; border-radius: 19px; background: color-mix(in srgb,var(--accent) 24%,white); }
.de-rule strong { font-size: clamp(1.25rem,3vw,1.8rem); }
.de-rule span { color: var(--muted); font-size: .92rem; line-height: 1.4; }
.de-feedback { width: min(740px,100%); }
.de-feedback.correct { --accent: #67d5bc; }
.de-feedback.incorrect { --accent: #ffd36f; }
.de-actions { flex: 0 0 auto; width: min(700px,100%); align-self: center; display: grid; grid-template-columns: 1.15fr 1fr; gap: 12px; padding: 16px 20px max(20px,env(safe-area-inset-bottom)); }
.de-actions button { min-height: 54px; padding: 12px 16px; border: 2px solid var(--ink); border-radius: 16px; background: white; color: var(--ink); font-weight: 900; cursor: pointer; }
.de-actions button:last-child { background: #67d5bc; }
.de-game button:disabled { opacity: .5; cursor: default; box-shadow: none; }
.de-stage .round-panel { max-height: none; }
@media(max-width:760px) {
  .de-home .mode-grid { grid-template-columns: 1fr; }
  .subject-grid { grid-template-columns: 1fr; gap: 28px; }
  .subject-card { min-height: 0; padding: 22px; }
  .subject-visual { min-height: 140px; }
  .de-toolbar { grid-template-columns: 44px minmax(0,1fr) 44px; gap: 6px; padding: 12px 10px 7px; }
  .de-toolbar .icon-button { width: 44px; height: 44px; }
  .de-toolbar .mode-label { padding: 8px 9px; }
  .de-toolbar .mode-label strong { font-size: .8rem; }
  .de-toolbar .mode-label span { font-size: .65rem; }
  .de-stage { padding: 14px 10px 28px; }
  .de-task-card { padding: 22px 13px; gap: 18px; border-radius: 25px; }
  .de-word-board { gap: 3px; }
  .de-letter { padding: 8px 4px; border-radius: 11px; font-size: clamp(1.35rem,6vw,2.8rem); }
  .de-letter.de-underlined { text-decoration-thickness: 3px; text-underline-offset: 5px; }
  .de-explanation { gap: 16px; }
  .de-choices { gap: 8px; }
  .de-choices button { min-height: 58px; padding: 10px; }
  .de-actions { padding: 10px 10px max(14px,env(safe-area-inset-bottom)); gap: 8px; }
  .de-actions button { padding: 10px 9px; font-size: .83rem; }
}
