:root {
  color-scheme: light;
  --bg: #f8f9ff;
  --surface: #ffffff;
  --surface-alt: #f1eeff;
  --ink: #08123a;
  --muted: #6e7594;
  --line: #e5e7f2;
  --primary: #6d52f4;
  --primary-dark: #4c36d8;
  --accent: #70b7ff;
  --sky: #eaf2ff;
  --sky-ink: #1664f5;
  --amber: #fff1df;
  --amber-ink: #8f602c;
  --coral: #ff8a1f;
  --danger: #9a4c36;
  --shadow: 0 18px 46px rgba(21, 31, 72, 0.12);
  --shadow-soft: 0 10px 26px rgba(21, 31, 72, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 50% 5%, #ffffff 0, rgba(248, 249, 255, 0.7) 48%, rgba(233, 238, 255, 0.9) 100%),
    repeating-linear-gradient(0deg, rgba(109, 82, 244, 0.035) 0, rgba(109, 82, 244, 0.035) 1px, transparent 1px, transparent 32px),
    repeating-linear-gradient(90deg, rgba(25, 118, 255, 0.032) 0, rgba(25, 118, 255, 0.032) 1px, transparent 1px, transparent 32px);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

.app {
  min-height: 100vh;
}

.app,
.shell,
.topbar,
.topbar__stats,
.screen-heading,
.screen-heading__copy,
.nav,
.row,
.grid,
.grid--wide,
.panel,
.segment-card,
.actions,
.metric-grid,
.flow-steps,
.fact-table-wrap,
.session-top,
.session-progress {
  min-width: 0;
}

.shell {
  width: min(100%, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 34px) 112px;
}

.topbar,
.row,
.nav,
.keypad-row,
.session-top,
.history-row,
.quest-row,
.settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar {
  margin-bottom: 18px;
}

.topbar__settings {
  flex: 0 0 auto;
  margin-left: auto;
}

.topbar__home {
  flex: 0 0 auto;
}

.topbar__stats {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.screen-title {
  margin: 0;
  font-size: clamp(28px, 7vw, 44px);
  line-height: 1.02;
  letter-spacing: 0;
}

.screen-copy {
  max-width: 680px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 2.2vw, 19px);
  line-height: 1.45;
}

.screen-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(14px, 4vw, 28px);
  align-items: end;
}

.screen-heading__copy {
  min-width: 0;
}

.welcome-shell .topbar {
  justify-content: flex-end;
  margin-bottom: 4px;
}

.welcome-shell .topbar__stats {
  display: none;
}

.welcome-hero {
  min-height: calc(100vh - 54px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 0.78fr);
  gap: clamp(24px, 7vw, 76px);
  align-items: center;
}

.welcome-hero__copy {
  max-width: 650px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.welcome-hero h1 {
  margin: 0;
  font-size: 58px;
  line-height: 1.02;
  letter-spacing: 0;
}

.welcome-hero p {
  max-width: 580px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(17px, 2.4vw, 21px);
  line-height: 1.45;
}

.welcome-hero__visual {
  display: grid;
  gap: 16px;
  justify-items: center;
}

.welcome-hero__note {
  width: min(100%, 290px);
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.9);
  box-shadow: var(--shadow-soft);
}

.welcome-hero__note strong,
.welcome-hero__note span {
  display: block;
}

.welcome-hero__note span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.aksi-character {
  display: block;
  width: clamp(112px, 18vw, 170px);
  height: auto;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 18px 32px rgba(21, 31, 72, 0.16));
}

.aksi-character--hero {
  width: clamp(176px, 25vw, 315px);
  justify-self: end;
}

.aksi-character--large {
  width: clamp(118px, 17vw, 168px);
}

.aksi-character--tiny {
  width: 48px;
  filter: drop-shadow(0 8px 14px rgba(21, 31, 72, 0.16));
}

.aksi-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 16px;
  border: 1px solid rgba(109, 82, 244, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-soft);
}

.aksi-panel--success,
.aksi-panel--reward {
  background: linear-gradient(135deg, rgba(233, 248, 242, 0.94), rgba(255, 248, 232, 0.78));
  border-color: rgba(36, 116, 107, 0.24);
}

.aksi-panel--correction {
  background: #fff8e8;
  border-color: rgba(143, 96, 44, 0.22);
}

.aksi-panel .aksi-character {
  width: clamp(74px, 14vw, 118px);
}

.aksi-panel__copy h2,
.aksi-panel__copy p {
  margin: 0;
}

.aksi-panel__copy h2 {
  font-size: clamp(20px, 4vw, 28px);
  line-height: 1.1;
}

.aksi-panel__copy p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.4;
  font-weight: 700;
}

.tutorial-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(18px, 5vw, 42px);
  align-items: center;
  margin-top: 18px;
}

.coach-bubble-list {
  display: grid;
  gap: 12px;
}

.coach-bubble {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.92);
  box-shadow: var(--shadow-soft);
}

.coach-bubble--lead {
  border-color: rgba(36, 116, 107, 0.28);
  background: #e9f8f2;
}

.coach-bubble span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--primary);
  font-weight: 900;
}

.coach-bubble p {
  margin: 0;
  color: var(--ink);
  font-weight: 750;
}

.coach-bubble--lead span {
  background: var(--primary-dark);
}

.coach-bubble--lead p {
  font-size: 18px;
  line-height: 1.35;
  font-weight: 850;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.grid--wide {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.panel,
.segment-card,
.unit-row,
.stat-pill,
.history-day,
.keypad-button,
.answer-box {
  border: 1px solid var(--line);
  background: var(--surface);
}

.panel,
.segment-card {
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel + .panel,
.panel + .nav,
.nav + .panel {
  margin-top: 14px;
}

.segment-card {
  text-align: left;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.segment-card:hover {
  transform: translateY(-1px);
  border-color: rgba(36, 116, 107, 0.42);
  box-shadow: 0 20px 54px rgba(32, 79, 74, 0.14);
}

.segment-card.is-selected {
  background: var(--surface-alt);
  border-color: rgba(36, 116, 107, 0.55);
}

.segment-card.is-disabled {
  cursor: default;
  opacity: 0.56;
}

.segment-card.is-disabled:hover {
  transform: none;
  border-color: var(--line);
}

.panel--soft {
  background:
    linear-gradient(135deg, rgba(233, 248, 242, 0.94), rgba(223, 241, 255, 0.72)),
    var(--surface-alt);
}

.panel--amber {
  background: var(--amber);
}

.panel--reward {
  background:
    linear-gradient(135deg, rgba(255, 248, 232, 0.96), rgba(233, 248, 242, 0.88)),
    var(--surface);
}

.award-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.award-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(36, 116, 107, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.award-item span {
  color: var(--muted);
  font-weight: 750;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.metric-tile {
  min-height: 74px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 12px;
  border: 1px solid rgba(109, 82, 244, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.metric-tile span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric-tile strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.08;
}

.flow-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.flow-steps--compact {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.flow-step {
  min-height: 92px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 10px;
  align-content: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.flow-step span {
  grid-row: span 2;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--primary);
  font-size: 13px;
  font-weight: 900;
}

.flow-step strong,
.flow-step small {
  min-width: 0;
}

.flow-step strong {
  line-height: 1.15;
}

.flow-step small {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.25;
}

.flow-step.is-done {
  border-color: rgba(36, 116, 107, 0.28);
  background: #e9f8f2;
}

.flow-step.is-current {
  border-color: rgba(109, 82, 244, 0.42);
  background: var(--surface-alt);
}

.flow-step.is-next {
  background: #f7f8fc;
}

.panel-title,
.card-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.card-copy,
.muted,
.small {
  color: var(--muted);
}

.card-copy {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.4;
}

.small {
  font-size: 14px;
  line-height: 1.35;
}

.stack {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-top: 16px;
  overflow: hidden;
}

.hero h2 {
  margin: 0;
  font-size: clamp(26px, 5vw, 36px);
  line-height: 1.08;
}

.hero p {
  margin: 8px 0 0;
  color: var(--muted);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  cursor: pointer;
  font-weight: 750;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow-soft);
  transition: transform 120ms ease, filter 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
  border-color: rgba(36, 116, 107, 0.46);
  box-shadow: 0 14px 30px rgba(32, 79, 74, 0.12);
}

.button:active {
  transform: translateY(0);
}

.button--primary {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

.button--danger {
  color: #ffffff;
  background: var(--danger);
  border-color: var(--danger);
}

.button--ghost {
  background: transparent;
  box-shadow: none;
}

.button--wide {
  width: 100%;
}

.icon-button {
  width: 46px;
  min-width: 46px;
  min-height: 46px;
  padding: 0;
  font-size: 21px;
  line-height: 1;
}

.settings-shortcut {
  width: 54px;
  min-width: 54px;
  min-height: 54px;
  border-color: rgba(36, 116, 107, 0.24);
  color: var(--primary-dark);
  background: linear-gradient(145deg, #ffffff, #e9f8f2);
  box-shadow: 0 10px 22px rgba(32, 79, 74, 0.13), inset 0 -4px 0 rgba(36, 116, 107, 0.11);
}

.settings-shortcut__icon {
  display: block;
  font-size: 28px;
  line-height: 1;
  transform: rotate(-8deg);
  transition: transform 120ms ease;
}

.settings-shortcut:hover .settings-shortcut__icon {
  transform: rotate(10deg) scale(1.05);
}

.home-shortcut {
  width: 54px;
  min-width: 54px;
  min-height: 54px;
  border-color: rgba(36, 116, 107, 0.24);
  color: var(--primary-dark);
  background: linear-gradient(145deg, #ffffff, #e9f8f2);
  box-shadow: 0 10px 22px rgba(32, 79, 74, 0.13), inset 0 -4px 0 rgba(36, 116, 107, 0.11);
}

.home-shortcut__icon {
  display: block;
  font-size: 30px;
  line-height: 1;
  transform: translateY(-1px);
}

.button[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.actions .button {
  flex: 1 1 180px;
}

.segment-card .actions {
  align-items: stretch;
  width: 100%;
}

.segment-card .actions .button {
  flex-basis: 100%;
  width: 100%;
}

.stat-pill {
  min-height: 36px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 750;
  background: rgba(255, 254, 250, 0.86);
  box-shadow: var(--shadow-soft);
}

.stat-pill--streak {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 12px;
}

.streak-fire {
  --flame: #b8c1d1;
  --flame-core: #eef2f7;
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  position: relative;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(109, 82, 244, 0.10);
  box-shadow: inset 0 -3px 0 rgba(76, 54, 216, 0.10);
}

.streak-fire::before,
.streak-fire::after {
  content: "";
  display: block;
  border-radius: 78% 78% 78% 18%;
  transform: rotate(-45deg);
}

.streak-fire::before {
  width: 14px;
  height: 18px;
  background: var(--flame);
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.08);
}

.streak-fire::after {
  width: 7px;
  height: 10px;
  position: absolute;
  bottom: 8px;
  background: var(--flame-core);
}

.streak-fire--3 {
  --flame: #ff8a2a;
  --flame-core: #ffd166;
}

.streak-fire--5 {
  --flame: #ff4f8b;
  --flame-core: #ffd166;
}

.streak-fire--10 {
  --flame: #8b5cf6;
  --flame-core: #7dd3fc;
}

.streak-fire--30 {
  --flame: #1d7df2;
  --flame-core: #ffe66d;
}

.nav {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 0 0;
  background: linear-gradient(to top, var(--bg) 78%, rgba(243, 251, 248, 0));
}

.nav .button {
  flex: 1 1 96px;
}

.progress-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.unit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
}

.unit-row.is-active {
  background: var(--surface-alt);
  border-color: rgba(36, 116, 107, 0.48);
}

.unit-row__meta,
.unit-row__status {
  margin-top: 3px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 700;
}

.unit-row__status {
  color: var(--ink);
}

.unit-row__percent {
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
}

.fact-table-wrap {
  width: 100%;
  max-width: 100%;
  margin-top: 14px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.fact-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
}

.fact-table th {
  min-width: 50px;
  height: 30px;
  padding: 3px 4px;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 850;
  text-align: center;
}

.fact-cell {
  width: 74px;
  min-width: 74px;
  height: 50px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
}

.fact-cell:hover,
.fact-cell:focus {
  outline: none;
  border-color: rgba(109, 82, 244, 0.52);
  box-shadow: 0 0 0 2px rgba(109, 82, 244, 0.16), var(--shadow-soft);
}

.fact-cell__example,
.fact-cell__status {
  display: block;
  line-height: 1.15;
}

.fact-cell__example {
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.fact-cell__status {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.fact-cell.is-next {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(109, 82, 244, 0.18), var(--shadow-soft);
}

.fact-cell.is-new {
  background: #ffffff;
  border-color: rgba(112, 183, 255, 0.36);
}

.fact-cell.is-learning {
  background: var(--sky);
  border-color: rgba(22, 100, 245, 0.26);
}

.fact-cell.is-strong {
  background: #e9f8f2;
  border-color: rgba(36, 116, 107, 0.38);
}

.fact-cell.is-review {
  background: var(--amber);
  border-color: rgba(143, 96, 44, 0.28);
}

.fact-cell.is-locked {
  background: #f2f3f8;
  border-style: dashed;
  opacity: 0.68;
}

.fact-cell.is-empty {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.fact-table-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(156px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.fact-table-legend span {
  display: grid;
  grid-template-columns: 14px 1fr;
  align-items: start;
  column-gap: 8px;
  row-gap: 2px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.fact-table-legend strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.2;
}

.fact-table-legend em {
  display: block;
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  font-style: normal;
}

.fact-table-legend .fact-table-mark {
  grid-row: 1 / span 2;
  align-items: center;
  margin-top: 1px;
}

.fact-table-mark {
  width: 12px;
  height: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
}

.fact-table-mark.is-next {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(109, 82, 244, 0.18);
}

.fact-table-mark.is-learning {
  background: var(--sky);
  border-color: rgba(22, 100, 245, 0.26);
}

.fact-table-mark.is-strong {
  background: #e9f8f2;
  border-color: rgba(36, 116, 107, 0.38);
}

.fact-table-mark.is-review {
  background: var(--amber);
  border-color: rgba(143, 96, 44, 0.28);
}

.fact-table-mark.is-locked {
  background: #f2f3f8;
  border-style: dashed;
}

.speed-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
  align-items: end;
  gap: 10px;
  min-height: 168px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.speed-chart__item {
  display: grid;
  grid-template-rows: 112px auto auto auto;
  gap: 6px;
  align-items: end;
  justify-items: center;
  min-width: 0;
}

.speed-chart__track {
  position: relative;
  width: 100%;
  max-width: 42px;
  height: 112px;
  border-radius: 8px;
  background: #eef1f7;
  overflow: hidden;
}

.speed-chart__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 12px;
  border-radius: 8px 8px 0 0;
  background: var(--primary);
}

.speed-chart__bar.is-fast {
  background: #2f8c7d;
}

.speed-chart__bar.is-steady {
  background: var(--primary);
}

.speed-chart__bar.is-long {
  background: var(--coral);
}

.speed-chart__item strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.15;
}

.speed-chart__item span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.15;
}

.speed-chart__item em {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.18;
  font-style: normal;
  text-align: center;
}

.speed-clusters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.speed-cluster {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.speed-cluster.is-fast {
  border-color: rgba(47, 140, 125, 0.28);
  background: #edf9f5;
}

.speed-cluster.is-steady {
  border-color: rgba(109, 82, 244, 0.22);
  background: #f6f4ff;
}

.speed-cluster.is-long {
  border-color: rgba(255, 138, 31, 0.26);
  background: #fff6ea;
}

.speed-cluster.is-miss {
  border-color: rgba(154, 76, 54, 0.22);
  background: #fff2ee;
}

.speed-cluster__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.speed-cluster__head strong {
  font-size: 14px;
  line-height: 1.2;
}

.speed-cluster__head span {
  min-width: 28px;
  min-height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 900;
}

.speed-cluster small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.speed-cluster p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.speed-cluster__facts {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.speed-fact {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid rgba(8, 18, 58, 0.08);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 850;
  text-align: left;
  cursor: pointer;
}

.speed-fact span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dcebe6;
}

.bar span {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  background: linear-gradient(90deg, var(--primary), #70b7ff);
}

.history-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}

.history-day {
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 8px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.history-day__mark {
  color: var(--primary-dark);
  font-size: 18px;
  line-height: 1;
  font-weight: 900;
}

.history-day__label {
  line-height: 1.1;
}

.history-day.is-done {
  color: var(--primary-dark);
  background: var(--surface-alt);
  font-weight: 800;
}

.quest-row {
  justify-content: space-between;
  min-height: 34px;
  border-bottom: 1px solid rgba(220, 225, 222, 0.78);
}

.quest-row:last-child {
  border-bottom: 0;
}

.session-shell {
  max-width: 720px;
}

.recovery-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(36, 116, 107, 0.22);
  border-radius: 8px;
  color: var(--primary-dark);
  background: #e9f8f2;
  box-shadow: var(--shadow-soft);
}

.recovery-notice strong,
.recovery-notice span {
  display: block;
}

.recovery-notice span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.session-top {
  position: relative;
  align-items: center;
  padding: 10px 72px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.84);
  box-shadow: var(--shadow-soft);
}

.session-settings {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
}

.session-home {
  flex: 0 0 auto;
}

.session-progress {
  flex: 1;
  color: var(--muted);
  font-weight: 750;
}

.session-progress strong,
.session-progress span {
  display: block;
}

.session-progress strong {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--ink);
}

.session-progress span {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.25;
  font-weight: 650;
}

.session-progress .session-count {
  min-width: 64px;
  min-height: 40px;
  display: inline-grid;
  place-items: center;
  margin-top: 0;
  padding: 0 10px;
  border: 1px solid rgba(109, 82, 244, 0.20);
  border-radius: 8px;
  color: var(--primary-dark);
  background: #fff8e8;
  box-shadow: inset 0 -4px 0 rgba(255, 184, 77, 0.18);
  font-size: 22px;
  line-height: 1;
  font-weight: 900;
}

.streak-badge {
  min-width: 76px;
  min-height: 36px;
  display: grid;
  place-items: center;
  padding: 6px 10px;
  border: 1px solid rgba(36, 116, 107, 0.24);
  border-radius: 999px;
  color: var(--primary-dark);
  background: #e9f8f2;
  font-size: 14px;
  font-weight: 850;
}

.session-timer-button {
  min-height: 38px;
  padding: 0 10px;
  font-size: 13px;
  flex: 0 0 auto;
}

.countdown {
  width: 58px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--primary-dark);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 24px;
  font-weight: 900;
}

.countdown.is-low {
  color: var(--danger);
  background: #fff2dd;
}

.timer-stack {
  display: grid;
  gap: 5px;
  justify-items: center;
}

.timer-track {
  width: 58px;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe8e4;
}

.timer-track span {
  display: block;
  width: var(--time-left, 100%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 160ms ease;
}

.countdown--paused {
  color: var(--muted);
  background: var(--surface-alt);
}

.countdown--hidden {
  color: var(--muted);
  background: #f2f4f3;
  font-size: 18px;
}

.problem {
  margin: clamp(32px, 8vw, 58px) 0 18px;
  text-align: center;
  font-size: clamp(56px, 14vw, 92px);
  line-height: 1;
  font-weight: 900;
  color: var(--ink);
  text-shadow: 0 8px 0 rgba(255, 184, 77, 0.16);
}

.answer-box {
  display: grid;
  place-items: center;
  min-height: 76px;
  border-radius: 8px;
  font-size: 42px;
  font-weight: 850;
  background: #ffffff;
  box-shadow: inset 0 -5px 0 rgba(47, 140, 125, 0.08), var(--shadow-soft);
}

.answer-box--correction {
  color: var(--muted);
  background: #f0f2f1;
  box-shadow: inset 0 -5px 0 rgba(36, 49, 65, 0.05), var(--shadow-soft);
}

.correction-slot {
  min-height: 74px;
  display: grid;
  align-items: center;
  margin: 10px 0 12px;
}

.correction-slot:empty {
  visibility: hidden;
}

.correction-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 430px);
  margin: 0 auto;
}

.correction-details p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  font-weight: 750;
}

.correction-pill {
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 10px;
  border: 1px solid rgba(143, 96, 44, 0.18);
  border-radius: 8px;
  background: #fff8e8;
  text-align: center;
}

.correction-pill span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.correction-pill strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.correction-pill.is-answer {
  background: #f0f2f1;
}

.correction-pill.is-paused {
  background: var(--sky);
  border-color: rgba(22, 100, 245, 0.18);
}

.feedback {
  height: 0;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  text-align: center;
  color: var(--primary-dark);
  font-size: 0;
  font-weight: 800;
}

.feedback.is-correct {
  color: var(--primary-dark);
}

.feedback.is-wrong {
  color: #9a4b27;
}

.feedback.is-slow {
  color: var(--amber-ink);
}

.feedback.is-correction {
  color: var(--muted);
}

.coach-reaction {
  min-height: 34px;
  margin: 0 auto 10px;
  padding: 8px 12px;
  border: 1px solid rgba(47, 140, 125, 0.18);
  border-radius: 8px;
  color: var(--muted);
  background: #f7fbf8;
  text-align: center;
  font-size: 14px;
  font-weight: 750;
}

.coach-reaction[hidden] {
  display: none;
}

.coach-reaction.is-correct {
  color: var(--primary-dark);
  background: #e9f8f2;
}

.coach-reaction.is-slow,
.coach-reaction.is-correction {
  color: var(--amber-ink);
  background: #fff8e8;
}

.coach-reaction.is-wrong {
  color: #9a4b27;
  background: #fff3ec;
}

.policy-list {
  margin: 12px 0 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.55;
}

.policy-list li + li {
  margin-top: 8px;
}

.keypad {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.keypad--left {
  width: min(100%, 420px);
  margin-right: auto;
}

.keypad--right {
  width: min(100%, 420px);
  margin-left: auto;
}

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

.keypad-button {
  min-height: 64px;
  border-radius: 8px;
  font-size: 25px;
  font-weight: 850;
  cursor: pointer;
  box-shadow: inset 0 -4px 0 rgba(36, 49, 65, 0.08), var(--shadow-soft);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.keypad-button:hover {
  transform: translateY(-1px);
}

.keypad-button:active {
  transform: translateY(1px);
  box-shadow: inset 0 -2px 0 rgba(36, 49, 65, 0.08), var(--shadow-soft);
}

.is-reduced-motion .keypad-button,
.is-reduced-motion .timer-track span,
.is-reduced-motion .segment-card,
.is-reduced-motion .button {
  transition: none;
}

.is-reduced-motion .keypad-button:hover,
.is-reduced-motion .keypad-button:active,
.is-reduced-motion .segment-card:hover {
  transform: none;
}

.keypad-button[data-key="unknown"] {
  font-size: 16px;
}

.settings-row {
  justify-content: space-between;
  min-height: 44px;
  gap: 12px;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.switch {
  width: 54px;
  height: 32px;
  padding: 3px;
  border-radius: 999px;
  background: #d7ddda;
  cursor: pointer;
}

.switch span {
  display: block;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 140ms ease;
}

.switch.is-on {
  background: var(--primary);
}

.switch.is-on span {
  transform: translateX(22px);
}

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

.fact-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.fact-chip {
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--primary-dark);
  background: #e9f8f2;
  font-size: 13px;
  font-weight: 800;
}

.fact-chip--button {
  border: 1px solid rgba(36, 116, 107, 0.18);
  cursor: pointer;
  text-align: left;
}

.fact-detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.fact-detail-hero h2 {
  margin: 0;
  font-size: clamp(34px, 8vw, 56px);
  line-height: 1;
}

.fact-detail-status {
  min-width: 92px;
  min-height: 92px;
  display: grid;
  place-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

.fact-detail-status.is-next {
  color: var(--primary-dark);
  border-color: var(--primary);
  background: var(--surface-alt);
}

.fact-detail-status.is-strong {
  color: var(--primary-dark);
  border-color: rgba(36, 116, 107, 0.38);
  background: #e9f8f2;
}

.fact-detail-status.is-review {
  color: var(--amber-ink);
  border-color: rgba(143, 96, 44, 0.28);
  background: var(--amber);
}

.certificate {
  margin-top: 18px;
  padding: clamp(24px, 6vw, 44px);
  border: 1px solid rgba(109, 82, 244, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(241, 238, 255, 0.88)),
    var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.certificate h2 {
  margin: 0;
  font-size: clamp(30px, 7vw, 52px);
  line-height: 1.05;
}

.certificate p {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 750;
}

.certificate__fact {
  width: min(100%, 520px);
  margin: 24px auto 0;
  padding: 18px;
  border: 1px solid rgba(36, 116, 107, 0.22);
  border-radius: 8px;
  background: #e9f8f2;
  color: var(--primary-dark);
  font-size: clamp(22px, 5vw, 34px);
  font-weight: 900;
}

.certificate__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

@media (max-width: 820px) {
  .session-shell {
    max-width: 100%;
  }

  .session-top {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .session-progress {
    flex: 1 1 min(100%, 280px);
  }

  .session-timer-button {
    flex: 1 1 190px;
  }

  .session-top > .button:not(.settings-shortcut) {
    flex: 1 1 150px;
  }

  .session-top > .button.home-shortcut {
    flex: 0 0 54px;
  }
}

@media (max-width: 640px) {
  .shell {
    padding-top: 16px;
  }

  .welcome-shell {
    padding: 12px 16px 42px;
  }

  .welcome-shell .topbar {
    margin-bottom: 0;
  }

  .welcome-shell .settings-shortcut,
  .welcome-shell .home-shortcut {
    width: 48px;
    min-width: 48px;
    min-height: 48px;
  }

  .welcome-hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 16px;
    align-content: start;
    padding-top: 8px;
  }

  .welcome-hero__copy {
    max-width: none;
  }

  .welcome-hero .eyebrow {
    margin-bottom: 8px;
    font-size: 12px;
  }

  .welcome-hero h1 {
    max-width: 320px;
    font-size: 34px;
    line-height: 1.03;
  }

  .welcome-hero p {
    margin-top: 12px;
    font-size: 16px;
    line-height: 1.38;
  }

  .welcome-hero .actions {
    margin-top: 14px;
  }

  .welcome-hero__visual {
    display: grid;
    grid-template-columns: minmax(104px, 0.42fr) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    justify-items: stretch;
  }

  .welcome-hero__note {
    width: 100%;
    padding: 12px 14px;
  }

  .welcome-hero__note strong {
    font-size: 18px;
  }

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

  .tutorial-layout .aksi-character {
    justify-self: end;
  }

  .aksi-panel {
    grid-template-columns: minmax(68px, auto) minmax(0, 1fr);
    padding: 12px;
  }

  .aksi-panel .aksi-character {
    width: 72px;
  }

  .metric-grid,
  .flow-steps {
    grid-template-columns: 1fr;
  }

  .screen-heading,
  .hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .screen-heading .aksi-character,
  .aksi-character--hero {
    width: 82px;
  }

  .welcome-hero__visual .aksi-character--hero {
    width: min(34vw, 128px);
    justify-self: center;
  }

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

  .topbar__stats {
    justify-content: flex-start;
  }

  .session-top {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto auto auto;
    padding-right: 68px;
  }

  .session-top .button {
    grid-column: 1 / -1;
  }

  .session-top .button.home-shortcut {
    grid-column: 1;
    grid-row: 1;
  }

  .session-top .button.settings-shortcut {
    position: absolute;
    top: 8px;
    right: 8px;
  }

  .fact-detail-hero {
    grid-template-columns: 1fr;
  }

  .recovery-notice {
    align-items: stretch;
    flex-direction: column;
  }

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

  .correction-slot {
    min-height: 70px;
  }

  .correction-details p {
    display: none;
  }

  .correction-pill {
    min-height: 54px;
    padding: 8px 6px;
  }

  .correction-pill span {
    font-size: 10px;
  }

  .correction-pill strong {
    font-size: 18px;
  }

  .fact-detail-status {
    min-width: 0;
    min-height: 58px;
  }

  .actions .button {
    flex-basis: 100%;
  }

  .fact-table {
    border-spacing: 3px;
  }

  .fact-table th {
    min-width: 40px;
    height: 28px;
    padding: 2px 3px;
    font-size: 12px;
  }

  .fact-cell {
    width: 64px;
    min-width: 64px;
    height: 48px;
    padding: 2px;
  }

  .fact-cell__example {
    font-size: 11px;
  }

  .fact-cell__status {
    margin-top: 2px;
    font-size: 9px;
  }
}

@media (max-width: 420px) {
  .welcome-hero h1 {
    font-size: 32px;
  }

  .screen-heading {
    grid-template-columns: 1fr;
  }

  .welcome-hero__visual {
    grid-template-columns: 112px minmax(0, 1fr);
    justify-items: stretch;
  }

  .welcome-hero__visual .aksi-character {
    width: 112px;
    justify-self: center;
  }

  .screen-heading .aksi-character {
    width: 72px;
    justify-self: end;
    margin-top: -10px;
  }

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

  .aksi-character--hero {
    width: 160px;
    justify-self: end;
    margin-top: 0;
  }
}
