/* ============================
   ONBOARDING — full redesign
   Nunito-only, single-column, mobile-first.
   ============================ */
.screen-onboarding {
  min-height: 100dvh;
  padding: 0;
  animation: none;
  background: var(--bg-main);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Nunito', sans-serif;
}

/* Top progress bar (hidden on welcome step) */
.ob-progress {
  position: sticky;
  top: 0;
  height: 4px;
  background: var(--bg-surface);
  z-index: 10;
  opacity: 0;
  transition: opacity 300ms ease-out;
}

.ob-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--color-primary);
  border-radius: 0 50px 50px 0;
  transition: width 400ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Stage + sliding step panels */
.ob-stage {
  position: relative;
  flex: 1;
  overflow: hidden;
}

.ob-step {
  position: absolute;
  inset: 0;
  opacity: 1;
  transform: translateX(0);
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1), opacity 220ms ease-out;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.ob-step-active { transform: translateX(0); opacity: 1; }
.ob-step-before { transform: translateX(-100%); opacity: 0; pointer-events: none; }
.ob-step-after  { transform: translateX(100%);  opacity: 0; pointer-events: none; }

/* Panel shell — single column, centered, max 420px */
.ob-panel {
  min-height: 100%;
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 20px 20px;
  padding-top: calc(20px + env(safe-area-inset-top));
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.ob-panel-welcome {
  background: var(--bg-main);
  min-height: 100dvh;
}

/* Primary CTA button — burgundy filled pill with soft shadow */
.ob-cta-zone {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
}

.ob-cta {
  width: 100%;
  height: 56px;
  background: var(--color-primary);
  color: #FFFFFF;
  border: none;
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: var(--type-section);
  letter-spacing: 0.2px;
  box-shadow: 0 4px 12px rgba(139, 26, 74, 0.3);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color 200ms ease-out,
    box-shadow 200ms ease-out,
    transform 200ms ease-out,
    opacity 200ms ease-out;
}

.ob-cta:active {
  background: var(--color-primary-dark);
  transform: scale(0.98);
  box-shadow: 0 2px 6px rgba(139, 26, 74, 0.28);
}

.ob-cta:disabled {
  opacity: 0.5;
  box-shadow: none;
  cursor: default;
}

.ob-cta-large {
  height: 60px;
  font-size: var(--type-h2);
}

.ob-cta-pulse {
  animation: obPulse 1.8s ease-in-out infinite;
}

@keyframes obPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.03); }
}

.ob-skip {
  align-self: center;
  background: transparent;
  border: none;
  color: var(--color-primary);
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: var(--type-body-sm);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 10px 16px;
  min-height: 44px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ob-skip:active { opacity: 0.7; }

/* Speech bubbles (pointing up, centered by default) */
.ob-speech {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  max-width: 360px;
  width: 100%;
  box-sizing: border-box;
}

.ob-speech::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 14px;
  height: 14px;
  background: var(--bg-card);
  border-left: 1px solid var(--border-card);
  border-top: 1px solid var(--border-card);
  border-top-left-radius: 3px;
}

.ob-speech-text {
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: var(--type-section);
  color: var(--text-primary);
  line-height: 1.4;
  margin: 0;
  text-align: center;
}

/* Side-pointing speech (tail on bottom-left) */
.ob-speech-side::before {
  left: 20px;
  transform: translateX(0) rotate(45deg);
}

.ob-speech-side .ob-speech-text {
  text-align: left;
  font-size: var(--type-body);
}

.ob-speech-compact {
  padding: 10px 14px;
  margin-top: 8px;
}

.ob-speech-compact .ob-speech-text {
  font-size: var(--type-body-sm);
  font-weight: 700;
}

/* =====================================================
   Step 0 — Welcome
   ===================================================== */
.ob-welcome-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 20px 0;
}

.ob-avatar-hero {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 200px;
  height: 200px;
  animation: obBounceIn 600ms cubic-bezier(0.34, 1.56, 0.64, 1) 200ms both;
}

.ob-avatar-hero .jk-avatar {
  transform: scale(1.2);
  transform-origin: center;
}

@keyframes obBounceIn {
  0%   { transform: scale(0);    opacity: 0; }
  50%  { transform: scale(1.1);  opacity: 1; }
  75%  { transform: scale(0.95); opacity: 1; }
  100% { transform: scale(1);    opacity: 1; }
}

/* =====================================================
   Step 1 — Daily goal
   ===================================================== */
.ob-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  animation: obFadeUp 400ms ease-out both;
}

.ob-topbar .ob-speech {
  flex: 1;
  padding: 12px 16px;
}

.ob-avatar-small {
  flex-shrink: 0;
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ob-avatar-small .jk-avatar {
  transform: scale(0.9);
  transform-origin: center;
}

.ob-goal-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: obFadeUp 400ms ease-out 100ms both;
  opacity: 0;
}

.ob-goal-card {
  display: grid;
  grid-template-columns: 22px auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 70px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 16px;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color 200ms ease-out,
    background-color 200ms ease-out,
    transform 150ms ease-out;
}

.ob-goal-card:active { transform: scale(0.97); }

.ob-goal-card.selected {
  border: 2px solid var(--color-primary);
  background: var(--bg-card-hover);
  padding: 15px 19px;
}

.ob-goal-radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
  position: relative;
  flex-shrink: 0;
  transition: border-color 200ms ease-out;
}

.ob-goal-card.selected .ob-goal-radio { border-color: var(--color-primary); }

.ob-goal-card.selected .ob-goal-radio::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--color-primary);
}

.ob-goal-emoji { font-size: var(--type-h2); line-height: 1; }

.ob-goal-label {
  font-weight: 700;
  font-size: var(--type-body);
  color: var(--text-primary);
}

.ob-goal-detail {
  font-weight: 700;
  font-size: var(--type-body-sm);
  color: var(--text-secondary);
}

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

/* ---------- Onboarding: user-type / level / subjects cards ---------- */
.ob-type-list,
.ob-level-list {
  width: 100%;
  max-width: 400px;
  margin: 12px auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: obFadeUp 400ms ease-out 100ms both;
  opacity: 0;
}
.ob-type-card,
.ob-level-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  cursor: pointer;
  text-align: left;
  font-family: 'Nunito', sans-serif;
  color: var(--text-primary);
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color 180ms ease-out,
    background-color 180ms ease-out,
    box-shadow 180ms ease-out,
    transform 120ms ease-out;
}
.ob-type-card:active,
.ob-level-card:active { transform: scale(0.98); }
.ob-type-card.selected,
.ob-level-card.selected {
  border-color: var(--color-primary);
  background: rgba(199, 58, 107, 0.14);
  box-shadow: 0 0 0 3px rgba(199, 58, 107, 0.22), 0 8px 18px rgba(199, 58, 107, 0.18);
}
.ob-type-emoji {
  font-size: var(--type-h2);
  line-height: 1;
  margin-bottom: 4px;
}
.ob-type-label,
.ob-level-label {
  font-weight: 800;
  font-size: var(--type-body);
  color: var(--text-primary);
}
.ob-type-sub,
.ob-level-sub {
  font-weight: 600;
  font-size: var(--type-body-sm);
  color: var(--text-secondary);
  line-height: 1.35;
}

/* ---------- Subjects multi-select grid ---------- */
.ob-subjects-list {
  width: 100%;
  max-width: 400px;
  margin: 12px auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  animation: obFadeUp 400ms ease-out 100ms both;
  opacity: 0;
}
.ob-subject-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  min-height: 68px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  color: var(--text-primary);
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color 180ms ease-out,
    background-color 180ms ease-out,
    transform 120ms ease-out;
}
.ob-subject-card:active { transform: scale(0.97); }
.ob-subject-card.selected {
  border-color: var(--color-primary);
  background: rgba(199, 58, 107, 0.14);
}
.ob-subject-emoji { font-size: var(--type-h2); line-height: 1; }
.ob-subject-label {
  font-weight: 700;
  font-size: var(--type-body-sm);
  color: var(--text-primary);
  line-height: 1.2;
}
.ob-subject-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  transition: background 160ms, border-color 160ms;
}
.ob-subject-card.selected .ob-subject-check {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.ob-subject-card.selected .ob-subject-check::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: solid #FFFFFF;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.ob-toggle-row {
  width: 100%;
  max-width: 400px;
  margin: 4px auto 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: var(--type-body-sm);
  color: var(--text-secondary);
  cursor: pointer;
}
.ob-toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
}

/* Inline math rendered by renderInlineLatexInContainer. Baseline-aligns
   with surrounding prose, wraps with the paragraph rather than overflowing. */
.latex-inline {
  display: inline-block;
  max-width: 100%;
  line-height: 1.4;
  vertical-align: -0.08em;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.latex-inline.latex-display {
  display: block;
  margin: 8px 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.latex-inline[data-latex-pending="1"] {
  color: var(--text-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
}

/* ---------- Profile: Learning Profile card ---------- */
.profile-learn-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}
.profile-learn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.profile-learn-row-col {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.profile-learn-label {
  font-weight: 700;
  font-size: var(--type-body-sm);
  color: var(--text-primary);
}
.profile-learn-select {
  flex: 0 0 auto;
  font-family: inherit;
  font-weight: 700;
  font-size: var(--type-body-sm);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 6px 28px 6px 10px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M1 1l4 4 4-4'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.profile-learn-subjects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.profile-learn-subject {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  cursor: pointer;
  font-size: var(--type-caption);
  font-weight: 600;
  color: var(--text-primary);
  transition: border-color 160ms, background 160ms;
}
.profile-learn-subject.selected {
  border-color: var(--color-primary);
  background: rgba(199, 58, 107, 0.10);
}
.profile-learn-subject input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}
.profile-learn-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--type-body-sm);
  font-weight: 600;
  color: var(--text-secondary);
  padding: 4px 2px 0;
  cursor: pointer;
}
.profile-learn-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
}
.profile-learn-hint {
  margin: 4px 0 0;
  font-size: var(--type-caption);
  color: var(--text-tertiary, var(--text-secondary));
  font-style: italic;
}

/* =====================================================
   Step 2 — Test intro
   ===================================================== */
.ob-intro-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
  animation: obFadeUp 400ms ease-out both;
}

.ob-avatar-mid {
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ob-avatar-mid .jk-avatar {
  transform: scale(0.9);
  transform-origin: center;
}

.ob-info-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.ob-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 50px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: var(--type-body-sm);
  white-space: nowrap;
}

.ob-intro-note {
  font-family: 'Nunito', sans-serif;
  font-size: var(--type-body-sm);
  color: var(--text-hint);
  text-align: center;
  margin: 4px 8px 0;
  line-height: 1.4;
}

/* =====================================================
   Step 3 — Placement test
   ===================================================== */
.ob-panel-test {
  gap: 14px;
  padding-top: calc(16px + env(safe-area-inset-top));
}

.ob-test-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ob-test-counter {
  text-align: center;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: var(--type-body);
  color: var(--color-primary);
}

.ob-test-track {
  height: 3px;
  background: var(--bg-surface);
  border-radius: 50px;
  overflow: hidden;
}

.ob-test-track-fill {
  height: 100%;
  background: var(--color-green);
  width: 0%;
  transition: width 300ms ease-out;
  border-radius: 50px;
}

.ob-q-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.ob-q-card {
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: 16px;
  padding: 24px 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  opacity: 1;
  transition:
    opacity 220ms ease-out,
    border-color 200ms ease-out,
    box-shadow 200ms ease-out,
    transform 200ms ease-out;
}

.ob-q-enter { opacity: 0; transform: translateY(6px); }

.ob-q-correct {
  border-color: var(--color-green);
  box-shadow: 0 0 0 4px rgba(88, 204, 2, 0.15);
}

.ob-q-wrong {
  border-color: #E24B4A;
  box-shadow: 0 0 0 4px rgba(226, 75, 74, 0.15);
}

.ob-q-text {
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: var(--type-section);
  color: var(--text-primary);
  text-align: center;
  line-height: 1.4;
  margin: 0 0 10px;
}

.ob-q-latex {
  margin: 10px 0 18px;
  text-align: center;
  font-size: var(--type-section);
  color: var(--text-primary);
}

.ob-opts {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ob-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 0 20px;
  background: var(--bg-option);
  border: 2px solid var(--border-option);
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: var(--type-body);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color 200ms ease-out,
    background-color 200ms ease-out,
    transform 150ms ease-out;
}

.ob-opt:active { transform: scale(0.97); }

.ob-opt.selected {
  border-color: var(--color-primary);
  background: var(--bg-card-hover);
}

.ob-opt-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
  flex-shrink: 0;
  position: relative;
  transition: border-color 200ms ease-out;
}

.ob-opt.selected .ob-opt-dot { border-color: var(--color-primary); }

.ob-opt.selected .ob-opt-dot::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--color-primary);
}

.ob-opt-label {
  flex: 1;
  text-align: left;
}

.ob-opt-label .katex { font-size: 1em; }

.ob-input-wrap {
  display: flex;
  flex-direction: column;
}

.ob-input {
  width: 100%;
  height: 52px;
  padding: 0 20px;
  background: var(--bg-input);
  border: 2px solid var(--border-card);
  border-radius: 16px;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: var(--type-body);
  color: var(--text-primary);
  box-sizing: border-box;
  outline: none;
  transition: border-color 200ms ease-out;
}

.ob-input:focus { border-color: var(--color-primary); }

.ob-input::placeholder { color: var(--text-hint); font-weight: 500; }

.ob-idk {
  align-self: center;
  background: none;
  border: none;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: var(--type-body-sm);
  color: var(--text-hint);
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ob-idk:active { opacity: 0.7; }

/* =====================================================
   Step 4 — Results + nickname
   ===================================================== */
.ob-panel-results {
  padding-top: calc(20px + env(safe-area-inset-top));
}

.ob-results-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: obFadeUp 400ms ease-out both;
}

.ob-ring-wrap {
  position: relative;
  width: 120px;
  height: 120px;
}

.ob-ring { display: block; }

.ob-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ob-ring-score {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: var(--type-h1);
  color: var(--text-primary);
}

.ob-results-title {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: var(--type-h2);
  color: var(--text-primary);
  margin: 0;
  text-align: center;
}

.ob-levels-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
}

.ob-level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  height: 28px;
  padding: 0 10px;
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: var(--type-micro);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.ob-start-card {
  width: 100%;
  background: var(--bg-surface);
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ob-start-line {
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: var(--type-body);
  color: var(--text-primary);
  margin: 0;
  line-height: 1.4;
}

.ob-start-line strong {
  font-weight: 800;
  color: var(--color-primary);
}

.ob-nickname-block {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.ob-nickname-label {
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: var(--type-body);
  color: var(--text-secondary);
}

/* ============================
   LEARN (Skill Tree)
   ============================ */
.screen-learn {
  padding: 0;
  position: relative;
}


.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 300ms ease;
}

[data-theme="dark"] .splash-screen {
  background: radial-gradient(circle at 50% 40%, #25253E 0%, var(--bg-main) 75%);
}

:root:not([data-theme="dark"]) .splash-screen {
  background: linear-gradient(160deg, #FEF2F0 0%, #FFE0EA 100%);
}

.splash-screen.splash-leaving {
  opacity: 0;
}

.splash-canvas {
  width: 220px;
  max-width: 60vw;
  height: auto;
  display: block;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.15));
}

.splash-logo {
  font-family: var(--font-logo, 'Fredoka One', sans-serif);
  font-size: var(--type-h1);
  color: var(--color-primary);
  margin-top: 14px;
  letter-spacing: 0.5px;
}

[data-theme="dark"] .splash-logo {
  color: var(--color-primary-light);
}

/* Learn Header — static magenta gradient. Previously had an animated
   canvas background (particles + tier shifts), removed because repeated
   visual regressions made it not worth the complexity. Clean and fast now. */
.learn-header {
  background: var(--gradient-header);
  padding: var(--space-4);
  padding-top: calc(12px + env(safe-area-inset-top));
  padding-bottom: var(--space-4);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  margin-bottom: var(--space-4);
}

.learn-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.learn-streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: var(--weight-heavy);
  font-size: var(--type-body);
  color: #FFFFFF;
  background: rgba(255, 150, 0, 0.22);
  padding: 6px 14px 6px 10px;
  border-radius: 16px;
}

.learn-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.learn-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--type-body);
  font-weight: var(--weight-heavy);
  color: #FFFFFF;
  padding: 6px 14px 6px 10px;
  border-radius: 16px;
  line-height: 1;
}

.learn-stat:nth-child(1) { background: rgba(255, 200, 0, 0.22); }   /* XP */
.learn-stat:nth-child(2) { background: rgba(28, 176, 246, 0.22); }  /* Gems */
.learn-stat.learn-stat-hearts { background: rgba(255, 75, 75, 0.25); }

/* Shared PNG stat icons (streak / xp / gem / heart / goal-check).
   Used on learn header + profile stat cards. Chunkier than the number
   next to them so they read at a glance. Drop-shadow gives lift on
   dark bgs (learn header) and stays subtle on light (profile card). */
.ui-icon {
  width: var(--icon-utility);
  height: var(--icon-utility);
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
}
.ui-icon-sm { width: 24px; height: 24px; }
.ui-icon-lg { width: var(--icon-avatar); height: var(--icon-avatar); }
.ui-icon-xl { width: var(--icon-summary); height: var(--icon-summary); }

/* XP is a wide "XP" text badge (landscape ~1.75:1). Inside the square
   PNG canvas it's centred with transparent padding above and below, so
   on render its text sits visually higher than the fire/crystals next
   to it. A small positive translateY drops the profile XP icon so its
   baseline lines up with the other column icons.
   (Only needed for the big profile boxes — in the smaller learn header
   pill the offset is inside the vertical flex centre, no shift needed.) */
.ui-icon-xl[src$="xp.png"] {
  transform: translateY(10px);
}
/* Back-compat aliases (older learn.js references). */
.learn-icon {
  width: var(--icon-utility);
  height: var(--icon-utility);
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
}
.learn-icon-sm { width: 24px; height: 24px; }

.learn-daily-goal {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.learn-goal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--type-body-sm);
  font-weight: var(--weight-bold);
  color: #FFFFFF;
  margin-bottom: 8px;
}
/* Icon + text on the left side of the goal row should share a baseline
   without the icon pushing the text off-center. */
.learn-goal-row > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.learn-goal-check {
  /* Sits above the darker goal-row background; the extra shadow keeps
     the green ring readable on both light and dark header variants. */
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}
.learn-daily-goal.goal-complete .learn-goal-row {
  /* Bigger, bolder when complete — matches the green check badge. */
  font-size: var(--type-body);
}

.learn-daily-goal .progress-track {
  background: rgba(255, 255, 255, 0.18);
  height: 8px;
  border-radius: 8px;
  overflow: hidden;
}

.learn-daily-goal .progress-fill {
  background: linear-gradient(90deg, var(--color-gold), var(--color-coral));
  height: 100%;
  border-radius: 8px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.12), inset 0 2px 0 rgba(255,255,255,0.28);
  transition: width 250ms ease, background 250ms ease;
}

.learn-daily-goal.goal-complete .progress-fill {
  background: linear-gradient(90deg, var(--color-green), var(--color-green-dark));
}

/* Learning engine blocks */
.learn-reco-card,
.learn-exam-card {
  font-family: var(--font-body);
}

.learn-reco-card {
  margin-top: var(--space-3);
  margin-bottom: var(--space-2);
}

.learn-exam-card {
  margin-top: var(--space-2);
  margin-bottom: var(--space-3);
}

.learn-exam-card-after-reco {
  margin-top: var(--space-2);
  margin-bottom: var(--space-2);
}

.learn-exam-toggle {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.learn-exam-controls {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.learn-exam-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(104px, 0.38fr);
  gap: var(--space-2);
  align-items: center;
}

.learn-exam-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.learn-exam-field span {
  color: rgba(255, 255, 255, 0.72);
  font-size: var(--type-micro);
  font-weight: var(--weight-heavy);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.learn-exam-topic-button,
.learn-exam-level-button {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-bottom: 4px solid rgba(41, 17, 70, 0.56);
  border-radius: var(--radius-button);
  padding: 0 12px;
  background: rgba(28, 20, 48, 0.5);
  color: #FFFFFF;
  font-family: var(--font-body);
  font-size: var(--type-body-sm);
  font-weight: var(--weight-heavy);
  text-align: left;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  -webkit-tap-highlight-color: transparent;
}

.learn-exam-topic-button:active,
.learn-exam-level-button:active {
  border-bottom-width: 2px;
  transform: translateY(2px);
}

.learn-exam-topic-text,
.learn-exam-level-text {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.learn-exam-topic-arrow {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.72);
  font-size: var(--type-section);
  line-height: 1;
}

.learn-exam-start {
  margin-top: var(--space-3);
  background: #FFFFFF;
  color: var(--color-primary);
  border-color: rgba(255, 255, 255, 0.72);
  border-bottom-color: rgba(255, 255, 255, 0.46);
}

@media (max-width: 360px) {
  .learn-exam-toggle {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
  }

  .learn-exam-fields {
    grid-template-columns: 1fr;
  }
}

.exam-topic-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 9975;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.42);
  padding-top: 48px;
}

.exam-topic-sheet {
  width: 100%;
  max-width: 480px;
  max-height: min(78dvh, 680px);
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 2px solid var(--border-card);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.28);
  color: var(--text-primary);
}

.exam-topic-grabber {
  align-self: center;
  width: 42px;
  height: 5px;
  border-radius: var(--radius-full);
  background: var(--border-card);
  margin: 2px 0 12px;
}

.exam-topic-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.exam-topic-title {
  color: var(--text-primary);
  font-size: var(--type-section);
  font-weight: 800;
  line-height: 1.15;
}

.exam-topic-subtitle {
  color: var(--text-secondary);
  font-size: var(--type-body-sm);
  font-weight: 700;
  line-height: 1.25;
  margin-top: 2px;
}

.exam-topic-close {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: var(--type-h2);
  font-weight: 800;
  line-height: 1;
}

.exam-topic-search {
  width: 100%;
  height: 44px;
  border: 2px solid var(--border-card);
  border-bottom: 4px solid var(--border-card-bottom);
  border-radius: 14px;
  padding: 0 14px;
  margin-bottom: 10px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--type-body);
  font-weight: 800;
}

.exam-topic-search::placeholder {
  color: var(--text-hint);
}

.exam-topic-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 4px;
}

.exam-topic-option {
  min-height: 52px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid var(--border-card);
  border-bottom: 4px solid var(--border-card-bottom);
  border-radius: 14px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-body);
  text-align: left;
}

.exam-topic-option:active {
  border-bottom-width: 2px;
  transform: translateY(2px);
}

.exam-topic-option.selected {
  background: var(--bg-card-hover);
  border-color: var(--color-primary);
  border-bottom-color: var(--color-primary-dark);
}

.exam-topic-number {
  flex: 0 0 auto;
  min-width: 34px;
  color: var(--color-primary);
  font-size: var(--type-body-sm);
  font-weight: 800;
}

.exam-topic-name {
  min-width: 0;
  flex: 1;
  color: var(--text-primary);
  font-size: var(--type-body);
  font-weight: 800;
  line-height: 1.2;
}

.exam-topic-chevron {
  flex: 0 0 auto;
  color: var(--text-tertiary);
  font-size: var(--type-caption);
  font-weight: 800;
}

.exam-topic-option.selected .exam-topic-chevron {
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.exam-topic-empty {
  padding: 20px 12px;
  color: var(--text-secondary);
  font-weight: 700;
  text-align: center;
}

.exam-level-dot {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: var(--radius-full);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.16);
}

.exam-level-dot-easy {
  background: var(--color-green);
}

.exam-level-dot-medium {
  background: var(--color-coral);
}

.exam-level-dot-hard {
  background: var(--color-red);
}

/* ============================
   EXAM
   ============================ */
.screen-exam {
  min-height: 100dvh;
  padding: var(--space-4) var(--space-4) calc(96px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 20% -5%, rgba(255, 75, 120, 0.22), transparent 34%),
    radial-gradient(circle at 95% 12%, rgba(124, 77, 255, 0.18), transparent 32%);
}

.exam-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.exam-kicker {
  color: var(--color-primary);
  font-size: var(--type-caption);
  font-weight: var(--weight-heavy);
  line-height: 1;
  text-transform: uppercase;
}

.exam-title {
  margin: 4px 0 0;
  color: var(--color-text-primary);
  font-family: var(--font-display);
  font-size: var(--type-h1);
  font-weight: var(--weight-heavy);
  line-height: 1.05;
}

.exam-header-pill {
  flex: 0 0 auto;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-3);
  border: 2px solid var(--border-card);
  border-bottom: 4px solid var(--border-card-bottom);
  border-radius: var(--radius-full);
  background: var(--bg-card);
  color: var(--color-text-secondary);
  font-size: var(--type-caption);
  font-weight: var(--weight-heavy);
  text-transform: uppercase;
}

.exam-hero-card {
  position: relative;
  overflow: hidden;
  padding: var(--space-4);
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-bottom: 5px solid rgba(82, 14, 68, 0.65);
  border-radius: var(--radius-lg);
  background: var(--gradient-exam);
  box-shadow: 0 10px 24px rgba(139, 26, 74, 0.18);
}

.exam-hero-card::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent 42%);
  opacity: 0.55;
}

.exam-hero-main {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.exam-hero-icon {
  width: var(--icon-learn-mode);
  height: var(--icon-learn-mode);
  flex: 0 0 auto;
  object-fit: contain;
}

.exam-hero-copy {
  min-width: 0;
}

.exam-hero-copy h2 {
  margin: 0;
  color: var(--color-text-on-dark);
  font-family: var(--font-display);
  font-size: var(--type-h2);
  font-weight: var(--weight-heavy);
  line-height: 1.05;
}

.exam-hero-copy p {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: var(--type-body);
  font-weight: var(--weight-bold);
  line-height: 1.25;
}

.exam-time-chips {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.exam-time-chip,
.exam-difficulty-chip {
  min-height: 40px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-bottom: 4px solid rgba(41, 17, 70, 0.48);
  border-radius: var(--radius-full);
  padding: 0 var(--space-3);
  background: rgba(28, 20, 48, 0.46);
  color: rgba(255, 255, 255, 0.82);
  font-family: var(--font-body);
  font-size: var(--type-body-sm);
  font-weight: var(--weight-heavy);
  white-space: nowrap;
}

.exam-time-chip.active,
.exam-difficulty-chip.active {
  background: #FFFFFF;
  color: var(--color-primary);
  border-color: rgba(255, 255, 255, 0.74);
  border-bottom-color: rgba(255, 255, 255, 0.48);
}

.exam-time-chip:active,
.exam-difficulty-chip:active,
.exam-field-button:active {
  border-bottom-width: 2px;
  transform: translateY(2px);
}

.exam-setup-card {
  margin-top: var(--space-4);
  padding: var(--space-4);
  border: 2px solid var(--border-card);
  border-bottom: 5px solid var(--border-card-bottom);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.exam-field-button {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0 var(--space-3);
  border: 2px solid var(--border-card);
  border-bottom: 4px solid var(--border-card-bottom);
  border-radius: var(--radius-button);
  background: var(--bg-surface);
  color: var(--color-text-primary);
  text-align: left;
}

.exam-field-button > span:first-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.exam-field-label {
  display: block;
  color: var(--color-text-secondary);
  font-size: var(--type-micro);
  font-weight: var(--weight-heavy);
  line-height: 1;
  text-transform: uppercase;
}

.exam-field-value {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--color-text-primary);
  font-size: var(--type-body);
  font-weight: var(--weight-heavy);
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exam-field-arrow {
  flex: 0 0 auto;
  color: var(--color-text-secondary);
  font-size: var(--type-h2);
  font-weight: var(--weight-heavy);
  line-height: 1;
}

.exam-difficulty-block {
  margin-top: var(--space-4);
}

.exam-difficulty-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.exam-difficulty-chip {
  border-color: var(--border-card);
  border-bottom-color: var(--border-card-bottom);
  background: var(--bg-surface);
  color: var(--color-text-secondary);
}

.exam-difficulty-chip.active {
  background: var(--color-primary);
  color: var(--color-text-on-dark);
  border-color: var(--color-primary);
  border-bottom-color: var(--color-primary-dark);
}

.exam-start-button {
  margin-top: var(--space-4);
}

.exam-prep-pilot-card,
.exam-prep-overview {
  margin-top: var(--space-4);
  padding: var(--space-4);
  border: 2px solid var(--border-card);
  border-bottom: 5px solid var(--border-card-bottom);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(114, 213, 246, 0.08), rgba(168, 139, 232, 0.08)),
    var(--bg-card);
  box-shadow: var(--shadow-card);
}

.exam-prep-pilot-head,
.exam-prep-overview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.exam-prep-pilot-kicker {
  color: var(--color-text-secondary);
  font-size: var(--type-micro);
  font-weight: var(--weight-heavy);
  line-height: 1;
  text-transform: uppercase;
}

.exam-prep-pilot-card h2,
.exam-prep-overview h2 {
  margin: 4px 0 0;
  color: var(--color-text-primary);
  font-family: var(--font-display);
  font-size: var(--type-section);
  font-weight: var(--weight-heavy);
  line-height: 1.08;
}

.exam-prep-pilot-card p,
.exam-prep-overview p {
  margin: 4px 0 0;
  color: var(--color-text-secondary);
  font-size: var(--type-body-sm);
  font-weight: var(--weight-bold);
  line-height: 1.28;
}

.exam-prep-pilot-tag,
.exam-prep-count {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-secondary);
  border: 1px solid var(--border-card);
  font-size: var(--type-micro);
  font-weight: var(--weight-heavy);
  line-height: 1.25;
  text-align: center;
  text-transform: uppercase;
}

.exam-prep-pilot-button {
  width: 100%;
  min-height: 42px;
  margin-top: var(--space-3);
  border: 2px solid var(--border-card);
  border-bottom: 4px solid var(--border-card-bottom);
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--type-body-sm);
  font-weight: var(--weight-heavy);
}

.exam-prep-pilot-button:active,
.exam-prep-mode:active {
  border-bottom-width: 2px;
  transform: translateY(2px);
}

.exam-prep-patterns {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.exam-prep-patterns span {
  padding: 6px 9px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.07);
  color: var(--color-text-secondary);
  font-size: var(--type-caption);
  font-weight: var(--weight-bold);
}

.exam-prep-modes {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.exam-prep-mode {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0 var(--space-3);
  border: 2px solid var(--border-card);
  border-bottom: 4px solid var(--border-card-bottom);
  border-radius: var(--radius-button);
  background: var(--bg-surface);
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-weight: var(--weight-heavy);
  text-align: left;
}

.exam-prep-mode.enabled {
  background: var(--color-primary);
  color: var(--color-text-on-dark);
  border-color: var(--color-primary);
  border-bottom-color: var(--color-primary-dark);
}

.exam-prep-mode span,
.exam-prep-mode small {
  display: block;
}

.exam-prep-mode small {
  font-size: var(--type-caption);
  opacity: 0.72;
}

.exam-prep-mode:disabled {
  opacity: 0.58;
}

.exam-prep-empty {
  color: var(--color-text-secondary);
  font-size: var(--type-body-sm);
  font-weight: var(--weight-bold);
}

@media (max-width: 360px) {
  .screen-exam {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  .exam-hero-card,
  .exam-setup-card,
  .exam-prep-pilot-card,
  .exam-prep-overview {
    padding: var(--space-3);
  }

  .exam-hero-icon {
    width: var(--icon-summary);
    height: var(--icon-summary);
  }

  .exam-time-chip,
  .exam-difficulty-chip {
    min-height: 38px;
    padding: 0 var(--space-2);
    font-size: var(--type-caption);
  }
}

/* ============================
   EXAM PREP VISUAL PROTOTYPE
   Isolated preview UI. Not wired into production navigation.
   ============================ */
body.exam-prep-prototype-body {
  overflow-x: hidden;
}

body.exam-prep-prototype-body #app {
  width: 100%;
  max-width: none;
  padding-bottom: 0;
  overflow-x: hidden;
}

.exam-prep-prototype {
  min-height: 100dvh;
  width: 100%;
  max-width: 480px;
  box-sizing: border-box;
  margin: 0 auto;
  padding: var(--space-4) var(--space-4) calc(var(--space-8) + env(safe-area-inset-bottom));
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 75, 120, 0.18), transparent 30%),
    radial-gradient(circle at 100% 18%, rgba(206, 130, 255, 0.18), transparent 32%),
    var(--bg-main);
}

.epp-header,
.epp-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.epp-header {
  margin-bottom: var(--space-4);
}

.epp-kicker,
.epp-topic,
.epp-example-label {
  color: var(--color-primary-light);
  font-size: var(--type-caption);
  font-weight: var(--weight-heavy);
  line-height: 1;
  text-transform: uppercase;
}

.epp-title {
  margin: var(--space-1) 0 0;
  color: var(--text-primary);
  font-family: var(--font-logo);
  font-size: var(--type-h1);
  font-weight: var(--weight-heavy);
  line-height: 1.05;
}

.epp-chip,
.epp-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-full);
  background: rgba(139, 26, 74, 0.22);
  border: 2px solid rgba(206, 130, 255, 0.20);
  color: var(--text-primary);
  font-size: var(--type-caption);
  font-weight: var(--weight-heavy);
  white-space: nowrap;
}

.epp-lesson-card,
.epp-practice-card,
.epp-gallery-card {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  margin-bottom: var(--space-4);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.epp-card-head h2 {
  margin: var(--space-1) 0 0;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--type-section);
  font-weight: var(--weight-heavy);
  line-height: 1.15;
}

.epp-micro,
.epp-question {
  margin: var(--space-3) 0;
  color: var(--text-secondary);
  font-size: var(--type-body);
  font-weight: var(--weight-bold);
  line-height: 1.35;
}

.epp-diagram {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  margin: var(--space-3) 0;
  border-radius: var(--radius-lg);
  background: rgba(20, 15, 34, 0.82);
  border: 1px solid rgba(206, 130, 255, 0.16);
  overflow: hidden;
}

.epp-diagram svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

.epp-diagram text {
  font-family: var(--font-body);
  paint-order: normal;
  stroke: transparent;
  stroke-width: 0;
  stroke-linejoin: round;
}

.epp-diagram .math-visual {
  min-width: 0;
  overflow: visible;
}

.epp-practice-visual {
  margin-top: var(--space-2);
  margin-bottom: var(--space-2);
}

.epp-steps {
  display: grid;
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
}

.epp-steps li,
.epp-formula-card,
.epp-example-card {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 2px solid var(--border-card);
  color: var(--text-primary);
  font-size: var(--type-body-sm);
  font-weight: var(--weight-bold);
  line-height: 1.3;
}

.epp-steps li::before {
  content: counter(list-item);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: var(--space-2);
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--text-on-dark);
  font-size: var(--type-caption);
  font-weight: var(--weight-heavy);
}

.epp-formula-card {
  margin-top: var(--space-3);
  text-align: center;
  background: rgba(255, 200, 0, 0.10);
  border-color: rgba(255, 200, 0, 0.26);
  font-size: var(--type-body);
}

.epp-example-card {
  display: grid;
  gap: var(--space-1);
  margin-top: var(--space-2);
}

.epp-visual-gallery {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.epp-gallery-item {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 2px solid var(--border-card);
}

.epp-gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  color: var(--text-primary);
  font-size: var(--type-body-sm);
  font-weight: var(--weight-heavy);
}

.epp-gallery-head span:last-child {
  color: var(--color-primary-light);
  font-size: var(--type-caption);
  text-transform: uppercase;
}

.epp-gallery-diagram {
  margin-bottom: 0;
}

.epp-experimental-note {
  margin: var(--space-2) 0;
  color: var(--text-secondary);
  font-size: var(--type-body-sm);
  font-weight: var(--weight-bold);
  line-height: 1.3;
}

.epp-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.epp-options button {
  min-height: 48px;
  border: 2px solid var(--border-card);
  border-bottom: 4px solid var(--border-card-bottom);
  border-radius: var(--radius-button);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--type-body);
  font-weight: var(--weight-heavy);
}

.epp-options button.correct {
  background: rgba(88, 204, 2, 0.16);
  border-color: rgba(88, 204, 2, 0.62);
  border-bottom-color: rgba(70, 163, 2, 0.72);
  color: var(--text-primary);
}

@media (max-width: 360px) {
  .exam-prep-prototype {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  .epp-lesson-card,
  .epp-practice-card,
  .epp-gallery-card {
    padding: var(--space-3);
  }

  .epp-chip,
  .epp-badge {
    min-height: 28px;
    padding: 0 var(--space-2);
    font-size: var(--type-micro);
  }

  .epp-diagram text {
    stroke-width: 0;
  }
}

/* Linear Equations Exam Pack */
.screen-linear-pack {
  min-height: 100dvh;
  padding: var(--space-4) var(--space-4) calc(104px + env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(139, 26, 74, 0.08), transparent 180px),
    var(--bg-main);
}

.lep-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: calc(var(--space-4) * -1) calc(var(--space-4) * -1) var(--space-4);
  padding: var(--space-4) var(--space-4) var(--space-3);
  background: color-mix(in srgb, var(--bg-main) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(139, 26, 74, 0.12);
}

.lep-toprow {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: start;
  gap: var(--space-2);
}

.lep-head-copy {
  min-width: 0;
}

.lep-kicker,
.lep-panel-label {
  color: var(--color-primary);
  font-size: var(--type-micro);
  font-weight: var(--weight-heavy);
  line-height: 1;
  text-transform: uppercase;
}

.lep-head-copy h1 {
  margin: 3px 0 0;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: var(--weight-heavy);
  letter-spacing: 0;
}

.lep-head-copy p,
.lep-panel p {
  margin-top: var(--space-1);
  color: var(--text-secondary);
  font-size: var(--type-body-sm);
  font-weight: var(--weight-bold);
  line-height: 1.35;
}

.lep-icon-btn,
.lep-text-btn {
  min-width: 38px;
  min-height: 38px;
  border: 2px solid var(--border-card);
  border-bottom: 4px solid var(--border-card-bottom);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: var(--weight-heavy);
}

.lep-icon-btn {
  font-size: 30px;
  line-height: 1;
}

.lep-text-btn {
  padding: 0 var(--space-2);
  color: var(--text-secondary);
  font-size: var(--type-caption);
}

.lep-progress {
  height: 10px;
  margin-top: var(--space-3);
  overflow: hidden;
  border-radius: 8px;
  background: var(--bg-progress-track);
}

.lep-progress-fill {
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-blue));
  transition: width 220ms ease;
}

.screen-linear-pack h1:focus,
.screen-linear-pack .lep-feedback:focus,
.screen-linear-pack button:focus-visible,
.screen-linear-pack .lep-answer-input:focus {
  outline: 3px solid var(--color-blue);
  outline-offset: 3px;
}

.screen-linear-pack .lep-answer-input:focus {
  border-color: var(--color-primary);
}

.lep-hero,
.lep-panel,
.lep-price-card,
.lep-pattern-card,
.lep-mini-action,
.lep-timer-strip {
  border: 2px solid var(--border-card);
  border-bottom: 4px solid var(--border-card-bottom);
  border-radius: 8px;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.lep-hero {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-4);
  background:
    linear-gradient(135deg, rgba(139, 26, 74, 0.12), rgba(28, 176, 246, 0.10)),
    var(--bg-card);
}

.lep-hero-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: var(--color-primary);
  color: #FFFFFF;
  font-family: var(--font-logo);
  font-size: 31px;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.16);
}

.lep-hero h2,
.lep-panel h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--type-section);
  letter-spacing: 0;
}

.lep-panel {
  margin-top: var(--space-4);
  padding: var(--space-4);
}

.lep-center-panel {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: var(--space-2);
}

.lep-big-number {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  background: rgba(255, 200, 0, 0.18);
  color: var(--color-primary);
  font-size: 34px;
  font-weight: var(--weight-heavy);
}

.lep-rose-grid {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.lep-rose-grid div,
.lep-signal-grid div,
.lep-report-list,
.lep-missed-example,
.lep-contrast {
  padding: var(--space-3);
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  font-size: var(--type-body-sm);
  font-weight: var(--weight-bold);
}

.lep-rose-grid span,
.lep-signal-grid span,
.lep-report-list span,
.lep-missed-example span {
  display: block;
  margin-bottom: 3px;
  color: var(--text-primary);
  font-size: var(--type-caption);
  font-weight: var(--weight-heavy);
  text-transform: uppercase;
}

.lep-report-list small {
  display: block;
  margin-top: var(--space-1);
  color: var(--text-secondary);
  font-size: var(--type-caption);
  font-weight: var(--weight-bold);
  line-height: 1.3;
}

.lep-include-grid,
.lep-paywall-list,
.lep-repair-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.lep-include-grid span,
.lep-paywall-list span,
.lep-repair-list span {
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
  font-size: var(--type-caption);
  font-weight: var(--weight-heavy);
}

.lep-pricing-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.lep-price-card {
  padding: var(--space-3);
}

.lep-price-card span {
  display: block;
  min-height: 34px;
  color: var(--text-secondary);
  font-size: var(--type-caption);
  font-weight: var(--weight-bold);
  line-height: 1.25;
}

.lep-price-card strong {
  display: block;
  margin-top: var(--space-2);
  color: var(--text-primary);
  font-size: var(--type-section);
  font-weight: var(--weight-heavy);
}

.lep-sticky-actions {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
  width: min(428px, 100%);
  padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--bg-main) 94%, transparent);
  border-top: 1px solid rgba(139, 26, 74, 0.12);
  backdrop-filter: blur(12px);
}

.lep-sticky-actions:has(.lep-btn + .lep-btn) {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.lep-sticky-actions:has(.lep-btn + .lep-btn + .lep-btn) {
  grid-template-columns: 1fr;
}

.lep-btn {
  min-height: 50px;
  padding: 0 var(--space-3);
  border: 2px solid var(--border-card);
  border-bottom-width: 4px;
  border-radius: 8px;
  font-size: var(--type-body-sm);
  font-weight: var(--weight-heavy);
  line-height: 1.1;
}

.lep-btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  border-bottom-color: var(--color-primary-dark);
  color: #FFFFFF;
}

.lep-btn-secondary {
  background: var(--bg-card);
  border-bottom-color: var(--border-card-bottom);
  color: var(--text-primary);
}

.lep-mode-stack {
  display: grid;
  gap: var(--space-3);
}

.lep-mode-card {
  display: grid;
  gap: var(--space-1);
  width: 100%;
  padding: var(--space-4);
  border: 2px solid var(--border-card);
  border-bottom: 4px solid var(--border-card-bottom);
  border-radius: 8px;
  background: var(--bg-surface);
  text-align: left;
}

.lep-mode-card.selected {
  border-color: var(--color-primary);
  background: rgba(139, 26, 74, 0.10);
}

.lep-mode-title {
  color: var(--text-primary);
  font-size: var(--type-section);
  font-weight: var(--weight-heavy);
}

.lep-mode-time,
.lep-mode-includes {
  color: var(--color-primary);
  font-size: var(--type-caption);
  font-weight: var(--weight-heavy);
  text-transform: uppercase;
}

.lep-mode-focus {
  color: var(--text-secondary);
  font-size: var(--type-body-sm);
  font-weight: var(--weight-bold);
  line-height: 1.3;
}

.lep-task-prompt {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(28, 176, 246, 0.10), rgba(255, 200, 0, 0.10)),
    var(--bg-surface);
  border: 1px solid var(--border-card);
}

.lep-task-prompt span,
.lep-input-label {
  color: var(--text-secondary);
  font-size: var(--type-caption);
  font-weight: var(--weight-heavy);
  text-transform: uppercase;
}

.lep-task-prompt strong,
.lep-example-prompt {
  color: var(--text-primary);
  font-size: 24px;
  font-weight: var(--weight-heavy);
  letter-spacing: 0;
  line-height: 1.2;
  word-break: break-word;
}

.lep-task-question {
  margin-top: var(--space-3);
}

.lep-input-label {
  display: block;
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
}

.lep-answer-input {
  width: 100%;
  min-height: 54px;
  padding: 0 var(--space-3);
  border: 2px solid var(--border-card);
  border-bottom: 4px solid var(--border-card-bottom);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: var(--type-body);
  font-weight: var(--weight-heavy);
}

.lep-choice-grid {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.lep-choice {
  min-height: 50px;
  padding: var(--space-2) var(--space-3);
  border: 2px solid var(--border-card);
  border-bottom: 4px solid var(--border-card-bottom);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: var(--type-body-sm);
  font-weight: var(--weight-heavy);
  text-align: left;
}

.lep-feedback {
  margin-top: var(--space-4);
  padding: var(--space-3);
  border-radius: 8px;
  border: 2px solid var(--border-card);
  background: var(--bg-surface);
}

.lep-feedback-correct {
  border-color: rgba(88, 204, 2, 0.55);
  background: rgba(88, 204, 2, 0.11);
}

.lep-feedback-incorrect {
  border-color: rgba(255, 150, 0, 0.58);
  background: rgba(255, 150, 0, 0.10);
}

.lep-feedback-label,
.lep-expected {
  color: var(--text-secondary);
  font-size: var(--type-caption);
  font-weight: var(--weight-heavy);
  text-transform: uppercase;
}

.lep-feedback p {
  margin-top: var(--space-1);
  color: var(--text-primary);
}

.lep-expected {
  margin-top: var(--space-2);
}

.lep-result-hero {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: var(--space-3);
  align-items: center;
}

.lep-score-ring {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  border: 9px solid rgba(28, 176, 246, 0.34);
  border-radius: 50%;
  background: var(--bg-surface);
  text-align: center;
}

.lep-score-ring strong {
  color: var(--text-primary);
  font-size: var(--type-h1);
  line-height: 1;
}

.lep-score-ring span {
  color: var(--text-secondary);
  font-size: var(--type-caption);
  font-weight: var(--weight-heavy);
  text-transform: uppercase;
}

.lep-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.lep-tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 8px;
  background: rgba(28, 176, 246, 0.12);
  border: 1px solid rgba(28, 176, 246, 0.32);
  color: var(--text-primary);
  font-size: var(--type-caption);
  font-weight: var(--weight-heavy);
}

.lep-muted {
  margin-top: var(--space-3);
  color: var(--text-secondary);
}

.lep-map-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
}

.lep-mini-action {
  min-height: 44px;
  padding: 0 var(--space-1);
  color: var(--text-primary);
  font-size: var(--type-caption);
  font-weight: var(--weight-heavy);
}

.lep-pattern-grid {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.lep-pattern-card {
  display: grid;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-4);
  color: var(--text-primary);
  text-align: left;
}

.lep-pattern-card.locked {
  opacity: 0.68;
}

.lep-pattern-status {
  justify-self: start;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: var(--type-micro);
  font-weight: var(--weight-heavy);
  text-transform: uppercase;
}

.lep-status-recommended .lep-pattern-status,
.lep-status-weak .lep-pattern-status {
  background: rgba(255, 150, 0, 0.16);
  color: var(--color-coral);
}

.lep-status-mastered .lep-pattern-status {
  background: rgba(88, 204, 2, 0.15);
  color: var(--color-green-dark);
}

.lep-status-preview .lep-pattern-status {
  background: rgba(28, 176, 246, 0.14);
  color: var(--color-blue-dark);
}

.lep-pattern-card strong {
  color: var(--text-primary);
  font-size: var(--type-section);
  font-weight: var(--weight-heavy);
}

.lep-pattern-card p {
  margin: 0;
}

.lep-pattern-meta {
  display: grid;
  gap: var(--space-1);
  color: var(--text-secondary);
  font-size: var(--type-caption);
  font-weight: var(--weight-bold);
}

.lep-fact-list {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.lep-fact-list div {
  padding: var(--space-3);
  border-radius: 8px;
  background: var(--bg-surface);
}

.lep-fact-list dt {
  color: var(--color-primary);
  font-size: var(--type-caption);
  font-weight: var(--weight-heavy);
  text-transform: uppercase;
}

.lep-fact-list dd {
  margin-top: 2px;
  color: var(--text-primary);
  font-size: var(--type-body-sm);
  font-weight: var(--weight-bold);
}

.lep-jam-line,
.lep-state-line {
  margin-top: var(--space-3);
  padding: var(--space-3);
  border-radius: 8px;
  background: rgba(255, 200, 0, 0.13);
  color: var(--text-primary);
  font-size: var(--type-body-sm);
  font-weight: var(--weight-heavy);
}

.lep-theory-card p {
  color: var(--text-primary);
  font-size: var(--type-body);
}

.lep-example-prompt {
  margin-top: var(--space-3);
  padding: var(--space-3);
  border-radius: 8px;
  background: var(--bg-surface);
}

.lep-step-list {
  display: grid;
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
  padding-left: 22px;
}

.lep-step-list li {
  padding: var(--space-2);
  color: var(--text-primary);
  font-size: var(--type-body-sm);
  font-weight: var(--weight-bold);
}

.lep-trap-warning {
  margin-bottom: var(--space-3);
  padding: var(--space-3);
  border-radius: 8px;
  background: rgba(255, 150, 0, 0.13);
  border: 1px solid rgba(255, 150, 0, 0.35);
  color: var(--text-primary);
  font-size: var(--type-body-sm);
  font-weight: var(--weight-heavy);
}

.lep-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.lep-metric-grid div {
  min-height: 74px;
  padding: var(--space-3);
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
}

.lep-metric-grid span {
  display: block;
  color: var(--text-secondary);
  font-size: var(--type-caption);
  font-weight: var(--weight-heavy);
  text-transform: uppercase;
}

.lep-metric-grid strong {
  display: block;
  margin-top: var(--space-1);
  color: var(--text-primary);
  font-size: var(--type-section);
  font-weight: var(--weight-heavy);
}

.lep-signal-grid {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.lep-evidence-card {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding: var(--space-3);
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
}

.lep-evidence-head {
  display: grid;
  gap: 3px;
}

.lep-evidence-head span {
  color: var(--color-primary);
  font-size: var(--type-caption);
  font-weight: var(--weight-heavy);
  text-transform: uppercase;
}

.lep-evidence-head strong {
  color: var(--text-primary);
  font-size: var(--type-section);
  font-weight: var(--weight-heavy);
}

.lep-timer-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding: var(--space-3);
}

.lep-timer-strip span {
  color: var(--text-secondary);
  font-size: var(--type-caption);
  font-weight: var(--weight-heavy);
  text-transform: uppercase;
}

.lep-timer-strip strong {
  color: var(--color-primary);
  font-size: var(--type-h2);
  font-weight: var(--weight-heavy);
}

.lep-paywall {
  display: grid;
  gap: var(--space-3);
}

.lep-paywall .lep-btn {
  width: 100%;
}

.lep-roadmap {
  background:
    linear-gradient(135deg, rgba(88, 204, 2, 0.10), rgba(28, 176, 246, 0.10)),
    var(--bg-card);
}

.lep-final-message {
  background:
    linear-gradient(135deg, rgba(255, 200, 0, 0.12), rgba(139, 26, 74, 0.08)),
    var(--bg-card);
}

.lep-final-message strong {
  display: block;
  margin-top: var(--space-2);
  color: var(--text-primary);
  font-size: var(--type-section);
}

@media (max-width: 360px) {
  .screen-linear-pack {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  .lep-topbar {
    margin-left: calc(var(--space-3) * -1);
    margin-right: calc(var(--space-3) * -1);
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  .lep-head-copy h1 {
    font-size: 22px;
  }

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

  .lep-pricing-row,
  .lep-map-actions,
  .lep-metric-grid {
    grid-template-columns: 1fr;
  }

  .lep-sticky-actions {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  .lep-btn {
    min-height: 52px;
    white-space: normal;
  }

  .lep-task-prompt strong,
  .lep-example-prompt {
    font-size: 21px;
  }

  .lep-timer-strip {
    align-items: start;
  }
}

/* Tree */
.learn-tree {
  padding: 0 16px 80px;
}

/* Snake path */
.snake-path {
  padding: 0 16px 100px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.path-section {
  position: relative;
  width: 100%;
  padding: 8px 12px 16px;
  border-radius: 20px;
  margin-bottom: 4px;
}

.theory-card {
  background: var(--bg-card);
  border: 2px solid var(--border-card);
  border-bottom: 4px solid var(--border-card-bottom);
  border-radius: 16px;
  padding: 14px 16px;
  margin: 0 16px 12px;
}

.theory-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  color: var(--text-primary);
}

.theory-card-title {
  font-weight: 800;
  font-size: var(--type-body);
}

.theory-card-arrow {
  font-size: var(--type-body-sm);
  transition: transform 200ms ease;
  color: var(--text-secondary);
}

.theory-card-summary {
  font-size: var(--type-body-sm);
  color: var(--text-secondary);
  margin-top: 4px;
}

.theory-card-body {
  display: none;
  margin-top: 12px;
}

.theory-card-body.open { display: block; }

.theory-section {
  margin-top: 12px;
}

.theory-section-title {
  font-weight: 800;
  font-size: var(--type-body-sm);
  margin-bottom: 6px;
  color: var(--text-primary);
}

.theory-prose {
  font-size: var(--type-body-sm);
  line-height: 1.55;
  color: var(--text-primary);
}

.theory-prose p { margin-bottom: 8px; }

.theory-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 12px;
  font-size: var(--type-caption);
  line-height: 1.4;
  color: var(--text-primary);
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.theory-table th,
.theory-table td {
  border: 1px solid var(--border-card);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.theory-table th {
  background: var(--bg-katex);
  font-weight: 700;
  color: var(--text-primary);
}

.theory-table tbody tr:nth-child(odd) {
  background: var(--bg-card);
}

.theory-table tbody tr:nth-child(even) {
  background: transparent;
}

.theory-table strong { color: var(--text-primary); }

.theory-formula {
  background: var(--bg-katex);
  border-left: 3px solid var(--color-primary);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 6px;
}

.theory-formula-latex {
  color: var(--text-primary);
}

.theory-formula-desc {
  font-size: var(--type-caption);
  color: var(--text-hint);
  margin-top: 2px;
}

.theory-example {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 6px;
}

.theory-example-title {
  font-weight: 700;
  font-size: var(--type-body-sm);
  color: var(--text-primary);
}

.theory-example-step {
  font-size: var(--type-caption);
  color: var(--text-secondary);
  margin-top: 4px;
  padding-left: 8px;
}

.theory-example-answer {
  font-weight: 800;
  font-size: var(--type-body-sm);
  color: var(--color-green);
  margin-top: 6px;
}

.theory-mistake {
  background: var(--bg-hint);
  border-left: 3px solid var(--border-hint);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 4px;
  font-size: var(--type-caption);
  color: var(--text-primary);
}

.theory-keypoint {
  font-size: var(--type-caption);
  color: var(--text-primary);
  margin-bottom: 3px;
}

/* Category wrapper — neutral, just lays out header + sections */
.path-category-wrap {
  position: relative;
}

/* Inner sections container carries the per-category gradient — inset + rounded */
.path-category-sections {
  position: relative;
  margin: 8px 0 16px;
  padding: 12px 8px;
  border-radius: 24px;
}

/* School category container stays transparent — each school section carries its own tint below */

.path-category-sections.category-logic {
  background: linear-gradient(180deg, #E0F7FA 0%, var(--bg-main) 100%);
}

.path-category-sections.category-university {
  background: linear-gradient(180deg, #EDE7F6 0%, #E8EAF6 50%, var(--bg-main) 100%);
}

[data-theme="dark"] .path-category-sections.category-logic {
  background: linear-gradient(180deg, rgba(0, 188, 212, 0.08) 0%, var(--bg-main) 100%);
}

[data-theme="dark"] .path-category-sections.category-university {
  background: linear-gradient(180deg, rgba(124, 77, 255, 0.08) 0%, rgba(41, 121, 255, 0.05) 50%, var(--bg-main) 100%);
}

.path-category-header {
  text-align: center;
  padding: 16px 0 8px;
  margin-top: 16px;
}

.path-category-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: none;
  border-radius: 20px;
  padding: 12px 28px;
  font-size: var(--type-body);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.3px;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  isolation: isolate;
}

.path-category-pill::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 20px;
  padding: 2px;
  background: var(--cat-gradient, linear-gradient(135deg, var(--border-card), var(--border-card-bottom)));
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

.path-category-pill:active { transform: translateY(1px); }

.path-category-wrap.category-school      .path-category-pill { --cat-gradient: linear-gradient(135deg, #8B1A4A, #CE3264); }
.path-category-wrap.category-logic       .path-category-pill { --cat-gradient: linear-gradient(135deg, #00BCD4, #0097A7); }
.path-category-wrap.category-university  .path-category-pill { --cat-gradient: linear-gradient(135deg, #7C4DFF, #2979FF); }

.path-category-pill:active {
  border-bottom-width: 2px;
  transform: translateY(2px);
}

.path-category-arrow {
  font-size: var(--type-caption);
  color: var(--text-secondary);
}

.section-tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-main);
  padding: 8px 12px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.section-tabs::-webkit-scrollbar { display: none; }

.section-tab {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 14px;
  font-size: var(--type-caption);
  font-weight: 800;
  white-space: nowrap;
  border: 2px solid rgba(var(--tab-color-rgb, 176, 176, 176), 0.3);
  border-bottom: 3px solid rgba(var(--tab-color-rgb, 176, 176, 176), 0.35);
  background: rgba(var(--tab-color-rgb, 176, 176, 176), 0.18);
  color: var(--tab-color, var(--text-primary));
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  letter-spacing: 0.3px;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease, transform 150ms ease;
  -webkit-tap-highlight-color: transparent;
}

.section-tab.active {
  background: var(--tab-color);
  color: #FFFFFF;
  border: 2px solid var(--tab-color);
  border-bottom: 3px solid var(--tab-color-dark);
  transform: translateY(-1px);
}

.diff-pills {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 0 0 14px;
}

.diff-pill {
  padding: 5px 14px;
  border-radius: 12px;
  font-size: var(--type-caption);
  font-weight: 800;
  font-family: 'Nunito', sans-serif;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 2px solid var(--border-card);
  border-bottom: 3px solid var(--border-card-bottom);
  cursor: pointer;
  transition: transform 100ms ease, border-bottom-width 100ms ease;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0.3px;
}

.diff-pill:active {
  border-bottom-width: 1px;
  transform: translateY(2px);
}

.diff-pill.active {
  border: none;
  border-bottom: 3px solid;
}

.diff-coming-soon {
  text-align: center;
  padding: 36px 24px 28px;
  color: var(--text-hint);
}

.diff-coming-soon-emoji {
  font-size: 36px;
  margin-bottom: 10px;
  opacity: 0.7;
}

.diff-coming-soon-title {
  font-size: var(--type-body);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.diff-coming-soon-sub {
  font-size: var(--type-body-sm);
  color: var(--text-secondary);
}

.path-section.tier-medium {
  border-radius: 20px;
}

.path-section.tier-hard {
  border-radius: 20px;
  box-shadow: inset 0 0 0 1px currentColor;
}

/* School sections: each carries its own colour tint via gradient → bg-main */
.path-section-elementary   { background: linear-gradient(180deg, var(--bg-section-elementary)   0%, var(--bg-main) 100%); }
.path-section-basic        { background: linear-gradient(180deg, var(--bg-section-basic)        0%, var(--bg-main) 100%); }
.path-section-intermediate { background: linear-gradient(180deg, var(--bg-section-intermediate) 0%, var(--bg-main) 100%); }
.path-section-upper        { background: linear-gradient(180deg, var(--bg-section-upper)        0%, var(--bg-main) 100%); }
.path-section-advanced     { background: linear-gradient(180deg, var(--bg-section-advanced)     0%, var(--bg-main) 100%); }

.path-section-header {
  text-align: center;
  margin-bottom: 10px;
  padding-top: 6px;
}

.path-section-badge {
  display: inline-block;
  color: #FFFFFF;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: var(--type-caption);
  padding: 5px 16px;
  border-radius: 20px;
  border: 2px solid transparent;
  border-bottom: 3px solid transparent;
  letter-spacing: 0.3px;
}

.path-divider {
  height: 2px;
  background: linear-gradient(90deg, transparent, #E0E0E0, transparent);
  margin: 10px 32px;
}

.path-connector {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 18px;
  border-radius: 2px;
}

.unit-row {
  position: relative;
  width: 100%;
  height: 72px;
  margin: 0;
  opacity: 0;
  animation: bounce-in 320ms ease forwards;
  -webkit-tap-highlight-color: transparent;
}

.unit-row.locked { cursor: default; }
.unit-row.tappable { cursor: pointer; }

.unit-row .unit-node {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  transition: transform 100ms ease, border-bottom-width 100ms ease;
}

.unit-row.pos-center .unit-node { left: 50%; }
.unit-row.pos-right  .unit-node { left: 72%; }
.unit-row.pos-left   .unit-node { left: 28%; }

.unit-row.tappable:active .unit-node {
  border-bottom-width: 3px;
  transform: translate(-50%, calc(-50% + 2px));
}

.unit-row.shake { animation: shakeUnit 400ms ease; }

.unit-node {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  border: 3px solid transparent;
  border-bottom-width: 5px;
  transition: transform 100ms ease, border-bottom-width 100ms ease;
}

.unit-node.current {
  width: 64px;
  height: 64px;
  background: #FFC800;
  border: 4px solid #FFFFFF;
  box-shadow: 0 0 0 3px #FFC800, 0 6px 14px rgba(255, 200, 0, 0.35);
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 0 3px #FFC800, 0 6px 14px rgba(255, 200, 0, 0.35);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(255, 200, 0, 0.55), 0 6px 18px rgba(255, 200, 0, 0.5);
  }
}

.unit-node.locked {
  background: var(--bg-progress-track);
  border-color: #DCDCDC;
}

/* In-progress: section-tinted circle with unit number.
   Size stays 56×56 (same as locked/completed, not enlarged like current).
   The bg + border colour come from inline style (meta.main-driven). */
.unit-node.in-progress {
  /* bg and border-color applied inline from renderNode */
}
.unit-node.in-progress .unit-node-num {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* Available: a quieter peer of "current" in free-nav sections. Unit is
   unlocked and tappable but the yellow beacon is already claimed by an
   earlier unit in the same section, so this one reads as "you can also
   do this" rather than "start here". */
.unit-node.available {
  border-style: dashed;
  border-width: 2px;
}
.unit-node.available .unit-node-num {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  opacity: 0.92;
}

/* Onboarding-driven subject collapse — hides units/difficulty-pills but
   keeps the section header visible as a stub. Tap header to expand via
   profile toggle. All unit DOM stays intact so progression is unaffected. */
.path-section.section-collapsed .unit-row,
.path-section.section-collapsed .path-connector,
.path-section.section-collapsed .diff-pills {
  display: none;
}
.path-section.section-collapsed {
  opacity: 0.75;
  padding-bottom: 8px;
}
.path-section.section-collapsed .path-section-badge::after {
  content: ' · hidden';
  opacity: 0.7;
  font-weight: 600;
}

.unit-node-num {
  color: #FFFFFF;
  font-size: var(--type-h2);
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.path-star-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #FFC800;
  border: 2px solid #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ------------------------------------------------------------
 * Continuous progress ring — single arc that grows with stroke-dashoffset.
 * Normal node (56×56): SVG 72×72.  Current node (64×64): SVG 80×80.
 * ------------------------------------------------------------ */
.unit-node { overflow: visible; }
.unit-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  overflow: visible;
  z-index: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}
.unit-ring-fill {
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Micro-celebration played on "just completed" circles when the roadmap
   re-renders after a unit win. The ring fill is already at 100% in the
   final state; CSS keyframes flash the ring briefly and animate the
   dashoffset from a near-empty start so it feels like the ring is
   closing in live. --ring-end-color is inlined on the .unit-node. */
.unit-node.just-completed .unit-ring-fill {
  animation: unitRingDraw 620ms cubic-bezier(0.22, 1, 0.36, 1) 80ms both;
}
@keyframes unitRingDraw {
  0%   { stroke-dashoffset: var(--ring-just-start-offset, 40); }
  100% { stroke-dashoffset: 0; }
}

.unit-node.just-completed {
  animation: unitNodePulse 320ms cubic-bezier(0.34, 1.56, 0.64, 1) 320ms both;
}
@keyframes unitNodePulse {
  0%   { transform: translate(-50%, -50%) scale(1); filter: drop-shadow(0 0 0 transparent); }
  50%  { transform: translate(-50%, -50%) scale(1.15); filter: drop-shadow(0 0 14px var(--ring-end-color, #FFC800)); }
  100% { transform: translate(-50%, -50%) scale(1); filter: drop-shadow(0 0 0 transparent); }
}

/* Checkmark SVG fades+scales in once ring + pulse are done. */
.unit-node.just-completed .unit-node-check {
  opacity: 0;
  transform: scale(0);
  animation: unitCheckDraw 320ms cubic-bezier(0.34, 1.56, 0.64, 1) 800ms forwards;
}
@keyframes unitCheckDraw {
  0%   { opacity: 0; transform: scale(0); }
  60%  { opacity: 1; transform: scale(1.25); }
  100% { opacity: 1; transform: scale(1); }
}

/* Star badge (perfect runs) pops in after the checkmark lands. */
.unit-node.just-completed .path-star-badge {
  transform: scale(0);
  animation: unitStarPop 300ms cubic-bezier(0.34, 1.56, 0.64, 1) 1100ms forwards;
}
@keyframes unitStarPop {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* Burst particles — spawned imperatively in document.body, fixed-position. */
.unit-burst-particle {
  position: fixed;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 60;
  will-change: transform, opacity;
  animation: unitBurstParticle 320ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes unitBurstParticle {
  0%   { transform: translate(-50%, -50%) translate(0, 0) scale(1);     opacity: 1; }
  100% { transform: translate(-50%, -50%) translate(var(--dx, 0), var(--dy, 0)) scale(0.4); opacity: 0; }
}

.unit-row .unit-label-below {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 160px;
}

.unit-row.pos-center .unit-label-below,
.unit-row.pos-left   .unit-label-below {
  left: calc(var(--node-x) + 44px);
  align-items: flex-start;
  text-align: left;
}

.unit-row.pos-right .unit-label-below {
  right: calc(100% - var(--node-x) + 44px);
  align-items: flex-end;
  text-align: right;
}

.unit-row.pos-center { --node-x: 50%; }
.unit-row.pos-right  { --node-x: 72%; }
.unit-row.pos-left   { --node-x: 28%; }

.unit-label-below .unit-label-title {
  font-size: var(--type-body-sm);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: normal;
  word-break: break-word;
}

.unit-label-below .unit-label-title.locked {
  color: var(--text-hint);
  font-weight: 700;
}

.unit-label-below .unit-label-sub {
  font-size: var(--type-micro);
  font-weight: 700;
  line-height: 1.1;
}

.unit-label-title {
  font-size: var(--type-body-sm);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.unit-label-title.locked {
  font-weight: 700;
  color: var(--text-hint);
}

.unit-label-sub {
  font-size: var(--type-micro);
  font-weight: 700;
  line-height: 1.1;
}

.learn-level-divider {
  height: 1px;
  background: #E8E0E4;
  margin: 10px 0;
}

.learn-level-section {
  margin-bottom: 4px;
}

.learn-level-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.learn-level-icon {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--type-caption);
}

.learn-level-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.learn-level-name {
  font-family: var(--font-display);
  font-size: var(--type-body);
  font-weight: 800;
}

.learn-level-topics {
  font-size: var(--type-micro);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.learn-level-badge {
  font-size: var(--type-caption);
  font-weight: 700;
  color: #FFFFFF;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* Unit list (detailed white cards) */
.learn-unit-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}

.learn-unit-list > .learn-unit-card {
  animation: bounce-in 300ms ease backwards;
}
.learn-unit-list > .learn-unit-card:nth-child(1) { animation-delay: 0ms; }
.learn-unit-list > .learn-unit-card:nth-child(2) { animation-delay: 40ms; }
.learn-unit-list > .learn-unit-card:nth-child(3) { animation-delay: 80ms; }
.learn-unit-list > .learn-unit-card:nth-child(4) { animation-delay: 120ms; }
.learn-unit-list > .learn-unit-card:nth-child(5) { animation-delay: 160ms; }
.learn-unit-list > .learn-unit-card:nth-child(n+6) { animation-delay: 200ms; }

.learn-unit-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 2px solid var(--border-card);
  border-bottom: 4px solid var(--border-card-bottom);
  border-radius: 16px;
  cursor: pointer;
  transition: transform 100ms ease, border-bottom-width 100ms ease;
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
}

.learn-unit-card:active {
  border-bottom-width: 2px;
  transform: translateY(2px);
}

.learn-unit-card.current {
  padding: 14px;
  background: var(--bg-card);
  border: 3px solid var(--color-gold);
  border-bottom: 4px solid var(--color-gold-dark);
}

.learn-unit-card.locked {
  cursor: default;
  background: var(--bg-locked);
  border: 2px solid var(--border-card);
  border-bottom: 4px solid #DCDCDC;
  padding: 10px 14px;
}

.learn-unit-card.locked:active { transform: none; border-bottom-width: 4px; }

.learn-unit-card.shake { animation: shakeUnit 400ms ease; }

.learn-unit-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.learn-unit-name {
  font-size: var(--type-caption);
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.learn-unit-name-locked {
  color: var(--text-hint);
  font-weight: 600;
}

.learn-unit-sub {
  font-size: var(--type-micro);
  font-weight: 600;
  line-height: 1.2;
}

.learn-unit-sub-locked {
  color: var(--text-hint);
}

.learn-minidots {
  display: flex;
  gap: 3px;
  margin-top: 3px;
}

.learn-minidot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.learn-unit-badge {
  font-size: var(--type-caption);
  font-weight: 600;
  color: #A0A0A0;
  white-space: nowrap;
  flex-shrink: 0;
}

.learn-unit-badge.perfect {
  font-weight: 700;
}

.learn-unit-play-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-gold);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--type-micro);
  font-weight: 700;
  flex-shrink: 0;
}

.learn-unit-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
  border: 2px solid transparent;
  overflow: visible;
}

.learn-unit-circle.current {
  width: 36px;
  height: 36px;
}

.learn-unit-circle.locked {
  background: #E8DFE4;
  border-color: transparent;
}

.learn-unit-circle.completed {
  border-width: 2px;
  border-style: solid;
}

.learn-unit-circle.current {
  border-width: 2px;
  border-style: solid;
}

.learn-unit-num {
  font-size: var(--type-caption);
  font-weight: 700;
  color: #FFFFFF;
}

@keyframes shakeUnit {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

/* Final banner */
.learn-final-banner {
  background: linear-gradient(135deg, #FF4B4B, #CE82FF);
  border: 2px solid #A855CC;
  border-bottom: 4px solid #A855CC;
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  margin-top: 16px;
}

.learn-final-banner.locked { opacity: 1; }

.learn-final-title {
  display: block;
  font-family: var(--font-display); font-weight: 800;
  font-size: var(--type-body);
  color: #FFFFFF;
  margin-bottom: 4px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.learn-final-sub {
  display: block;
  font-size: var(--type-body-sm);
  font-weight: 600;
  color: rgba(255,255,255,0.95);
}

/* ============================
   UNIT DETAIL
   ============================ */
.screen-unit {
  padding: 0 16px 180px;
  padding-top: calc(12px + env(safe-area-inset-top));
}

.unit-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.unit-header-info {
  flex: 1;
  min-width: 0;
}

.unit-title {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-style: normal;
  font-size: var(--type-section);
  line-height: 1.2;
}

.unit-subtitle {
  font-size: var(--type-caption);
  color: var(--text-secondary);
}

.unit-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.unit-intro-toggle {
  font-size: var(--type-body);
  width: 36px;
  height: 36px;
}

.unit-hearts {
  font-size: var(--type-body-sm);
}

/* Unit Intro Card */
.unit-intro-card {
  margin-bottom: 16px;
  animation: fadeIn var(--transition-normal);
}

.unit-intro-inner {
  background: var(--bg-card);
  border: var(--border-light);
  border-radius: 14px;
  padding: 16px;
}

.unit-intro-title {
  font-size: var(--type-body-sm);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.unit-intro-text {
  font-size: var(--type-body-sm);
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.unit-intro-latex {
  text-align: center;
  padding: 8px 0;
}

.unit-intro-latex .katex { font-size: var(--type-section); }

.unit-intro-example {
  background: var(--bg-hint);
  border-left: 3px solid var(--border-hint);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 12px;
  margin-top: 8px;
}

.unit-intro-example p {
  font-size: var(--type-body-sm);
  color: var(--text-primary);
  line-height: 1.4;
}

/* Unit Task List */
.unit-task-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.unit-task-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--bg-surface);
  background: var(--bg-card);
  min-height: var(--touch-min);
  transition: transform var(--transition-fast);
}

.unit-task-card.task-current {
  border-width: 2px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
}

.unit-task-card.task-current:active { transform: scale(0.98); }

.unit-task-card.task-correct {
  background: rgba(88, 204, 2, 0.12);
  border-color: rgba(88, 204, 2, 0.4);
}

.unit-task-card.task-wrong {
  background: rgba(255, 75, 75, 0.12);
  border-color: rgba(255, 75, 75, 0.4);
}

.unit-task-card.task-locked {
  opacity: 0.5;
  border-style: dashed;
}

.unit-task-circle {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.circle-correct { background: var(--color-green); }
.circle-wrong { background: var(--color-red); }
.circle-current { /* bg set inline */ }
.circle-locked { background: var(--bg-surface); }

.unit-task-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.unit-task-name {
  font-size: var(--type-body-sm);
  font-weight: 700;
}

.unit-task-desc {
  font-size: var(--type-micro);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unit-task-xp {
  font-size: var(--type-caption);
  font-weight: 700;
  white-space: nowrap;
}

/* Unit Footer */
.unit-footer {
  position: fixed;
  bottom: 60px;
  left: 0;
  right: 0;
  background: var(--bg-main);
  padding: 8px 16px;
  padding-bottom: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
}

.unit-footer-text {
  font-size: var(--type-caption);
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.unit-seg-bar {
  display: flex;
  gap: 3px;
  width: 100%;
  max-width: 428px;
}

.unit-seg {
  flex: 1;
  height: 6px;
  border-radius: 3px;
}

/* ============================
   UNIT COMPLETE — redesigned celebration screen
   ============================ */
.screen-unit-complete {
  min-height: 100dvh;
  padding: 0;
  background: var(--bg-main);
}

.uc-header {
  position: relative;
  min-height: 40vh;
  padding: 32px 20px 48px;
  padding-top: calc(32px + env(safe-area-inset-top));
  text-align: center;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  color: #FFFFFF;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.uc-header-pass {
  background: linear-gradient(180deg, #58CC02 0%, #46A302 100%);
}

.uc-header-fail {
  background: linear-gradient(180deg, #8B1A4A 0%, #6D1039 100%);
}

.uc-avatar-wrap {
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  transform-origin: center;
  will-change: transform;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.22));
}

.uc-avatar-wrap .jk-avatar {
  transform: scale(1.05);
}

.uc-avatar-canvas {
  width: 180px;
  height: auto;
  max-width: 70vw;
  display: block;
}

.ob-avatar-canvas {
  display: block;
  height: auto;
}
.ob-avatar-canvas-large { width: 240px; max-width: 70vw; }
.ob-avatar-canvas-mid   { width: 180px; max-width: 60vw; }
.ob-avatar-canvas-small { width: 120px; max-width: 40vw; }


.uc-avatar-bounce {
  animation: celebrationBounce 900ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes celebrationBounce {
  0%   { transform: scale(0.3);  opacity: 0; }
  50%  { transform: scale(1.1);  opacity: 1; }
  75%  { transform: scale(0.95); opacity: 1; }
  100% { transform: scale(1);    opacity: 1; }
}

.uc-title {
  font-family: var(--font-logo);
  font-size: var(--type-h1);
  font-weight: 400;
  color: #FFFFFF;
  margin: 0 0 6px;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
}

.uc-subtitle {
  color: rgba(255, 255, 255, 0.93);
  font-size: var(--type-body);
  font-weight: 700;
  margin: 0;
}

.uc-body {
  padding: 0 16px 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 3-card stats row overlapping the gradient header */
.uc-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: -20px;
  position: relative;
  z-index: 2;
}

.uc-stat-card {
  background: var(--bg-card);
  border: 2px solid var(--border-card);
  border-bottom: 4px solid var(--uc-stat-color, var(--border-card-bottom));
  border-radius: 16px;
  padding: 12px 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.uc-stat-icon-big {
  font-size: var(--type-h1);
  line-height: 1;
  margin-bottom: 4px;
}

.uc-stat-value {
  font-family: var(--font-display);
  font-size: var(--type-h2);
  font-weight: 800;
  line-height: 1.1;
}

.uc-stat-label {
  font-size: var(--type-micro);
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Difficulty badge — only rendered for Medium / Hard */
.uc-diff-badge {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 2px solid var(--border-card);
  border-bottom-width: 4px;
  font-weight: 700;
  font-size: var(--type-body-sm);
}

.uc-diff-medium {
  border-color: var(--color-gold);
  border-bottom-color: var(--color-gold-dark);
  background: rgba(255, 200, 0, 0.10);
  color: var(--color-gold-dark);
}

.uc-diff-hard {
  border-color: var(--color-red);
  border-bottom-color: var(--color-red-dark);
  background: rgba(255, 75, 75, 0.10);
  color: var(--color-red-dark);
}

.uc-diff-ico { font-size: var(--type-section); }
.uc-diff-label { font-weight: 800; text-transform: uppercase; letter-spacing: 0.4px; }
.uc-diff-bonus {
  margin-left: auto;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.55);
  font-size: var(--type-caption);
}

[data-theme="dark"] .uc-diff-bonus {
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-primary);
}

/* Speech bubble quote — 3D card with tail */
.uc-speech-card {
  position: relative;
  padding: 14px 16px !important;
  text-align: left;
  margin-top: 6px;
}

.uc-speech-card::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 24px;
  width: 16px;
  height: 16px;
  background: var(--bg-card);
  border-left: 2px solid var(--border-card);
  border-top: 2px solid var(--border-card);
  transform: rotate(45deg);
  border-top-left-radius: 3px;
}

.uc-speech-text {
  font-size: var(--type-body-sm);
  color: var(--text-primary);
  line-height: 1.45;
  margin: 0 0 6px;
  font-weight: 600;
}

.uc-speech-sig {
  font-size: var(--type-caption);
  color: var(--text-secondary);
  font-weight: 700;
  text-align: right;
  margin: 0;
  font-style: italic;
}

/* Daily goal banner */
.uc-daily-card {
  background: var(--bg-hint);
  border-color: var(--border-hint);
  border-bottom-color: var(--color-gold-dark);
  padding: 10px 14px !important;
  text-align: center;
  font-weight: 700;
  font-size: var(--type-body-sm);
  color: var(--text-primary);
}

.uc-daily-rewards { color: var(--color-gold-dark); font-weight: 800; }

/* Factory progress — gold-bordered card with gradient bar */
.uc-factory-card {
  background: var(--bg-card);
  border: 2px solid var(--color-gold);
  border-bottom: 4px solid var(--color-gold-dark);
  padding: 12px 14px !important;
}

.uc-factory-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}

.uc-factory-title {
  font-weight: 800;
  font-size: var(--type-body-sm);
  color: var(--text-primary);
}

.uc-factory-meta {
  font-size: var(--type-caption);
  color: var(--text-secondary);
  font-weight: 700;
}

.uc-factory-track {
  height: 10px;
  background: var(--bg-progress-track);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.uc-factory-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-gold) 0%, var(--color-coral) 100%);
  border-radius: var(--radius-full);
  transition: width 500ms ease-out;
}

/* Buttons — clear 3-tier hierarchy */
.uc-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.uc-btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary-dark);
  color: #FFFFFF;
}

.uc-btn-review {
  background: var(--bg-card);
}

.uc-btn-share {
  background: transparent;
  color: var(--text-secondary);
  border: 2px dashed var(--border-card);
  border-bottom-width: 2px;
  text-transform: none;
  letter-spacing: normal;
  font-size: var(--type-body-sm);
  font-weight: 700;
}

.uc-btn-share:active {
  border-bottom-width: 2px;
  transform: translateY(1px);
}

/* Canvas-based confetti overlay */
.uc-confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
}

/* Staggered entry for body sections */
.uc-fade-in {
  opacity: 0;
  animation: fadeInUp 500ms ease-out forwards;
}

@keyframes fadeInUp {
  0%   { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

.uc-toast {
  position: fixed;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 10px 16px;
  border: 2px solid var(--border-card);
  border-bottom: 4px solid var(--border-card-bottom);
  border-radius: 14px;
  font-size: var(--type-body-sm);
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  z-index: 300;
  animation: ucToastFade 1.6s ease;
}

@keyframes ucToastFade {
  0%   { opacity: 0; transform: translate(-50%, 8px); }
  15%  { opacity: 1; transform: translate(-50%, 0); }
  85%  { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -8px); }
}

.critical-hit-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
  pointer-events: none;
  animation: criticalFlash 700ms ease-out forwards;
}

.critical-hit-inner {
  animation: criticalPop 700ms cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}

.critical-hit-title {
  font-family: 'Nunito', sans-serif;
  font-size: var(--type-h1);
  font-weight: 800;
  letter-spacing: 1px;
  color: #FFC800;
  text-shadow: 0 2px 12px rgba(255, 200, 0, 0.6), 0 1px 2px rgba(0,0,0,0.3);
}

.critical-hit-sub {
  font-size: var(--type-h1);
  font-weight: 800;
  color: #FFFFFF;
  margin-top: 4px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

@keyframes criticalFlash {
  0%   { background: rgba(255, 200, 0, 0.28); }
  100% { background: transparent; }
}

@keyframes criticalPop {
  0%   { transform: scale(0.5); opacity: 0; }
  50%  { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1);   opacity: 0; }
}

/* Task */
.screen-task {
  padding: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  animation: none;
}

/* Header bar */
.task-header-bar {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  padding-top: calc(8px + env(safe-area-inset-top));
  gap: 8px;
}

/* Progress row */
.task-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 8px;
}

.task-progress-count {
  font-size: var(--type-caption);
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 36px;
  text-align: right;
}

.task-exam-note {
  padding: 0 16px 8px;
  color: var(--text-secondary);
  font-size: var(--type-caption);
  font-weight: var(--weight-bold);
  line-height: 1.25;
  text-align: center;
}

/* Exam timer */
.task-exam-timer {
  min-height: 34px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--type-body-sm);
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.task-exam-timer.expired {
  background: rgba(160, 22, 74, 0.28);
  border-color: rgba(255, 90, 130, 0.42);
  color: var(--text-primary);
}

.task-exam-end {
  min-height: 28px;
  padding: 0 var(--space-2);
  border: 0;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--type-caption);
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

/* Hearts */
.task-hearts {
  display: flex;
  align-items: center;
  gap: 4px;
}

.task-heart {
  font-size: var(--type-section);
  line-height: 0;
  display: inline-flex;
  align-items: center;
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}
.task-heart-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
  pointer-events: none;
}
/* Empty (lost) hearts are desaturated + dimmed so the filled ones stand out. */
.task-heart.empty .task-heart-img {
  filter: grayscale(1) brightness(0.55);
  opacity: 0.45;
}

.task-heart.losing {
  animation: heartLose 400ms ease-out forwards;
}

@keyframes heartLose {
  0% { transform: scale(1); opacity: 1; }
  40% { transform: scale(1.3); }
  100% { transform: scale(0); opacity: 0; }
}

/* Body */
.screen-task .task-body {
  flex: 1;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-bottom: 80px;
}

.task-loading {
  text-align: center;
  padding: 40px 0;
  color: var(--text-secondary);
}

/* Question area */
.task-question-area {
  position: relative;
  min-width: 0;
  max-width: 100%;
}

.task-unit-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--type-caption);
  font-weight: 800;
  color: #FFFFFF;
  background-color: var(--color-primary); /* fallback when inline var(--level-X) is undefined */
  margin-bottom: 10px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.task-question-text {
  font-size: var(--type-body);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.task-math-block {
  background: var(--bg-katex);
  border: 1px solid var(--border-katex);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  font-size: var(--type-h2);
  margin-bottom: 4px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.task-visual-block {
  background: var(--bg-katex);
  border: 2px solid var(--border-katex);
  border-bottom: 4px solid var(--border-katex);
  border-radius: 16px;
  padding: 12px;
  margin: 8px 0 4px;
}

.task-visual-block svg {
  width: 100%;
  height: auto;
  display: block;
}

.visual-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.visual-table-caption {
  font-size: var(--type-caption);
  color: var(--text-hint);
  margin-bottom: 6px;
  text-align: center;
  font-weight: 600;
}

.visual-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--type-body-sm);
  color: var(--text-primary);
}

.visual-table th {
  padding: 6px 10px;
  border-bottom: 2px solid var(--border-card);
  text-align: center;
  font-weight: 800;
  font-size: var(--type-caption);
}

.visual-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-card);
  text-align: center;
}

.task-math-block .katex { font-size: var(--type-h2); }

.task-math-block .katex-display,
.task-explanation-math .katex-display,
.latex-inline.latex-display .katex-display {
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  overflow: visible;
}

.task-math-block .katex,
.task-explanation-math .katex,
.latex-inline .katex {
  display: inline-block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  vertical-align: middle;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

/* MC options */
.task-mc-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.task-mc-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: var(--bg-card);
  border: 2px solid var(--border-card);
  border-bottom: 4px solid var(--border-card-bottom);
  border-radius: 16px;
  padding: 14px 16px;
  min-height: var(--touch-min);
  cursor: pointer;
  text-align: left;
  font-size: var(--type-body);
  transition: transform 100ms ease, background 120ms ease, border-color 120ms ease, border-bottom-width 100ms ease;
  -webkit-tap-highlight-color: transparent;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.task-mc-option:active {
  border-bottom-width: 2px;
  transform: translateY(2px);
}

.task-mc-radio {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 50%;
  border: 2px solid #D4A0B8;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.task-mc-label {
  flex: 1;
  font-weight: 600;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.task-mc-label .katex { font-size: var(--type-body); }

.task-mc-label .latex-inline,
.task-mc-label > .katex {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

/* MC States */
.task-mc-option.selected {
  background: var(--color-primary);
  border-color: var(--color-primary-dark);
  border-bottom-color: var(--color-primary-dark);
  color: #FFFFFF;
  transform: scale(1.015);
}

.task-mc-option.correct {
  border-bottom-color: var(--color-green-dark);
  animation: pop 200ms ease;
}

.task-mc-option.wrong {
  border-bottom-color: var(--color-red-dark);
  animation: wiggle 300ms ease;
}

.task-mc-option.selected .task-mc-radio {
  background: var(--bg-card);
  border-color: #FFFFFF;
}

.task-mc-option.selected .task-mc-label { color: #FFFFFF; }
.task-mc-option.selected .katex * { color: #FFFFFF !important; }

.task-mc-option.correct {
  background: var(--color-green);
  border-color: var(--color-green-dark);
  border-bottom-color: var(--color-green-dark);
  color: #FFFFFF;
  animation: pop 200ms ease;
}

.task-mc-option.correct .task-mc-radio {
  background: var(--bg-card);
  border-color: #FFFFFF;
}

.task-mc-option.correct .task-mc-label { color: #FFFFFF; }
.task-mc-option.correct .katex * { color: #FFFFFF !important; }

.task-mc-option.wrong {
  background: var(--color-red);
  border-color: var(--color-red-dark);
  border-bottom-color: var(--color-red-dark);
  color: #FFFFFF;
  animation: wiggle 300ms ease;
}

.task-mc-option.wrong .task-mc-label { color: #FFFFFF; }
.task-mc-option.wrong .katex * { color: #FFFFFF !important; }

.task-mc-option.wrong .task-mc-radio {
  background: var(--color-red);
  border-color: var(--color-red);
}

.task-mc-option.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.task-mc-option.correct.disabled,
.task-mc-option.wrong.disabled {
  opacity: 1;
}

/* I don't know */
.task-idk-option {
  margin-top: 4px;
  border-style: dashed;
  justify-content: center;
}

.task-idk-label {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: var(--type-body-sm);
}

.task-idk-option.selected {
  background: var(--bg-surface);
  border-color: var(--text-secondary);
  border-style: solid;
}

.task-idk-option.selected .task-idk-label { color: var(--text-primary); }

/* Input field */
.task-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-input {
  border: 2px solid var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: var(--type-h2);
  text-align: center;
  font-weight: 700;
  background: var(--bg-card);
  color: var(--text-primary);
  transition: border-color 200ms ease;
  outline: none;
}

.task-input:focus {
  border-color: var(--color-primary);
  outline: none;
}

.task-input::placeholder {
  color: var(--text-tertiary);
  font-weight: 400;
  font-size: var(--type-body);
}

.task-input-tip {
  font-size: var(--type-body-sm);
  color: var(--text-tertiary);
  text-align: center;
}

/* Hint */
.task-hint-area {
  margin-top: 4px;
}

.task-hint-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-main);
  color: var(--color-primary);
  font-size: var(--type-body-sm);
  font-weight: 700;
  cursor: pointer;
  border: none;
  min-height: var(--touch-min);
  transition: opacity var(--transition-fast);
}

.task-hint-btn:active { opacity: 0.7; }

.task-hint-content {
  font-size: var(--type-body-sm);
  color: var(--text-secondary);
  padding: 12px;
  background: var(--bg-hint);
  border-left: 3px solid var(--border-hint);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  animation: fadeIn var(--transition-normal);
  max-width: 100%;
  overflow-wrap: anywhere;
  overflow-x: hidden;
}

/* Footer / Action button */
.screen-task .task-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: var(--bg-main);
  z-index: 50;
  display: flex;
  justify-content: center;
}

.task-action-btn {
  max-width: 428px;
  height: 52px;
  border-radius: 14px;
  font-weight: 700;
  font-size: var(--type-body);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.task-action-btn:not(:disabled) {
  background: var(--color-primary);
  color: #FFFFFF;
  border: 2px solid var(--color-primary-dark);
  border-bottom: 4px solid var(--color-primary-dark);
}

.task-action-btn:disabled {
  background: var(--bg-progress-track);
  color: var(--text-hint);
  border: 2px solid var(--border-card);
  border-bottom: 4px solid var(--border-card-bottom);
  opacity: 1;
  pointer-events: none;
}

.task-action-correct:not(:disabled) { background: var(--color-green); }
.task-action-wrong:not(:disabled) { background: var(--color-red); }
.task-action-idk:not(:disabled) { background: var(--color-amber); }

/* Feedback overlay */
.task-feedback {
  position: fixed;
  bottom: 76px;
  left: 0;
  right: 0;
  z-index: 40;
  transform: translateY(100%);
  transition: transform 300ms ease-out;
  display: flex;
  justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
  overflow-x: hidden;
}

.task-feedback.show {
  transform: translateY(0);
}

.task-feedback-inner {
  width: 100%;
  max-width: 428px;
  padding: 16px;
  border-radius: 16px 16px 0 0;
  min-width: 0;
  box-sizing: border-box;
  overflow-x: hidden;
}

.task-feedback-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.task-feedback-avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-feedback-avatar .jk-avatar {
  transform: scale(0.3);
  transform-origin: center;
}


.feedback-correct .task-feedback-inner { background: var(--color-green); }
.feedback-wrong .task-feedback-inner { background: var(--color-red); }
.feedback-idk .task-feedback-inner { background: var(--color-amber); }

.task-feedback-title {
  font-weight: 700;
  font-size: var(--type-body);
  color: #FFFFFF;
  margin-bottom: 4px;
}

.task-feedback-answer {
  font-size: var(--type-body-sm);
  font-weight: 600;
  color: #FFFFFF;
  margin-bottom: 8px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.task-feedback-answer span { font-weight: 800; color: #FFFFFF; }
.task-feedback-answer .katex * { color: #FFFFFF !important; }

/* Explanation inside feedback */
.task-explanation {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 10px 14px;
  margin-top: 8px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

.task-explanation-body {
  position: relative;
  max-width: 100%;
  min-width: 0;
}

.task-explanation.is-collapsible.is-collapsed .task-explanation-body {
  max-height: 118px;
  overflow: hidden;
}

.task-explanation.is-collapsible.is-collapsed .task-explanation-body::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 36px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.16));
}

.task-explanation-text {
  font-family: 'Nunito', sans-serif;
  font-size: var(--type-body-sm);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.5;
  margin-bottom: 4px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.task-explanation-math {
  text-align: center;
  padding: 8px 0 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.task-explanation-math .katex { font-size: var(--type-section); color: #FFFFFF !important; }
.task-explanation-math .katex * { color: #FFFFFF !important; }

.task-explanation-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  margin-top: 8px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
  font-family: 'Nunito', sans-serif;
  font-size: var(--type-body-sm);
  font-weight: 800;
  line-height: 1;
}

.task-explanation-toggle:active {
  transform: translateY(1px);
}

/* ============================
   FEEDBACK — flag button, bottom sheet, toast, unit rating
   ============================ */

/* Flag button on task screen */
.fb-flag-btn {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: transparent;
  color: #999999;
  opacity: 0.6;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 200ms ease-out, opacity 200ms ease-out, background 200ms ease-out;
}

.fb-flag-btn:active { background: var(--bg-surface); }

.fb-flag-btn-reported {
  color: var(--color-primary);
  opacity: 1;
}

/* "Already reported" tooltip */
.fb-tooltip {
  position: fixed;
  z-index: 250;
  background: var(--text-primary);
  color: #FFFFFF;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: var(--type-caption);
  padding: 6px 10px;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 200ms ease-out, transform 200ms ease-out;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

.fb-tooltip.show { opacity: 1; transform: translateY(0); }

/* Bottom sheet */
.fb-sheet-root {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
}

.fb-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 300ms ease-out;
  pointer-events: auto;
}

.fb-sheet {
  position: relative;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
  padding: 12px 24px 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.32);
  transform: translateY(100%);
  transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: auto;
}

.fb-sheet-root.open .fb-sheet-backdrop { opacity: 1; }
.fb-sheet-root.open .fb-sheet { transform: translateY(0); }

.fb-sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border-card);
  border-radius: 2px;
  margin: 0 auto 14px;
}

.fb-sheet-title {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: var(--type-section);
  color: var(--text-primary);
  margin: 0 0 16px;
}

.fb-reasons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.fb-reason {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 0 18px;
  background: var(--bg-option);
  border: 2px solid var(--border-option);
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: var(--type-body);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color 200ms ease-out,
    background-color 200ms ease-out,
    transform 150ms ease-out;
}

.fb-reason:active { transform: scale(0.97); }

.fb-reason.selected {
  border-color: var(--color-primary);
  background: var(--bg-card-hover);
}

.fb-reason-emoji { font-size: var(--type-section); line-height: 1; }

.fb-reason-label { font-weight: 600; }

.fb-reason-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-card);
  position: relative;
  transition: border-color 200ms ease-out;
}

.fb-reason.selected .fb-reason-dot { border-color: var(--color-primary); }

.fb-reason.selected .fb-reason-dot::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--color-primary);
}

.fb-comment-wrap {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 300ms ease-out, opacity 200ms ease-out, margin-bottom 200ms ease-out;
  margin-bottom: 0;
}

.fb-comment-wrap.show {
  max-height: 60px;
  opacity: 1;
  margin-bottom: 12px;
}

.fb-comment {
  width: 100%;
  height: 44px;
  padding: 0 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-weight: 500;
  font-size: var(--type-body-sm);
  color: var(--text-primary);
  box-sizing: border-box;
  outline: none;
  transition: border-color 200ms ease-out;
}

.fb-comment:focus { border-color: var(--color-primary); }
.fb-comment::placeholder { color: var(--text-hint); font-weight: 500; }

.fb-submit {
  width: 100%;
  height: 52px;
  background: var(--color-primary);
  color: #FFFFFF;
  border: none;
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: var(--type-body);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 12px rgba(139, 26, 74, 0.3);
  transition: transform 200ms ease-out, background 200ms ease-out, opacity 200ms ease-out;
}

.fb-submit:active {
  transform: scale(0.98);
  background: var(--color-primary-dark);
}

.fb-submit:disabled {
  opacity: 0.5;
  box-shadow: none;
  cursor: default;
}

/* Top-slide toast */
.fb-toast {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 16px);
  left: 50%;
  transform: translate(-50%, -120%);
  z-index: 320;
  background: var(--color-green);
  color: #FFFFFF;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: var(--type-body-sm);
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transition: opacity 250ms ease-out, transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  max-width: calc(100% - 32px);
}

.fb-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Unit rating widget (Unit Complete screen) */
.fb-rate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 6px 0 2px;
  transition: opacity 400ms ease-out;
}

.fb-rate-label {
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: var(--type-body-sm);
  color: #999999;
  margin: 0;
  text-align: center;
  transition: color 300ms ease-out;
}

.fb-rate.thanks .fb-rate-label { color: var(--color-green); font-weight: 700; }

.fb-rate-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.fb-rate-btn {
  position: relative;
  width: 52px;
  height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color 200ms ease-out,
    border-color 200ms ease-out,
    opacity 300ms ease-out,
    transform 200ms ease-out;
}

.fb-rate-btn:active { transform: scale(0.95); }

.fb-rate-btn.selected {
  background: #FDF2F7;
  border-color: var(--color-primary);
}

.fb-rate-btn.dimmed { opacity: 0.4; }

.fb-rate-btn.bounce {
  animation: fbRateBounce 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fbRateBounce {
  0%   { transform: scale(0.9); }
  50%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.fb-rate-emoji {
  font-size: var(--type-h1);
  line-height: 1;
}

.fb-rate-caption {
  position: absolute;
  top: calc(100% + 4px);
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: var(--type-micro);
  color: #999999;
  white-space: nowrap;
  transition: color 200ms ease-out;
}

.fb-rate-btn.selected .fb-rate-caption { color: var(--color-primary); }

.fb-rate-check {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-green);
  color: #FFFFFF;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: var(--type-caption);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 250ms ease-out, transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 6px rgba(88, 204, 2, 0.35);
}

.fb-rate-check.show { opacity: 1; transform: scale(1); }

.fb-rate.thanks .fb-rate-buttons { margin-bottom: 14px; }

/* ============================
   ANIMATIONS (XP, Gems, Daily Goal)
   ============================ */
.xp-float {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display); font-weight: 800;
  font-size: var(--type-h1);
  color: var(--color-gold);
  pointer-events: none;
  animation: xpFloat 1.2s ease-out forwards;
  z-index: 1000;
  text-shadow: 0 2px 8px rgba(0,0,0,0.15);
  white-space: nowrap;
}

.xp-combo {
  font-size: var(--type-body-sm);
  margin-left: 4px;
  vertical-align: middle;
}

@keyframes xpFloat {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
  30% { opacity: 1; transform: translate(-50%, -100%) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -180%) scale(1); }
}

.gem-float {
  position: fixed;
  top: 30%;
  right: 16px;
  font-family: var(--font-display); font-weight: 800;
  font-size: var(--type-h2);
  color: var(--color-blue);
  pointer-events: none;
  animation: gemFloat 1.2s ease-out forwards;
  z-index: 1000;
  text-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

@keyframes gemFloat {
  0% { opacity: 1; transform: translateY(0) scale(0.5); }
  30% { opacity: 1; transform: translateY(-20px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-60px) scale(1); }
}

.daily-goal-float {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display); font-weight: 800;
  font-size: var(--type-section);
  color: var(--color-green);
  pointer-events: none;
  animation: dailyGoalFloat 2s ease-out forwards;
  z-index: 1000;
  background: var(--bg-card);
  padding: 8px 20px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-card);
  white-space: nowrap;
}

@keyframes dailyGoalFloat {
  0% { opacity: 0; transform: translateX(-50%) scale(0.5); }
  15% { opacity: 1; transform: translateX(-50%) scale(1.1); }
  70% { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-40px) scale(0.9); }
}

/* ============================
   HEARTS EMPTY OVERLAY
   ============================ */
.hearts-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 24px;
}

.hearts-overlay.hidden { display: none; }

/* ============================
   BREAK SCREEN (every 5 tasks)
   ============================ */
.break-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--bg-main);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: breakFadeIn 300ms ease-out;
}

:root:not([data-theme="dark"]) .break-overlay {
  background: linear-gradient(160deg, #FEF2F0 0%, #FFE0EA 100%);
}

[data-theme="dark"] .break-overlay {
  background: radial-gradient(circle at 50% 40%, #25253E 0%, var(--bg-main) 75%);
}

.break-overlay.break-leaving {
  animation: breakFadeOut 200ms ease-in forwards;
}

@keyframes breakFadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes breakFadeOut {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

.break-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 320px;
  text-align: center;
}

.break-canvas {
  width: 220px;
  max-width: 60vw;
  height: auto;
  display: block;
  margin-bottom: 20px;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.15));
}

.break-phrase {
  font-family: var(--font-logo, 'Fredoka One', 'Fredoka', 'Nunito', sans-serif);
  font-size: var(--type-body);
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 8px;
  min-height: 48px;
  padding: 0 12px;
}

.break-progress {
  font-family: var(--font-logo, 'Fredoka One', 'Fredoka', 'Nunito', sans-serif);
  font-size: var(--type-body-sm);
  color: var(--text-secondary);
  margin-bottom: 24px;
  letter-spacing: 0.3px;
}

.break-continue {
  font-family: var(--font-logo, 'Fredoka One', 'Fredoka', 'Nunito', sans-serif);
  font-size: var(--type-body);
  font-weight: 600;
  padding: 12px 48px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: #FFFFFF;
  cursor: pointer;
  letter-spacing: 0.3px;
  box-shadow: 0 6px 14px rgba(139, 26, 74, 0.28);
  transition: transform 120ms ease;
}

.break-continue:active {
  transform: scale(0.96);
}

.hearts-overlay-card {
  width: 100%;
  max-width: 320px;
  text-align: center;
  padding: 24px;
}

.hearts-overlay-canvas {
  width: 140px;
  max-width: 45%;
  height: auto;
  display: block;
  margin: 0 auto 6px;
}

.hearts-overlay-title {
  font-family: var(--font-display); font-weight: 800;
  font-size: var(--type-h2);
  color: var(--color-primary);
  margin-bottom: 4px;
}

.hearts-overlay-sub {
  font-size: var(--type-body-sm);
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.hearts-overlay-timer {
  font-size: var(--type-body-sm);
  color: var(--text-secondary);
  margin: 12px 0;
}

.hearts-premium-btn {
  background: linear-gradient(135deg, #FFD700, #FFA000);
  color: var(--text-primary);
  font-weight: 700;
  margin-top: 8px;
}

.hearts-back-link {
  display: block;
  margin-top: 12px;
  font-size: var(--type-body-sm);
  color: var(--text-tertiary);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
}

/* ============================
   DAILY REWARD POPUP
   ============================ */
.dr-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 47, 163, 0.22), transparent 36%),
    rgba(3, 2, 12, 0.76);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 18px;
  backdrop-filter: blur(10px);
}

.dr-card {
  position: relative;
  width: 100%;
  max-width: 356px;
  overflow: hidden;
  padding: 18px;
  border: 1px solid rgba(255, 77, 190, 0.26);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.018)),
    radial-gradient(circle at 22% 10%, rgba(255, 75, 185, 0.24), transparent 42%),
    rgba(18, 12, 40, 0.96);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 36px rgba(255, 47, 163, 0.16);
}

.dr-card-shine {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, transparent 0 18%, rgba(255, 255, 255, 0.06) 26%, transparent 38%),
    radial-gradient(circle at 76% 16%, rgba(102, 52, 180, 0.22), transparent 28%);
  pointer-events: none;
}

.dr-header,
.dr-gem-display,
.dr-claim-btn,
.dr-circles {
  position: relative;
  z-index: 1;
}

.dr-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.dr-kicker {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(255, 77, 190, 0.22);
  border-radius: 999px;
  background: rgba(255, 47, 163, 0.14);
  color: #FF8AD6;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.dr-title {
  margin: 8px 0 0;
  color: #FFFFFF;
  font-family: var(--font-logo);
  font-size: 31px;
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: 0;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.38);
}

.dr-subtitle {
  margin: 7px 0 0;
  color: #D8CDEF;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
}

.dr-badge {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 105, 196, 0.22), transparent 55%),
    rgba(14, 10, 32, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 12px 20px rgba(0, 0, 0, 0.28);
}

.dr-badge img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.dr-badge strong {
  margin-top: -6px;
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 950;
}

.dr-circles {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 14px;
}

.dr-circle {
  min-width: 0;
  display: grid;
  justify-items: center;
  align-items: center;
  gap: 3px;
}

.dr-circle-inner {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
  transition: transform var(--transition-normal), border-color var(--transition-normal);
}

.dr-circle.claimed .dr-circle-inner {
  border-color: rgba(114, 229, 87, 0.42);
  background: linear-gradient(180deg, #82E85C, #35A72E);
  color: #FFFFFF;
}

.dr-check {
  font-size: 16px;
  font-weight: 950;
}

.dr-circle.current .dr-circle-inner {
  border-color: rgba(255, 215, 91, 0.9);
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.26), transparent 38%),
    linear-gradient(180deg, #442A82, #241645);
  box-shadow: 0 0 0 3px rgba(255, 213, 77, 0.18), 0 0 18px rgba(255, 47, 163, 0.36);
  animation: drPulse 1.5s ease-in-out infinite;
}

.dr-circle.current .dr-circle-inner img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.dr-circle.future .dr-circle-inner {
  background: rgba(255, 255, 255, 0.05);
  opacity: 0.72;
}

.dr-lock {
  width: 12px;
  height: 10px;
  position: relative;
  border-radius: 3px;
  background: #8F82AE;
}

.dr-lock::before {
  content: '';
  position: absolute;
  left: 2px;
  top: -8px;
  width: 8px;
  height: 9px;
  border: 2px solid #8F82AE;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.dr-circle-label {
  color: #A99ACB;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.dr-circle strong {
  color: #E6DDF7;
  font-size: 8px;
  font-weight: 950;
  line-height: 1;
}

@keyframes drPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.dr-gem-display {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 88px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)),
    rgba(9, 7, 24, 0.54);
}

.dr-gem-icon {
  width: 62px;
  height: 62px;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(80, 210, 255, 0.28)) drop-shadow(0 12px 12px rgba(0, 0, 0, 0.34));
}

.dr-gem-amount {
  display: block;
  color: #FFD75B;
  font-family: var(--font-logo);
  font-size: 38px;
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: 0;
  text-shadow: 0 0 18px rgba(255, 196, 53, 0.22);
}

.dr-gem-display small {
  display: block;
  margin-top: 5px;
  color: #CFC4EC;
  font-size: 12px;
  font-weight: 850;
}

.dr-claim-btn {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(180deg, #F45AB8, #BD167B);
  color: #FFFFFF;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 14px 24px rgba(189, 22, 123, 0.34);
  font-size: 14px;
  font-weight: 950;
  text-transform: uppercase;
}

.dr-claim-btn img {
  width: 19px;
  height: 19px;
  object-fit: contain;
}

.dr-claim-btn strong {
  font-weight: 950;
}

.dr-claim-btn:active {
  transform: translateY(1px) scale(0.99);
}

@media (max-width: 380px) {
  .dr-card {
    padding: 16px;
  }

  .dr-title {
    font-size: 28px;
  }

  .dr-circle-inner {
    width: 31px;
    height: 31px;
  }

  .dr-circle-label,
  .dr-circle strong {
    font-size: 7px;
  }
}

/* ============================
   STREAK POPUPS
   ============================ */
.streak-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  padding: 24px;
}

.streak-popup-card {
  width: 100%;
  max-width: 300px;
  text-align: center;
  padding: 24px;
}

/* Streak at risk badge */
.learn-streak-risk {
  padding: 0 16px;
  margin-bottom: 8px;
}

.streak-risk-badge {
  display: block;
  text-align: center;
  font-size: var(--type-caption);
  font-weight: 700;
  color: var(--color-amber);
  background: #FFF3E0;
  border: 1px solid #FFE0B2;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  animation: streakRiskPulse 2s ease-in-out infinite;
}

@keyframes streakRiskPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.streak-pulse {
  animation: streakBadgePulse 1.5s ease-in-out infinite;
}

@keyframes streakBadgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Hidden utility */
.hidden { display: none !important; }

/* Unit complete */
.screen-unit-complete {
  min-height: 100dvh;
}

/* ============================
   HUB (Factory)
   ============================ */
.screen-hub {
  padding: 0;
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 80px);
  overflow: hidden;
}

.hub-image-area {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 200px;
  overflow: hidden;
  border-radius: 0 0 24px 24px;
}

.hub-factory-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================
   Factory level upgrade overlay
   ============================ */
.fu-stage {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 46%,
      rgba(255, 180, 80, 0.25) 0%,
      rgba(255, 140, 50, 0.10) 28%,
      rgba(0,0,0,0) 55%),
    linear-gradient(180deg, #14101F 0%, #07060B 100%);
  color: #fff;
  animation: fuStageFade 400ms ease-out;
}
@keyframes fuStageFade { from { opacity: 0; } to { opacity: 1; } }

.fu-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.fu-fx-ember { z-index: 11; }
.fu-fx-ring  { z-index: 12; }
.fu-fx-burst { z-index: 13; }

.fu-flash {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  z-index: 14;
  pointer-events: none;
}
.fu-flash.on { animation: fuFlashPulse 220ms ease-out; }
@keyframes fuFlashPulse {
  0%   { background: rgba(255, 255, 255, 0); }
  30%  { background: rgba(255, 255, 255, 0.15); }
  100% { background: rgba(255, 255, 255, 0); }
}

.fu-starburst {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  z-index: 13;
  pointer-events: none;
  transform: translate(-50%, -50%);
  opacity: 0;
}
.fu-starburst.on { animation: fuStarburstGo 800ms ease-out forwards; }
@keyframes fuStarburstGo {
  0%   { opacity: 0; transform: translate(-50%, -50%) rotate(0deg)  scale(0.2); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(45deg) scale(1); }
}
.fu-starburst-line {
  position: absolute;
  left: 0;
  top: -1.5px;
  width: 48vh;
  height: 3px;
  transform-origin: 0% 50%;
  background: linear-gradient(90deg,
    rgba(255, 225, 140, 0.95) 0%,
    rgba(255, 180, 70, 0.8) 30%,
    rgba(255, 120, 40, 0) 100%);
  filter: blur(0.5px);
}

.fu-content {
  position: relative;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 360px;
  width: 100%;
  text-align: center;
}

.fu-old-level {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-logo, 'Fredoka One', sans-serif);
  font-size: var(--type-h1);
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.8px;
  text-shadow: 0 2px 14px rgba(0,0,0,0.5);
  z-index: 15;
  animation: fuOldShake 300ms ease-in-out both, fuOldFade 220ms ease-in 300ms forwards;
}
@keyframes fuOldShake {
  0%, 100% { transform: translate(-50%, -50%); }
  20% { transform: translate(calc(-50% - 4px), calc(-50% - 1px)); }
  40% { transform: translate(calc(-50% + 5px), calc(-50% + 2px)); }
  60% { transform: translate(calc(-50% - 3px), calc(-50% + 1px)); }
  80% { transform: translate(calc(-50% + 2px), calc(-50% - 2px)); }
}
@keyframes fuOldFade {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
}

.fu-reveal { opacity: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.fu-reveal.on { animation: fuRevealIn 600ms cubic-bezier(0.22, 1.4, 0.36, 1) forwards; }
@keyframes fuRevealIn {
  0%   { opacity: 0; transform: scale(0); }
  55%  { opacity: 1; transform: scale(1.2); }
  80%  { transform: scale(0.97); }
  100% { opacity: 1; transform: scale(1); }
}
.fu-level-num {
  font-family: var(--font-logo, 'Fredoka One', sans-serif);
  font-size: 48px;
  color: #FFF5D5;
  letter-spacing: 1px;
  line-height: 1;
  text-shadow:
    0 0 16px rgba(255, 210, 120, 0.85),
    0 0 32px rgba(255, 160, 70, 0.55),
    0 2px 14px rgba(0, 0, 0, 0.45);
  animation: fuLevelShimmer 3s ease-in-out 600ms infinite;
}
@keyframes fuLevelShimmer {
  0%, 100% { text-shadow:
    0 0 16px rgba(255, 210, 120, 0.85),
    0 0 32px rgba(255, 160, 70, 0.55),
    0 2px 14px rgba(0, 0, 0, 0.45); }
  50% { text-shadow:
    0 0 22px rgba(255, 230, 150, 0.95),
    0 0 44px rgba(255, 180, 90, 0.7),
    0 2px 14px rgba(0, 0, 0, 0.45); }
}
.fu-level-sub {
  font-family: var(--font-body, 'Fredoka', 'Nunito', sans-serif);
  font-weight: 600;
  font-size: var(--type-section);
  color: #FFE7B5;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  opacity: 0;
  animation: fuSubFade 400ms ease-out 500ms forwards;
  text-shadow: 0 1px 6px rgba(0,0,0,0.4);
}
@keyframes fuSubFade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fu-factory-wrap {
  position: relative;
  width: 280px;
  max-width: 72vw;
  aspect-ratio: 1 / 1;
  opacity: 0;
  transform: translateY(16px) scale(0.85);
  filter: drop-shadow(0 20px 32px rgba(0, 0, 0, 0.55))
          drop-shadow(0 0 22px rgba(255, 175, 80, 0.35));
}
.fu-factory-wrap.on { animation: fuFactoryDrop 620ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
@keyframes fuFactoryDrop {
  from { opacity: 0; transform: translateY(16px) scale(0.85); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.fu-factory-wrap::before {
  content: '';
  position: absolute;
  inset: -10%;
  background: radial-gradient(circle,
    rgba(255, 190, 90, 0.30) 0%,
    rgba(255, 150, 60, 0.10) 45%,
    transparent 70%);
  filter: blur(14px);
  z-index: -1;
  animation: fuFactoryAura 3.2s ease-in-out infinite;
}
@keyframes fuFactoryAura {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.08); }
}
.fu-factory-card {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 32px;
  padding: 10px;
  box-sizing: border-box;
  background: linear-gradient(160deg, rgba(60, 42, 28, 0.55) 0%, rgba(28, 18, 10, 0.55) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 150, 0.18),
    inset 0 0 0 1px rgba(255, 195, 115, 0.22);
}
.fu-factory-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 22px;
  -webkit-mask-image: -webkit-radial-gradient(white, black);
}

.fu-bubble {
  position: relative;
  background: #FFFFFF;
  color: #3D3D3A;
  font-family: var(--font-body, 'Fredoka', 'Nunito', sans-serif);
  font-weight: 600;
  font-size: var(--type-body-sm);
  line-height: 1.4;
  padding: 10px 18px;
  border-radius: 18px;
  max-width: 280px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08);
  opacity: 0;
  transform: translateY(-4px) scale(0.9);
}
.fu-bubble.on { animation: fuBubbleIn 340ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
.fu-bubble::after {
  content: '';
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid #FFFFFF;
}
@keyframes fuBubbleIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.fu-continue {
  margin-top: 8px;
  font-family: var(--font-logo, 'Fredoka One', sans-serif);
  font-size: var(--type-body);
  color: #1F0E00;
  background: linear-gradient(135deg, #FFE17B 0%, #FFB347 55%, #FF7A1A 100%);
  border: none;
  border-radius: 999px;
  padding: 14px 56px;
  cursor: pointer;
  letter-spacing: 0.6px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  box-shadow:
    0 12px 28px rgba(255, 140, 40, 0.55),
    0 0 0 1px rgba(255, 190, 80, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  opacity: 0;
  transform: translateY(12px);
  transition: transform 150ms ease, box-shadow 200ms ease;
}
.fu-continue.on { animation: fuContinueIn 440ms cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.fu-continue:active { transform: scale(0.97); }
@keyframes fuContinueIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hub-level-badge {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: var(--type-caption);
  font-weight: 800;
  color: #FFFFFF;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  backdrop-filter: blur(6px);
  backdrop-filter: blur(4px);
}

.hub-info {
  padding: 24px 16px 18px;
  flex: 0 0 auto;
}

.hub-epoch-badge {
  display: block;
  background: transparent;
  color: var(--color-primary);
  font-size: var(--type-body);
  font-weight: 800;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  padding: 0;
  margin: 2px 0 14px;
}

[data-theme="dark"] .hub-epoch-badge {
  color: #FF7AA3;
}

.hub-factory-name {
  display: inline-block;
  font-size: var(--type-section);
  font-weight: 800;
  color: #FFFFFF;
  background: var(--color-gold);
  border: 2px solid var(--color-gold-dark);
  border-bottom: 4px solid var(--color-gold-dark);
  border-radius: 14px;
  padding: 6px 16px;
  margin: 0 0 10px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  letter-spacing: 0.3px;
}

.hub-progress-section {
  margin-bottom: 10px;
}

.hub-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.hub-progress-label {
  font-size: var(--type-caption);
  font-weight: 700;
  color: var(--color-primary);
}

.hub-progress-count {
  font-size: var(--type-caption);
  color: var(--text-secondary);
}

.hub-stats-row {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.hub-stat-badge {
  font-size: var(--type-micro);
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.hub-stat-epoch {
  background: var(--color-gold);
  color: var(--text-primary);
}

.hub-stat-tasks {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.hub-cta-sub {
  text-align: center;
  font-size: var(--type-caption);
  color: var(--text-tertiary);
  margin-top: 6px;
}

.hub-milestones {
  margin-top: 16px;
}

.hub-milestones-title {
  font-size: var(--type-caption);
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 8px;
}

.hub-milestones-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.hub-milestone-card {
  flex-shrink: 0;
  width: 84px;
  background: var(--bg-card);
  border: 2px solid var(--border-card);
  border-bottom: 4px solid var(--border-card-bottom);
  border-radius: 14px;
  padding: 6px;
  text-align: center;
  transition: transform 100ms ease, border-bottom-width 100ms ease;
  -webkit-tap-highlight-color: transparent;
}

.hub-milestone-card:active {
  border-bottom-width: 2px;
  transform: translateY(2px);
}

.hub-milestone-img {
  width: 68px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.hub-milestone-lvl {
  font-size: var(--type-micro);
  font-weight: 600;
  margin-top: 4px;
  color: var(--text-primary);
}

.hub-milestone-req {
  font-size: var(--type-micro);
  color: var(--text-secondary);
  font-weight: 600;
}

.hub-milestone-name {
  font-size: var(--type-micro);
  font-weight: 600;
  margin-top: 2px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hub-progress-track {
  height: 16px;
  border-radius: 10px;
  background: var(--bg-progress-track);
  position: relative;
  overflow: hidden;
}

.hub-progress-track .progress-fill {
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.1), inset 0 2px 0 rgba(255,255,255,0.3);
}

.hub-progress-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--type-caption);
  font-weight: 800;
  color: #FFFFFF;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

.hub-journey-card {
  flex-shrink: 0;
  text-align: center;
}

.hub-journey-img {
  width: 48px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #E0E0E0;
  display: block;
}

.hub-journey-lvl {
  font-size: var(--type-micro);
  color: var(--text-secondary);
  margin-top: 2px;
  font-weight: 600;
}

/* ============================
   JAMCHIK (Tamagotchi)
   ============================ */
.screen-jamchik {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
  gap: 6px;
  height: calc(100dvh - 80px - env(safe-area-inset-top));
  overflow: hidden;
}

.jk-screen-title {
  font-size: var(--type-section);
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: 0.3px;
}

.jk-avatar-area {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  margin-top: 0;
}

.jk-avatar-area-large {
  min-height: 220px;
  flex: 1 1 auto;
  padding-top: calc(6px + env(safe-area-inset-top));
  padding-bottom: 0;
  position: relative;
  width: calc(100% + 32px);
  margin: 0 -16px;
  margin-top: calc(-1 * env(safe-area-inset-top));
  overflow: hidden;
  /* Background image replaced by the mood-reactive scene
     injected at runtime (see components/mood-background.js). */
  background-color: #1A1028;
  border-radius: 0 0 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
}

.jk-avatar-slot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  max-height: 100%;
  overflow: hidden;
}

.jk-avatar-canvas {
  width: 280px;
  max-width: 78vw;
  max-height: 100%;
  height: auto;
  display: block;
  cursor: pointer;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.28));
}

.jk-avatar-area-large::after {
  content: '';
  position: absolute;
  bottom: 38px;
  left: 50%;
  transform: translateX(-50%);
  width: 72px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.25) 45%, rgba(0,0,0,0) 80%);
  z-index: 0;
  pointer-events: none;
  filter: blur(1.5px);
  transition: transform 200ms ease, opacity 200ms ease;
}

.jk-avatar-area-large.hopping::after {
  transform: translateX(-50%) scale(0.78);
  opacity: 0.7;
}

.jk-avatar-area-large .jk-avatar {
  position: relative;
  z-index: 1;
  cursor: pointer;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.28));
  transition: transform 120ms ease;
}

.jk-avatar-area-large.hopping .jk-avatar {
  animation: jkHop 420ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes jkHop {
  0%   { transform: translateY(0)    scale(1, 1); }
  25%  { transform: translateY(-18px) scale(0.97, 1.05); }
  55%  { transform: translateY(-26px) scale(1, 1); }
  80%  { transform: translateY(0)    scale(1.06, 0.94); }
  100% { transform: translateY(0)    scale(1, 1); }
}

.jk-speech-pop {
  position: relative;
  z-index: 2;
  max-width: 260px;
  background: #FFFFFF;
  border-radius: 16px;
  padding: 8px 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  margin-bottom: -2px;
  min-height: 1px;
  font-family: var(--font-logo, 'Fredoka One', 'Fredoka', 'Nunito', sans-serif);
}

.jk-speech-pop:empty {
  display: none;
}

.jk-speech-pop.show {
  animation: jkSpeechPop 260ms ease;
}

@keyframes jkSpeechPop {
  0%   { transform: scale(0.85); opacity: 0; }
  60%  { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1);    opacity: 1; }
}

.jk-speech-pop .jk-speech-text {
  font-size: var(--type-body-sm);
  color: #3D3D3A;
  text-align: center;
  line-height: 1.3;
  margin: 0;
  white-space: normal;
  font-family: inherit;
}

.jk-speech-tail-down {
  position: absolute;
  left: 50%;
  bottom: -7px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #FFFFFF;
  background: transparent;
  border-bottom: 0;
}

.jk-speech-tail {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: var(--bg-card);
  border-left: 1px solid #F0E0EB;
  border-top: 1px solid #F0E0EB;
}

.jk-speech-text {
  font-size: var(--type-body-sm);
  color: var(--text-primary);
  text-align: center;
  line-height: 1.4;
  margin: 0;
}

.jk-daily-stats {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: var(--bg-card);
  border: 2px solid var(--border-card);
  border-bottom: 4px solid var(--border-card-bottom);
  border-radius: 16px;
  padding: 8px 14px;
  margin: 0 16px;
  align-self: stretch;
  text-align: center;
  flex-shrink: 0;
}

.jk-daily-col { flex: 1; }

.jk-daily-num {
  font-size: var(--type-h2);
  font-weight: 800;
  line-height: 1.1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.jk-daily-label {
  font-size: var(--type-micro);
  color: var(--text-secondary);
  margin-top: 2px;
  font-weight: 600;
}

.jk-daily-sep {
  width: 1px;
  height: 28px;
  background: var(--bg-surface);
}

.jk-hearts-float {
  position: relative;
  height: 0;
  width: 140px;
}

.jk-float-heart {
  position: absolute;
  font-size: var(--type-h2);
  animation: heartFloatUp 1s ease-out forwards;
  pointer-events: none;
}

@keyframes heartFloatUp {
  0% { opacity: 1; transform: translateY(0) scale(0.5); }
  50% { opacity: 1; transform: translateY(-30px) scale(1); }
  100% { opacity: 0; transform: translateY(-60px) scale(0.8); }
}

.jk-name-row {
  text-align: center;
  align-self: stretch;
  margin: 0 16px;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 2px solid var(--color-primary);
  border-bottom: 4px solid var(--color-primary-dark);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(139, 26, 74, 0.12);
  flex-shrink: 0;
}

.jk-name {
  font-family: var(--font-display); font-weight: 800;
  font-size: var(--type-h2);
  color: var(--text-primary);
  display: block;
  margin-bottom: 2px;
}

.jk-status-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.jk-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.jk-status-label {
  font-size: var(--type-body-sm);
  font-weight: 700;
}

.jk-status-stage {
  font-size: var(--type-caption);
  color: var(--text-secondary);
}

.jk-status-desc {
  font-size: var(--type-caption);
  color: var(--text-tertiary);
  margin-top: 2px;
  text-align: center;
}

/* Bars */
.jk-bars {
  width: 100%;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.jk-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.jk-bar-label {
  font-size: var(--type-micro);
  font-weight: 700;
  color: var(--text-secondary);
  width: 44px;
  text-align: right;
}

.jk-bar-track {
  flex: 1;
  height: 14px;
  border-radius: 8px;
  background: var(--bg-progress-track);
  overflow: hidden;
}

.jk-bar-fill-hunger {
  background: linear-gradient(90deg, #FF9600, #FFC800);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.1), inset 0 2px 0 rgba(255,255,255,0.3);
  transition: width 0.5s ease;
}

.jk-bar-fill-joy {
  background: linear-gradient(90deg, #FFC800, #FFE047);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.1), inset 0 2px 0 rgba(255,255,255,0.3);
  transition: width 0.5s ease;
}

.jk-bar-pct {
  font-size: var(--type-micro);
  font-weight: 700;
  color: var(--text-primary);
  width: 30px;
}

/* Actions grid */
.jk-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  max-width: 280px;
  margin-top: 2px;
  flex-shrink: 0;
}

.jk-action-card {
  background: var(--bg-card);
  border: 2px solid var(--border-card);
  border-bottom: 4px solid var(--border-card-bottom);
  border-radius: 16px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: transform 100ms ease, border-bottom-width 100ms ease;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: var(--touch-min);
  transition: transform var(--transition-fast);
}

.jk-action-card:active { border-bottom-width: 2px; transform: translateY(2px); }
.jk-action-card.disabled { opacity: 0.5; pointer-events: none; }

.jk-action-emoji { font-size: var(--type-h2); }
.jk-action-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  display: block;
  margin: 0 auto 2px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
  pointer-events: none;
}
.jk-action-name { font-size: var(--type-body-sm); font-weight: 700; color: var(--text-primary); }
.jk-action-sub { font-size: var(--type-micro); color: var(--text-secondary); }

/* ============================
   JAMCHIK AVATAR (CSS)
   ============================ */
.jk-avatar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Idle life: gentle breathing pulse on the whole avatar.
   3% scale so hat/accessory move naturally with the body. */
.jamchik-alive {
  animation: jamchikBreathe 3s ease-in-out infinite;
  transform-origin: bottom center;
  will-change: transform;
}

@keyframes jamchikBreathe {
  0%, 100% { transform: scaleX(1) scaleY(1); }
  50%      { transform: scaleX(1.03) scaleY(0.97); }
}

@media (prefers-reduced-motion: reduce) {
  .jamchik-alive { animation: none; }
}

.jk-body {
  border-radius: 50% 50% 50% 42%;
  background: radial-gradient(circle at 40% 35%, #D4537E, #8B1A4A 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 16px rgba(139, 26, 74, 0.25);
}

.jk-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: -8px;
}

.jk-eyes {
  display: flex;
  gap: 16px;
}

.jk-eye {
  background: var(--bg-card);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.jk-eye-big { transform: scale(1.2); }

.jk-eye-star::after {
  content: '✦';
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: var(--type-micro);
  color: var(--color-gold);
  animation: sparkleRotate 1.5s linear infinite;
}

@keyframes sparkleRotate {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.3); }
  100% { transform: rotate(360deg) scale(1); }
}

.jk-pupil {
  background: #2D2D2D;
  border-radius: 50%;
}

.jk-eye-squint {
  background: var(--bg-card);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.jk-eye-closed {
  height: 3px;
  background: var(--bg-card);
  border-radius: 2px;
}

.jk-sparkle {
  position: absolute;
  top: -3px;
  right: -3px;
  font-size: var(--type-micro);
  color: var(--color-gold);
}

/* Cheeks */
.jk-cheeks {
  display: flex;
  gap: 32px;
  margin-top: -4px;
}

.jk-cheek {
  width: 12px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 150, 180, 0.5);
}

/* Mouth */
.jk-mouth { position: relative; }

.jk-mouth-wide {
  width: 20px;
  height: 10px;
  border-bottom: 3px solid #FFFFFF;
  border-radius: 0 0 50% 50%;
  background: rgba(255,255,255,0.15);
}

.jk-mouth-smile {
  width: 16px;
  height: 8px;
  border-bottom: 2px solid #FFFFFF;
  border-radius: 0 0 50% 50%;
}

.jk-mouth-o {
  width: 10px;
  height: 10px;
  border: 2px solid #FFFFFF;
  border-radius: 50%;
}

.jk-mouth-flat {
  width: 14px;
  height: 0;
  border-top: 2px solid rgba(255,255,255,0.6);
}

.jk-mouth-frown {
  width: 16px;
  height: 8px;
  border-top: 2px solid #FFFFFF;
  border-radius: 50% 50% 0 0;
}

.jk-mouth-wobble {
  width: 14px;
  height: 0;
  border-top: 2px solid rgba(255,255,255,0.6);
  animation: wobble 0.8s ease-in-out infinite;
}

@keyframes wobble {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

/* ZZZ */
.jk-zzz {
  position: absolute;
  right: -10px;
  top: 20%;
  font-size: var(--type-micro);
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  letter-spacing: 2px;
  animation: zzzFloat 2s ease-in-out infinite;
}

@keyframes zzzFloat {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 0.7; transform: translateY(-6px); }
}

/* Evolution badges */
.jk-evo-badge {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
}

.jk-evo-teen {
  width: 14px;
  height: 8px;
  background: var(--color-primary-light);
  border-radius: 50% 50% 0 0;
  border: 1px solid rgba(255,255,255,0.4);
}

.jk-evo-adult::before {
  content: '👑';
  font-size: var(--type-body);
}

/* Avatar animations */
.jk-breathe {
  animation: breathe 3s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.jk-wobble {
  animation: jkWobble 2s ease-in-out infinite;
}

@keyframes jkWobble {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-3deg) scale(1.02); }
  75% { transform: rotate(3deg) scale(1.02); }
}

.jk-sleepy {
  animation: sleepyBreath 4s ease-in-out infinite;
}

@keyframes sleepyBreath {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.015); }
}

.jk-bounce {
  animation: petBounce 600ms ease-out !important;
}

@keyframes petBounce {
  0% { transform: translateY(0); }
  30% { transform: translateY(-20px); }
  50% { transform: translateY(0); }
  70% { transform: translateY(-8px); }
  100% { transform: translateY(0); }
}

/* ============================
   HATS (CSS shapes — mini + full)
   ============================ */
.jk-hat {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

.hat-crown { width: 36px; height: 18px; background: var(--color-gold); clip-path: polygon(0% 100%, 10% 30%, 25% 70%, 50% 0%, 75% 70%, 90% 30%, 100% 100%); }
.hat-party { width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent; border-bottom: 28px solid #FF6B35; position: relative; }
.hat-party::after { content: ''; position: absolute; top: -6px; left: -3px; width: 6px; height: 6px; border-radius: 50%; background: var(--color-gold); }
.hat-top { width: 30px; height: 24px; background: #2D2D2D; border-radius: 2px 2px 0 0; position: relative; }
.hat-top::after { content: ''; position: absolute; bottom: 0; left: -6px; width: 42px; height: 4px; background: #2D2D2D; border-radius: 2px; }
.hat-beret { width: 34px; height: 14px; background: #E24B4A; border-radius: 50% 50% 20% 20%; }
.hat-cap { width: 30px; height: 14px; background: #2196F3; border-radius: 8px 8px 0 0; position: relative; }
.hat-cap::after { content: ''; position: absolute; bottom: 0; right: -8px; width: 20px; height: 4px; background: #2196F3; border-radius: 0 4px 4px 0; }
.hat-wizard { width: 0; height: 0; border-left: 16px solid transparent; border-right: 16px solid transparent; border-bottom: 34px solid #7B1FA2; position: relative; }
.hat-wizard::after { content: '⭐'; position: absolute; top: 10px; left: -4px; font-size: var(--type-micro); }
.hat-santa { width: 28px; height: 22px; background: #E24B4A; border-radius: 4px 12px 0 0; position: relative; }
.hat-santa::after { content: ''; position: absolute; top: -4px; right: -2px; width: 8px; height: 8px; background: #fff; border-radius: 50%; }
.hat-bunny { display: flex; gap: 8px; position: relative; top: -20px; }
.hat-bunny::before, .hat-bunny::after { content: ''; width: 10px; height: 24px; background: #FFB6C1; border-radius: 50%; display: block; }

/* Mini hat previews in shop */
.jk-hat-mini {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.jk-hat-mini.hat-crown { width: 30px; height: 16px; margin: auto; }
.jk-hat-mini.hat-party { margin: 6px auto; border-bottom-width: 24px; border-left-width: 12px; border-right-width: 12px; }
.jk-hat-mini.hat-top { width: 24px; height: 20px; margin: auto; }
.jk-hat-mini.hat-beret { width: 28px; height: 12px; margin: auto; }
.jk-hat-mini.hat-cap { width: 24px; height: 12px; margin: auto; }
.jk-hat-mini.hat-wizard { margin: 4px auto; border-bottom-width: 28px; border-left-width: 12px; border-right-width: 12px; }
.jk-hat-mini.hat-santa { width: 24px; height: 18px; margin: auto; }
.jk-hat-mini.hat-bunny { margin: auto; top: -4px; }
.jk-hat-mini.acc-glasses { width: 30px; height: 12px; background: transparent; border: 2px solid #2D2D2D; border-radius: 50%; margin: auto; position: relative; }
.jk-hat-mini.acc-glasses::after { content: ''; position: absolute; left: -3px; top: 4px; width: 6px; height: 2px; background: #2D2D2D; }
.jk-hat-mini.acc-bowtie { width: 0; height: 0; border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-left: 12px solid var(--color-primary); margin: auto; position: relative; }
.jk-hat-mini.acc-bowtie::after { content: ''; position: absolute; top: -8px; left: 0; width: 0; height: 0; border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-right: 12px solid var(--color-primary); }
.jk-hat-mini.acc-scarf { width: 30px; height: 8px; background: var(--color-coral); border-radius: 4px; margin: auto; position: relative; }
.jk-hat-mini.acc-scarf::after { content: ''; position: absolute; right: 2px; top: 8px; width: 8px; height: 14px; background: var(--color-coral); border-radius: 0 0 4px 4px; }
.jk-hat-mini.acc-necklace { width: 20px; height: 20px; border: 2px solid var(--color-gold); border-radius: 50%; border-top: none; margin: auto; position: relative; }
.jk-hat-mini.acc-necklace::after { content: '💎'; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%); font-size: var(--type-micro); }

/* Accessories on avatar */
.jk-acc {
  position: absolute;
  z-index: 5;
}

.jk-acc.acc-glasses { top: 38%; left: 50%; transform: translateX(-50%); width: 36px; height: 14px; border: 2px solid rgba(255,255,255,0.8); border-radius: 50%; }
.jk-acc.acc-bowtie { bottom: 15%; left: 50%; transform: translateX(-50%); width: 16px; height: 10px; background: var(--color-primary-light); clip-path: polygon(0% 50%, 35% 0%, 35% 100%, 50% 50%, 65% 0%, 65% 100%, 100% 50%); }
.jk-acc.acc-scarf { bottom: 8%; left: 50%; transform: translateX(-50%); width: 50px; height: 6px; background: var(--color-coral); border-radius: 3px; }
.jk-acc.acc-necklace { bottom: 12%; left: 50%; transform: translateX(-50%); width: 30px; height: 14px; border: 2px solid var(--color-gold); border-radius: 0 0 50% 50%; border-top: none; }

/* ============================
   SHOP
   ============================ */
.screen-shop {
  padding: 0 16px 100px;
  padding-top: calc(12px + env(safe-area-inset-top));
}

.shop-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.shop-header h2 { flex: 1; }

.shop-preview {
  text-align: center;
  margin-bottom: 16px;
}

.shop-preview-avatar {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
  transform: scale(0.7);
  transform-origin: center;
}

.shop-preview-hint {
  font-size: var(--type-caption);
  color: var(--text-tertiary);
}

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

.shop-item-card {
  background: var(--bg-card);
  border: 2px solid var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 10px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: var(--touch-min);
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.shop-item-card:active { transform: scale(0.95); }
.shop-item-card.selected { border-color: var(--color-primary); }
.shop-item-card.equipped { border-color: var(--color-blue); }
.shop-item-card.no-afford { opacity: 0.6; }

.shop-item-preview {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shop-item-name {
  font-size: var(--type-micro);
  font-weight: 700;
  color: var(--text-primary);
}

.shop-item-price {
  font-size: var(--type-caption);
  color: var(--color-primary);
  font-weight: 700;
}

.shop-item-no-afford { color: var(--text-tertiary); }
.shop-item-owned { font-size: var(--type-micro); color: var(--color-green); font-weight: 700; }
.shop-item-equipped { font-size: var(--type-micro); color: var(--color-blue); font-weight: 700; }

.shop-action-area {
  position: fixed;
  bottom: 60px;
  left: 0;
  right: 0;
  padding: 12px 16px;
  padding-bottom: 12px;
  background: var(--bg-main);
  z-index: 10;
  display: flex;
  justify-content: center;
}

.shop-action-area .btn { max-width: 428px; }

/* ============================
   PROFILE
   ============================ */
.screen-profile {
  padding: 0;
}

.profile-hero-frame {
  position: relative;
  width: 100%;
  padding: 0 0 4px;
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 55%, var(--color-primary-light) 100%);
  border-radius: 0 0 28px 28px;
  padding-top: env(safe-area-inset-top);
}

.profile-hero {
  position: relative;
  width: 100%;
  border-radius: 0 0 24px 24px;
  overflow: hidden;
  background: #000;
}

.profile-hero-gif {
  display: block;
  width: 100%;
  height: 280px;
  object-fit: cover;
  object-position: center;
}

.profile-hero-gif-dark { display: none; }
[data-theme="dark"] .profile-hero-gif-light { display: none; }
[data-theme="dark"] .profile-hero-gif-dark { display: block; }

.profile-identity {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  text-align: center;
  padding: 10px 22px;
  min-width: 180px;
  max-width: calc(100% - 32px);
  background: var(--bg-card);
  border: 2px solid var(--color-primary-dark);
  border-bottom: 4px solid var(--color-primary-dark);
  border-radius: 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.profile-gear {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 50%;
  backdrop-filter: blur(6px);
}


.profile-username {
  color: var(--text-primary);
  font-size: var(--type-h2);
  font-weight: 800;
  margin-bottom: 2px;
}

.profile-joined {
  color: var(--text-secondary);
  font-size: var(--type-caption);
  font-weight: 600;
}

.profile-body {
  padding: 14px 16px 100px;
  margin-top: -16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-stats-card {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 16px 8px;
}

.profile-stat-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.profile-stat-num {
  font-family: var(--font-display);
  font-size: var(--type-h1);
  font-weight: 800;
  line-height: 1.1;
}
.profile-stat-icon {
  margin-bottom: 4px;
}

.profile-stat-label {
  font-size: var(--type-micro);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.profile-stat-divider {
  width: 1px;
  height: 32px;
  background: var(--bg-surface);
}

/* League card */
.profile-league-card {
  padding: 12px;
}

.profile-league-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--type-body-sm);
  font-weight: 700;
  margin-bottom: 10px;
}
.profile-league-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--type-body);
  font-weight: 800;
}
.profile-league-icon {
  /* Slight lift so the trophy sits above the text baseline visually. */
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.profile-rank-badge {
  background: var(--color-primary);
  color: #fff;
  font-size: var(--type-caption);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.profile-week-chart {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  height: 54px;
  gap: 4px;
}

.profile-week-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
}

.profile-week-bar {
  width: 100%;
  background: var(--bg-surface);
  border-radius: 3px;
  min-height: 4px;
  transition: height 300ms ease;
}

.profile-week-bar.active {
  background: var(--color-primary);
}

.profile-week-day {
  font-size: var(--type-micro);
  color: var(--text-tertiary);
  font-weight: 700;
}

/* Daily goal selector */
.profile-goal-card {
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.profile-goal-title {
  font-size: var(--type-body-sm);
  font-weight: 700;
  color: var(--text-primary);
}

.profile-goal-options {
  display: flex;
  gap: 6px;
}

.profile-goal-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: var(--type-body-sm);
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.profile-goal-btn.active {
  background: var(--color-primary);
  color: #FFFFFF;
}

/* Stats table */
.profile-stats-table {
  padding: 12px;
}

.profile-section-title {
  font-size: var(--type-caption);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

/* Premium banner */
.profile-premium-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #FFD700, #FFA000);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  border: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
  transition: transform var(--transition-fast);
}

.profile-premium-banner:active { transform: scale(0.98); }

.profile-premium-title {
  display: block;
  font-weight: 700;
  font-size: var(--type-body-sm);
  color: var(--text-primary);
}

.profile-premium-sub {
  display: block;
  font-size: var(--type-caption);
  color: rgba(0,0,0,0.6);
}

.profile-premium-price {
  background: #FFFFFF;
  color: var(--color-primary);
  font-size: var(--type-caption);
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* Profile links */
.profile-links {
  padding: 4px 0;
}

.profile-links .stat-row {
  padding: 12px;
  cursor: pointer;
}

/* ============================
   SETTINGS
   ============================ */
.screen-settings {
  padding: 0 16px 100px;
  padding-top: calc(12px + env(safe-area-inset-top));
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.settings-note {
  font-size: var(--type-caption);
  color: var(--text-hint);
  padding: 4px 16px 0;
  margin: 0;
}

.settings-section-label {
  font-size: var(--type-micro);
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 1px;
  margin: 16px 0 6px 4px;
}

.settings-card {
  padding: 0;
}

.settings-card .stat-row {
  padding: 12px;
}

.settings-val {
  font-size: var(--type-body-sm);
  color: var(--text-secondary);
}

.settings-val-grey {
  font-size: var(--type-body-sm);
  color: var(--text-tertiary);
}

.settings-connected {
  font-size: var(--type-micro);
  font-weight: 700;
  color: var(--color-green);
  background: #E8F5E9;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  margin-right: 4px;
}

.settings-upgrade-btn {
  background: linear-gradient(135deg, #FFD700, #FFA000);
  color: var(--text-primary);
  font-weight: 700;
  font-size: var(--type-caption);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
}

/* Toggle rows */
.settings-toggle-row {
  display: flex;
  align-items: center;
  padding: 12px;
  border-bottom: var(--border-light);
}

.settings-toggle-row.last {
  border-bottom: none;
}

.settings-toggle-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.settings-toggle-label {
  font-size: var(--type-body-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.settings-toggle-sub {
  font-size: var(--type-micro);
  color: var(--text-tertiary);
}

/* Toggle switch */
.settings-toggle {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: #CCC;
  border: none;
  cursor: pointer;
  position: relative;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.settings-toggle.on {
  background: var(--color-primary);
}

.settings-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-card);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform var(--transition-fast);
}

.settings-toggle.on .settings-toggle-thumb {
  transform: translateX(18px);
}

/* Danger card */
.settings-danger {
  cursor: pointer;
}

.settings-danger .stat-row {
  padding: 12px;
}

.settings-footer {
  text-align: center;
  font-size: var(--type-micro);
  color: var(--text-tertiary);
  margin-top: 24px;
  padding-bottom: 12px;
}

/* Tappable rows (used by the new <a> rows in About) */
.settings-card .stat-row.tappable {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background 120ms ease;
}
.settings-card .stat-row.tappable:hover,
.settings-card .stat-row.tappable:active {
  background: #FBE9F0;
}

/* Daily goal selector */
.settings-goal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-card, #F0E0EB);
  min-height: 52px;
}
.settings-goal-options {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}
.settings-goal-chip {
  appearance: none;
  border: 1.5px solid #F0E0EB;
  background: #ffffff;
  color: #555;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: var(--type-body-sm);
  min-width: 36px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease, transform 80ms ease;
}
.settings-goal-chip:active { transform: scale(0.96); }
.settings-goal-chip.selected {
  background: #8B1A4A;
  border-color: #8B1A4A;
  color: #ffffff;
}

/* Full-width outlined action buttons (Clear cache / Reset progress) */
.settings-action-btn {
  appearance: none;
  display: block;
  width: 100%;
  padding: 12px 16px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: var(--type-body);
  color: #8B1A4A;
  background: #ffffff;
  border: 1.5px solid #8B1A4A;
  border-radius: 12px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
  margin-bottom: 10px;
}
.settings-action-btn:last-child { margin-bottom: 0; }
.settings-action-btn:hover { background: #FBE9F0; }
.settings-action-btn:active { background: #F5DDE8; }
.settings-action-btn.settings-action-danger {
  color: #E24B4A;
  border-color: #E24B4A;
}
.settings-action-btn.settings-action-danger:hover { background: #FDE8E8; }
.settings-action-btn.settings-action-danger:active { background: #F8D3D3; }

/* Modal — confirm / rename / reset-type */
.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.settings-modal.open {
  opacity: 1;
  pointer-events: auto;
}
.settings-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.settings-modal-card {
  position: relative;
  background: #ffffff;
  border-radius: 16px;
  padding: 20px 20px 16px;
  width: calc(100% - 48px);
  max-width: 360px;
  box-shadow: 0 20px 40px rgba(139, 26, 74, 0.25);
  animation: settingsModalIn 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.settings-modal:not(.open) .settings-modal-card {
  transform: scale(0.95);
  opacity: 0;
}
@keyframes settingsModalIn {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.settings-modal-title {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: var(--type-section);
  color: #8B1A4A;
  margin: 0 0 8px;
}
.settings-modal-body {
  font-family: 'Nunito', sans-serif;
  font-weight: 500;
  font-size: var(--type-body-sm);
  color: #555;
  line-height: 1.4;
  margin: 0 0 16px;
}
.settings-modal-body strong {
  color: #E24B4A;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.settings-modal-input {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid #F0E0EB;
  background: #FFF7FB;
  border-radius: 10px;
  padding: 10px 12px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: var(--type-body);
  color: #333;
  margin-bottom: 16px;
  outline: none;
  transition: border-color 120ms ease;
}
.settings-modal-input:focus { border-color: #8B1A4A; }
.settings-modal-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.settings-modal-cancel {
  flex: 1 1 auto;
}
.settings-modal-confirm {
  flex: 0 1 auto;
  padding: 10px 14px;
  background: #ffffff;
  color: #555;
  border: 1.5px solid #D6C3CF;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  border-radius: 10px;
  font-size: var(--type-body-sm);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.settings-modal-confirm:hover:not(:disabled) { background: #F5DDE8; }
.settings-modal-confirm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.settings-modal-confirm.settings-modal-danger {
  color: #E24B4A;
  border-color: #E24B4A;
}
.settings-modal-confirm.settings-modal-danger:hover:not(:disabled) { background: #FDE8E8; }

/* Toast */
.settings-toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #333;
  color: #ffffff;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: var(--type-body-sm);
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: opacity 220ms ease, transform 220ms ease;
  z-index: 250;
  pointer-events: none;
}
.settings-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .settings-modal-card,
  .settings-goal-chip,
  .settings-action-btn,
  .settings-toast { animation: none !important; transition: none !important; }
}

/* ============================
   LEADERBOARD
   ============================ */
.screen-leaderboard {
  padding: 0 16px 100px;
  padding-top: calc(12px + env(safe-area-inset-top));
}

.lb-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.lb-title-area {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.lb-league-name {
  font-family: var(--font-display); font-weight: 800;
  font-size: var(--type-body);
}

.lb-week {
  font-size: var(--type-caption);
  color: var(--text-secondary);
}

.lb-zones {
  margin-bottom: 6px;
}

.lb-zone-label {
  font-size: var(--type-micro);
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.lb-zone-promo {
  background: #E8F5E9;
  color: var(--color-green);
}

.lb-zone-demo {
  background: #FFEBEE;
  color: var(--color-red);
}

.lb-zone-divider {
  height: 1px;
  background: var(--bg-surface);
  margin: 6px 0;
}

.lb-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  min-height: var(--touch-min);
  background: var(--bg-card);
  border: 1px solid transparent;
}

.lb-row.user {
  border: 2px solid var(--color-primary);
  background: var(--bg-main);
}

.lb-row.promo {
  border-left: 3px solid var(--color-green);
}

.lb-row.demo {
  border-left: 3px solid var(--color-red);
  opacity: 0.7;
}

.lb-rank {
  font-size: var(--type-caption);
  font-weight: 700;
  color: var(--text-secondary);
  width: 32px;
  text-align: center;
}

.lb-rank.top3 {
  font-size: var(--type-body);
}

.lb-avatar {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--type-micro);
  font-weight: 700;
  color: #FFFFFF;
}

.lb-name {
  flex: 1;
  font-size: var(--type-body-sm);
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-xp {
  font-size: var(--type-caption);
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ============================
   PAYWALL
   ============================ */
.screen-paywall {
  padding: 24px;
  padding-top: calc(16px + env(safe-area-inset-top));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.pw-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
  z-index: 10;
}

.pw-hero {
  text-align: center;
  margin-bottom: 20px;
  margin-top: 20px;
}

.pw-avatar-glow {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 16px rgba(255, 215, 0, 0.4));
  transform: scale(0.9);
}

.pw-title {
  font-family: var(--font-display); font-weight: 800;
  font-size: var(--type-h2);
  color: var(--color-primary);
  margin-bottom: 4px;
}

.pw-subtitle {
  font-size: var(--type-body-sm);
  color: var(--text-secondary);
}

.pw-benefits {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.pw-benefit {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pw-benefit-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--type-section);
}

.pw-benefit-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.pw-benefit-label {
  font-size: var(--type-body-sm);
  font-weight: 700;
  color: var(--text-primary);
}

.pw-benefit-desc {
  font-size: var(--type-caption);
  color: var(--text-secondary);
}

.pw-plans {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 340px;
  margin-bottom: 16px;
}

.pw-plan-card {
  flex: 1;
  background: var(--bg-card);
  border: 2px solid var(--bg-surface);
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: border-color var(--transition-fast);
  font-family: var(--font-body);
  position: relative;
}

.pw-plan-card.selected {
  border-color: var(--color-primary);
}

.pw-plan-annual.selected {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.pw-plan-annual.selected .pw-plan-name,
.pw-plan-annual.selected .pw-plan-price,
.pw-plan-annual.selected .pw-plan-save {
  color: #FFFFFF;
}

.pw-plan-best {
  font-size: var(--type-micro);
  font-weight: 700;
  color: var(--text-primary);
  background: var(--color-gold);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  position: absolute;
  top: -8px;
  right: 8px;
}

.pw-plan-name {
  font-size: var(--type-body-sm);
  font-weight: 700;
  color: var(--text-primary);
}

.pw-plan-price {
  font-size: var(--type-body);
  font-weight: 700;
  color: var(--color-primary);
}

.pw-plan-save {
  font-size: var(--type-micro);
  color: var(--text-secondary);
}

.pw-cta-btn {
  width: 100%;
  max-width: 340px;
  min-height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #FFD700, #FFA000);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--type-body);
  border: none;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.pw-cta-btn:active { transform: scale(0.97); }

.pw-fine {
  font-size: var(--type-micro);
  color: var(--text-tertiary);
  margin-top: 8px;
  text-align: center;
}

.pw-restore {
  font-size: var(--type-caption);
  color: var(--color-primary);
  background: none;
  border: none;
  cursor: pointer;
  margin-top: 12px;
  font-family: var(--font-body);
  font-weight: 600;
}

.pw-celebrate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80dvh;
  text-align: center;
}

/* =====================================================
   Jamchik voice bubble (.jv-*)
   Static character speech bubble used on task, hub, etc.
   ===================================================== */
.jv-mount {
  min-height: 0;
}

.jv-container {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  margin: 8px 16px;
  animation: jvFadeUp 300ms ease-out;
}

.jv-avatar-wrap {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.jv-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.jv-avatar.jk-fallback {
  background: var(--color-primary-light, #d97aa8);
  border-radius: 50%;
}

.jv-bubble {
  background: #ffffff;
  border: 1px solid #F0E0EB;
  border-radius: 12px;
  padding: 10px 14px;
  position: relative;
  max-width: calc(100% - 58px);
  box-shadow: 0 1px 2px rgba(139, 26, 74, 0.04);
}

.jv-bubble::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 14px;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border-left: 1px solid #F0E0EB;
  border-bottom: 1px solid #F0E0EB;
  transform: rotate(45deg);
}

.jv-text {
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: var(--type-body-sm);
  color: #555;
  line-height: 1.4;
  margin: 0;
}

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

@keyframes jvFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.jv-container.jv-dismiss {
  animation: jvFadeOut 500ms ease-out forwards;
}

/* Hub-screen overlay — pinned near the factory image. */
.jv-hub-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  z-index: 5;
  pointer-events: none;
}

.jv-hub-overlay .jv-container {
  pointer-events: auto;
  margin: 0 12px;
}

/* =====================================================
   Micro-animations (.ma-*)
   Visceral feedback on every answer. CSS-driven, minimal JS.
   ===================================================== */

/* --- Correct MC option: green ring burst + bounce ------ */
.task-mc-option.ma-correct-burst {
  position: relative;
  animation: maCorrectBounce 260ms ease-out;
  border-color: #58CC02;
  background: #EAFBE6;
}
.task-mc-option.ma-correct-burst::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 18px;
  border: 3px solid rgba(88, 204, 2, 0.55);
  animation: maCorrectRing 420ms ease-out forwards;
  pointer-events: none;
  will-change: transform, opacity;
}
@keyframes maCorrectRing {
  from { transform: scale(0.95); opacity: 1; }
  to   { transform: scale(1.3); opacity: 0; }
}
@keyframes maCorrectBounce {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* Checkmark pop inside the radio dot (plays on the already-stamped SVG) */
.task-mc-radio.ma-check-stamp {
  animation: maCheckStamp 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes maCheckStamp {
  0%   { transform: scale(0);    opacity: 0; }
  60%  { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1);    opacity: 1; }
}

/* Floating "+N XP" — fixed-position so it works anywhere on screen */
.ma-xp-float {
  position: fixed;
  transform: translateX(-50%);
  color: #FFD700;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: var(--type-body);
  text-shadow: 0 1px 3px rgba(0,0,0,0.35), 0 0 10px rgba(255, 215, 0, 0.35);
  pointer-events: none;
  z-index: 60;
  will-change: transform, opacity;
  animation: maXpFloat 820ms ease-out forwards;
  white-space: nowrap;
}
@keyframes maXpFloat {
  0%   { opacity: 1; transform: translateX(-50%) translateY(0); }
  80%  { opacity: 1; transform: translateX(-50%) translateY(-52px); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-60px); }
}

/* --- Wrong: shake the task body card ------------------- */
.task-body.ma-wrong-shake,
.ma-wrong-shake {
  animation: maWrongShake 360ms ease-out;
}
@keyframes maWrongShake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-6px); }
  30% { transform: translateX(6px); }
  50% { transform: translateX(-4px); }
  70% { transform: translateX(4px); }
  85% { transform: translateX(-2px); }
}

/* Red wrong flash on selected option */
.task-mc-option.ma-wrong-flash {
  border-color: #E24B4A !important;
  background: #FDE8E8;
}

/* Green hint pulse on the correct option after a wrong answer */
.task-mc-option.ma-correct-hint {
  position: relative;
  animation: maCorrectHint 600ms ease-out;
}
@keyframes maCorrectHint {
  0%   { box-shadow: 0 0 0 0 rgba(88, 204, 2, 0.6); }
  50%  { box-shadow: 0 0 0 8px rgba(88, 204, 2, 0.15); }
  100% { box-shadow: 0 0 0 0 rgba(88, 204, 2, 0); }
}

/* --- IDK: gentle dim, no punishment -------------------- */
.task-body.ma-idk-dim {
  opacity: 0.6;
  transition: opacity 300ms ease-out;
}

/* --- Numeric input feedback ---------------------------- */
.task-input.ma-input-correct {
  border-color: #58CC02 !important;
  animation: maCorrectBounce 260ms ease-out;
}
.task-input.ma-input-wrong {
  border-color: #E24B4A !important;
  animation: maInputShake 360ms ease-out;
}
@keyframes maInputShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

/* --- Session streak badge ---------------------------------
   Anchored inside .task-question-area (position:relative). Flag is 44px
   wide at right:0; mount sits at right:52px so the badge hugs the left
   edge of the flag with an 8px gap. Identical markup across all units. */
.ma-streak-mount {
  position: absolute;
  top: 6px;
  right: 52px;
  z-index: 5;
  pointer-events: none;
  display: flex;
  justify-content: flex-end;
}
.ma-streak-badge {
  background: linear-gradient(135deg, #FF6B35, #FFD700);
  color: white;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: var(--type-body-sm);
  padding: 4px 12px;
  border-radius: 50px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
  animation: maStreakAppear 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  transform-origin: right center;
  will-change: transform, opacity;
}
.ma-streak-badge.hot {
  font-size: var(--type-body);
  box-shadow: 0 2px 12px rgba(255, 107, 53, 0.5);
  animation:
    maStreakAppear 400ms cubic-bezier(0.34, 1.56, 0.64, 1),
    maStreakPulse 1s ease-in-out 400ms infinite;
}
.ma-streak-badge.blazing {
  font-size: var(--type-section);
  background: linear-gradient(135deg, #FF4500, #FFD700, #FF6B35);
  background-size: 200% 200%;
  animation:
    maStreakAppear 400ms cubic-bezier(0.34, 1.56, 0.64, 1),
    maStreakFire 1.5s ease 400ms infinite,
    maStreakPulse 0.8s ease-in-out 400ms infinite;
}
.ma-streak-badge.ma-streak-dismiss {
  animation: maStreakDismiss 300ms ease-out forwards;
}
@keyframes maStreakAppear {
  from { transform: scale(0) rotate(-20deg); opacity: 0; }
  to   { transform: scale(1) rotate(0);      opacity: 1; }
}
@keyframes maStreakDismiss {
  from { transform: scale(1);   opacity: 1; }
  to   { transform: scale(0.5); opacity: 0; }
}
@keyframes maStreakPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}
@keyframes maStreakFire {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.ma-streak-num {
  display: inline-block;
}
.ma-streak-num.ma-pop {
  animation: maNumPop 220ms ease-out;
}
@keyframes maNumPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}
.ma-streak-plus {
  position: absolute;
  top: -4px;
  right: 10px;
  color: #FFD700;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: var(--type-caption);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  pointer-events: none;
  animation: maStreakPlus 620ms ease-out forwards;
}
@keyframes maStreakPlus {
  0%   { opacity: 0; transform: translateY(0); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-22px); }
}

/* --- Combo flash --------------------------------------- */
.ma-combo-flash {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  pointer-events: none;
  text-align: center;
}
.ma-combo-text {
  display: inline-block;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: var(--type-h1);
  color: #FFD700;
  background: rgba(0, 0, 0, 0.35);
  padding: 12px 24px;
  border-radius: 999px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.35), 0 0 20px rgba(255, 215, 0, 0.35);
  animation: maComboFlash 1000ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  will-change: transform, opacity;
}
.ma-combo-text.ma-combo-big {
  font-size: var(--type-h1);
}
@keyframes maComboFlash {
  0%   { transform: scale(0.5); opacity: 0; }
  30%  { transform: scale(1.15); opacity: 1; }
  70%  { transform: scale(1);    opacity: 1; }
  100% { transform: scale(1);    opacity: 0; }
}

.ma-screen-flash {
  position: fixed;
  inset: 0;
  background: white;
  opacity: 0;
  z-index: 99;
  pointer-events: none;
  animation: maScreenFlash 240ms ease-out forwards;
}
@keyframes maScreenFlash {
  0%   { opacity: 0.12; }
  100% { opacity: 0; }
}

/* --- Progress bar shimmer + gold flash + particles ----- */
.progress-fill.ma-progress-host {
  position: relative;
  overflow: hidden;
  transition: width 400ms ease-out, background 400ms ease-out;
}
.ma-progress-shimmer {
  position: absolute;
  top: 0;
  left: -50%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.45), transparent);
  animation: maProgressShimmer 620ms ease-out forwards;
  pointer-events: none;
}
@keyframes maProgressShimmer {
  from { left: -60%; }
  to   { left: 110%; }
}

.progress-fill.ma-progress-gold {
  animation: maProgressGold 520ms ease-out;
}
@keyframes maProgressGold {
  0%, 100% { filter: none; }
  50%      { filter: hue-rotate(-30deg) saturate(1.4) brightness(1.15); }
}

.ma-progress-particle {
  position: fixed;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #FFD700;
  box-shadow: 0 0 6px rgba(255, 215, 0, 0.85);
  pointer-events: none;
  z-index: 30;
  opacity: 0;
  animation: maParticleBurst 720ms ease-out forwards;
  will-change: transform, opacity;
}
@keyframes maParticleBurst {
  0%   { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx, 0), var(--dy, -30px)) scale(0.3); }
}

@media (prefers-reduced-motion: reduce) {
  .task-mc-option.ma-correct-burst,
  .task-mc-option.ma-correct-burst::after,
  .task-mc-option.ma-correct-hint,
  .task-body.ma-wrong-shake,
  .ma-wrong-shake,
  .task-input.ma-input-correct,
  .task-input.ma-input-wrong,
  .ma-streak-badge,
  .ma-streak-badge.hot,
  .ma-streak-badge.blazing,
  .ma-combo-text,
  .ma-screen-flash,
  .ma-progress-shimmer,
  .progress-fill.ma-progress-gold,
  .ma-progress-particle,
  .ma-xp-float,
  .ma-streak-plus {
    animation: none !important;
    transition: none !important;
  }
}

/* =====================================================
   First-session experience (.fse-*)
   Post-onboarding interstitial, learn-tab spotlight, first-task tip.
   ===================================================== */

/* --- Post-onboarding interstitial --- */
.fse-interstitial {
  position: fixed;
  inset: 0;
  background: var(--bg-main);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fseFadeIn 400ms ease-out;
  padding: 24px;
  cursor: pointer;
}
.fse-interstitial-leaving {
  animation: fseFadeOut 250ms ease-out forwards;
}
.fse-interstitial-inner {
  max-width: 360px;
  width: 100%;
  text-align: center;
}
.fse-interstitial-avatar {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  animation: fseAvatarPop 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.fse-interstitial-title {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: var(--type-h2);
  color: var(--color-primary);
  margin: 0 0 6px;
  line-height: 1.25;
}

[data-theme="dark"] .fse-interstitial-title {
  color: var(--color-primary-light);
}
.fse-interstitial-sub {
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: var(--type-body);
  color: var(--text-secondary);
  margin: 0 0 14px;
}
.fse-interstitial-hint {
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: var(--type-caption);
  color: var(--text-hint);
  margin: 0;
  letter-spacing: 0.3px;
  text-transform: lowercase;
}
@keyframes fseFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes fseFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}
@keyframes fseAvatarPop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* --- Learn-tab spotlight: pulse + dim + anchored bubble --- */
.unit-node.fse-pulse,
.fse-pulse {
  position: relative;
  z-index: 5;
  animation: fsePulseGlow 1.5s ease-in-out infinite;
  border-radius: 50%;
}
@keyframes fsePulseGlow {
  0%, 100% { box-shadow: 0 0 0 4px rgba(139, 26, 74, 0.22); }
  50%      { box-shadow: 0 0 0 10px rgba(139, 26, 74, 0.35), 0 0 24px rgba(139, 26, 74, 0.25); }
}

.fse-dim {
  opacity: 0.4;
  transition: opacity 300ms ease-out;
  pointer-events: none;
}

.fse-bubble {
  position: fixed;
  transform: translateX(-50%);
  z-index: 60;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 10px 14px;
  max-width: min(240px, calc(100vw - 28px));
  box-shadow: 0 4px 14px rgba(139, 26, 74, 0.15);
  animation: fseBubbleIn 320ms ease-out;
  pointer-events: none;
}
.fse-bubble-leaving {
  animation: fseBubbleOut 240ms ease-out forwards;
}
.fse-bubble-body {
  position: relative;
}
.fse-bubble-tail {
  position: absolute;
  top: -16px;
  left: var(--fse-tail-x, 50%);
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background: var(--bg-card);
  border-left: 1px solid var(--border-card);
  border-top: 1px solid var(--border-card);
  border-top-left-radius: 2px;
  display: block;
  transform-origin: center;
  transform: translateX(-50%) rotate(45deg);
  top: -7px;
}
.fse-bubble-text {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: var(--type-body-sm);
  color: var(--color-primary);
  line-height: 1.35;
  margin: 0;
  text-align: center;
}

[data-theme="dark"] .fse-bubble-text {
  color: var(--color-primary-light);
}
@keyframes fseBubbleIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes fseBubbleOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* --- First-task floating tip --- */
.fse-tip {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 16px;
  right: 16px;
  max-width: 420px;
  margin: 0 auto;
  background: #8B1A4A;
  color: white;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: var(--type-body-sm);
  padding: 10px 16px;
  border-radius: 12px;
  text-align: center;
  z-index: 50;
  box-shadow: 0 4px 14px rgba(139, 26, 74, 0.35);
  animation: fseTipSlide 300ms ease-out;
  cursor: pointer;
}
.fse-tip-leaving {
  animation: fseTipOut 240ms ease-out forwards;
}
@keyframes fseTipSlide {
  from { transform: translateY(-20px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
@keyframes fseTipOut {
  from { transform: translateY(0);     opacity: 1; }
  to   { transform: translateY(-20px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .fse-interstitial,
  .fse-interstitial-leaving,
  .fse-interstitial-avatar,
  .fse-pulse,
  .unit-node.fse-pulse,
  .fse-bubble,
  .fse-bubble-leaving,
  .fse-tip,
  .fse-tip-leaving {
    animation: none !important;
  }
  .fse-dim { transition: none !important; }
}

/* =====================================================
   Share — shared toast, profile share button, streak milestone popup
   ===================================================== */

/* Shared toast (clipboard confirmation) */
.share-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(12px);
  background: #58CC02;
  color: #ffffff;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: var(--type-body-sm);
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(88, 204, 2, 0.35);
  opacity: 0;
  transition: opacity 250ms ease, transform 250ms ease;
  z-index: 260;
  pointer-events: none;
  max-width: calc(100% - 32px);
  text-align: center;
}
.share-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Profile "Share progress" button */
.profile-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  color: #8B1A4A;
  border-color: #8B1A4A;
  font-weight: 700;
}
.profile-share-btn:hover,
.profile-share-btn:active {
  background: #FBE9F0;
}
.profile-share-btn svg { flex: 0 0 auto; }

/* Streak milestone popup */
.streak-milestone-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 220;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}
.streak-milestone-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.streak-milestone-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 24px 22px 18px;
  max-width: 340px;
  width: calc(100% - 48px);
  text-align: center;
  box-shadow: 0 22px 44px rgba(255, 107, 53, 0.25);
  animation: streakMilestoneIn 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.streak-milestone-overlay:not(.open) .streak-milestone-card {
  transform: scale(0.95);
  opacity: 0;
}
@keyframes streakMilestoneIn {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.streak-milestone-jamchik {
  width: 180px;
  max-width: 55%;
  height: auto;
  display: block;
  margin: 0 auto 4px;
}
.streak-milestone-flame {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 10px;
  animation: streakMilestoneFlame 1.2s ease-in-out infinite;
  display: inline-block;
}
@keyframes streakMilestoneFlame {
  0%, 100% { transform: scale(1) rotate(-3deg); }
  50%      { transform: scale(1.08) rotate(3deg); }
}
.streak-milestone-title {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: var(--type-h1);
  color: #FF6B35;
  margin: 0 0 6px;
  background: linear-gradient(135deg, #FF4500, #FFD700);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.streak-milestone-sub {
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: var(--type-body-sm);
  color: #666;
  margin: 0 0 16px;
  line-height: 1.35;
}
.streak-milestone-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.streak-milestone-share {
  background: linear-gradient(135deg, #FF6B35, #FFD700);
  border: none;
  color: #ffffff;
  font-weight: 800;
  font-family: 'Nunito', sans-serif;
}
.streak-milestone-close {
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
}

@media (prefers-reduced-motion: reduce) {
  .share-toast,
  .streak-milestone-overlay,
  .streak-milestone-card,
  .streak-milestone-flame {
    animation: none !important;
    transition: none !important;
  }
}

/* ============================
   Jamchik Neon v2 screens
   ============================ */
.neo-screen-pad {
  padding: 16px 16px 0;
  padding-top: calc(16px + env(safe-area-inset-top));
}

.neo-hero-card,
.exam-hero-card,
.exam-setup-card,
.exam-prep-pilot-card,
.exam-prep-overview,
.exam-last-card,
.hub-building-card,
.hub-bonus-card,
.hub-pantry-card,
.jk-name-row,
.jk-daily-stats,
.jk-action-card,
.jk-collection-card,
.profile-stats-card,
.profile-league-card,
.profile-goal-card,
.profile-achievements-card,
.profile-statistics-card,
.profile-stats-table,
.profile-learn-card,
.profile-links {
  border: 1px solid var(--neo-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018)),
    var(--neo-panel);
  box-shadow: var(--neo-card-shadow);
}

.neo-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

.neo-section-head h2 {
  margin: 0;
  color: #FFFFFF;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.1;
}

.neo-section-head button {
  color: var(--neo-pink-2);
  font-size: 13px;
  font-weight: 900;
}

.neo-progress-track,
.exam-mini-progress,
.profile-level-track,
.jk-mood-track,
.hub-building-progress {
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.28);
}

.neo-progress-fill,
.exam-mini-progress i,
.profile-level-track span,
.jk-mood-track i,
.hub-building-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--neo-pink), var(--neo-pink-2));
  box-shadow: 0 0 16px rgba(255, 47, 163, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.screen-learn,
.screen-exam,
.screen-hub,
.screen-jamchik,
.screen-profile {
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 47, 163, 0.16), transparent 31%),
    radial-gradient(circle at 100% 18%, rgba(141, 77, 255, 0.13), transparent 35%),
    var(--neo-bg);
  color: #FFFFFF;
}

.screen-learn {
  padding: 0;
}

.roadmap-hero {
  position: relative;
  display: grid;
  grid-template-rows: minmax(136px, auto) auto;
  row-gap: 10px;
  min-height: 0;
  overflow: hidden;
  border-radius: 22px;
  padding: 17px 17px 14px;
  background:
    linear-gradient(168deg, rgba(255, 65, 174, 0.16) 0 16%, transparent 17%),
    radial-gradient(ellipse at 74% 54%, rgba(124, 77, 255, 0.2), transparent 42%),
    linear-gradient(145deg, rgba(24, 16, 48, 0.96), rgba(13, 10, 32, 0.96));
}

.roadmap-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, transparent 0 56%, rgba(255, 47, 163, 0.08) 57% 61%, transparent 62%),
    linear-gradient(156deg, transparent 0 45%, rgba(255, 255, 255, 0.035) 46% 47%, transparent 48%),
    radial-gradient(ellipse at 78% 72%, rgba(91, 50, 133, 0.46) 0 28%, transparent 29%),
    radial-gradient(ellipse at 56% 72%, rgba(73, 41, 111, 0.34) 0 25%, transparent 26%);
  opacity: 0.98;
}

.roadmap-hero::after {
  content: none;
}

.roadmap-hero-copy {
  position: relative;
  z-index: 4;
  max-width: 55%;
  min-height: 136px;
}

.roadmap-hero-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-bottom: 9px;
  border: 1px solid rgba(255, 111, 202, 0.24);
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(255, 47, 163, 0.12);
  color: #FF8DD8;
  font-size: 9px;
  font-weight: 1000;
  letter-spacing: 0;
  text-transform: uppercase;
}

.roadmap-hero h1,
.jk-title-card h1,
.hub-hero-copy h1 {
  margin: 0;
  color: #FFFFFF;
  font-family: var(--font-logo);
  font-size: 40px;
  line-height: 0.95;
  letter-spacing: 0;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.34);
}

.roadmap-hero p,
.jk-title-card p,
.hub-hero-copy p {
  margin-top: 10px;
  color: #CFC4EC;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.26;
}

.roadmap-hero h1 {
  font-size: 34px;
}

.roadmap-hero p {
  max-width: 176px;
  font-size: 12px;
}

.roadmap-hero-stats {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.roadmap-hero-stats span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 0 8px;
  background: rgba(8, 7, 22, 0.42);
  color: #BEB2DA;
  font-size: 9px;
  font-weight: 950;
  line-height: 1;
}

.roadmap-hero-stats strong {
  margin-right: 4px;
  color: #FFFFFF;
  font-size: 11px;
  line-height: 1;
}

.roadmap-hero-scene {
  position: absolute;
  z-index: 2;
  right: 8px;
  top: 34px;
  width: 182px;
  height: 130px;
  pointer-events: none;
}

.roadmap-hero-scene-img {
  position: absolute;
  z-index: 2;
  right: -3px;
  top: 32px;
  width: min(40%, 148px);
  max-height: 118px;
  object-fit: contain;
  object-position: right bottom;
  pointer-events: none;
  filter:
    drop-shadow(0 18px 22px rgba(0, 0, 0, 0.4))
    drop-shadow(0 0 18px rgba(255, 47, 163, 0.18));
}

.roadmap-route-line {
  position: absolute;
  right: 18px;
  top: 12px;
  width: 126px;
  height: 96px;
  border: 8px solid rgba(255, 200, 91, 0.38);
  border-left: 0;
  border-bottom: 0;
  border-radius: 0 62px 0 0;
  transform: rotate(12deg);
  box-shadow: 0 0 18px rgba(255, 47, 163, 0.12);
}

.roadmap-route-node {
  position: absolute;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: linear-gradient(180deg, #FF70C8, #D91882);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 1000;
  box-shadow: 0 0 18px rgba(255, 47, 163, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.36);
}

.roadmap-route-node.n1 {
  left: 20px;
  bottom: 20px;
}

.roadmap-route-node.n2 {
  left: 68px;
  bottom: 52px;
}

.roadmap-route-node.n3 {
  right: 48px;
  top: 18px;
}

.roadmap-route-flag {
  position: absolute;
  right: 20px;
  top: 8px;
  width: 30px;
  height: 30px;
  border-left: 4px solid rgba(255, 255, 255, 0.42);
}

.roadmap-route-flag::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0;
  width: 27px;
  height: 19px;
  background: linear-gradient(90deg, #FF4DBB, #FF83D5);
  clip-path: polygon(0 0, 100% 12%, 78% 52%, 100% 88%, 0 74%);
  filter: drop-shadow(0 0 10px rgba(255, 47, 163, 0.28));
}

.roadmap-route-label {
  position: absolute;
  right: 10px;
  bottom: 12px;
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(8, 7, 22, 0.48);
  color: #FFD6EF;
  font-size: 9px;
  font-weight: 1000;
  text-transform: uppercase;
}

.roadmap-hero-jamchik {
  position: absolute;
  z-index: 3;
  right: 16px;
  top: 96px;
  width: 118px;
  max-width: 38%;
  filter: drop-shadow(0 16px 20px rgba(0, 0, 0, 0.42)) drop-shadow(0 0 16px rgba(255, 47, 163, 0.24));
}

.roadmap-progress-card {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 124px;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(8, 7, 22, 0.58);
  backdrop-filter: blur(10px);
}

.roadmap-progress-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 7px 10px;
  align-items: center;
  min-width: 0;
}

.roadmap-progress-col > span {
  grid-column: 1 / -1;
}

.roadmap-progress-percent {
  color: #FF62C6;
  font-size: 14px;
  font-weight: 950;
  line-height: 1;
  text-align: right;
}

.roadmap-progress-col span,
.roadmap-progress-stat span {
  display: block;
  margin-bottom: 6px;
  color: #BEB2DA;
  font-size: 11px;
  font-weight: 800;
}

.roadmap-progress-stat {
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  min-width: 0;
  padding-left: 10px;
}

.roadmap-progress-stat strong {
  color: #FFFFFF;
  font-size: 19px;
  line-height: 1;
}

.roadmap-progress-stat small {
  display: block;
  margin-top: 5px;
  color: #FF6FCA;
  font-size: 8px;
  font-weight: 900;
  line-height: 1.15;
}

.neo-progress-track {
  height: 11px;
}

.neo-daily-goal {
  margin-top: 14px;
  border: 1px solid var(--neo-border);
  background: rgba(24, 16, 48, 0.86);
}

.screen-learn .neo-daily-goal {
  padding: 0;
  overflow: hidden;
}

.roadmap-goal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0;
}

.roadmap-goal-cell {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px;
  gap: 8px;
  align-items: center;
  min-height: 88px;
  padding: 12px 14px;
}

.roadmap-goal-cell + .roadmap-goal-cell {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.roadmap-goal-copy {
  min-width: 0;
}

.roadmap-goal-copy strong,
.roadmap-goal-copy span,
.roadmap-goal-cell em {
  display: block;
}

.roadmap-goal-copy strong {
  color: #FF63C7;
  font-size: 13px;
  font-weight: 950;
  line-height: 1.05;
  text-transform: uppercase;
}

.roadmap-goal-copy span {
  margin-top: 5px;
  color: #D8CDEF;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
}

.roadmap-goal-icon {
  grid-row: 1 / 4;
  grid-column: 2;
  width: 50px;
  height: 50px;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.34));
}

.roadmap-goal-cell .progress-track {
  grid-column: 1;
  height: 8px;
  margin-top: 4px;
}

.roadmap-goal-cell .progress-fill {
  background: linear-gradient(90deg, #FF2FA3, #FF79D2);
}

.roadmap-goal-cell em {
  grid-column: 1;
  color: #FF6FCA;
  font-size: 12px;
  font-style: normal;
  font-weight: 950;
  line-height: 1;
}

.section-tabs {
  margin: 14px 16px 0;
}

.snake-path {
  padding-top: 14px;
}

.path-section {
  margin: 0 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 22px;
  background: rgba(13, 10, 32, 0.58) !important;
}

.path-section-badge,
.path-category-pill,
.section-tab.active,
.diff-pill.active {
  box-shadow: var(--neo-glow-pink);
}

.unit-label-below .unit-label-title,
.unit-label-title {
  color: #FFFFFF;
}

/* Roadmap V2: topic-by-topic route inspired by the production reference. */
.screen-learn .section-tabs {
  display: none;
}

.screen-learn .roadmap-path {
  padding: 8px 16px 24px;
  gap: 0;
}

.screen-learn .path-category-wrap {
  margin: 0;
}

.screen-learn .path-category-header {
  margin: 8px 0 10px;
  padding: 0;
  text-align: left;
}

.screen-learn .path-category-pill {
  width: 100%;
  min-height: 42px;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(24, 16, 48, 0.9);
  color: #FFFFFF;
  font-size: 13px;
  line-height: 1.1;
  box-shadow: none;
}

.screen-learn .path-category-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-learn .path-category-arrow {
  color: #FF6FCA;
}

.screen-learn .path-category-sections {
  margin: 0;
  padding: 0;
  background: transparent !important;
}

.screen-learn .roadmap-route-panel {
  position: relative;
  margin: 0 0 14px;
  padding: 12px 10px 12px 0;
  overflow: hidden;
  border: 1px solid rgba(255, 47, 163, 0.22);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(28, 19, 50, 0.72), rgba(10, 8, 25, 0.4)),
    rgba(13, 10, 32, 0.48);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.045),
    0 12px 26px rgba(0, 0, 0, 0.16);
}

.screen-learn .path-section {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none;
}

.screen-learn .roadmap-section-list .path-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

.screen-learn .roadmap-daily-panel {
  margin: 14px 0 18px;
}

.screen-learn .path-section-header {
  margin: 8px 0 8px;
  padding: 0;
  text-align: left;
}

.screen-learn .path-section-badge {
  padding: 0;
  border: 0 !important;
  background: transparent !important;
  color: #FF6FCA;
  font-family: var(--font-logo);
  font-size: 19px;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 3px 12px rgba(255, 47, 163, 0.22);
  box-shadow: none;
}

.screen-learn .diff-pills {
  justify-content: flex-start;
  gap: 6px;
  margin: 0 0 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.screen-learn .diff-pills::-webkit-scrollbar {
  display: none;
}

.screen-learn .diff-pill {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 4px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 2px solid rgba(255, 47, 163, 0.24);
  border-radius: 999px;
  background: rgba(24, 16, 48, 0.74);
  color: #BEB2DA;
  font-size: 11px;
  letter-spacing: 0;
  box-shadow: none;
}

.screen-learn .diff-pill.active {
  color: #FFFFFF !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-bottom: 2px solid rgba(128, 20, 91, 0.86) !important;
  box-shadow: 0 8px 18px rgba(255, 47, 163, 0.18);
}

.screen-learn .path-divider,
.screen-learn .path-connector {
  display: none;
}

.roadmap-unit-list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 0 2px;
}

.roadmap-unit-list::before {
  content: '';
  position: absolute;
  left: 27px;
  top: 24px;
  bottom: 24px;
  width: 4px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 47, 163, 0.82) 0 14px,
      rgba(255, 47, 163, 0.08) 14px 22px
    );
  filter: drop-shadow(0 0 10px rgba(255, 47, 163, 0.22));
}

.screen-learn .roadmap-unit-card.unit-row {
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  width: 100%;
  height: auto;
  min-height: 116px;
  margin: 0;
  opacity: 1;
  animation: roadmapCardIn 280ms ease both;
}

.screen-learn .roadmap-section-card.unit-row {
  min-height: 124px;
}

.screen-learn .roadmap-unit-card.shake {
  animation: shakeUnit 400ms ease;
}

.screen-learn .roadmap-unit-card.no-action {
  cursor: default;
}

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

.roadmap-rail-slot {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen-learn .roadmap-step-node.unit-node {
  position: relative;
  top: auto;
  left: auto;
  width: 50px;
  height: 50px;
  transform: none;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-bottom-width: 3px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.36), transparent 26%),
    linear-gradient(180deg, #FF5CC7 0%, #C70C82 100%);
  color: #FFFFFF;
  box-shadow:
    0 0 0 4px rgba(255, 47, 163, 0.14),
    0 10px 20px rgba(199, 12, 130, 0.26);
  animation: none;
}

.screen-learn .roadmap-lesson-card.current .roadmap-step-node.unit-node {
  border-color: rgba(255, 230, 255, 0.72);
  box-shadow:
    0 0 0 5px rgba(255, 47, 163, 0.18),
    0 0 28px rgba(255, 47, 163, 0.48),
    0 12px 22px rgba(199, 12, 130, 0.3);
}

.screen-learn .roadmap-lesson-card.current .roadmap-step-node.unit-node::after {
  content: '';
  position: absolute;
  inset: -9px;
  border: 2px solid rgba(255, 111, 202, 0.22);
  border-radius: inherit;
  animation: roadmapCurrentPulse 1.9s ease-in-out infinite;
}

@keyframes roadmapCurrentPulse {
  0%, 100% { opacity: 0.32; transform: scale(0.92); }
  50% { opacity: 0.75; transform: scale(1.08); }
}

.screen-learn .roadmap-step-node.unit-node .unit-node-num {
  color: #FFFFFF;
  font-size: 22px;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

.screen-learn .roadmap-step-node.unit-node.completed {
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.34), transparent 28%),
    linear-gradient(180deg, #79F35F 0%, #2DAF37 100%);
  color: #FFFFFF;
  box-shadow:
    0 0 0 4px rgba(121, 243, 95, 0.13),
    0 10px 20px rgba(45, 175, 55, 0.22);
}

.screen-learn .roadmap-step-node.unit-node.in-progress,
.screen-learn .roadmap-step-node.unit-node.in_progress {
  background:
    radial-gradient(circle at 30% 16%, rgba(255, 255, 255, 0.34), transparent 27%),
    linear-gradient(180deg, #FF5CC7 0%, #C70C82 100%);
  border-color: rgba(255, 111, 202, 0.78);
}

.screen-learn .roadmap-step-node.unit-node.available {
  background: rgba(255, 47, 163, 0.14);
  border-color: rgba(255, 47, 163, 0.72);
  border-style: solid;
}

.screen-learn .roadmap-step-node.unit-node.locked {
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.08), transparent 30%),
    rgba(44, 38, 68, 0.92);
  color: #A99BC2;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 4px rgba(120, 99, 156, 0.08);
}

.screen-learn .roadmap-unit-card.tappable:active .roadmap-step-node.unit-node {
  transform: translateY(2px) scale(0.98);
}

.roadmap-topic-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px 74px;
  gap: 8px;
  align-items: center;
  min-height: 132px;
  padding: 13px 11px 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 47, 163, 0.23);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(35, 25, 57, 0.96), rgba(17, 12, 35, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 10px 22px rgba(0, 0, 0, 0.22);
}

.roadmap-topic-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 47, 163, 0.105), transparent 48%),
    radial-gradient(circle at 78% 18%, rgba(124, 77, 255, 0.09), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 42%);
  pointer-events: none;
}

.roadmap-lesson-card.current .roadmap-topic-card {
  border-color: rgba(255, 111, 202, 0.62);
  background:
    radial-gradient(circle at 78% 24%, rgba(255, 47, 163, 0.16), transparent 32%),
    linear-gradient(180deg, rgba(44, 27, 69, 0.98), rgba(22, 12, 42, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(255, 47, 163, 0.16),
    0 16px 30px rgba(255, 47, 163, 0.18),
    0 12px 24px rgba(0, 0, 0, 0.26);
}

.roadmap-lesson-card.current .roadmap-topic-card::after {
  content: 'NEXT';
  position: absolute;
  left: 10px;
  top: 8px;
  z-index: 2;
  min-height: 16px;
  display: inline-grid;
  place-items: center;
  padding: 0 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 47, 163, 0.22);
  color: #FFD9F3;
  font-size: 7px;
  font-weight: 1000;
  line-height: 1;
  letter-spacing: 0;
}

.roadmap-lesson-card.current .roadmap-topic-kicker {
  padding-left: 42px;
}

.roadmap-lesson-card.in_progress .roadmap-topic-card {
  border-color: rgba(255, 111, 202, 0.48);
  background:
    radial-gradient(circle at 80% 18%, rgba(255, 47, 163, 0.12), transparent 33%),
    linear-gradient(180deg, rgba(40, 27, 64, 0.98), rgba(19, 12, 39, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 12px 25px rgba(255, 47, 163, 0.12),
    0 10px 22px rgba(0, 0, 0, 0.22);
}

.roadmap-lesson-card.completed .roadmap-topic-card {
  border-color: rgba(133, 244, 110, 0.34);
  background:
    radial-gradient(circle at 82% 20%, rgba(133, 244, 110, 0.1), transparent 32%),
    radial-gradient(circle at 14% 10%, rgba(255, 47, 163, 0.09), transparent 30%),
    linear-gradient(180deg, rgba(32, 27, 52, 0.98), rgba(15, 13, 31, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.065),
    0 0 0 1px rgba(133, 244, 110, 0.055),
    0 12px 24px rgba(0, 0, 0, 0.22);
}

.roadmap-topic-main,
.roadmap-topic-art-wrap,
.roadmap-topic-status {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.roadmap-topic-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.roadmap-topic-kicker {
  display: block;
  margin: 0 0 4px;
  overflow: hidden;
  color: #FF6FCA;
  font-size: 8px;
  font-weight: 950;
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.roadmap-topic-main h3 {
  min-width: 0;
  margin: 0;
  color: #FFFFFF;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: 0;
}

.roadmap-level-badge {
  flex: 0 0 auto;
  width: 72px;
  min-width: 0;
  max-width: 72px;
  padding: 6px 7px;
  border-radius: 10px;
  background: rgba(8, 7, 22, 0.55);
  color: #CFC4EC;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
}

.roadmap-level-badge span,
.roadmap-level-badge strong,
.roadmap-level-badge em {
  display: block;
}

.roadmap-level-badge span {
  color: #BEB2DA;
  font-size: 10px;
  font-weight: 850;
}

.roadmap-level-badge strong {
  margin-top: 2px;
  color: #FF6FCA;
  font-size: 20px;
  font-weight: 950;
  line-height: 0.95;
}

.roadmap-level-badge em {
  margin-top: 3px;
  color: #D8CDEF;
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.roadmap-level-badge.completed {
  border: 1px solid rgba(133, 244, 110, 0.14);
  background:
    radial-gradient(circle at 38% 10%, rgba(133, 244, 110, 0.12), transparent 44%),
    rgba(8, 7, 22, 0.6);
  color: #85F46E;
}

.roadmap-level-badge.completed strong {
  color: #85F46E;
}

.roadmap-level-badge.locked {
  color: #8F84AA;
}

.roadmap-level-badge.locked strong,
.roadmap-level-badge.locked em {
  color: #8F84AA;
}

.roadmap-topic-main p {
  display: -webkit-box;
  margin: 7px 0 6px;
  overflow: hidden;
  color: #CFC4EC;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.roadmap-topic-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 0 8px;
}

.roadmap-topic-meta span {
  min-height: 18px;
  display: inline-grid;
  place-items: center;
  padding: 0 7px;
  border: 1px solid rgba(255, 111, 202, 0.16);
  border-radius: 999px;
  background: rgba(8, 7, 22, 0.38);
  color: #D8CDEF;
  font-size: 9px;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}

.roadmap-topic-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
  align-items: center;
}

.roadmap-topic-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
}

.roadmap-topic-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #FF4DBB, #FF88D7);
  box-shadow: 0 0 12px rgba(255, 47, 163, 0.36);
}

.roadmap-lesson-card.completed .roadmap-topic-track span {
  background: linear-gradient(90deg, #55DB4A, #A0FF86);
  box-shadow: 0 0 12px rgba(92, 214, 76, 0.24);
}

.roadmap-topic-progress strong {
  color: #FF6FCA;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-align: right;
}

.roadmap-lock-hint {
  min-height: 24px;
  display: flex;
  align-items: center;
  width: 100%;
  margin-top: 2px;
  padding: 0 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 111, 202, 0.12);
  border-radius: 999px;
  background: rgba(8, 7, 22, 0.36);
  color: #BEB2DA;
  font-size: 10px;
  font-weight: 850;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roadmap-topic-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
}

.roadmap-topic-art-wrap {
  position: relative;
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
}

.roadmap-topic-art-wrap::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 22px;
  background: radial-gradient(circle, rgba(255, 47, 163, 0.24), transparent 66%);
  filter: blur(6px);
}

.roadmap-topic-art-wrap img,
.roadmap-topic-side img {
  position: relative;
  z-index: 1;
  width: 78px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.36));
}

.roadmap-topic-art-wrap.locked img {
  opacity: 0.42;
  filter: grayscale(1) saturate(0.15) drop-shadow(0 8px 10px rgba(0, 0, 0, 0.3));
}

.roadmap-topic-art-wrap.locked::after {
  content: '';
  position: absolute;
  right: 4px;
  bottom: 6px;
  width: 27px;
  height: 27px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background:
    url('../assets/images/factory-v2/locked-chest.png') center / 22px 22px no-repeat,
    rgba(8, 7, 22, 0.72);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.28);
}

.roadmap-topic-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-align: center;
}

.roadmap-tier-pips {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin-top: 9px;
}

.roadmap-tier-pip {
  flex: 1 1 0;
  min-width: 0;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  background: rgba(8, 7, 22, 0.44);
  color: #7E6F9D;
  font-size: 8px;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.28);
}

.roadmap-tier-pip.done {
  border-color: rgba(133, 244, 110, 0.26);
  background: rgba(92, 214, 76, 0.13);
  color: #85F46E;
}

.roadmap-tier-pip.active {
  border-color: rgba(255, 111, 202, 0.36);
  background: rgba(255, 47, 163, 0.16);
  color: #FF6FCA;
}

.roadmap-topic-state {
  width: 72px;
  min-width: 0;
  padding: 8px 7px;
  border-radius: 10px;
  background: linear-gradient(180deg, #FF5BC3, #C70C82);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(255, 47, 163, 0.22);
}

.roadmap-topic-state.completed {
  border: 1px solid rgba(133, 244, 110, 0.18);
  background:
    radial-gradient(circle at 36% 12%, rgba(255, 255, 255, 0.1), transparent 36%),
    rgba(92, 214, 76, 0.16);
  color: #85F46E;
  box-shadow: 0 8px 16px rgba(92, 214, 76, 0.08);
}

.roadmap-topic-state.locked {
  background: rgba(255, 255, 255, 0.07);
  color: #8F84AA;
  box-shadow: none;
}

.roadmap-topic-state.in_progress {
  background: linear-gradient(180deg, #FF5BC3, #C70C82);
}

.roadmap-topic-side small {
  display: none;
  color: #AFA2CC;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.05;
}

.roadmap-topic-status small {
  display: none;
}

.roadmap-topic-side em {
  display: none;
}

.roadmap-unit-card.locked .roadmap-topic-card {
  border-color: rgba(255, 255, 255, 0.08);
  filter: saturate(0.72);
}

.roadmap-chapter-header {
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 82px;
  margin: 4px 0 6px 58px;
  padding: 10px 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 111, 202, 0.26);
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 47, 163, 0.18), transparent 28%),
    radial-gradient(circle at 84% 20%, rgba(124, 77, 255, 0.14), transparent 30%),
    linear-gradient(180deg, rgba(35, 25, 57, 0.92), rgba(17, 12, 35, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    0 10px 20px rgba(0, 0, 0, 0.18);
}

.roadmap-chapter-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 47, 163, 0.11), transparent 54%);
  pointer-events: none;
}

.roadmap-chapter-art,
.roadmap-chapter-copy {
  position: relative;
  z-index: 1;
}

.roadmap-chapter-art {
  width: 56px;
  height: 56px;
  object-fit: contain;
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.34));
}

.roadmap-chapter-copy {
  min-width: 0;
}

.roadmap-chapter-copy > span {
  display: block;
  color: #FF6FCA;
  font-size: 10px;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.roadmap-chapter-copy h2 {
  margin: 3px 0 3px;
  color: #FFFFFF;
  font-size: 18px;
  font-weight: 950;
  line-height: 1.05;
}

.roadmap-chapter-copy p {
  display: -webkit-box;
  margin: 0 0 6px;
  overflow: hidden;
  color: #CFC4EC;
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1.16;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.roadmap-chapter-header .roadmap-topic-meta {
  margin-bottom: 6px;
}

.roadmap-chapter-header .roadmap-topic-meta span {
  min-height: 16px;
  padding: 0 6px;
  font-size: 8px;
}

.roadmap-chapter-header .roadmap-topic-track {
  height: 7px;
}

.roadmap-chapter-header .roadmap-topic-progress strong {
  font-size: 11px;
}

.screen-learn .roadmap-lesson-card.unit-row {
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 8px;
  min-height: 110px;
}

.screen-learn .roadmap-lesson-card .roadmap-step-node.unit-node {
  width: 40px;
  height: 40px;
}

.screen-learn .roadmap-lesson-card .roadmap-step-node.unit-node .unit-node-num {
  font-size: 16px;
}

.roadmap-lesson-card .roadmap-topic-card {
  grid-template-columns: minmax(0, 1fr) 76px 54px;
  gap: 7px;
  min-height: 110px;
  padding: 10px 9px;
  border-radius: 16px;
}

.roadmap-lesson-card .roadmap-topic-kicker {
  margin-bottom: 4px;
  color: #FF78D0;
  font-size: 8px;
}

.roadmap-lesson-card .roadmap-topic-main h3 {
  font-size: 15px;
  line-height: 1.08;
}

.roadmap-lesson-card .roadmap-topic-main p {
  display: none;
}

.roadmap-lesson-card .roadmap-topic-meta {
  gap: 4px;
  margin-bottom: 6px;
}

.roadmap-lesson-card .roadmap-topic-meta span {
  min-height: 17px;
  padding: 0 5px;
  font-size: 8px;
}

.roadmap-lesson-card .roadmap-topic-art-wrap {
  width: 76px;
  height: 76px;
}

.roadmap-lesson-card .roadmap-topic-art-wrap img {
  width: 76px;
  height: 70px;
}

.roadmap-lesson-card .roadmap-level-badge {
  width: 54px;
  max-width: 54px;
  padding: 5px 4px;
}

.roadmap-lesson-card .roadmap-level-badge span {
  font-size: 8px;
}

.roadmap-lesson-card .roadmap-level-badge strong {
  font-size: 15px;
}

.roadmap-lesson-card .roadmap-level-badge.locked strong {
  font-size: 14px;
  white-space: nowrap;
}

.roadmap-lesson-card .roadmap-level-badge em {
  font-size: 8px;
}

.roadmap-lesson-card .roadmap-topic-state {
  width: 54px;
  min-width: 0;
  padding: 7px 4px;
  font-size: 10px;
}

.roadmap-lesson-card .roadmap-topic-state.locked {
  display: none;
}

.roadmap-lesson-card .roadmap-topic-status {
  gap: 6px;
}

.roadmap-lesson-card.locked .roadmap-topic-status {
  gap: 0;
}

.roadmap-lesson-card.locked .roadmap-topic-card {
  background:
    radial-gradient(circle at 82% 18%, rgba(255, 111, 202, 0.055), transparent 34%),
    linear-gradient(180deg, rgba(31, 25, 48, 0.94), rgba(14, 12, 29, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 8px 18px rgba(0, 0, 0, 0.18);
}

.roadmap-lesson-card.locked .roadmap-topic-kicker {
  color: rgba(255, 120, 208, 0.82);
}

.roadmap-lesson-card.locked .roadmap-topic-track {
  opacity: 0.7;
}

.roadmap-lesson-card.locked .roadmap-topic-progress strong {
  opacity: 0.8;
}

.roadmap-lesson-card.locked .roadmap-lock-hint {
  border-color: rgba(255, 255, 255, 0.07);
  background: rgba(8, 7, 22, 0.48);
  color: #AFA2CC;
}

.roadmap-lesson-card.locked .roadmap-level-badge {
  border: 1px solid rgba(255, 255, 255, 0.045);
  background: rgba(8, 7, 22, 0.74);
}

.roadmap-lesson-card.locked .roadmap-topic-art-wrap::before {
  opacity: 0.45;
}

.roadmap-lesson-card.current .roadmap-topic-art-wrap::before,
.roadmap-lesson-card.in_progress .roadmap-topic-art-wrap::before {
  opacity: 1;
  filter: blur(7px);
}

.roadmap-lesson-card.completed .roadmap-topic-art-wrap::before {
  background: radial-gradient(circle, rgba(133, 244, 110, 0.18), transparent 66%);
  opacity: 0.72;
  filter: blur(7px);
}

.roadmap-lesson-card.current .roadmap-topic-art-wrap img {
  transform: translateY(-1px) scale(1.05);
}

.roadmap-lesson-card.completed .roadmap-topic-state {
  border: 1px solid rgba(133, 244, 110, 0.18);
}

.roadmap-lesson-card .roadmap-tier-pips {
  display: none;
}

.roadmap-lesson-card .roadmap-tier-pip {
  min-width: 0;
  height: 16px;
  font-size: 7px;
}

.roadmap-lesson-card .roadmap-topic-track {
  height: 8px;
}

.roadmap-finale-card {
  position: relative;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin: 10px 0 0;
  padding: 16px 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 47, 163, 0.26);
  border-radius: 20px;
  background:
    radial-gradient(circle at 8% 18%, rgba(255, 47, 163, 0.2), transparent 26%),
    linear-gradient(180deg, rgba(35, 25, 57, 0.94), rgba(17, 12, 35, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    0 12px 24px rgba(0, 0, 0, 0.18);
}

.roadmap-finale-card::before {
  content: '';
  position: absolute;
  right: 16px;
  top: 14px;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: rgba(255, 47, 163, 0.08);
  filter: blur(8px);
}

.roadmap-finale-art {
  position: relative;
  z-index: 1;
  width: 82px;
  height: 82px;
  object-fit: contain;
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.34));
}

.roadmap-finale-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.roadmap-finale-copy span {
  display: block;
  color: #FF6FCA;
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.roadmap-finale-copy h2 {
  margin: 5px 0 4px;
  color: #FFFFFF;
  font-size: 21px;
  font-weight: 950;
  line-height: 1.05;
}

.roadmap-finale-copy p {
  margin: 0;
  color: #CFC4EC;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.roadmap-finale-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.roadmap-finale-progress strong {
  color: #FF6FCA;
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
  text-align: right;
}

@media (max-width: 380px) {
  .screen-learn .roadmap-path {
    padding-left: 14px;
    padding-right: 14px;
  }

  .screen-learn .roadmap-unit-card.unit-row {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 8px;
  }

  .roadmap-unit-list::before {
    left: 24px;
  }

  .screen-learn .roadmap-step-node.unit-node {
    width: 46px;
    height: 46px;
  }

  .roadmap-topic-card {
    grid-template-columns: minmax(0, 1fr) 54px 58px;
    gap: 7px;
    min-height: 124px;
    padding: 12px 10px 11px;
  }

  .roadmap-topic-main h3 {
    font-size: 16px;
  }

  .roadmap-level-badge {
    width: 56px;
    min-width: 0;
    max-width: 56px;
    padding-inline: 5px;
    font-size: 10px;
  }

  .roadmap-topic-art-wrap img,
  .roadmap-topic-side img {
    width: 54px;
    height: 50px;
  }

  .roadmap-topic-art-wrap {
    width: 54px;
    height: 54px;
  }

  .roadmap-topic-state {
    width: 56px;
    min-width: 0;
    padding: 7px 6px;
    font-size: 10px;
  }

  .roadmap-tier-pips {
    gap: 3px;
  }

  .roadmap-tier-pip {
    min-width: 0;
    height: 17px;
    font-size: 7px;
  }

  .roadmap-topic-meta {
    gap: 4px;
    margin-bottom: 7px;
  }

  .roadmap-topic-meta span {
    min-height: 17px;
    padding: 0 6px;
    font-size: 8px;
  }

  .roadmap-lesson-card.current .roadmap-topic-card::after {
    content: 'GO';
    left: 9px;
    min-height: 15px;
    padding: 0 6px;
    font-size: 7px;
  }

  .roadmap-lesson-card.current .roadmap-topic-kicker {
    padding-left: 30px;
  }

  .roadmap-goal-cell {
    grid-template-columns: minmax(0, 1fr) 42px;
    padding: 10px;
  }

  .roadmap-goal-icon {
    width: 40px;
    height: 40px;
  }

  .roadmap-finale-card {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 10px;
    padding: 14px 12px;
  }

  .roadmap-finale-art {
    width: 64px;
    height: 64px;
  }

  .roadmap-finale-copy h2 {
    font-size: 19px;
  }
}

.screen-exam {
  padding: 16px 16px calc(100px + env(safe-area-inset-bottom));
  padding-top: calc(16px + env(safe-area-inset-top));
}

.screen-exam .resource-bar {
  margin-bottom: 12px;
}

.exam-header {
  margin-bottom: 12px;
}

.exam-title {
  color: #FFFFFF;
}

.exam-kicker,
.exam-header-pill {
  color: var(--neo-pink-2);
}

.exam-header-pill {
  min-height: 30px;
  padding: 0 12px;
  border-width: 1px;
  border-bottom-width: 2px;
  background: rgba(24, 16, 48, 0.82);
  border-color: var(--neo-border);
  border-bottom-color: var(--neo-border-strong);
  color: var(--neo-pink-2);
  font-size: 11px;
}

.exam-hero-card {
  padding: 14px 16px 16px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 47, 163, 0.28), transparent 42%),
    linear-gradient(145deg, rgba(33, 20, 63, 0.96), rgba(15, 10, 35, 0.98));
}

.exam-hero-kicker {
  display: none;
}

.exam-hero-main {
  align-items: center;
}

.exam-hero-jamchik {
  width: 104px;
  height: 92px;
  margin: -6px 0 -2px -8px;
  filter: drop-shadow(0 12px 16px rgba(0, 0, 0, 0.42));
}

.exam-hero-copy h2 {
  font-size: 34px;
}

.exam-hero-copy p {
  font-size: 14px;
}

.exam-hero-start,
.exam-continue,
.hub-upgrade-btn,
.jk-action-card b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 16px;
  background: linear-gradient(180deg, #FF58BE, #D91483);
  color: #FFFFFF;
  box-shadow: 0 8px 20px rgba(255, 47, 163, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.exam-hero-start {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 46px;
  margin-top: 12px;
  font-size: 17px;
  font-weight: 900;
}

.exam-time-chip,
.exam-difficulty-chip {
  min-height: 36px;
  border-bottom-width: 2px;
  font-size: 13px;
  border-color: var(--neo-border);
  background: rgba(8, 7, 22, 0.62);
}

.exam-time-chip.active,
.exam-difficulty-chip.active {
  color: #FFFFFF;
  border-color: var(--neo-border-strong);
  background: rgba(255, 47, 163, 0.18);
  box-shadow: var(--neo-glow-pink);
}

.exam-topic-section,
.exam-last-section {
  margin-top: 14px;
}

.exam-topic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.exam-topic-card {
  min-height: 76px;
  display: grid;
  position: relative;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--neo-border);
  border-radius: 16px;
  background: rgba(24, 16, 48, 0.9);
  color: #FFFFFF;
  text-align: left;
}

.exam-topic-card.active {
  border-color: var(--neo-border-strong);
  box-shadow: var(--neo-glow-pink);
}

.exam-topic-orb {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #FF69C4, #53107F 68%);
  color: #FFFFFF;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 8px 16px rgba(0, 0, 0, 0.28);
}

.exam-topic-orb img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  filter: drop-shadow(0 7px 8px rgba(0, 0, 0, 0.36));
}

.exam-topic-card-copy {
  min-width: 0;
}

.exam-topic-card-copy strong,
.exam-topic-card-copy small {
  display: block;
}

.exam-topic-card-copy strong {
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.15;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.exam-topic-card-copy small,
.exam-topic-pct {
  color: var(--neo-pink-2);
  font-size: 10px;
  font-weight: 900;
}

.exam-mini-progress {
  width: 100%;
  height: 6px;
  margin: 0;
}

.exam-topic-pct {
  position: static;
  text-align: right;
  white-space: nowrap;
}

.exam-topic-progress-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px;
  gap: 5px;
  align-items: center;
  margin-top: 6px;
}

.screen-exam .exam-setup-card {
  display: none;
}

.exam-setup-card,
.exam-prep-pilot-card,
.exam-prep-overview {
  border-radius: 18px;
}

.exam-field-button,
.exam-prep-pilot-button {
  background: rgba(8, 7, 22, 0.44);
  border-color: var(--neo-border);
  border-bottom-color: var(--neo-border-strong);
}

.exam-last-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 14px;
  position: relative;
  padding: 14px;
  border-radius: 18px;
}

.exam-last-icon,
.exam-last-empty img {
  width: 68px;
  height: 68px;
  object-fit: contain;
}

.exam-last-main h3 {
  color: #FFFFFF;
  font-size: 18px;
}

.exam-last-main p,
.exam-last-empty p {
  color: var(--neo-muted);
}

.exam-last-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.exam-last-stats small {
  display: block;
  color: var(--neo-muted);
  font-size: 11px;
  font-weight: 800;
}

.exam-last-stats strong {
  color: #FFFFFF;
  font-size: 17px;
}

.exam-weak-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.exam-weak-tags span {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #E6DDF7;
  font-size: 10px;
  font-weight: 800;
}

.exam-continue {
  grid-column: 1 / -1;
  min-height: 44px;
  font-weight: 900;
}

.exam-last-empty {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--neo-border);
  border-radius: 18px;
  background: var(--neo-panel);
}

.exam-last-empty strong {
  color: #FFFFFF;
}

.exam-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.exam-history-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 46px;
  padding: 8px 10px;
  border-radius: 14px;
  background: var(--bg-surface);
}

.exam-history-row .ok { color: var(--neo-green); }
.exam-history-row .bad { color: var(--neo-pink-2); }

.screen-hub {
  --hub-edge: 20px;
  display: block;
  min-height: 100dvh;
  height: auto;
  overflow: visible;
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
}

.hub-top-pad {
  padding-bottom: 0;
}

.hub-image-area {
  min-height: 300px;
  height: 300px;
  margin: 0 16px;
  border: 1px solid var(--neo-border);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(24, 16, 48, 0.98), rgba(9, 8, 24, 0.98));
  box-shadow: var(--neo-card-shadow);
}

.hub-image-area::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 7, 22, 0.18), rgba(8, 7, 22, 0.64));
  pointer-events: none;
}

.hub-factory-img {
  opacity: 0.76;
}

.hub-hero-copy {
  position: absolute;
  z-index: 2;
  top: 30px;
  right: 22px;
  max-width: 54%;
}

.hub-level-badge {
  z-index: 3;
  left: 18px;
  top: auto;
  bottom: 16px;
  transform: none;
  background: rgba(255, 47, 163, 0.18);
  border: 1px solid var(--neo-border-strong);
}

.hub-info {
  padding: 16px;
}

.hub-factory-name {
  background: linear-gradient(180deg, var(--neo-pink-2), var(--neo-pink));
  border-color: rgba(255, 255, 255, 0.18);
  border-bottom-color: rgba(112, 0, 75, 0.62);
}

.hub-buildings,
.hub-bonuses {
  padding: 0 16px;
}

.hub-building-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.hub-building-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 210px;
  padding: 12px 8px;
  border-radius: 18px;
  text-align: center;
}

.hub-building-card img {
  width: 74px;
  height: 62px;
  object-fit: cover;
  border-radius: 12px;
}

.hub-building-card h3 {
  color: #FFFFFF;
  font-size: 15px;
}

.hub-building-card p,
.hub-building-card small {
  color: var(--neo-muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.hub-building-progress {
  width: 100%;
  height: 8px;
  margin-top: auto;
}

.hub-upgrade-btn {
  width: 100%;
  min-height: 40px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.hub-upgrade-btn img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.hub-upgrade-btn.denied {
  animation: shakeUnit 360ms ease;
}

.hub-bonus-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.hub-bonus-card {
  min-height: 82px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border-radius: 16px;
}

.hub-bonus-card img,
.hub-bonus-card span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font-size: 28px;
}

.hub-bonus-card strong {
  color: #FFFFFF;
  font-size: 12px;
}

.hub-bonus-card small {
  color: var(--neo-muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.hub-pantry-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 54px;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 18px;
}

.hub-pantry-card img:first-child {
  width: 94px;
  height: 86px;
  object-fit: contain;
}

.hub-pantry-card h2 {
  color: var(--neo-pink-2);
  font-size: 22px;
}

.hub-pantry-card p {
  color: #E6DDF7;
}

.hub-pantry-chest {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.screen-jamchik {
  display: block;
  height: auto;
  min-height: 100dvh;
  overflow: visible;
  padding: 0 0 calc(100px + env(safe-area-inset-bottom));
}

.jk-top-shell {
  position: relative;
  z-index: 3;
}

.jk-title-card {
  text-align: center;
}

.jk-title-card h1 {
  color: #FF9BD7;
  font-size: 42px;
}

.jk-avatar-area-large {
  min-height: 290px;
  width: auto;
  margin: 14px 16px 0;
  padding: 12px;
  border: 1px solid var(--neo-border);
  border-radius: 22px;
  background:
    radial-gradient(circle at 48% 45%, rgba(255, 47, 163, 0.2), transparent 42%),
    linear-gradient(145deg, rgba(24, 16, 48, 0.98), rgba(8, 7, 22, 0.98));
  box-shadow: var(--neo-card-shadow);
}

.jk-avatar-slot {
  width: 100%;
  justify-content: center;
  padding-top: 36px;
}

.jk-hero-img {
  width: min(245px, 66vw);
  height: auto;
  filter: drop-shadow(0 18px 20px rgba(0, 0, 0, 0.46)) drop-shadow(0 0 20px rgba(255, 47, 163, 0.3));
}

.jk-mood-card {
  position: absolute;
  right: 14px;
  top: 90px;
  width: 128px;
  padding: 12px;
  border: 1px solid var(--neo-border);
  border-radius: 16px;
  background: rgba(13, 10, 32, 0.78);
  backdrop-filter: blur(10px);
  z-index: 2;
}

.jk-mood-card span,
.jk-mood-card small {
  display: block;
  color: var(--neo-muted);
  font-size: 11px;
  font-weight: 800;
}

.jk-mood-card strong {
  display: block;
  margin: 4px 0 8px;
  color: #FFFFFF;
  font-size: 16px;
}

.jk-mood-track {
  height: 8px;
  margin-bottom: 4px;
}

.jk-mood-card button {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  border-radius: 12px;
  background: rgba(255, 47, 163, 0.16);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 900;
}

.jk-mood-card button img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.jk-name-row,
.jk-daily-stats,
.jk-bars,
.jk-actions-grid,
.jk-collection {
  width: auto;
  max-width: none;
  margin: 12px 16px 0;
}

.jk-name {
  color: #FFFFFF;
}

.jk-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.jk-actions-title {
  grid-column: 1 / -1;
  margin: 0;
}

.jk-action-card {
  min-height: 156px;
  padding: 12px 8px;
}

.jk-action-card b {
  width: 100%;
  min-height: 36px;
  margin-top: auto;
  font-size: 13px;
}

.jk-action-name {
  color: #FFFFFF;
}

.jk-action-sub,
.jk-status-desc,
.jk-daily-label {
  color: var(--neo-muted);
}

.jk-action-icon {
  width: 54px;
  height: 54px;
}

.jk-collection-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.jk-collection-card {
  min-height: 126px;
  padding: 8px;
  border-radius: 16px;
  color: #FFFFFF;
}

.jk-collection-card img {
  width: 100%;
  height: 66px;
  object-fit: contain;
}

.jk-collection-card strong,
.jk-collection-card small {
  display: block;
}

.jk-collection-card strong {
  font-size: 12px;
}

.jk-collection-card small {
  color: var(--neo-muted);
  font-size: 10px;
  font-weight: 900;
}

.jk-collection-card.active {
  border-color: var(--neo-border-strong);
  box-shadow: var(--neo-glow-pink);
}

.jk-collection-card.locked img {
  filter: grayscale(45%) brightness(0.72);
}

.screen-profile {
  min-height: 100dvh;
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
}

.profile-resource-shell {
  padding-bottom: 0;
}

.profile-hero-frame {
  margin: 0 16px;
  padding: 0;
  border-radius: 22px;
  background: transparent;
}

.profile-hero-v2 {
  min-height: 210px;
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) 78px;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--neo-border);
  border-radius: 22px;
  background:
    radial-gradient(circle at 16% 18%, rgba(255, 47, 163, 0.2), transparent 44%),
    var(--neo-panel);
  box-shadow: var(--neo-card-shadow);
}

.profile-avatar-ring {
  width: 116px;
  height: 116px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--neo-gold), #A56B00);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34);
}

.profile-avatar-ring img {
  width: 104px;
  height: 104px;
  object-fit: contain;
}

.profile-identity {
  position: static;
  transform: none;
  min-width: 0;
  max-width: none;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.profile-username {
  color: #FFFFFF;
  font-size: 24px;
}

.profile-joined,
.profile-identity small {
  color: #E6DDF7;
  font-weight: 900;
}

.profile-level-track {
  height: 12px;
  margin: 12px 0 6px;
}

.profile-rank-shield {
  display: grid;
  place-items: center;
  width: 72px;
  height: 84px;
  border-radius: 22px;
  background: linear-gradient(180deg, #FFE173, #F69A20);
  color: #7A3B00;
  font-size: 32px;
  font-weight: 900;
}

.profile-rank-shield small {
  color: #FFFFFF;
  font-size: 11px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.24);
}

.profile-body {
  margin-top: 0;
}

.profile-stats-card,
.profile-achievements-card,
.profile-statistics-card,
.profile-links,
.profile-stats-table,
.profile-learn-card,
.profile-goal-card,
.profile-league-card {
  border-radius: 18px;
}

.profile-stat-num,
.profile-section-title,
.profile-league-name,
.profile-goal-title,
.profile-links .stat-row,
.profile-stats-table .stat-row {
  color: #FFFFFF;
}

.profile-achievement-row,
.profile-statistics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.profile-achievement {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(8, 7, 22, 0.36);
  text-align: center;
}

.profile-achievement span {
  font-size: 34px;
}

.profile-achievement strong {
  color: #FFFFFF;
  font-size: 12px;
}

.profile-achievement small,
.profile-statistics-grid span,
.profile-stat-label,
.profile-week-day {
  color: var(--neo-muted);
  font-weight: 800;
}

.profile-achievement.locked {
  opacity: 0.52;
}

.profile-statistics-grid {
  grid-template-columns: repeat(3, 1fr);
}

.profile-statistics-grid div {
  min-height: 86px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(8, 7, 22, 0.36);
}

.profile-statistics-grid small {
  color: var(--neo-muted);
  font-weight: 900;
}

.profile-statistics-grid strong {
  color: #FFFFFF;
  font-size: 22px;
}

@media (max-width: 380px) {
  .exam-topic-grid,
  .hub-building-grid,
  .hub-bonus-row,
  .jk-actions-grid,
  .jk-collection-row,
  .profile-achievement-row {
    grid-template-columns: 1fr 1fr;
  }

  .profile-hero-v2 {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .profile-rank-shield {
    display: none;
  }

  .profile-avatar-ring {
    width: 92px;
    height: 92px;
  }

  .profile-avatar-ring img {
    width: 82px;
    height: 82px;
  }

  .hub-pantry-card {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .hub-pantry-chest {
    display: none;
  }
}

/* Production pass: Jamchik home */
.screen-jamchik .jk-top-shell {
  padding-bottom: 0;
}

.screen-jamchik .jk-avatar-area-large {
  position: relative;
  display: block;
  min-height: 374px;
  margin: 0 16px;
  padding: 18px 18px 16px;
  overflow: hidden;
  border-radius: 24px;
  border-color: rgba(255, 77, 190, 0.22);
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 47, 163, 0.24), transparent 40%),
    radial-gradient(circle at 18% 28%, rgba(107, 78, 255, 0.2), transparent 34%),
    linear-gradient(180deg, rgba(25, 14, 49, 0.98), rgba(9, 7, 23, 0.99));
}

.screen-jamchik .mbg-scene {
  opacity: 0.72;
  mix-blend-mode: screen;
}

.screen-jamchik .jk-room-shelf {
  position: absolute;
  z-index: 1;
  left: 22px;
  top: 88px;
  width: 96px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(101, 68, 152, 0.68), rgba(33, 18, 67, 0.72));
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.28);
}

.screen-jamchik .jk-room-shelf::before {
  content: '';
  position: absolute;
  left: 14px;
  bottom: 9px;
  width: 32px;
  height: 42px;
  border-radius: 16px 16px 9px 9px;
  background:
    radial-gradient(circle at 50% 14%, rgba(255, 95, 197, 0.78), transparent 36%),
    linear-gradient(180deg, rgba(68, 41, 117, 0.88), rgba(25, 17, 55, 0.92));
  opacity: 0.64;
}

.screen-jamchik .jk-room-shelf::after {
  content: '';
  position: absolute;
  right: -186px;
  top: -34px;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 47, 163, 0.22), transparent 64%);
  filter: blur(4px);
}

.screen-jamchik .jk-title-card {
  position: relative;
  z-index: 3;
  text-align: center;
}

.screen-jamchik .jk-title-card h1 {
  color: #FF9BD7;
  font-size: 44px;
  text-shadow: 0 5px 18px rgba(0, 0, 0, 0.38), 0 0 20px rgba(255, 47, 163, 0.24);
}

.screen-jamchik .jk-title-card p {
  margin-top: 7px;
  font-size: 15px;
}

.screen-jamchik .jk-hero-stage {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 8px;
  align-items: center;
  min-height: 260px;
  margin-top: 2px;
}

.screen-jamchik .jk-avatar-slot {
  width: 100%;
  min-height: 242px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 10px 0 0;
}

.screen-jamchik .jk-hero-img {
  width: min(228px, 58vw);
  max-height: 236px;
  object-fit: contain;
  transform: translateX(8px);
  filter:
    drop-shadow(0 20px 22px rgba(0, 0, 0, 0.48))
    drop-shadow(0 0 22px rgba(255, 47, 163, 0.36));
}

.screen-jamchik .jk-avatar-area-large::after {
  content: '';
  position: absolute;
  z-index: 2;
  left: 42px;
  right: 112px;
  bottom: 26px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.42), transparent 70%);
  filter: blur(4px);
  pointer-events: none;
}

.screen-jamchik .jk-mood-card {
  position: relative;
  top: auto;
  right: auto;
  z-index: 4;
  width: 100%;
  align-self: center;
  padding: 12px;
  border-color: rgba(255, 77, 190, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02)),
    rgba(11, 8, 28, 0.76);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.3);
}

.screen-jamchik .jk-mood-card strong {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
}

.screen-jamchik .jk-mood-face {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.screen-jamchik .jk-mood-card button.disabled {
  opacity: 0.55;
}

.screen-jamchik .jk-speech-pop {
  left: 8px;
  right: 124px;
  top: auto;
  bottom: 12px;
  min-height: 54px;
}

.screen-jamchik .jk-name-row {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015)),
    rgba(16, 10, 36, 0.92);
}

.screen-jamchik .jk-status-row {
  margin-top: 4px;
}

.screen-jamchik .jk-status-desc {
  margin: 8px 0 0;
  line-height: 1.35;
}

.screen-jamchik .jk-bars,
.screen-jamchik .jk-daily-stats {
  display: none;
}

.screen-jamchik .jk-actions-grid {
  gap: 8px;
  margin-top: 18px;
}

.screen-jamchik .jk-actions-title h2,
.screen-jamchik .jk-collection .neo-section-head h2 {
  color: #FF70C8;
  font-size: 15px;
  letter-spacing: 0.2px;
}

.screen-jamchik .jk-action-card {
  min-height: 154px;
  padding: 10px 7px;
  border-radius: 17px;
  background:
    radial-gradient(circle at 50% 16%, rgba(255, 47, 163, 0.12), transparent 48%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.016)),
    rgba(17, 11, 39, 0.94);
}

.screen-jamchik .jk-action-icon {
  width: 50px;
  height: 50px;
  object-fit: contain;
  filter: drop-shadow(0 8px 9px rgba(0, 0, 0, 0.35));
}

.screen-jamchik .jk-action-name {
  font-size: 12px;
  line-height: 1.15;
}

.screen-jamchik .jk-action-sub {
  min-height: 31px;
  font-size: 10px;
  line-height: 1.2;
}

.screen-jamchik .jk-action-card b {
  min-height: 34px;
  border-radius: 12px;
}

.screen-jamchik .jk-collection {
  margin-top: 16px;
}

.screen-jamchik .jk-collection-card {
  min-height: 118px;
  border-radius: 17px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.048), rgba(255, 255, 255, 0.014)),
    rgba(17, 11, 39, 0.9);
}

.screen-jamchik .jk-collection-card img {
  height: 62px;
}

@media (max-width: 380px) {
  .screen-jamchik .jk-hero-stage {
    grid-template-columns: 1fr;
  }

  .screen-jamchik .jk-mood-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    gap: 8px;
    align-items: center;
  }

  .screen-jamchik .jk-mood-card button {
    margin-top: 0;
  }

  .screen-jamchik .jk-speech-pop {
    right: 8px;
  }
}

/* Jamchik hero refinements after browser pass */
.screen-jamchik .mbg-grad.ecstatic,
.screen-jamchik .mbg-grad.content,
.screen-jamchik .mbg-grad.hungry,
.screen-jamchik .mbg-grad.sad {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 47, 163, 0.26), transparent 40%),
    radial-gradient(circle at 18% 18%, rgba(111, 72, 255, 0.18), transparent 34%),
    linear-gradient(180deg, #171033 0%, #21133C 42%, #2A1238 72%, #0B0717 100%) !important;
  filter: saturate(1.1) !important;
}

.screen-jamchik .mbg-scene {
  opacity: 0.86;
  mix-blend-mode: normal;
}

.screen-jamchik .jk-hero-stage {
  display: block;
  width: 100%;
  min-height: 260px;
}

.screen-jamchik .jk-avatar-slot {
  position: absolute;
  z-index: 4;
  left: 2px;
  right: 150px;
  top: 76px;
  bottom: 64px;
  min-height: 0;
  padding: 0;
}

.screen-jamchik .jk-hero-img {
  width: min(194px, 48vw);
  max-height: 194px;
  transform: translateX(0);
}

.screen-jamchik .jk-mood-card {
  position: absolute;
  z-index: 5;
  right: 2px;
  top: 84px;
  width: 128px;
  transform: none;
}

.screen-jamchik .jk-speech-pop {
  position: absolute;
  z-index: 6;
  left: 18px;
  right: 142px;
  bottom: 18px;
  min-height: 50px;
  display: grid;
  place-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(255, 77, 190, 0.22);
  background: rgba(17, 11, 39, 0.88);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.3);
}

.screen-jamchik .jk-speech-pop:empty {
  display: none;
}

.screen-jamchik .jk-speech-pop .jk-speech-text {
  color: #FFFFFF;
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 800;
}

.screen-jamchik .jk-speech-tail-down {
  border-top-color: rgba(17, 11, 39, 0.9);
}

/* Jamchik production pass: compact game-screen composition */
.screen-jamchik {
  min-height: 100dvh;
  height: auto;
  overflow: visible;
  padding-bottom: calc(124px + env(safe-area-inset-bottom));
}

.screen-jamchik .jk-avatar-area-large {
  min-height: 340px;
  margin: 0 16px;
  padding: 16px;
  border-radius: 24px;
}

.screen-jamchik .jk-title-card h1 {
  font-size: 42px;
  line-height: 0.92;
}

.screen-jamchik .jk-title-card p {
  margin-top: 6px;
  font-size: 14px;
}

.screen-jamchik .jk-hero-stage {
  display: block;
  min-height: 236px;
  margin-top: 0;
}

.screen-jamchik .jk-avatar-slot {
  position: absolute;
  z-index: 4;
  left: 2px;
  right: 126px;
  top: 116px;
  bottom: 48px;
  min-height: 0;
  overflow: visible;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.screen-jamchik .jk-hero-img {
  width: min(212px, 54vw);
  max-height: 202px;
  object-fit: contain;
  transform: translateX(0);
}

.screen-jamchik .jk-avatar-area-large::after {
  left: 42px;
  right: 132px;
  bottom: 36px;
  height: 30px;
}

.screen-jamchik .jk-mood-card {
  position: absolute;
  z-index: 5;
  right: 14px;
  top: 126px;
  width: 124px;
  padding: 9px;
  border-radius: 16px;
}

.screen-jamchik .jk-mood-card strong {
  margin: 3px 0 6px;
  font-size: 13px;
}

.screen-jamchik .jk-mood-track {
  height: 7px;
}

.screen-jamchik .jk-mood-card button {
  min-height: 30px;
  margin-top: 6px;
  border-radius: 11px;
  font-size: 10px;
}

.screen-jamchik .jk-mood-card button img {
  width: 19px;
  height: 19px;
}

.screen-jamchik .jk-speech-pop {
  left: 18px;
  right: 150px;
  bottom: 10px;
  min-height: 46px;
  padding: 8px 10px;
  border-radius: 15px;
}

.screen-jamchik .jk-speech-pop .jk-speech-text {
  font-size: 12px;
  line-height: 1.16;
}

.screen-jamchik .jk-name-row {
  position: relative;
  min-height: 62px;
  margin: 12px 16px 0;
  padding: 12px 16px 12px 18px;
  border-radius: 18px;
  text-align: left;
}

.screen-jamchik .jk-name-row::before {
  content: '';
  position: absolute;
  left: 18px;
  top: -7px;
  width: 14px;
  height: 14px;
  border-left: 1px solid rgba(255, 77, 190, 0.22);
  border-top: 1px solid rgba(255, 77, 190, 0.22);
  background: rgba(17, 11, 39, 0.94);
  transform: rotate(45deg);
}

.screen-jamchik .jk-status-bubble-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.screen-jamchik .jk-status-bubble-copy strong {
  color: #FFFFFF;
  font-size: 14px;
  line-height: 1.15;
}

.screen-jamchik .jk-status-bubble-copy span {
  color: #CFC4EC;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}

.screen-jamchik .jk-name-row .jk-name {
  display: none;
}

.screen-jamchik .jk-name-row .jk-status-row {
  justify-content: flex-start;
  margin-top: 0;
}

.screen-jamchik .jk-name-row .jk-status-desc {
  margin: 5px 0 0;
  color: #CFC4EC;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  text-align: left;
}

.screen-jamchik .jk-actions-grid {
  gap: 8px;
  margin-top: 16px;
}

.screen-jamchik .jk-actions-title {
  margin-bottom: -1px;
}

.screen-jamchik .jk-action-card {
  min-height: 137px;
  padding: 9px 6px 8px;
  border-radius: 16px;
}

.screen-jamchik .jk-action-icon {
  width: 46px;
  height: 46px;
}

.screen-jamchik #jk-review .jk-action-icon {
  content: url('../assets/images/nav-v2/roadmap.png');
}

.screen-jamchik #jk-practice .jk-action-icon {
  content: url('../assets/images/nav-v2/exam.png');
}

.screen-jamchik .jk-action-name {
  font-size: 11px;
}

.screen-jamchik .jk-action-sub {
  min-height: 28px;
  font-size: 9.5px;
}

.screen-jamchik .jk-action-card b {
  min-height: 31px;
  border-radius: 11px;
  font-size: 12px;
}

.screen-jamchik .jk-collection {
  margin-top: 14px;
}

.screen-jamchik .jk-collection-card {
  min-height: 108px;
  padding: 7px;
}

.screen-jamchik .jk-collection-card img {
  height: 56px;
}

@media (max-width: 380px) {
  .screen-jamchik .jk-avatar-area-large {
    min-height: 344px;
  }

  .screen-jamchik .jk-avatar-slot {
    right: 118px;
  }

  .screen-jamchik .jk-hero-img {
    width: min(202px, 56vw);
  }

  .screen-jamchik .jk-mood-card {
    right: 10px;
    width: 120px;
  }

  .screen-jamchik .jk-speech-pop {
    right: 138px;
  }
}

/* Production pass: Factory */
.screen-hub {
  --hub-edge: 20px;
  display: block;
  min-height: 100dvh;
  height: auto;
  overflow: visible;
  padding: 0 0 calc(148px + env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(16, 9, 33, 0.98), rgba(6, 5, 18, 1));
  color: #FFFFFF;
}

.screen-hub .hub-top-pad {
  padding-bottom: 0;
}

.screen-hub .resource-bar {
  margin-bottom: 10px;
}

.screen-hub .resource-chip,
.screen-hub .resource-settings {
  height: 40px;
  border-radius: 15px;
}

.screen-hub .resource-icon {
  width: 25px;
  height: 25px;
}

.screen-hub .resource-chip span,
.screen-hub .resource-streak-copy span {
  font-size: 14px;
}

.screen-hub .resource-chip small,
.screen-hub .resource-streak-copy small {
  font-size: 9px;
}

.screen-hub .hub-image-area {
  position: relative;
  width: auto;
  max-width: calc(100% - (var(--hub-edge) * 2));
  height: 229px;
  min-height: 229px;
  margin: 0 var(--hub-edge);
  overflow: hidden;
  border: 1px solid rgba(255, 77, 190, 0.2);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(22, 15, 48, 0.98) 0%, rgba(35, 14, 54, 0.96) 54%, rgba(13, 8, 28, 0.99) 100%);
  box-shadow: var(--neo-card-shadow);
}

.screen-hub .hub-image-area::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(8, 6, 20, 0.14), rgba(8, 6, 20, 0.38) 58%, rgba(8, 6, 20, 0.12)),
    linear-gradient(180deg, rgba(8, 6, 20, 0.06), rgba(8, 6, 20, 0.64));
  pointer-events: none;
}

.hub-stage-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.86;
  filter: saturate(1.05) brightness(0.78) contrast(1.02);
}

.hub-hero-night {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.hub-backdrop-img {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.36;
  filter: saturate(1.12) brightness(0.74) contrast(1.05);
}

.hub-hero-night::before,
.hub-hero-night::after,
.hub-hero-night span {
  content: '';
  position: absolute;
  display: block;
  border-radius: 999px;
  background: rgba(255, 77, 190, 0.12);
  filter: blur(0.2px);
}

.hub-hero-night::before {
  left: 22px;
  top: 72px;
  width: 78px;
  height: 22px;
}

.hub-hero-night::after {
  right: 20px;
  top: 58px;
  width: 104px;
  height: 28px;
}

.hub-hero-night span:nth-child(1) {
  left: 10px;
  bottom: 84px;
  width: 96px;
  height: 30px;
  background: rgba(71, 43, 105, 0.34);
}

.hub-hero-night span:nth-child(2) {
  right: 18px;
  bottom: 92px;
  width: 84px;
  height: 26px;
  background: rgba(71, 43, 105, 0.28);
}

.hub-hero-night span:nth-child(3) {
  left: 126px;
  top: 28px;
  width: 10px;
  height: 10px;
  background: rgba(255, 117, 211, 0.46);
  box-shadow: 72px 42px 0 rgba(255, 117, 211, 0.32), 188px 14px 0 rgba(255, 117, 211, 0.34);
}

.screen-hub .hub-factory-img {
  position: absolute;
  z-index: 2;
  left: 28px;
  bottom: 65px;
  width: min(129px, 32.8vw);
  height: auto;
  object-fit: contain;
  opacity: 1;
  filter:
    drop-shadow(0 20px 22px rgba(0, 0, 0, 0.44))
    drop-shadow(0 0 18px rgba(255, 47, 163, 0.24));
}

.screen-hub .hub-hero-copy {
  position: absolute;
  z-index: 3;
  top: 28px;
  right: 20px;
  max-width: 52%;
}

.screen-hub .hub-hero-copy h1 {
  margin: 0;
  color: #FFFFFF;
  font-family: var(--font-logo);
  font-size: 31px;
  line-height: 0.95;
  letter-spacing: 0;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.36);
}

.screen-hub .hub-hero-copy p {
  margin: 6px 0 0;
  color: #D8CDEF;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
}

.hub-hero-solve {
  position: absolute;
  z-index: 5;
  top: 18px;
  left: 16px;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid rgba(255, 77, 190, 0.24);
  border-radius: 999px;
  background: rgba(255, 47, 163, 0.16);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 0 18px rgba(255, 47, 163, 0.18);
}

.hub-level-panel {
  position: absolute;
  z-index: 5;
  left: 12px;
  right: 12px;
  bottom: 10px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 96px;
  gap: 8px;
  align-items: center;
  min-height: 54px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(12, 8, 27, 0.72);
  backdrop-filter: blur(12px);
}

.hub-level-medal {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(180deg, #FF5CC3, #C60F7B);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.28), 0 0 18px rgba(255, 47, 163, 0.36);
}

.hub-level-medal strong {
  font-size: 20px;
  font-weight: 950;
}

.hub-level-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #CFC4EC;
  font-size: 10px;
  font-weight: 850;
}

.hub-level-row strong {
  color: #FFFFFF;
  white-space: nowrap;
}

.hub-hero-progress {
  height: 7px;
  margin-top: 5px;
}

.hub-level-reward {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  column-gap: 5px;
  align-items: center;
}

.hub-level-reward span,
.hub-level-reward strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hub-level-reward span {
  color: #CFC4EC;
  font-size: 9px;
  font-weight: 850;
}

.hub-level-reward strong {
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 950;
}

.hub-level-reward img {
  grid-row: 1 / 3;
  grid-column: 2;
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 8px 9px rgba(0, 0, 0, 0.3));
}

.screen-hub .hub-info {
  padding: 0;
}

.screen-hub .hub-info:empty {
  display: none;
}

.hub-current-strip {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 1fr;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 77, 190, 0.14);
  border-radius: 18px;
  background: rgba(18, 11, 39, 0.72);
}

.hub-current-strip div {
  min-width: 0;
  padding: 2px 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.hub-current-strip div:first-child {
  border-left: 0;
}

.hub-current-strip span,
.hub-current-strip strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hub-current-strip span {
  color: #A99ACB;
  font-size: 10px;
  font-weight: 850;
}

.hub-current-strip strong {
  color: #FFFFFF;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 950;
}

.screen-hub .hub-buildings,
.screen-hub .hub-bonuses {
  padding: 0 var(--hub-edge);
}

.screen-hub .hub-buildings {
  margin-top: 12px;
}

.screen-hub .neo-section-head {
  margin-bottom: 8px;
}

.screen-hub .neo-section-head h2 {
  font-size: 18px;
}

.screen-hub .hub-building-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.screen-hub .hub-building-card {
  min-width: 0;
  min-height: 168px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 8px 7px;
  border-radius: 15px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.016)),
    rgba(17, 11, 39, 0.92);
}

.screen-hub .hub-building-card.locked {
  opacity: 0.86;
}

.hub-building-art {
  width: 100%;
  height: 59px;
  display: grid;
  place-items: center;
}

.screen-hub .hub-building-card img {
  width: 75px;
  height: 58px;
  object-fit: contain;
  border-radius: 0;
  filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.32));
}

.screen-hub .hub-building-card h3 {
  min-height: 18px;
  margin: 0;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 950;
  line-height: 1.1;
}

.screen-hub .hub-building-card p {
  margin: 0;
  color: #CFC4EC;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.05;
}

.screen-hub .hub-building-card small {
  min-height: 16px;
  color: #B7A9D8;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.05;
}

.screen-hub .hub-building-card em {
  width: 100%;
  min-height: 10px;
  color: #8E7FB5;
  font-size: 7.5px;
  font-style: normal;
  font-weight: 850;
  line-height: 1.05;
}

.hub-building-meter {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  gap: 5px;
  align-items: center;
  margin-top: 4px;
}

.screen-hub .hub-building-progress {
  width: 100%;
  height: 6px;
  margin: 0;
}

.hub-building-meter strong {
  color: #FFFFFF;
  font-size: 9px;
  font-weight: 900;
}

.screen-hub .hub-upgrade-btn {
  width: 100%;
  min-height: 29px;
  margin-top: 2px;
  gap: 3px;
  padding: 0 3px;
  border-radius: 11px;
  font-size: 8px;
  font-weight: 950;
  text-transform: uppercase;
}

.screen-hub .hub-upgrade-btn:disabled {
  opacity: 0.68;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.screen-hub .hub-upgrade-btn.short-gems:not(:disabled) {
  filter: saturate(0.75) brightness(0.9);
}

.screen-hub .hub-upgrade-btn img {
  width: 12px;
  height: 12px;
  object-fit: contain;
}

.screen-hub .hub-bonuses {
  margin-top: 12px;
}

.screen-hub .hub-bonus-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.screen-hub .hub-bonus-card {
  min-height: 64px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  column-gap: 6px;
  align-items: center;
  padding: 8px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.016)),
    rgba(17, 11, 39, 0.9);
}

.screen-hub .hub-bonus-empty {
  grid-column: 1 / -1;
}

.screen-hub .hub-bonus-card img {
  grid-row: 1 / 3;
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 9px 8px rgba(0, 0, 0, 0.3));
}

.screen-hub .hub-bonus-card strong {
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 950;
  line-height: 1.12;
}

.screen-hub .hub-bonus-card small {
  color: #B7A9D8;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.12;
}

.screen-hub .hub-pantry-card {
  min-height: 97px;
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
  margin: 0 0 12px;
  padding: 10px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.016)),
    rgba(17, 11, 39, 0.9);
}

.screen-hub .hub-pantry-card img:first-child {
  width: 66px;
  height: 66px;
  object-fit: contain;
}

.screen-hub .hub-pantry-card h2 {
  margin: 0 0 4px;
  color: #FF70C8;
  font-size: 18px;
  font-weight: 950;
}

.screen-hub .hub-pantry-card p {
  margin: 0;
  color: #E6DDF7;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.screen-hub .hub-pantry-chest {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 12px 12px rgba(0, 0, 0, 0.34));
}

@media (max-width: 380px) {
  .hub-level-panel {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .hub-level-reward {
    display: none;
  }

  .screen-hub .hub-factory-img {
    left: 24px;
    width: min(122px, 34vw);
  }

  .hub-current-strip {
    grid-template-columns: 1fr;
  }

  .hub-current-strip div {
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .hub-current-strip div:first-child {
    border-top: 0;
  }
}
