:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #24313f;
  --muted: #708092;
  --line: #d9e5ef;
  --paper: #f4f9fc;
  --panel: #ffffff;
  --green: #58cc02;
  --green-dark: #45a501;
  --blue: #1cb0f6;
  --blue-dark: #1687bd;
  --orange: #ff9600;
  --orange-dark: #d67900;
  --purple: #ce82ff;
  --purple-dark: #9c5cc4;
  --yellow: #ffc800;
  --yellow-dark: #d7a800;
  --red: #ff4b4b;
  --red-dark: #cc3939;
  --shadow: rgba(36, 49, 63, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #dceff7;
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

#app {
  min-height: 100vh;
}

.phone {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  position: relative;
  overflow: hidden;
}

.screen {
  min-height: 100vh;
  padding: 14px 16px 104px;
}

.screen.flow {
  padding-bottom: 30px;
}

.loading-screen,
.empty-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
}

.loader-mark {
  width: 70px;
  height: 70px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: inset 0 -8px 0 var(--green-dark);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 32px;
  font-weight: 900;
}

.top-hud,
.top-bar,
.bottom-nav,
.stat-row,
.row,
.filter-row,
.stepper,
.reward-tabs {
  display: flex;
  align-items: center;
}

.top-hud {
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 18px;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  box-shadow: inset 0 -5px 0 var(--green-dark);
  flex: none;
}

.hud-pills {
  display: flex;
  gap: 7px;
  min-width: 0;
  flex: 1;
  justify-content: flex-end;
}

.pill {
  min-height: 34px;
  padding: 7px 9px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.pill.green {
  border-color: #b8ef93;
  color: var(--green-dark);
}

.pill.blue {
  border-color: #aee5ff;
  color: var(--blue-dark);
}

.pill.red {
  border-color: #ffd0d0;
  color: var(--red-dark);
}

.top-bar {
  min-height: 48px;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.back-btn,
.round-btn {
  width: 42px;
  height: 42px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
  box-shadow: 0 4px 0 #cbd9e5;
}

.top-title {
  flex: 1;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
}

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

h1 {
  font-size: 25px;
  line-height: 1.15;
}

h2 {
  font-size: 21px;
  line-height: 1.2;
}

h3 {
  font-size: 16px;
}

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

.hero-panel,
.lesson-panel,
.flat-panel,
.result-panel {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 0 #d7e4ee;
}

.hero-panel {
  padding: 16px;
  margin-bottom: 16px;
}

.hero-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-mark,
.small-mark {
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  flex: none;
}

.hero-mark {
  width: 56px;
  height: 56px;
  font-size: 24px;
  background: var(--blue);
  box-shadow: inset 0 -7px 0 var(--blue-dark);
}

.small-mark {
  width: 38px;
  height: 38px;
  background: var(--green);
  box-shadow: inset 0 -5px 0 var(--green-dark);
}

.stat-row {
  gap: 8px;
  margin-top: 14px;
}

.stat {
  flex: 1;
  min-width: 0;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 8px;
  text-align: center;
}

.stat strong {
  display: block;
  font-size: 20px;
  color: var(--green-dark);
}

.stat span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.path-wrap {
  position: relative;
  padding: 12px 0 8px;
}

.path-line {
  position: absolute;
  left: 50%;
  top: 30px;
  bottom: 30px;
  width: 8px;
  transform: translateX(-50%);
  border-radius: 99px;
  background: #d7e8f0;
}

.path-node {
  position: relative;
  min-height: 96px;
  display: flex;
  align-items: center;
}

.path-node.left {
  justify-content: flex-start;
  padding-left: 34px;
}

.path-node.right {
  justify-content: flex-end;
  padding-right: 34px;
}

.node-button {
  width: 74px;
  height: 74px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
  font-size: 22px;
  box-shadow: inset 0 -9px 0 rgba(0, 0, 0, 0.18), 0 6px 0 #c8d8e4;
}

.node-button.green {
  background: var(--green);
}

.node-button.blue {
  background: var(--blue);
}

.node-button.orange {
  background: var(--orange);
}

.node-button.purple {
  background: var(--purple);
}

.node-button.yellow {
  background: var(--yellow);
  color: #7a5600;
}

.node-button.gray {
  background: #b7c7d4;
}

.node-label {
  position: absolute;
  top: 12px;
  max-width: 142px;
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 4px 0 #d7e4ee;
}

.path-node.left .node-label {
  left: 116px;
}

.path-node.right .node-label {
  right: 116px;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.18);
}

.primary-btn {
  background: var(--green);
}

.secondary-btn {
  background: var(--blue);
}

.danger-btn {
  background: var(--red);
}

.ghost-btn {
  border: 2px solid var(--line);
  background: #fff;
  color: var(--blue-dark);
  box-shadow: 0 5px 0 #d7e4ee;
}

.button-row {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.lesson-panel {
  padding: 16px;
}

.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.meta-chip {
  padding: 7px 9px;
  border-radius: 999px;
  background: #eef7fb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.steps {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.step-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.step-number {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  flex: none;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

input,
textarea,
select {
  width: 100%;
  min-height: 48px;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 118px;
  resize: vertical;
}

.upload-zone {
  min-height: 150px;
  display: grid;
  place-items: center;
  border: 3px dashed #aee5ff;
  border-radius: 8px;
  background: #f1fbff;
  text-align: center;
  color: var(--blue-dark);
  font-weight: 900;
}

.upload-zone input {
  display: none;
}

.preview-strip {
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  background: #fff8df;
  color: #856100;
  font-size: 13px;
  font-weight: 900;
}

.stepper {
  justify-content: space-between;
  gap: 6px;
  margin: 18px 0;
}

.step-dot {
  flex: 1;
  min-width: 0;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.step-dot::before {
  content: "";
  display: block;
  width: 28px;
  height: 28px;
  margin: 0 auto 6px;
  border-radius: 50%;
  background: #c9d8e4;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12);
}

.step-dot.done::before {
  background: var(--green);
}

.step-dot.current::before {
  background: var(--blue);
}

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

.menu-tile,
.reward-tile,
.goal-tile,
.mistake-tile {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 14px;
  text-align: left;
  box-shadow: 0 5px 0 #d7e4ee;
}

.menu-tile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tile-title {
  font-size: 15px;
  font-weight: 900;
}

.tile-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: pre-line;
}

.reward-tabs,
.filter-row {
  gap: 8px;
  margin: 12px 0 14px;
}

.tab-chip,
.subject-chip {
  flex: 1;
  min-height: 38px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
}

.tab-chip.active,
.subject-chip.active {
  border-color: var(--green);
  color: var(--green-dark);
  background: #efffe8;
}

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

.reward-tile {
  min-height: 150px;
  display: grid;
  align-content: space-between;
}

.reward-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--yellow);
  color: #7a5600;
  font-weight: 900;
  box-shadow: inset 0 -7px 0 var(--yellow-dark);
}

.progress-bar {
  height: 16px;
  border-radius: 999px;
  background: #dce8ef;
  overflow: hidden;
  margin-top: 10px;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--green);
}

.result-panel {
  min-height: 360px;
  padding: 22px;
  display: grid;
  place-items: center;
  text-align: center;
}

.big-result {
  width: 116px;
  height: 116px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  color: #fff;
  font-size: 46px;
  font-weight: 900;
  background: var(--green);
  box-shadow: inset 0 -14px 0 var(--green-dark);
}

.big-result.blue {
  background: var(--blue);
  box-shadow: inset 0 -14px 0 var(--blue-dark);
}

.big-result.orange {
  background: var(--orange);
  box-shadow: inset 0 -14px 0 var(--orange-dark);
}

.answer-options {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.answer-option {
  min-height: 48px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.answer-option.selected {
  border-color: var(--blue);
  background: #eaf8ff;
  color: var(--blue-dark);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: min(100%, 430px);
  transform: translateX(-50%);
  height: 76px;
  padding: 8px 10px 10px;
  gap: 6px;
  background: #fff;
  border-top: 2px solid var(--line);
  z-index: 10;
}

.nav-item {
  flex: 1;
  min-width: 0;
  height: 56px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.nav-item strong {
  display: block;
  margin-bottom: 2px;
  font-size: 18px;
}

.nav-item.active {
  color: var(--green-dark);
  background: #efffe8;
}

.toast {
  position: fixed;
  left: 50%;
  top: 14px;
  width: min(calc(100% - 28px), 402px);
  transform: translateX(-50%);
  padding: 11px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
  z-index: 20;
  box-shadow: 0 8px 24px var(--shadow);
}

.toast.error {
  background: var(--red);
}

.hidden {
  display: none;
}

@media (max-width: 360px) {
  .screen {
    padding-left: 12px;
    padding-right: 12px;
  }

  .path-node.left {
    padding-left: 10px;
  }

  .path-node.right {
    padding-right: 10px;
  }

  .path-node.left .node-label {
    left: 92px;
  }

  .path-node.right .node-label {
    right: 92px;
  }

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