:root {
  --bg: #1a1a2e;
  --bg-2: #15152a;
  --panel: #0f3460;
  --panel-2: #16284f;
  --accent: #e94560;
  --accent-2: #ff6b81;
  --text: #eaeaea;
  --text-dim: #b6b9d2;
  --text-mute: #8388a8;
  --ok: #4caf50;
  --warn: #ff9800;
  --bad: #f44336;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 6px 16px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  min-height: 100dvh;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(900px 700px at 50% -10%, rgba(233, 69, 96, 0.18), transparent 60%),
    radial-gradient(800px 500px at 50% 110%, rgba(15, 52, 96, 0.6), transparent 60%),
    var(--bg);
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

button { font-family: inherit; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
  text-align: center;
  line-height: 1.25;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 8px 22px rgba(233, 69, 96, 0.35);
}
.btn-primary:hover { box-shadow: 0 12px 26px rgba(233, 69, 96, 0.45); }

.btn-secondary {
  background: var(--panel);
  color: var(--text);
}
.btn-secondary:hover { background: var(--panel-2); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.04); }

.btn-cta {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ───── screens ───── */
.screen {
  display: none;
  animation: fadeIn 0.25s ease;
}
.screen.is-active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ───── splash ───── */
.screen-splash {
  text-align: center;
  padding-top: 120px;
}
.splash-art {
  margin: 0 auto 28px;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: bob 2s ease-in-out infinite;
}
.splash-svg { width: 100%; height: 100%; }
.splash-tagline {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  opacity: 0.9;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ───── hook ───── */
.screen-hook { padding-top: 60px; text-align: center; }
.hook-card {
  background: linear-gradient(180deg, rgba(15, 52, 96, 0.55), rgba(15, 52, 96, 0.15));
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 32px 24px 28px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hook-badge {
  display: inline-block;
  padding: 6px 12px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(233, 69, 96, 0.12);
  border-radius: 999px;
  margin-bottom: 18px;
}
.hook-title {
  font-size: 38px;
  line-height: 1.05;
  font-weight: 800;
  margin: 0 0 14px;
  background: linear-gradient(135deg, #fff, #b6b9d2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hook-sub {
  font-size: 18px;
  color: var(--text-dim);
  margin: 0 0 28px;
  line-height: 1.4;
}
.hook-meta {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--text-dim);
}
.hook-link {
  display: inline-block;
  margin-top: 18px;
  color: var(--text-dim);
  font-size: 14px;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.2);
}

/* ───── tutor ───── */
.screen-tutor { padding-top: 80px; }
.tutor-card {
  background: rgba(15, 52, 96, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 24px;
  border-radius: var(--radius);
}
.tutor-slide {
  display: none;
  text-align: center;
  padding: 18px 8px;
}
.tutor-slide.is-active { display: block; animation: fadeIn 0.3s ease; }
.tutor-icon {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 14px;
}
.tutor-slide p {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
  margin: 0 0 24px;
  color: var(--text);
}

/* ───── game ───── */
.screen-game { padding-top: 4px; }

.hud {
  background: rgba(15, 52, 96, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
}
.hud-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.hud-progress-label {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}
.hud-progress-label span { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.hud-score-wrap {
  font-size: 13px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.hud-score-wrap span {
  color: var(--text);
  font-weight: 700;
  transition: color 0.2s, text-shadow 0.2s;
}
.hud-score-wrap span.is-pop {
  color: var(--ok);
  text-shadow: 0 0 12px rgba(76, 175, 80, 0.6);
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 99px;
  overflow: hidden;
  margin: 8px 0 12px;
}
.progress-fill {
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 99px;
  transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.hud-mood {
  font-size: 12px;
  color: var(--text-mute);
  gap: 12px;
}
.hud-mood-label {
  white-space: nowrap;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.mood-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 99px;
  overflow: hidden;
}
.mood-fill {
  height: 100%;
  width: 75%;
  background: linear-gradient(90deg, var(--bad), var(--warn) 40%, var(--ok));
  border-radius: 99px;
  transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  background-size: 250% 100%;
  background-position: 100% 0;
}

/* ───── история (карточка) ───── */
.story-area { position: relative; }
.story-card {
  background: rgba(15, 52, 96, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 20px 18px 18px;
  box-shadow: var(--shadow);
  animation: cardIn 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.story-tag {
  display: inline-block;
  padding: 4px 10px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(233, 69, 96, 0.14);
  border-radius: 99px;
  margin-bottom: 12px;
}

.story-context {
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 0 0 14px;
  font-style: italic;
  padding-left: 12px;
  border-left: 3px solid rgba(233, 69, 96, 0.4);
}

.story-situation {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 20px;
  color: var(--text);
}

.story-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn-answer {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 500;
  text-align: left;
  padding: 14px 16px;
  min-height: 64px;
  align-items: center;
  justify-content: flex-start;
  line-height: 1.35;
  font-size: 15px;
  white-space: normal;
  position: relative;
}
.btn-answer:hover { background: rgba(255, 255, 255, 0.09); }
.btn-answer:disabled { opacity: 0.4; }
.btn-answer.is-correct {
  background: rgba(76, 175, 80, 0.18);
  border-color: var(--ok);
  opacity: 1;
}
.btn-answer.is-wrong {
  background: rgba(244, 67, 54, 0.18);
  border-color: var(--bad);
  opacity: 1;
}
.btn-answer.is-correct::after,
.btn-answer.is-wrong::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  width: 22px;
  height: 22px;
  margin-top: -11px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-answer.is-correct::after {
  background: var(--ok);
  content: '✓';
  color: white;
  font-weight: 700;
  text-align: center;
  line-height: 22px;
  font-size: 13px;
}
.btn-answer.is-wrong::after {
  background: var(--bad);
  content: '×';
  color: white;
  font-weight: 700;
  text-align: center;
  line-height: 22px;
  font-size: 16px;
}

/* блок «почему» */
.story-explain {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  animation: explainIn 0.35s ease;
}
@keyframes explainIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.explain-verdict {
  display: inline-block;
  padding: 4px 10px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  border-radius: 99px;
  margin-bottom: 10px;
}
.explain-verdict.is-ok {
  color: var(--ok);
  background: rgba(76, 175, 80, 0.14);
}
.explain-verdict.is-bad {
  color: var(--accent);
  background: rgba(233, 69, 96, 0.14);
}
.explain-text {
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-line;
}

.popup-score {
  position: absolute;
  left: 50%;
  top: 28%;
  transform: translate(-50%, 0);
  font-size: 32px;
  font-weight: 800;
  color: var(--ok);
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  opacity: 0;
  transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.7s;
  z-index: 5;
}
.popup-score.is-pop {
  opacity: 1;
  transform: translate(-50%, -36px);
}
.popup-score.is-bad { color: var(--accent); font-size: 22px; }

/* ───── результат ───── */
.screen-result { padding-top: 16px; }
.result-card {
  background: linear-gradient(180deg, rgba(15, 52, 96, 0.6), rgba(15, 52, 96, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 26px 22px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.result-verdict-emoji {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 10px;
}
.result-verdict {
  margin: 0 0 18px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.15;
}
.result-score-block {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-bottom: 6px;
}
.result-score {
  font-size: 56px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}
.result-score-label {
  font-size: 14px;
  color: var(--text-dim);
}
.result-percentile {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--text-dim);
}
.result-headline {
  margin: 18px 0 22px;
  font-size: 18px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
  text-align: left;
}
.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* мотивация */
.motivation-card {
  background: rgba(15, 52, 96, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 22px 20px;
}
.motivation-block-a {
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 20px;
}
.motivation-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px;
}
.motivation-sub {
  font-size: 14px;
  color: var(--text-dim);
  margin: 0 0 16px;
  line-height: 1.45;
}

.lead-form { display: flex; flex-direction: column; gap: 10px; }
.form-label { display: block; }
.form-input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.form-input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.09);
}
.form-input::placeholder { color: var(--text-dim); }

.form-error {
  margin: 6px 0 0;
  min-height: 18px;
  font-size: 13px;
  color: var(--bad);
}

/* ───── лидерборд ───── */
.screen-leaderboard { padding-top: 24px; }
.leaderboard-card {
  background: rgba(15, 52, 96, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 22px 18px;
  box-shadow: var(--shadow);
}
.leaderboard-title {
  margin: 0 0 16px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
}
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  max-height: 60vh;
  overflow-y: auto;
}
.leaderboard-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}
.lb-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  align-items: center;
  font-size: 14px;
}
.lb-row.is-top1 { background: rgba(233, 69, 96, 0.14); }
.lb-row.is-self { outline: 1px solid var(--accent); }
.lb-rank { font-weight: 800; color: var(--text-dim); }
.lb-row.is-top1 .lb-rank { color: var(--accent); }
.lb-name { font-weight: 600; }
.lb-score { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }

@media (max-width: 360px) {
  .hook-title { font-size: 32px; }
  .story-situation { font-size: 18px; }
  .result-score { font-size: 44px; }
  .result-headline { font-size: 16px; }
}
