@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=JetBrains+Mono:wght@400;700&display=swap');

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  --brand:       #ff9f43;
  --brand-light: #ffecd9;
  --brand-dark:  #e68a35;
  --brand-press: #f08a1f;
  --brand-2:     #10b981;
  --danger:      #ef4444;
  --danger-dark: #c0392b;
  --warning:     #f59e0b;
  --info:        #3b82f6;
  --bg:          #fff9f2;
  --card:        #ffffff;
  --sep:         rgba(60,60,67,0.12);

  --text-1: #1c1c2e;
  --text-2: #64748b;
  --text-3: #94a3b8;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 32px;
  --r-full: 9999px;

  --sh-sm: 0 1px 3px rgba(49,38,21,.08), 0 1px 2px rgba(49,38,21,.04);
  --sh-md: 0 4px 16px rgba(49,38,21,.10);
  --sh-lg: 0 12px 32px rgba(49,38,21,.14);

  --font: 'Nunito', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Courier New', Courier, monospace;

  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);

  --safe-top:    env(safe-area-inset-top,    0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
::-webkit-scrollbar { display: none; }

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  font-family: var(--font);
  font-size: 16px;
  color: var(--text-1);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at top, rgba(255,236,217,.65) 0%, transparent 55%),
    radial-gradient(closest-side at 96% 14%, rgba(139,92,246,.07), transparent 70%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.5;
}

h1,h2,h3,h4,h5,h6 { font-family: var(--font); font-weight: 800; letter-spacing: -0.022em; }

/* ============================================================
   UTILITIES
   ============================================================ */
.glass {
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.glass-bottom {
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}
.app-page {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 18px calc(96px + var(--safe-bottom));
  flex-grow: 1;
}
.btn-block { width: 100%; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes slideUp   { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes float     { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes blobFloat {
  0%,100% { transform: translateY(0) rotate(0deg);  border-radius: 46% 54% 58% 42% / 52% 44% 56% 48%; }
  50%     { transform: translateY(-8px) rotate(4deg); border-radius: 54% 46% 42% 58% / 44% 56% 48% 52%; }
}
@keyframes pulseGlow { 0%,100% { box-shadow: 0 0 0 0 rgba(255,159,67,.4); } 50% { box-shadow: 0 0 0 12px rgba(255,159,67,0); } }
@keyframes popIn     { 0% { transform: scale(0); opacity: 0; } 60% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
@keyframes stepPop   { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fbPop     { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes doneBounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes starPop   { to { transform: scale(1); } }
@keyframes sheetUp   { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes arenaBlink { 0%,100% { opacity: .4; } 50% { opacity: 1; } }
@keyframes mazePulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.18); } }
@keyframes radioPop  { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes sway      { 0%,100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }

.screen { display: none; flex-direction: column; flex-grow: 1; animation: slideUp .35s var(--ease-out); }
.screen.active { display: flex; }

/* ============================================================
   BUTTONS — 3D press (signature look)
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 15px 26px;
  border-radius: var(--r-md);
  font-family: var(--font);
  font-weight: 800;
  font-size: 1.0625rem;
  cursor: pointer;
  border: none;
  outline: none;
  text-decoration: none;
  gap: 8px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition:
    transform .15s var(--ease-spring),
    box-shadow .15s ease,
    background-color .15s ease;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 4px 0 0 var(--brand-dark);
  border: 1px solid var(--brand-dark);
}
.btn-primary:hover { background: #f09030; }
.btn-primary:active { transform: translateY(4px); box-shadow: none; }

.btn-secondary {
  background: #22c55e;
  color: #fff;
  box-shadow: 0 4px 0 0 #16a34a;
  border: 1px solid #16a34a;
}
.btn-secondary:hover { background: #16a34a; }
.btn-secondary:active { transform: translateY(4px); box-shadow: none; }

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 0 0 var(--danger-dark);
  border: 1px solid var(--danger-dark);
}
.btn-danger:active { transform: translateY(4px); box-shadow: none; }

.btn-outline {
  background: transparent;
  color: var(--brand);
  border: 1.5px solid rgba(120,120,128,.2);
}
.btn-outline:hover { background: rgba(120,120,128,.07); }
.btn-outline:active { transform: scale(.97); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  font-weight: 700;
}
.btn-ghost:hover { background: rgba(120,120,128,.08); }
.btn-ghost:active { transform: scale(.97); }

.btn-danger-ghost { color: var(--danger); }

.btn:disabled {
  background: #e2e8f0 !important;
  color: #94a3b8 !important;
  box-shadow: 0 4px 0 0 #cbd5e1 !important;
  border-color: #cbd5e1 !important;
  pointer-events: none;
  transform: none !important;
}

@media (max-width: 768px) { .btn { min-height: 48px; } }

/* ============================================================
   HEADER (TopBar) — glass, rounded bottom
   ============================================================ */
header {
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(226,232,240,.5);
  border-radius: 0 0 24px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 56px;
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  box-shadow: 0 2px 16px rgba(49,38,21,.06);
}
.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-1);
}
.logo-icon {
  width: 40px; height: 40px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--brand);
  animation: float 4s ease-in-out infinite;
}
.logo-text { font-size: 1.5rem; font-weight: 900; letter-spacing: -0.03em; }
.logo-accent { color: var(--brand); }

/* Logged-in: hide logo, spread pills full-width like new design */
header.user-logged-in .logo-link { display: none; }
header.user-logged-in .header-container { width: 100%; }
header.user-logged-in .user-stats { flex: 1; justify-content: space-between; }

/* Stat pills */
.user-stats { display: flex; align-items: center; gap: 10px; }
.stat-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  font-weight: 900;
  font-size: 0.95rem;
  border: 1.5px solid;
}
.stat-pill.heart  { color: #e53e3e; background: #fff5f5; border-color: #fed7d7; }
.stat-pill.streak { color: #c05621; background: #fffaf0; border-color: #fbd38d; }
.stat-pill.coins  { color: #b7791f; background: #fefce8; border-color: #fef08a; }

#guest-actions { display: flex; gap: 8px; }

@media (max-width: 768px) {
  header { padding: calc(var(--safe-top) + 10px) 18px 10px; }
  .logo-text { display: none; }
  .user-stats { gap: 8px; }
  .stat-pill { padding: 7px 13px; font-size: 0.92rem; }
}

/* ============================================================
   BOTTOM NAV — glass, rounded top, active pill
   ============================================================ */
.mobile-bottom-nav { display: none; }

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed !important;
    bottom: 0 !important;
    left: 0; right: 0;
    z-index: 10000 !important;
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(226,232,240,.5);
    border-radius: 24px 24px 0 0;
    justify-content: space-around;
    padding-bottom: var(--safe-bottom);
    box-shadow: 0 -6px 24px rgba(0,0,0,.06);
  }
  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 0 8px;
    width: 100%;
    text-decoration: none;
    color: var(--text-2);
    -webkit-tap-highlight-color: transparent;
    gap: 2px;
  }
  .bottom-nav-item .icon {
    font-size: 1.35rem;
    width: 44px; height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: background .2s ease, transform .25s var(--ease-spring);
  }
  .bottom-nav-item .text {
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .03em;
  }
  .bottom-nav-item.active { color: var(--brand); }
  .bottom-nav-item.active .icon {
    background: var(--brand-light);
    transform: scale(1.08);
  }

  body, main.screen { padding-bottom: 90px !important; }
  #screen-landing { padding-bottom: 0 !important; }
}

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
  position: fixed;
  top: 90px; right: 16px;
  z-index: 1100;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: rgba(28,28,46,.92);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--r-full);
  font-weight: 700;
  font-size: 0.95rem;
  animation: slideUp .3s var(--ease-spring);
  display: flex; align-items: center; gap: 8px;
  backdrop-filter: blur(12px);
  box-shadow: var(--sh-lg);
}
.toast.success { border-left: 3px solid var(--brand-2); }
.toast.error   { border-left: 3px solid var(--danger); }

@media (max-width: 600px) {
  .toast-container { top: auto; bottom: 110px; right: 12px; left: 12px; }
  .toast { font-size: .88rem; padding: 10px 16px; }
}

/* ============================================================
   MODALS — bottom sheet with grabber
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
  z-index: 99999;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.modal-overlay.active { display: flex; }
.modal-card {
  background: var(--card);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  width: 100%;
  max-width: 540px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 -12px 44px rgba(0,0,0,.2);
  animation: sheetUp .4s var(--ease-out);
  display: flex;
  flex-direction: column;
}
.modal-card::before {
  content: '';
  display: block;
  width: 36px; height: 5px;
  border-radius: 3px;
  background: rgba(120,120,128,.35);
  margin: 12px auto 0;
  flex-shrink: 0;
}
@media (min-width: 600px) {
  .modal-overlay { align-items: center; padding: 16px; }
  .modal-card { border-radius: var(--r-xl); max-width: 480px; }
  .modal-card::before { display: none; }
}
.modal-header {
  padding: 20px 20px 14px;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}
.modal-header h3 { font-size: 1.2rem; }
.modal-close {
  background: rgba(120,120,128,.1);
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  min-width: 32px; min-height: 32px;
}
.modal-body { padding: 20px; overflow-y: auto; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 7px; font-weight: 700; font-size: .9rem; }
.form-input {
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-radius: var(--r-sm);
  background: rgba(120,120,128,.1);
  font-family: var(--font);
  font-size: 1rem;
  outline: none;
  transition: box-shadow .2s ease, background .2s ease;
  pointer-events: auto !important;
  user-select: text !important;
  -webkit-user-select: text !important;
  touch-action: manipulation;
  position: relative; z-index: 10;
}
.form-input:focus {
  background: rgba(120,120,128,.15);
  box-shadow: 0 0 0 3px rgba(255,159,67,.25);
}

/* Auth tabs */
.auth-tabs {
  display: flex;
  background: rgba(120,120,128,.12);
  border-radius: var(--r-sm);
  padding: 4px;
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1; border: none; background: transparent;
  padding: 10px; border-radius: 8px;
  font-family: var(--font); font-weight: 700; font-size: 1rem;
  color: var(--text-2); cursor: pointer;
  transition: background .2s, color .2s;
  -webkit-tap-highlight-color: transparent;
}
.auth-tab.active { background: var(--card); color: var(--text-1); box-shadow: var(--sh-sm); }

/* ============================================================
   WELCOME SCREEN
   ============================================================ */
#screen-landing {
  background:
    radial-gradient(ellipse at top, rgba(255,236,217,.8) 0%, transparent 55%),
    var(--bg) !important;
}
.welcome {
  flex-grow: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: calc(var(--safe-top) + 32px) 26px calc(28px + var(--safe-bottom));
  max-width: 480px; margin: 0 auto; width: 100%;
}
.welcome-art {
  position: relative;
  width: 200px; height: 200px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
}
.welcome-blob {
  position: absolute; inset: 0;
  border-radius: 46% 54% 58% 42% / 52% 44% 56% 48%;
  background: linear-gradient(145deg, #ffd9a8, #ff9f43);
  box-shadow: 0 18px 44px -8px rgba(255,159,67,.4);
  animation: blobFloat 6s ease-in-out infinite;
}
.welcome-mascot {
  position: relative; z-index: 1;
  width: 150px; height: 150px;
  object-fit: contain;
  filter: drop-shadow(0 10px 16px rgba(0,0,0,.18));
}
.welcome-title { font-size: 2.6rem; font-weight: 900; margin-bottom: 8px; letter-spacing: -0.03em; }
.welcome-subtitle { color: var(--text-2); font-size: 1.05rem; line-height: 1.5; margin-bottom: 28px; }
.welcome-points {
  list-style: none; text-align: left;
  display: flex; flex-direction: column; gap: 12px;
  margin-bottom: 32px; width: 100%; max-width: 320px;
}
.welcome-points li {
  display: flex; align-items: center; gap: 12px;
  font-size: 1rem; font-weight: 700; color: var(--text-1);
}
.welcome-points .wp-emoji {
  flex: 0 0 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--card);
  border-radius: var(--r-full);
  box-shadow: var(--sh-sm);
  font-size: 1.2rem;
}
.welcome-actions {
  width: 100%; max-width: 340px;
  display: flex; flex-direction: column; gap: 10px;
  position: relative;
}
.welcome-actions::before {
  content: '';
  position: absolute; left: 15%; right: 15%; top: -8px; height: 52px;
  background: rgba(255,159,67,.32);
  filter: blur(24px);
  border-radius: var(--r-full);
  pointer-events: none;
}
.welcome-actions .btn { position: relative; }
.btn-cta-start, .btn-cta-login { width: 100%; }

/* ============================================================
   ONBOARDING QUIZ
   ============================================================ */
.onb {
  flex-grow: 1; display: flex; flex-direction: column;
  width: 100%; max-width: 540px; margin: 0 auto;
}
.onb-top {
  display: flex; align-items: center; gap: 12px;
  padding: calc(var(--safe-top) + 14px) 18px 6px;
}
.onb-back {
  flex: 0 0 36px; height: 36px; border: none; background: transparent;
  font-size: 2rem; line-height: 1; color: var(--text-3);
  cursor: pointer; display: grid; place-items: center; padding-bottom: 4px;
}
.onb-back:active { transform: scale(.9); }
.onb-progress {
  flex: 1; height: 12px; background: rgba(120,120,128,.18);
  border-radius: var(--r-full); overflow: hidden;
}
.onb-progress span {
  display: block; height: 100%; width: 0;
  background: var(--brand-2); border-radius: inherit;
  transition: width .4s var(--ease-out);
}
.onb-step { font-size: .8rem; font-weight: 800; color: var(--text-3); min-width: 30px; text-align: right; }
.onb-body { flex-grow: 1; padding: 22px 20px 12px; overflow-y: auto; }
.onb-q-row { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 26px; }
.onb-mascot { flex: 0 0 64px; width: 64px; height: 64px; object-fit: contain; }
.onb-bubble {
  position: relative;
  background: var(--card); border: 2px solid var(--sep);
  border-radius: var(--r-lg); padding: 14px 16px;
  font-size: 1.1rem; font-weight: 700; line-height: 1.35;
  box-shadow: var(--sh-sm);
}
.onb-bubble::before {
  content: '';
  position: absolute; left: -9px; bottom: 14px;
  width: 16px; height: 16px;
  background: var(--card);
  border-left: 2px solid var(--sep); border-bottom: 2px solid var(--sep);
  transform: rotate(45deg);
}
.onb-options { display: flex; flex-direction: column; gap: 12px; }
.onb-option {
  width: 100%; text-align: left;
  background: var(--card); border: 2px solid var(--sep);
  border-bottom: 4px solid #e2e8f0;
  border-radius: 20px; padding: 16px 18px;
  font-size: 1.02rem; font-weight: 700; color: var(--text-1);
  cursor: pointer; box-shadow: var(--sh-sm);
  transition: transform .14s var(--ease-spring), border-color .18s;
}
.onb-option:active { transform: translateY(2px); border-bottom-width: 2px; }
.onb-option.selected {
  border-color: var(--brand); border-bottom-color: var(--brand-dark);
  background: rgba(255,159,67,.08);
}
.onb-footer {
  padding: 12px 18px calc(16px + var(--safe-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  position: sticky; bottom: 0;
}
.onb-view-item { padding: 12px 0; border-bottom: 1px solid var(--sep); }
.onb-view-item:last-child { border-bottom: none; }
.onb-view-q { font-size: .86rem; color: var(--text-2); margin-bottom: 3px; }
.onb-view-a { font-size: 1.05rem; font-weight: 700; }

/* ============================================================
   HOME SCREEN
   ============================================================ */
.home-greeting {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.home-hello { color: var(--text-2); font-size: 1rem; font-weight: 700; }
.home-username { font-size: 1.9rem; font-weight: 900; letter-spacing: -0.03em; }
.home-avatar {
  width: 52px; height: 52px;
  border-radius: var(--r-full);
  object-fit: cover;
  border: 2px solid var(--brand);
  background: #fff;
}
.home-section-title {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  font-weight: 800;
  margin: 6px 4px 12px;
  display: flex; align-items: center; gap: 6px;
}
.home-section-title::before {
  content: '';
  width: 4px; height: 14px; border-radius: 3px;
  background: linear-gradient(var(--brand), var(--brand-2));
  flex-shrink: 0;
}

/* Daily goal card */
.goal-card {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border: 1px solid #eef1f6; border-radius: 22px;
  padding: 14px 16px; margin-bottom: 14px;
  box-shadow: 0 10px 24px -16px rgba(15,23,42,.2);
}
.goal-card.done { border-color: rgba(16,185,129,.35); background: linear-gradient(160deg,#fff,#ecfdf5); }
.goal-ring {
  --p: 0;
  flex: 0 0 56px; width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--brand-2) calc(var(--p)*1%), #e9edf3 0);
  transition: background .5s ease;
}
.goal-ring::before {
  content: '';
  position: absolute;
  width: 42px; height: 42px; border-radius: 50%;
  background: #fff;
}
.goal-card.done .goal-ring::before { background: #ecfdf5; }
.goal-ring-num { position: relative; font-weight: 900; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.goal-ring-num i { font-style: normal; font-size: .72rem; color: var(--text-2); }
.goal-info { flex: 1; min-width: 0; }
.goal-title { font-weight: 800; font-size: 1rem; }
.goal-sub { font-size: .85rem; color: var(--text-2); margin-top: 2px; }
.goal-badge { font-size: 1.5rem; flex: 0 0 auto; }

/* Continue (hero) card */
.continue-card {
  width: 100%; display: flex; align-items: center; gap: 16px;
  text-align: left; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--brand), #f97316);
  color: #fff; border-radius: 24px; padding: 18px;
  margin: 0 0 16px;
  box-shadow: 0 6px 0 0 var(--brand-dark), 0 16px 32px -14px rgba(249,115,22,.45);
  border: 1px solid var(--brand-dark);
  transition: transform .15s var(--ease-spring), box-shadow .15s ease;
  position: relative; overflow: hidden;
}
.continue-card::after {
  content: '';
  position: absolute; inset: 0 0 55% 0;
  background: linear-gradient(180deg, rgba(255,255,255,.16), transparent);
  pointer-events: none;
}
.continue-card:active { transform: translateY(5px); box-shadow: 0 0 0 0 var(--brand-dark), 0 4px 12px rgba(0,0,0,.15); }
.cc-emoji {
  width: 56px; height: 56px; flex: 0 0 56px;
  display: grid; place-items: center; font-size: 1.7rem;
  background: rgba(255,255,255,.22); border-radius: 18px;
}
.cc-info { flex: 1; min-width: 0; }
.cc-label { font-size: .78rem; font-weight: 700; opacity: .85; text-transform: uppercase; letter-spacing: .04em; }
.cc-lesson { font-weight: 800; font-size: 1.05rem; margin: 3px 0 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-bar { height: 7px; background: rgba(255,255,255,.28); border-radius: 999px; overflow: hidden; }
.cc-bar > span { display: block; height: 100%; background: #fff; border-radius: inherit; }
.cc-go {
  width: 42px; height: 42px; flex: 0 0 42px;
  display: grid; place-items: center;
  background: #fff; color: #f97316;
  border-radius: 50%; font-size: .95rem;
  box-shadow: 0 6px 14px -6px rgba(0,0,0,.3);
}

/* Mistake card */
.mistakes-card {
  width: 100%; display: flex; align-items: center; gap: 14px;
  text-align: left; cursor: pointer;
  border: 1px solid #fecdd3;
  background: linear-gradient(135deg, #fff1f2, #ffe4e6);
  border-radius: 20px; padding: 14px 16px; margin-bottom: 14px;
  box-shadow: 0 10px 24px -16px rgba(244,63,94,.35);
  transition: transform .12s ease;
}
.mistakes-card:active { transform: scale(.98); }
.mc-icon { width: 48px; height: 48px; flex: 0 0 48px; display: grid; place-items: center; font-size: 1.5rem; background: #fff; border-radius: 14px; }
.mc-info { flex: 1; min-width: 0; }
.mc-title { font-weight: 800; font-size: 1rem; color: #be123c; }
.mc-sub { font-size: .84rem; color: #9f1239; opacity: .85; margin-top: 2px; }
.mc-go { font-size: 1.5rem; color: #fb7185; }

/* Subject cards */
.subject-list { display: flex; flex-direction: column; gap: 12px; }
.subject-card {
  --accent: var(--brand);
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left;
  background: var(--card); border: 1.5px solid #f1f5f9;
  border-bottom: 4px solid #e2e8f0;
  border-radius: 24px; padding: 16px;
  cursor: pointer; box-shadow: var(--sh-sm);
  transition: transform .15s var(--ease-spring), border-color .15s, box-shadow .15s;
  position: relative; overflow: hidden;
}
.subject-card:active { transform: translateY(3px); border-bottom-width: 1px; box-shadow: none; }
.subject-icon {
  flex: 0 0 58px; height: 58px;
  display: grid; place-items: center;
  font-size: 1.9rem; border-radius: 20px;
  background: color-mix(in srgb, var(--accent) 14%, white);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, white);
}
.subject-info { flex: 1; min-width: 0; }
.subject-top { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.subject-name { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.01em; }
.subject-free {
  font-size: .68rem; font-weight: 800; color: var(--brand-2);
  background: rgba(16,185,129,.12); padding: 2px 8px;
  border-radius: var(--r-full);
}
.subject-sub { color: var(--text-2); font-size: .86rem; margin-bottom: 10px; font-weight: 600; }
.subject-progress { display: flex; align-items: center; gap: 10px; }
.subject-bar {
  flex: 1; height: 7px; background: rgba(120,120,128,.16);
  border-radius: var(--r-full); overflow: hidden;
}
.subject-bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .5s var(--ease-out); }
.subject-count { font-size: .78rem; font-weight: 800; color: var(--text-2); font-variant-numeric: tabular-nums; }
.subject-chevron { font-size: 1.5rem; color: var(--text-3); }

/* Arena card */
.arena-card {
  width: 100%; display: flex; align-items: center; gap: 14px;
  text-align: left; border: none; cursor: pointer;
  background: linear-gradient(135deg, #6d28d9, #4f46e5); color: #fff;
  border-bottom: 4px solid #4338ca;
  border-radius: 22px; padding: 16px 18px; margin: 4px 0 20px;
  box-shadow: 0 12px 26px -10px rgba(79,70,229,.5);
  transition: transform .15s var(--ease-spring), border-bottom-width .12s;
}
.arena-card:active { transform: translateY(3px); border-bottom-width: 1px; }
.arena-card-icon { font-size: 2rem; flex: 0 0 auto; }
.arena-card-info { flex: 1; min-width: 0; }
.arena-card-title { font-weight: 800; font-size: 1.05rem; }
.arena-card-sub { font-size: .82rem; opacity: .9; margin-top: 2px; }
.arena-card-go { font-size: 1.6rem; opacity: .8; }

/* ============================================================
   ROADMAP / MAP SCREEN
   ============================================================ */
.subnav {
  position: sticky; top: 0; z-index: 90;
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-top) + 10px) 14px 10px;
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(226,232,240,.5);
}
.subnav-back {
  flex: 0 0 38px; height: 38px; border: none; background: var(--card);
  border-radius: var(--r-full); font-size: 1.6rem; line-height: 1;
  color: var(--text-1); box-shadow: var(--sh-sm);
  cursor: pointer; display: grid; place-items: center; padding-bottom: 3px;
}
.subnav-back:active { transform: scale(.92); }
.subnav-title {
  flex: 1; display: flex; align-items: center; gap: 8px;
  font-size: 1.2rem; font-weight: 900;
}
.subnav-emoji { font-size: 1.25rem; }
.subnav-progress {
  font-size: .82rem; font-weight: 800; color: var(--brand);
  background: rgba(255,159,67,.14); padding: 5px 12px;
  border-radius: var(--r-full);
  font-variant-numeric: tabular-nums;
}
.roadmap-page { padding-top: 22px; }

.roadmap-path-container {
  position: relative; width: 100%; max-width: 340px;
  margin: 0 auto; display: flex; flex-direction: column;
  align-items: center; gap: 8px; padding: 20px 0;
}
.roadmap-svg-connector {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 1; pointer-events: none;
}
.roadmap-module {
  width: 100%; display: flex; flex-direction: column; align-items: center;
  gap: 0; padding: 20px 0 8px;
}
.roadmap-module.locked { opacity: .5; filter: grayscale(.4); }
.roadmap-module-head {
  position: relative; z-index: 4; width: 100%; max-width: 300px;
  background: var(--card); border: 1px solid #eef1f6;
  border-radius: 20px; box-shadow: 0 10px 26px -14px rgba(15,23,42,.26);
  padding: 14px 16px; margin-top: 6px;
}
.roadmap-module-head.locked { opacity: .75; box-shadow: none; background: #f1f5f9; }
.roadmap-module-head.done { border-color: rgba(16,185,129,.4); }
.rm-head-row { display: flex; align-items: center; gap: 12px; }
.rm-head-emoji {
  font-size: 1.6rem; width: 44px; height: 44px; flex: 0 0 44px;
  display: flex; align-items: center; justify-content: center;
  background: #f8fafc; border-radius: 14px;
}
.rm-head-info { flex: 1; min-width: 0; }
.rm-head-name { font-weight: 800; font-size: .98rem; line-height: 1.2; }
.rm-head-sub { font-size: .78rem; color: var(--text-2); margin-top: 2px; }
.rm-head-prog {
  font-weight: 800; font-size: .85rem; color: var(--brand);
  background: #fff7ed; padding: 4px 10px; border-radius: 999px;
  flex: 0 0 auto; font-variant-numeric: tabular-nums;
}
.rm-head-bar { margin-top: 12px; height: 8px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.rm-head-bar > span {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width .5s ease;
}

/* Roadmap nodes — big rounded squares (new design) */
.roadmap-node-wrapper {
  position: relative; display: flex; flex-direction: column;
  align-items: center; z-index: 2;
  margin-bottom: 74px;
  transition: transform .35s var(--ease-out);
}
/* У активного узла сверху висит бейдж «ЖАЛҒАСТЫРУ» — ему нужно доп. место,
   чтобы не наехать на подпись предыдущего узла. */
.roadmap-node-wrapper:has(.node-continue-badge) { margin-top: 30px; }

/* "ЖАЛҒАСТЫРУ" floating badge above active node */
.node-continue-badge {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%; transform: translateX(-50%);
  background: #fff;
  color: var(--brand-dark);
  font-weight: 900;
  font-size: .76rem;
  letter-spacing: .05em;
  padding: 6px 14px;
  border-radius: var(--r-full);
  box-shadow: 0 4px 16px rgba(0,0,0,.14);
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}
.node-continue-badge::after {
  content: '';
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border-width: 6px; border-style: solid;
  border-color: #fff transparent transparent transparent;
}
.roadmap-node {
  width: 74px; height: 74px;
  border-radius: 50%;
  z-index: 2; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border: 5px solid rgba(255,255,255,.75);
  transition: transform .18s var(--ease-spring);
  position: relative;
}
.roadmap-node:active { transform: scale(.92); }
.roadmap-node .node-icon { font-size: 1.8rem; }

.roadmap-node.active-unlocked {
  background: var(--brand);
  box-shadow: 0 8px 0 0 var(--brand-dark);
  animation: pulseGlow 2.5s ease-in-out infinite;
}
.roadmap-node.active-unlocked:active { transform: translateY(6px); box-shadow: 0 2px 0 0 var(--brand-dark); }
.roadmap-node.completed {
  background: var(--brand);
  box-shadow: 0 8px 0 0 var(--brand-dark);
}
.roadmap-node.completed:active { transform: translateY(6px); box-shadow: 0 2px 0 0 var(--brand-dark); }
.roadmap-node.locked {
  background: #cbd5e1;
  box-shadow: 0 8px 0 0 #94a3b8;
  cursor: not-allowed;
}
.roadmap-node.locked:active { transform: none; }
.roadmap-node.is-premium {
  background: linear-gradient(145deg, #fde68a, #f59e0b);
  box-shadow: 0 8px 0 0 #b45309;
}
.roadmap-node.boss-node { width: 84px; height: 84px; border-radius: 50%; }
.roadmap-node.boss-node .node-icon { font-size: 2rem; }
.roadmap-node.is-boss-open {
  background: linear-gradient(145deg, #fde68a, #f59e0b);
  box-shadow: 0 8px 0 0 #b45309;
  animation: pulseGlow 2s infinite;
}
.roadmap-node.boss-node.completed {
  background: linear-gradient(145deg, #fbbf24, #d97706);
  box-shadow: 0 8px 0 0 #b45309;
}

/* Tooltip */
.node-tooltip {
  position: absolute; bottom: calc(100% + 14px);
  background: #0f172a; color: #fff;
  padding: 8px 14px; border-radius: var(--r-sm);
  font-size: .85rem; white-space: nowrap;
  pointer-events: none; opacity: 0;
  transform: translateY(10px) translateX(-50%);
  left: 50%; transition: all .2s var(--ease-out);
  box-shadow: var(--sh-md); z-index: 10;
}
.node-tooltip::after {
  content: '';
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border-width: 6px; border-style: solid;
  border-color: #0f172a transparent transparent transparent;
}
.roadmap-node-wrapper:hover .node-tooltip { opacity: 1; transform: translateY(0) translateX(-50%); }
.node-label {
  margin-top: 8px; font-weight: 700; font-size: .82rem;
  text-align: center; color: var(--text-2); max-width: 110px;
}

@media (max-width: 480px) {
  .node-label { max-width: 96px; }
}

/* ============================================================
   LEARNING ROOM (Lesson Screen)
   ============================================================ */
#screen-learning { background: var(--bg) !important; }

.learning-room-header {
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  height: 60px; border-bottom: 1px solid rgba(226,232,240,.4);
  display: flex; align-items: center;
  position: sticky; top: 0; z-index: 10;
}
.learning-room-header-content {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center; gap: 10px; width: 100%;
}
.back-arrow-btn {
  border: none; background: rgba(120,120,128,.1);
  border-radius: 50%; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1.2rem; color: var(--text-2);
  transition: transform .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.back-arrow-btn:active { transform: scale(.9); background: rgba(120,120,128,.18); }

/* Progress bar */
.progress-container {
  width: 100%; background: #e2e8f0;
  height: 12px; border-radius: var(--r-full); overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  width: 0%; border-radius: var(--r-full);
  transition: width .5s var(--ease-out);
  box-shadow: inset 0 -2px 4px rgba(0,0,0,.08);
}

/* Lesson workspace */
.lesson-workspace {
  flex-grow: 1;
  display: grid; grid-template-columns: 1fr 2fr;
  padding: 40px 0 130px; gap: 40px;
}

/* Mascot + speech bubble */
.mascot-speech-panel {
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  gap: 20px; position: sticky; top: 110px;
}
.mascot-image-learning {
  width: 180px; height: auto;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,.1));
}
.speech-bubble {
  background: var(--card); border: 1.5px solid #eef1f6;
  border-radius: var(--r-md); padding: 18px;
  position: relative; width: 100%; box-shadow: var(--sh-sm);
  font-weight: 700; font-size: 1.05rem;
}
.speech-bubble::after {
  content: '';
  position: absolute; right: 100%; top: 50px;
  border-width: 12px; border-style: solid;
  border-color: transparent var(--card) transparent transparent;
}
.speech-bubble::before {
  content: '';
  position: absolute; right: 100%; top: 48px;
  border-width: 14px; border-style: solid;
  border-color: transparent #eef1f6 transparent transparent;
  z-index: -1;
}

/* Interactive panel */
.interactive-panel {
  background: rgba(255,255,255,.96);
  border-radius: var(--r-lg); border: 1.5px solid #eef2f7;
  padding: 26px 22px; box-shadow: var(--sh-md);
}

/* Lesson question headings */
.lesson-q-cap {
  font-size: .8rem; font-weight: 800; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 14px;
}
.lesson-q-title { font-size: 1.15rem; font-weight: 800; margin-bottom: 6px; }
.lesson-q-sub {
  color: var(--text-2); font-size: .98rem; margin-bottom: 16px; line-height: 1.4;
}
.lesson-q-sub code, .lesson-q-title code {
  font-family: var(--mono); background: rgba(120,120,128,.14);
  padding: 1px 6px; border-radius: 6px; font-size: .92em;
}

/* ---- QUIZ OPTIONS — radio circle + border-b-4 depth ---- */
.quiz-options-grid {
  display: grid; grid-template-columns: 1fr;
  gap: 10px; margin-top: 18px;
}
.quiz-options-grid.short { grid-template-columns: 1fr 1fr; }

.quiz-option-btn {
  background: var(--card);
  border: 2px solid #e2e8f0;
  border-bottom: 4px solid #cbd5e1;
  border-radius: 22px;
  padding: 14px 18px;
  font-family: var(--font);
  font-size: 1.0rem;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; gap: 14px;
  text-align: left;
  transition:
    border-color .18s ease,
    background .18s ease,
    transform .15s var(--ease-spring);
  -webkit-tap-highlight-color: transparent;
}
.quiz-option-btn:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 2px; }
.quiz-option-btn.selected {
  border-color: var(--brand);
  border-bottom-color: var(--brand-dark);
  background: rgba(255,159,67,.07);
}
.quiz-option-btn.opt-correct { background: #dcfce7 !important; border-color: #22c55e !important; border-bottom-color: #16a34a !important; }
.quiz-option-btn.opt-wrong   { background: #fee2e2 !important; border-color: #ef4444 !important; border-bottom-color: #c0392b !important; }

/* Radio circle */
.quiz-option-radio {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2.5px solid #cbd5e1; background: var(--card);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: border-color .18s ease;
}
.quiz-option-btn.selected .quiz-option-radio { border-color: var(--brand); }
.quiz-option-radio-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--brand); display: none;
  animation: radioPop .2s var(--ease-spring);
}
.quiz-option-btn.selected .quiz-option-radio-dot { display: block; }
.quiz-option-text { flex: 1; color: var(--text-1); line-height: 1.35; }
.quiz-option-btn.selected .quiz-option-text { color: var(--brand-dark); }
.quiz-option-code { font-family: var(--mono); font-size: .95rem; color: #7c3aed; flex: 1; }

/* Short/symbol options */
.quiz-options-grid.short .quiz-option-btn {
  justify-content: center; padding: 18px 10px;
  font-family: var(--mono); font-size: 1.15rem;
}
.quiz-options-grid.short .quiz-option-radio { display: none; }

@media (max-width: 850px) {
  .quiz-option-btn { padding: 12px 14px; font-size: .98rem; border-radius: 18px; }
  .quiz-option-radio { width: 24px; height: 24px; }
  .quiz-option-radio-dot { width: 12px; height: 12px; }
}

/* ---- LESSON FOOTER — bottom-sheet ---- */
/* footer tag is globally hidden, so we use #lesson-footer directly */
footer { display: none !important; }
#lesson-footer {
  display: flex !important;
  position: fixed !important;
  bottom: 0 !important; left: 0 !important; right: 0 !important;
  z-index: 999999 !important;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-top: 1.5px solid rgba(226,232,240,.5);
  border-radius: 32px 32px 0 0;
  box-shadow: 0 -8px 32px rgba(0,0,0,.07);
  padding: 18px 20px calc(14px + var(--safe-bottom));
  align-items: stretch;
  transition: background .3s ease, border-color .3s ease;
}
#lesson-footer.correct {
  background: #dcfce7;
  border-top-color: #bbf7d0;
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
#lesson-footer.wrong {
  background: #fee2e2;
  border-top-color: #fecaca;
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
#lesson-footer.is-hidden { display: none !important; }

.footer-content {
  display: flex; flex-direction: column; align-items: stretch;
  width: 100%; gap: 12px;
}
.footer-content .btn { width: 100%; font-size: 1.1rem; padding: 16px 20px; border-radius: 18px; }

/* Feedback banner */
.fb-banner { width: 100%; animation: fbPop .3s var(--ease-spring); }
.fb-row { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.fb-icon { font-size: 1.3rem; }
.fb-title { font-weight: 900; font-size: 1.1rem; letter-spacing: -.01em; }
.fb-banner.correct .fb-title { color: #15803d; }
.fb-banner.wrong   .fb-title { color: #b91c1c; }
.fb-answer {
  margin-top: 8px; font-weight: 700; color: #7f1d1d;
  background: rgba(255,255,255,.5); border-radius: 12px;
  padding: 8px 12px; font-size: .95rem; line-height: 1.4;
  word-break: break-word;
}

/* Disabled check button (no answer selected) */
.learning-room-footer .btn:disabled,
#lesson-footer .btn:disabled {
  background: #e5e8ee !important;
  color: #aab2c0 !important;
  box-shadow: none !important;
  border-color: transparent !important;
  transform: none !important;
  cursor: default;
}

/* Mobile lesson workspace */
@media (max-width: 850px) {
  .lesson-workspace {
    display: flex; flex-direction: column;
    justify-content: flex-start; gap: 14px;
    padding: 14px 0 180px; min-height: calc(100vh - 110px);
  }
  .mascot-speech-panel {
    display: flex; flex-direction: row !important;
    align-items: center !important;
    position: static !important;
    margin: 14px 0 6px !important; gap: 12px;
  }
  .mascot-image-learning {
    width: 60px !important; height: 60px !important;
    object-fit: contain; flex-shrink: 0;
    background: linear-gradient(145deg, #fff7ed, #ffe8cc);
    border-radius: 50%; padding: 6px;
    box-shadow: 0 8px 18px -8px rgba(255,159,67,.5);
  }
  .speech-bubble {
    flex: 1; margin: 0;
    border: 1px solid #eef1f6 !important;
    border-radius: 18px;
    padding: 12px 14px !important;
    font-size: .98rem !important;
    font-weight: 700;
    box-shadow: 0 8px 20px -12px rgba(15,23,42,.2);
  }
  .speech-bubble::after, .speech-bubble::before { display: none; }
  .interactive-panel { padding: 18px 14px; border-radius: var(--r-md); }
  .learning-room-header-content { grid-template-columns: 40px 1fr 40px !important; gap: 8px; }
}

/* Code blocks */
.code-display { margin-bottom: 18px; }
.code-pre {
  background: #1c1c2e; color: #f8f8f2;
  border-radius: var(--r-md); padding: 16px 18px;
  font-family: var(--mono); font-size: 1.05rem; line-height: 1.6;
  overflow-x: auto; white-space: pre;
}

/* Order block */
.order-source, .order-result {
  display: flex; flex-wrap: wrap; gap: 10px; min-height: 60px;
  padding: 14px; border-radius: var(--r-md);
  border: 2px dashed #e2e8f0; background: #f8fafc;
}
.order-result { background: #f0fdf4; border-color: #bbf7d0; }
.order-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; background: var(--card);
  border: 2px solid #e2e8f0; border-radius: var(--r-sm);
  font-family: var(--font); font-size: .95rem; cursor: pointer;
  box-shadow: 0 3px 0 #e2e8f0; animation: slideUp .3s ease-out;
  transition: transform .15s var(--ease-spring);
}
.order-chip:active { transform: translateY(3px); box-shadow: none; }
.order-chip.placed { background: #eff6ff; border-color: var(--info); box-shadow: 0 3px 0 #93c5fd; }
.order-chip code { font-family: var(--mono); font-weight: 700; color: #1e40af; }
.order-number {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; background: var(--info); color: #fff;
  border-radius: 50%; font-size: .8rem; font-weight: 700;
}

/* Match block */
.match-container { display: flex; flex-direction: column; gap: 12px; }
.match-row { display: grid; grid-template-columns: 1fr 40px 1fr; gap: 8px; align-items: center; }
.match-item {
  padding: 12px 14px; border: 2px solid #e2e8f0;
  border-radius: var(--r-sm); background: var(--card);
  font-size: .9rem; cursor: pointer; text-align: center;
  min-height: 48px; display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, background .15s;
}
.match-item.left code { font-family: var(--mono); font-weight: 700; color: #7c3aed; }
.match-item.active { border-color: var(--brand); background: #fff8f0; box-shadow: 0 0 0 3px rgba(255,159,67,.2); }
.match-item.connected { border-color: var(--brand-2); background: #f0fdf4; }
.match-connector { text-align: center; }
.match-options {
  margin-top: 16px; padding: 16px;
  background: #fffbeb; border: 2px solid #fde68a;
  border-radius: var(--r-md); animation: slideUp .25s ease-out;
}
.match-option-btn {
  display: block; width: 100%; padding: 12px 16px; margin-bottom: 8px;
  background: var(--card); border: 2px solid #e2e8f0;
  border-radius: var(--r-sm); font-family: var(--font); font-size: .95rem;
  cursor: pointer; text-align: left;
  transition: border-color .15s, background .15s;
}
.match-option-btn:hover { border-color: var(--brand); background: #fff8f0; }
.match-option-btn:last-child { margin-bottom: 0; }

/* Visual code scene */
.visual-scene {
  position: relative; width: 100%; height: 200px;
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, #7dd3fc 0%, #bae6fd 50%, #86efac 50%, #4ade80 100%);
  overflow: hidden; border: 2px solid #e2e8f0; margin-bottom: 8px;
}
.visual-ground { position: absolute; bottom: 0; left: 0; right: 0; height: 50%; background: linear-gradient(180deg, #86efac 0%, #22c55e 100%); }
.visual-object {
  position: absolute; bottom: 50%; left: 50%;
  transform: translateX(-50%) translateY(50%);
  text-align: center; z-index: 2;
}
.visual-scene.active .visual-object { animation: popIn .5s var(--ease-spring) forwards; }
@keyframes pop-in {
  0%   { transform: translateX(-50%) translateY(50%) scale(0); opacity: 0; }
  60%  { transform: translateX(-50%) translateY(50%) scale(1.2); opacity: 1; }
  100% { transform: translateX(-50%) translateY(50%) scale(1); opacity: 1; }
}
.code-option .quiz-option-code { color: #7c3aed; }

/* Steps (slideshow theory) */
.lesson-steps { display: flex; flex-direction: column; }
.steps-dots { display: flex; gap: 7px; justify-content: center; margin-bottom: 18px; }
.steps-dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(120,120,128,.25); transition: all .3s; }
.steps-dots span.on { background: var(--brand); width: 22px; border-radius: 5px; }
.step-card {
  background: var(--card); border-radius: var(--r-lg); box-shadow: var(--sh-sm);
  padding: 28px 22px; text-align: center; margin-bottom: 18px;
  min-height: 180px; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.step-emoji { font-size: 3rem; margin-bottom: 14px; }
.step-text { font-size: 1.18rem; font-weight: 600; line-height: 1.5; }
.step-text code { font-family: var(--mono); background: #1c1c2e; color: #8be9fd; padding: 2px 8px; border-radius: 7px; font-size: .92em; }
.step-text strong { color: var(--brand-press); }
.step-card.pop { animation: stepPop .34s var(--ease-out); }

/* Flashcard (карточка-слово для языковых курсов) */
.flashcard {
  position: relative; border-radius: var(--r-lg); margin-bottom: 18px;
  padding: 32px 22px; text-align: center; min-height: 220px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #fff, var(--brand-light));
  border: 2px solid #ffe0bd; box-shadow: 0 14px 30px -16px rgba(230,138,53,.5);
}
.flash-emoji { font-size: 4.2rem; margin-bottom: 10px; line-height: 1; }
.flash-word { font-size: 2rem; font-weight: 900; color: var(--text-1); letter-spacing: -.01em; }
.flash-hint { font-size: 1rem; color: var(--brand-dark); font-weight: 700; margin-top: 4px; font-style: italic; }
.flash-tr {
  margin-top: 12px; font-size: 1.2rem; font-weight: 700; color: var(--brand-press);
  background: #fff; padding: 8px 18px; border-radius: var(--r-full); box-shadow: var(--sh-sm);
}
.flashcard.pop { animation: stepPop .34s var(--ease-out); }
.flash-speak {
  position: absolute; top: 12px; right: 12px;
  width: 44px; height: 44px; border: none; cursor: pointer;
  border-radius: var(--r-full); background: var(--brand); color: #fff;
  font-size: 1.25rem; line-height: 1; box-shadow: 0 4px 0 0 var(--brand-dark);
  transition: transform .12s var(--ease-out);
}
.flash-speak:active { transform: translateY(4px); box-shadow: 0 0 0 0 var(--brand-dark); }
.flash-listen-hint { margin-top: 14px; font-size: .82rem; font-weight: 700; color: var(--text-3); }

/* ===== РОДИТЕЛЬСКИЙ ДАШБОРД (веб) ===== */
#screen-parent { background: var(--brand-light); min-height: 100vh; }
.parent-wrap { max-width: 640px; margin: 0 auto; padding: 20px 16px 60px; }
.parent-header { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; }
.parent-hi { font-size: .85rem; font-weight: 700; color: var(--brand-dark); }
.parent-name { font-size: 1.5rem; font-weight: 900; color: var(--text-1); }
.parent-logout {
  border: none; cursor: pointer; background: #fff; color: var(--text-2);
  border-radius: var(--r-full); padding: 8px 16px; font-weight: 800; font-size: .85rem;
  box-shadow: var(--sh-sm);
}
.parent-sub { color: var(--text-2); font-weight: 600; margin: 8px 0 18px; font-size: .92rem; }
.parent-empty, .pc-nodata { text-align: center; color: var(--text-2); font-weight: 700; padding: 30px 10px; line-height: 1.6; }

.parent-card {
  background: #fff; border-radius: var(--r-lg); padding: 18px; margin-bottom: 18px;
  box-shadow: var(--sh-md); border: 1.5px solid #ffe6cc;
}
.pc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.pc-avatar {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(160deg, var(--brand), var(--brand-dark));
  color: #fff; font-size: 1.5rem; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}
.pc-name { font-size: 1.2rem; font-weight: 900; color: var(--text-1); }
.pc-login { font-size: .82rem; color: var(--text-3); font-weight: 600; }

.pc-stats { display: flex; gap: 10px; margin-bottom: 18px; }
.pc-stat { flex: 1; background: var(--brand-light); border-radius: var(--r-md); padding: 12px 8px; text-align: center; }
.pc-stat-val { font-size: 1.3rem; font-weight: 900; color: var(--brand-dark); }
.pc-stat-cap { font-size: .72rem; font-weight: 700; color: var(--text-2); margin-top: 2px; }

.pc-section-title { font-size: .95rem; font-weight: 800; color: var(--text-1); margin: 16px 0 10px; }
.pc-bars { display: flex; flex-direction: column; gap: 9px; }
.pc-bar-row { display: flex; align-items: center; gap: 10px; }
.pc-bar-label { width: 92px; font-size: .82rem; font-weight: 700; color: var(--text-2); flex-shrink: 0; }
.pc-bar-track { flex: 1; height: 14px; background: #eef1f5; border-radius: var(--r-full); overflow: hidden; }
.pc-bar-fill { height: 100%; border-radius: var(--r-full); transition: width .5s var(--ease-out); min-width: 2px; }
.pc-bar-val { width: 42px; text-align: right; font-size: .8rem; font-weight: 800; color: var(--text-2); flex-shrink: 0; }

.pc-mistakes { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.pc-mistake {
  background: #fff7f0; border: 1px solid #ffe0c7; border-radius: var(--r-md);
  padding: 9px 12px; display: flex; flex-direction: column; gap: 2px;
}
.pc-mistake-type { font-size: .72rem; font-weight: 800; color: var(--brand-dark); text-transform: uppercase; }
.pc-mistake-q { font-size: .9rem; font-weight: 700; color: var(--text-1); }
.pc-mistake-a { font-size: .82rem; color: var(--text-2); }
.pc-mistake-none { background: #f0fdf4; border-color: #bbf7d0; color: #16a34a; font-weight: 800; }
.pc-updated { text-align: right; font-size: .75rem; color: var(--text-3); margin-top: 12px; }

/* Вкладки панели (учитель) */
.parent-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.parent-tab {
  flex: 1; border: none; cursor: pointer; padding: 11px; border-radius: var(--r-md);
  background: #fff; color: var(--text-2); font-weight: 800; font-size: .92rem; box-shadow: var(--sh-sm);
}
.parent-tab.active { background: var(--brand); color: #fff; box-shadow: 0 4px 0 0 var(--brand-dark); }

/* Форма добавления ученика (учитель) */
.teacher-add {
  background: #fff; border: 1.5px dashed #ffcfa3; border-radius: var(--r-lg);
  padding: 16px; margin-bottom: 18px;
}
.teacher-add-title { font-weight: 900; color: var(--text-1); margin-bottom: 12px; }
.teacher-add-row { display: flex; gap: 8px; margin-bottom: 8px; }
.teacher-add-row .form-input { flex: 1; margin: 0; }
.teacher-add-row .btn { flex-shrink: 0; white-space: nowrap; }
.teacher-add-msg { font-size: .85rem; font-weight: 700; margin-top: 6px; min-height: 18px; }
.teacher-add-msg.ok { color: #16a34a; }
.teacher-add-msg.err { color: var(--brand-danger); }

/* Календарь-расписание */
.sched-hint { color: var(--text-2); font-weight: 600; font-size: .88rem; margin-bottom: 12px; }
.sched-courses { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 14px; }
.sched-course-btn {
  border: none; cursor: pointer; white-space: nowrap; padding: 9px 14px; border-radius: var(--r-full);
  background: #fff; color: var(--text-2); font-weight: 800; font-size: .85rem; box-shadow: var(--sh-sm); flex-shrink: 0;
}
.sched-course-btn.active { background: var(--brand-dark); color: #fff; }
.sched-day {
  display: flex; gap: 12px; background: #fff; border-radius: var(--r-md);
  padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--sh-sm);
}
.sched-day-num {
  flex-shrink: 0; width: 56px; font-weight: 900; color: var(--brand-dark);
  font-size: .9rem; padding-top: 2px;
}
.sched-day-lessons { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.sched-lesson { font-size: .88rem; font-weight: 600; color: var(--text-1); display: flex; gap: 7px; align-items: baseline; }
.sched-l-mod { flex-shrink: 0; }
.sched-rest { font-size: .85rem; color: var(--text-3); font-weight: 700; }

/* Listen block (аудио-викторина) */
.listen-wrap { text-align: center; margin: 10px 0 18px; }
.listen-big-btn {
  width: 96px; height: 96px; border: none; cursor: pointer;
  border-radius: 50%; font-size: 2.6rem; line-height: 1; color: #fff;
  background: linear-gradient(160deg, var(--brand), var(--brand-dark));
  box-shadow: 0 8px 0 0 var(--brand-dark), 0 14px 30px -12px rgba(230,138,53,.6);
  transition: transform .12s var(--ease-out);
  animation: pulseGlow 2.4s ease-in-out infinite;
}
.listen-big-btn:active { transform: translateY(6px); box-shadow: 0 2px 0 0 var(--brand-dark); }
.listen-sub { margin-top: 12px; font-size: .9rem; font-weight: 700; color: var(--text-2); }

/* Wordbuild block (собери слово из букв) */
.wb-prompt {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  background: var(--brand-light); border: 1.5px solid #ffd9b0;
  border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 16px;
}
.wb-emoji { font-size: 2rem; }
.wb-tr { font-size: 1.15rem; font-weight: 800; color: var(--text-1); }
.wb-speak {
  width: 40px; height: 40px; border: none; cursor: pointer;
  border-radius: var(--r-full); background: var(--brand); color: #fff;
  font-size: 1.1rem; line-height: 1; box-shadow: 0 3px 0 0 var(--brand-dark);
}
.wb-speak:active { transform: translateY(3px); box-shadow: none; }
.wb-slots { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.wb-slot {
  width: 52px; height: 58px; border-radius: 14px; border: 2.5px dashed #d8dee9;
  background: #f8fafc; font-size: 1.5rem; font-weight: 900; color: var(--text-1);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  font-family: var(--font);
}
.wb-slot.filled {
  border: none; background: var(--brand); color: #fff;
  box-shadow: 0 4px 0 0 var(--brand-dark);
  animation: stepPop .25s var(--ease-out);
}
.wb-bank { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.wb-tile {
  width: 56px; height: 60px; border: none; border-radius: 16px; cursor: pointer;
  background: var(--card); color: var(--text-1); font-size: 1.5rem; font-weight: 900;
  box-shadow: 0 4px 0 0 #d8dee9, var(--sh-sm); font-family: var(--font);
  transition: transform .12s var(--ease-out);
}
.wb-tile:active { transform: translateY(4px); box-shadow: 0 0 0 0 #d8dee9; }
.wb-tile.used { opacity: .25; pointer-events: none; }

/* Fill block */
.fill-code {
  background: #1c1c2e; border-radius: var(--r-md);
  padding: 18px; margin-bottom: 20px; text-align: center;
}
.fill-code code { font-family: var(--mono); color: #f8f8f2; font-size: 1.25rem; }
.fill-slot {
  display: inline-block; min-width: 70px; padding: 2px 12px; margin: 0 2px;
  border: 2px dashed #6272a4; border-radius: 8px;
  background: rgba(255,255,255,.06); color: #8be9fd;
  font-family: var(--mono); cursor: pointer;
}
.fill-slot.filled { border-style: solid; border-color: var(--brand); background: rgba(255,159,67,.18); color: #ffd9a8; }
.fill-bank { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.fill-chip {
  border: none; background: var(--card); box-shadow: var(--sh-sm);
  border-radius: 10px; padding: 10px 16px; cursor: pointer;
  transition: transform .14s ease, opacity .18s ease;
}
.fill-chip code { font-family: var(--mono); font-size: 1rem; color: var(--text-1); }
.fill-chip:active { transform: scale(.95); }
.fill-chip.used { opacity: .35; pointer-events: none; }

/* Terminal */
.terminal { background: #11111b; border-radius: var(--r-md); overflow: hidden; box-shadow: var(--sh-md); margin-bottom: 10px; }
.terminal-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 12px; background: #1c1c2e;
  font-size: .78rem; color: #6272a4; font-weight: 700;
}
.terminal-bar i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.terminal-bar i:nth-child(1) { background: #ff5f56; }
.terminal-bar i:nth-child(2) { background: #ffbd2e; }
.terminal-bar i:nth-child(3) { background: #27c93f; }
.terminal-bar span { margin-left: 8px; }
.terminal-body { display: flex; align-items: center; gap: 8px; padding: 16px 14px; }
.terminal-prompt { color: #27c93f; font-family: var(--mono); font-weight: 700; }
.terminal-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: #f8f8f2; font-family: var(--mono); font-size: 1.05rem; caret-color: #27c93f;
}
.terminal-input::placeholder { color: #44475a; }
.terminal-hint { color: var(--text-2); font-size: .88rem; }
.terminal-hint code { font-family: var(--mono); background: rgba(120,120,128,.14); padding: 1px 6px; border-radius: 6px; }

/* Debug */
.debug-code { display: flex; flex-direction: column; gap: 8px; }
.debug-line {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: #1c1c2e; border: 2px solid transparent;
  border-radius: 10px; padding: 12px 14px; cursor: pointer;
  transition: border-color .16s ease, transform .14s ease;
}
.debug-line:active { transform: scale(.99); }
.debug-line code { font-family: var(--mono); color: #f8f8f2; font-size: 1rem; }
.debug-ln { color: #6272a4; font-family: var(--mono); font-size: .85rem; min-width: 16px; }
.debug-line.selected { border-color: var(--brand); background: #2a2440; }

/* Sort block */
.sort-pool { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; min-height: 48px; margin-bottom: 18px; }
.sort-empty { color: var(--text-2); font-weight: 600; align-self: center; }
.sort-chip {
  background: #fff; border: 2px solid #e6e9f0; border-radius: 12px;
  padding: 10px 14px; cursor: pointer;
  box-shadow: 0 2px 6px rgba(15,23,42,.06);
  transition: transform .14s, border-color .16s, background .16s;
}
.sort-chip code { font-family: var(--mono); font-size: .98rem; color: var(--text-1); }
.sort-chip:active { transform: scale(.95); }
.sort-chip.selected { border-color: var(--brand); background: #fff7ed; transform: translateY(-2px); }
.sort-chip.placed { background: #f1f5f9; box-shadow: none; padding: 8px 12px; }
.sort-buckets { display: flex; gap: 12px; align-items: stretch; }
.sort-bucket {
  flex: 1; min-height: 110px; background: #f8fafc;
  border: 2px dashed #d7dde7; border-radius: 16px; padding: 10px;
  transition: border-color .16s, background .16s;
}
.sort-bucket.droppable { border-color: var(--brand); background: #fff7ed; }
.sort-bucket-label { font-weight: 800; font-size: .9rem; text-align: center; margin-bottom: 8px; }
.sort-bucket-items { display: flex; flex-direction: column; gap: 6px; align-items: center; }

/* Maze */
.maze-grid {
  position: relative; display: grid;
  grid-template-columns: repeat(var(--maze-cols, 3), var(--maze-cell, 54px));
  grid-auto-rows: var(--maze-cell, 54px); gap: 0;
  justify-content: center; margin: 4px auto 14px;
  background: #eef2f7; border-radius: 14px; padding: 6px;
  width: fit-content;
}
.maze-cell {
  width: var(--maze-cell, 54px); height: var(--maze-cell, 54px);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid #e2e8f0; background: #fff; font-size: 1.7rem;
}
.maze-cell.wall { background: #475569; border-color: #334155; }
.maze-goal { animation: mazePulse 1.4s ease-in-out infinite; }
.maze-foal {
  position: absolute; top: 6px; left: 6px;
  width: var(--maze-cell, 54px); height: var(--maze-cell, 54px);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  transition: transform .25s var(--ease-out); z-index: 2; pointer-events: none;
}
.maze-program {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  align-items: center; min-height: 40px; background: #f8fafc;
  border-radius: 12px; padding: 8px 10px; margin-bottom: 14px;
}
.maze-prog-empty { color: var(--text-2); font-size: .88rem; }
.maze-cmd { font-size: 1.3rem; }
.maze-pad {
  display: grid; grid-template-columns: repeat(3, 56px);
  grid-template-rows: repeat(2, 56px); gap: 8px; justify-content: center;
}
.maze-btn {
  border: none; border-radius: 14px; background: #fff;
  box-shadow: 0 4px 0 #cbd5e1; font-size: 1.5rem; cursor: pointer;
  transition: transform .1s ease;
}
.maze-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #cbd5e1; }
.maze-up { grid-column: 2; grid-row: 1; }
.maze-left { grid-column: 1; grid-row: 2; }
.maze-right { grid-column: 3; grid-row: 2; }
.maze-down { grid-column: 2; grid-row: 2; }
.maze-clear { grid-column: 1; grid-row: 1; background: #fef2f2; box-shadow: 0 4px 0 #fecaca; font-size: 1.3rem; }

/* Lesson done */
.interactive-panel.is-done { background: transparent; border: none; box-shadow: none; padding: 6px 0 0; }
.lesson-done {
  text-align: center;
  background: linear-gradient(165deg, #fff, #ecfdf5);
  border: 1px solid #d1fae5; border-radius: 28px;
  padding: 28px 22px 32px;
  box-shadow: 0 22px 46px -24px rgba(16,185,129,.4);
  animation: fbPop .4s var(--ease-out);
}
.lesson-done.perfect {
  background: linear-gradient(165deg, #fffdf5, #fef3c7);
  border-color: #fde68a;
  box-shadow: 0 22px 46px -22px rgba(245,158,11,.45);
}
.lesson-done-mascot img, .lesson-done-mascot > div {
  width: 128px !important; height: auto;
  margin: 0 auto 4px; display: block;
  filter: drop-shadow(0 12px 18px rgba(0,0,0,.12));
  animation: doneBounce 1.7s ease-in-out infinite;
}
.lesson-done-head { font-size: 2rem; font-weight: 900; color: var(--brand-2); margin-bottom: 10px; }
.lesson-done.perfect .lesson-done-head { color: #d97706; }
.lesson-done-stars { display: flex; justify-content: center; gap: 12px; margin-bottom: 14px; }
.ld-star { font-size: 2.5rem; display: inline-block; transform: scale(0); animation: starPop .5s cubic-bezier(.22,1.5,.4,1) forwards; }
.ld-star.off { filter: grayscale(1); opacity: .45; }
.lesson-done-sub { color: var(--text-2); font-size: 1.02rem; margin-bottom: 18px; }
.lesson-done-reward {
  display: inline-flex; align-items: baseline; gap: 7px;
  font-size: 1.7rem; font-weight: 900; color: #b45309;
  background: #fff7ed; border: 1px solid #fed7aa;
  padding: 9px 20px; border-radius: 999px;
}
.lesson-done-reward span { font-size: .85rem; font-weight: 700; color: #9a7b4f; }

/* ============================================================
   PROFILE SCREEN
   ============================================================ */
.profile-hero {
  text-align: center; padding: 26px 0 22px; margin: 0 0 18px;
  background: linear-gradient(160deg, #fff7ed, #f8fafc);
  border-radius: 26px; border: 1px solid #f1ece4;
}
.profile-avatar-wrap {
  width: 96px; height: 96px; margin: 0 auto 12px;
  border-radius: 50%; border: 4px solid #fff;
  background: linear-gradient(145deg, #fff, #ffedd5);
  box-shadow: 0 14px 30px -12px rgba(255,159,67,.55);
  padding: 4px; box-sizing: border-box;
}
.profile-avatar-wrap .dm-cos { font-size: 30px; }
.profile-avatar-wrap.dressed .dm-base { border-radius: 50%; }
.profile-avatar {
  width: 96px; height: 96px; border-radius: var(--r-full);
  object-fit: cover; border: 4px solid #fff;
  background: linear-gradient(145deg, #fff, #ffedd5);
  box-shadow: 0 14px 30px -12px rgba(255,159,67,.55);
  margin-bottom: 12px; padding: 4px;
}
.profile-name { font-size: 1.5rem; font-weight: 900; }
.profile-phone { color: var(--text-2); font-size: .95rem; margin-top: 2px; }
.profile-badge { margin-top: 10px; }
.profile-stats {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; margin-bottom: 22px;
}
.pstat {
  background: var(--card); border: 1px solid #f1f0f4; border-radius: 20px;
  padding: 16px 10px; text-align: center;
  box-shadow: 0 8px 20px -14px rgba(15,23,42,.2);
  position: relative; overflow: hidden;
}
.pstat::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: var(--brand);
}
.pstat:nth-child(1)::before { background: #fb923c; }
.pstat:nth-child(2)::before { background: #f59e0b; }
.pstat:nth-child(3)::before { background: #ef4444; }
.pstat:nth-child(4)::before { background: #8b5cf6; }
.pstat-num { font-size: 1.7rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.pstat-lbl { font-size: .8rem; color: var(--text-2); margin-top: 3px; font-weight: 700; }
.profile-actions { display: flex; flex-direction: column; gap: 10px; }

/* ============================================================
   SHOP SCREEN
   ============================================================ */
.shop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.shop-title { font-size: 1.8rem; font-weight: 900; letter-spacing: -0.02em; }
.shop-sub { color: var(--text-2); font-size: .92rem; margin-top: 2px; }
.shop-balance {
  font-weight: 800; font-size: 1.05rem; color: var(--warning);
  background: rgba(245,158,11,.12); padding: 8px 14px;
  border-radius: var(--r-full); white-space: nowrap;
}
.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 0; }
.shop-card {
  --accent: var(--brand);
  background: var(--card); border: 1.5px solid #eef1f6;
  border-radius: 22px; padding: 18px 14px;
  text-align: center; display: flex; flex-direction: column; align-items: center;
  box-shadow: var(--sh-sm);
  transition: transform .15s var(--ease-spring);
}
.shop-card:active { transform: scale(.98); }
.shop-emoji {
  width: 76px; height: 76px; display: grid; place-items: center; font-size: 2.4rem;
  border-radius: var(--r-full);
  background: color-mix(in srgb, var(--accent) 14%, white);
  margin-bottom: 12px;
}
.shop-emoji.has-img { width: 100%; height: 120px; border-radius: 16px; background: linear-gradient(160deg, #eff6ff, #f8fafc); overflow: hidden; }
.shop-img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.shop-name { font-size: 1.05rem; font-weight: 800; }
.shop-desc { font-size: .78rem; color: var(--text-2); margin: 2px 0 10px; min-height: 2.2em; }
.shop-price { font-weight: 800; color: var(--warning); font-size: 1.05rem; margin-bottom: 12px; }
.shop-card .shop-buy-btn { width: 100%; padding: 11px 12px; font-size: .95rem; }
.shop-owned { background: rgba(16,185,129,.12); color: var(--brand-2); }

/* ============================================================
   WARDROBE
   ============================================================ */
.dressed { position: relative; display: inline-block; }
.dressed .dm-base { width: 100%; height: 100%; object-fit: contain; display: block; }
.dm-cos { position: absolute; left: 50%; transform: translateX(-50%); pointer-events: none; line-height: 1; }
.dm-head { top: -6%; }
.dm-face { top: 30%; }
.dm-neck { top: 56%; }
.wardrobe-stage {
  width: 160px; height: 160px; margin: 8px auto 18px; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #fff7ed, #ffe8cc);
  box-shadow: 0 18px 40px -16px rgba(255,159,67,.55); padding: 8px; box-sizing: border-box;
}
.wardrobe-stage .dm-cos { font-size: 52px; }
.cos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.cos-card {
  background: #fff; border: 1px solid #eef1f6; border-radius: 18px;
  padding: 14px 6px 10px; text-align: center; cursor: pointer;
  box-shadow: 0 8px 18px -14px rgba(15,23,42,.2);
  transition: transform .12s ease, border-color .16s;
}
.cos-card:active { transform: scale(.96); }
.cos-card.equipped { border-color: var(--brand-2); background: #ecfdf5; }
.cos-emoji { font-size: 2rem; margin-bottom: 6px; }
.cos-name { font-size: .8rem; font-weight: 700; }
.cos-action { margin-top: 6px; font-size: .82rem; font-weight: 800; color: var(--brand); }
.cos-card.equipped .cos-action { color: var(--brand-2); }
.badge-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding-bottom: 8px; }
.badge-item { text-align: center; opacity: .5; filter: grayscale(1); }
.badge-item.earned { opacity: 1; filter: none; }
.badge-emoji {
  width: 60px; height: 60px; margin: 0 auto 4px;
  display: grid; place-items: center; font-size: 1.8rem;
  background: #f1f5f9; border-radius: 50%;
}
.badge-item.earned .badge-emoji { background: linear-gradient(145deg, #fde68a, #fbbf24); box-shadow: 0 8px 16px -8px rgba(245,158,11,.55); }
.badge-name { font-size: .72rem; font-weight: 700; color: var(--text-2); }

/* ============================================================
   ARENA SCREEN
   ============================================================ */
.arena-match { text-align: center; padding: 18px 0; }
.arena-vs { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 22px; }
.arena-fighter { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 120px; }
.arena-ava {
  width: 76px; height: 76px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem; background: #f1f5f9; box-shadow: var(--sh-sm);
}
.arena-fighter.you .arena-ava { background: #fff7ed; }
.arena-fighter.foe .arena-ava { background: #ede9fe; }
.arena-fname { font-weight: 700; font-size: .9rem; }
.arena-vs-badge { font-weight: 900; color: var(--brand); font-size: 1.3rem; }
.arena-status { font-weight: 600; color: var(--text-2); margin-bottom: 18px; min-height: 22px; }
.arena-online { color: #10b981; font-weight: 700; }
.arena-scorebar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.arena-chip { font-size: .82rem; background: #f1f5f9; padding: 5px 10px; border-radius: 999px; font-weight: 600; }
.arena-chip.you { background: #fff7ed; }
.arena-chip.foe { background: #ede9fe; }
.arena-qno { font-weight: 800; color: var(--text-2); font-variant-numeric: tabular-nums; }
.arena-progress { height: 8px; background: #eef2f7; border-radius: 999px; overflow: hidden; margin-bottom: 16px; }
.arena-progress > span { display: block; height: 100%; background: linear-gradient(90deg, #6d28d9, #4f46e5); transition: width .3s ease; }
.arena-q { font-size: 1.15rem; font-weight: 800; margin-bottom: 16px; }
.arena-foe-typing { margin-top: 14px; text-align: center; color: var(--text-2); font-size: .85rem; animation: arenaBlink 1.1s ease-in-out infinite; }
.arena-result {
  text-align: center; background: var(--card);
  border: 1px solid #eef1f6; border-radius: 26px;
  padding: 22px 18px 26px; margin-top: 6px;
  box-shadow: 0 20px 44px -24px rgba(15,23,42,.3);
  animation: fbPop .4s var(--ease-out);
}
.arena-result-banner { border-radius: 20px; padding: 16px; margin-bottom: 18px; }
.arena-result.win  .arena-result-banner { background: linear-gradient(135deg, #fde68a, #fbbf24); }
.arena-result.draw .arena-result-banner { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); }
.arena-result.lose .arena-result-banner { background: linear-gradient(135deg, #f1f5f9, #e2e8f0); }
.arena-result-emoji { font-size: 2.8rem; line-height: 1; margin-bottom: 4px; animation: doneBounce 1.7s ease-in-out infinite; }
.arena-result-head { font-size: 1.7rem; font-weight: 900; margin: 0; color: #1f2937; }
.arena-final { display: flex; align-items: center; justify-content: center; gap: 20px; margin-bottom: 16px; }
.arena-final-side { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 12px; border-radius: 18px; min-width: 96px; border: 2px solid transparent; }
.arena-final-side.winner { background: #fff7ed; border-color: var(--brand); transform: scale(1.06); }
.arena-final-side .arena-ava { width: 60px; height: 60px; font-size: 2rem; }
.arena-final-score { font-size: 2.4rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.arena-final-vs { font-size: 2rem; font-weight: 900; color: var(--text-2); }
.arena-reward { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.arena-reward-pill { font-weight: 800; font-size: .95rem; padding: 6px 14px; border-radius: 999px; }
.arena-reward-pill.trophy { background: #fef9c3; color: #a16207; }
.arena-reward-pill.coin   { background: #fff7ed; color: #b45309; }
.arena-reward-pill.none   { background: #f1f5f9; color: var(--text-2); }

/* ============================================================
   ADMIN PANEL
   ============================================================ */
.admin-container { padding: 40px 0; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.admin-table-card { background: var(--card); border-radius: var(--r-lg); border: 1.5px solid #eef1f6; overflow-x: auto; box-shadow: var(--sh-sm); }
.admin-table { width: 100%; border-collapse: collapse; text-align: left; }
.admin-table th, .admin-table td { padding: 16px 20px; border-bottom: 1px solid #f1f5f9; }
.admin-table th { background: #f8fafc; font-weight: 700; font-size: .88rem; text-transform: uppercase; color: var(--text-2); }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: #f8fafc; }
@media (max-width: 768px) {
  .admin-container { padding: 20px 0; }
  .admin-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .admin-table th, .admin-table td { padding: 10px 12px; font-size: .82rem; }
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  padding: 4px 10px; border-radius: var(--r-full);
  font-size: .75rem; font-weight: 800; display: inline-block;
}
.badge-free   { background: #e2e8f0; color: #475569; }
.badge-it     { background: #fffbeb; color: #d97706; border: 1px solid #fef3c7; }
.badge-eng    { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.badge-rus    { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.badge-super  { background: #fdf2f8; color: #be185d; border: 1px solid #fbcfe8; }

/* ============================================================
   PREMIUM MODAL
   ============================================================ */
.premium-card {
  text-align: center; position: relative; padding: 28px 22px 22px;
  background: linear-gradient(170deg, #fffdf5, #fff);
  border: 1px solid #fde68a;
}
.premium-card .modal-close { position: absolute; top: 12px; right: 14px; }
.premium-emoji { font-size: 3rem; line-height: 1; margin-bottom: 8px; animation: doneBounce 1.8s ease-in-out infinite; }
.premium-title { font-size: 1.5rem; font-weight: 900; color: #b45309; margin-bottom: 6px; }
.premium-sub { color: var(--text-2); font-size: .98rem; margin-bottom: 18px; }
.premium-perks {
  list-style: none; text-align: left; display: flex; flex-direction: column;
  gap: 12px; margin: 0 auto 20px; max-width: 300px;
}
.premium-perks li { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: .98rem; }
.premium-perks li span {
  flex: 0 0 38px; height: 38px; display: grid; place-items: center;
  background: #fff7ed; border-radius: 12px; font-size: 1.15rem;
}
#premium-buy-btn {
  background: linear-gradient(135deg, var(--brand), #f59e0b);
  box-shadow: 0 4px 0 0 #d97706;
  border-color: #d97706;
}

/* Achievement share */
.achieve-modal { padding: 16px; }
.achieve-card {
  border-radius: 22px; padding: 22px 18px 18px; margin-bottom: 14px;
  text-align: center; color: #fff;
  background: linear-gradient(165deg, #ffb45e, #f97316);
  box-shadow: 0 16px 36px -18px rgba(249,115,22,.65);
}
.ac-head { font-weight: 800; font-size: .92rem; opacity: .95; }
.ac-head span { opacity: .8; font-weight: 600; }
.ac-mascot {
  width: 116px; height: 116px; margin: 12px auto 6px;
  background: rgba(255,255,255,.9); border-radius: 50%;
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.5);
}
.ac-mascot img, .ac-mascot > div { width: 92px; height: 92px; object-fit: contain; }
.ac-name { font-size: 1.6rem; font-weight: 900; letter-spacing: -.01em; }
.ac-title { font-weight: 800; font-size: 1rem; opacity: .95; margin-bottom: 14px; }
.ac-stats { display: flex; justify-content: center; gap: 10px; margin-bottom: 16px; }
.ac-stat { flex: 1; max-width: 110px; background: rgba(255,255,255,.2); border-radius: 16px; padding: 10px 6px; }
.ac-stat b { display: block; font-size: 1.2rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.ac-stat span { font-size: .72rem; opacity: .9; font-weight: 600; }
.ac-foot { font-size: .85rem; font-weight: 700; opacity: .95; }
#achieve-share-btn { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 12px 26px -12px rgba(16,185,129,.55); }

/* ============================================================
   MISCELLANEOUS
   ============================================================ */
.result-feedback-message { font-weight: 800; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.result-feedback-message.correct { color: #15803d; }
.result-feedback-message.wrong   { color: #b91c1c; }

/* Numbers monospace */
#hearts-count, #streak-count, #coins-count,
.pstat-num, .arena-final-score, .arena-qno, #arena-points-top,
.subnav-progress, .subject-count, .goal-ring-num {
  font-variant-numeric: tabular-nums;
}

/* SVG clothing */
.svg-clothing { width: 100px; height: 100px; }

/* Home goal section */
.home-goal, .home-mistakes, .home-continue { width: 100%; }

/* Tariff cards (legacy landing) */
.tariff-card {
  background: #f8fafc; border: 1.5px solid #e2e8f0;
  border-radius: var(--r-lg); padding: 32px 24px;
  text-align: center; display: flex; flex-direction: column;
  box-shadow: var(--sh-md);
}
.tariff-card.featured { background: #fffbeb; border-color: var(--brand); }
.tariff-name { font-size: 1.4rem; margin-bottom: 16px; font-weight: 800; }
.tariff-price { font-size: 2.2rem; font-weight: 900; margin-bottom: 10px; }
.tariff-price span { font-size: 1rem; font-weight: 500; color: var(--text-2); }
.tariff-features { list-style: none; margin: 24px 0 32px; flex-grow: 1; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.tariff-features li { display: flex; align-items: center; gap: 8px; font-size: .95rem; }
.tariff-features li::before { content: '✓'; color: var(--brand-2); font-weight: 800; }

/* Course selector (roadmap tabs) */
.course-selector {
  display: flex; gap: 12px; margin-bottom: 24px;
  background: rgba(120,120,128,.12); padding: 4px;
  border-radius: var(--r-full);
}
.course-tab {
  padding: 10px 24px; border-radius: var(--r-full);
  border: none; background: transparent; cursor: pointer;
  font-weight: 700; font-family: var(--font);
  transition: all .2s; color: var(--text-2);
}
.course-tab.active { background: var(--card); color: var(--text-1); box-shadow: var(--sh-sm); }

@media (max-width: 600px) {
  .course-selector {
    flex-direction: row !important; flex-wrap: nowrap !important;
    overflow-x: auto !important; justify-content: flex-start !important;
    gap: 12px !important; padding: 4px 4px 12px 4px !important;
    -webkit-overflow-scrolling: touch;
  }
  .course-selector::-webkit-scrollbar { display: none; }
  .course-tab { flex: 0 0 auto !important; font-size: .9rem; padding: 10px 18px !important; }
}

/* Payment / QR (legacy) */
.payment-price-tag { font-size: 1.8rem; font-weight: 900; color: var(--brand); text-align: center; margin-bottom: 16px; }
.payment-instructions { font-size: .95rem; color: var(--text-2); text-align: center; margin-bottom: 20px; background: #f8fafc; padding: 16px; border-radius: var(--r-md); border: 1px dashed #cbd5e1; }
.qr-code-img { width: 180px; height: 180px; margin: 0 auto 20px; display: block; border-radius: var(--r-md); border: 2px solid #e2e8f0; }
.payment-simple-text { text-align: center; color: var(--text-2); font-size: 1rem; line-height: 1.5; margin: 8px 4px 22px; }

/* Visual animations */
.tree-anim { text-align: center; position: relative; }
.tree-crown { font-size: 4rem; animation: popIn .8s ease-out forwards; }
.tree-fruit { font-size: 1.5rem; position: absolute; animation: slideUp .5s ease-out forwards; opacity: 0; }
.tree-fruit { top: -10px; left: 30%; animation-delay: .8s; }
.tree-fruit.f2 { top: 5px; right: 25%; left: auto; animation-delay: 1.1s; }
.tree-fruit.f3 { top: -5px; left: 50%; animation-delay: 1.4s; }
.flowers-anim { display: flex; justify-content: center; gap: 8px; }
.flower { font-size: 2.5rem; display: inline-block; animation: popIn .5s ease-out forwards; opacity: 0; }
.flower.f1 { animation-delay: .1s; } .flower.f2 { animation-delay: .3s; }
.flower.f3 { animation-delay: .5s; } .flower.f4 { animation-delay: .7s; } .flower.f5 { animation-delay: .9s; }
.wheat-anim { display: flex; justify-content: center; gap: 4px; }
.wheat { font-size: 2.5rem; display: inline-block; animation: popIn .4s ease-out forwards, sway 2s ease-in-out infinite; opacity: 0; }
.wheat.w1 { animation-delay: .1s; } .wheat.w2 { animation-delay: .2s; }
.wheat.w3 { animation-delay: .3s; } .wheat.w4 { animation-delay: .4s; }
.wheat.w5 { animation-delay: .5s; } .wheat.w6 { animation-delay: .6s; }
.house-anim { text-align: center; }
.house-body { font-size: 5rem; animation: popIn .8s var(--ease-spring) forwards; }
.apple-anim { display: flex; justify-content: center; gap: 20px; align-items: center; position: relative; }
.apple-item { font-size: 2rem; animation: slideUp .5s ease-out forwards; opacity: 0; }
.apple-item.a1 { animation-delay: .2s; } .apple-item.a2 { animation-delay: .5s; } .apple-item.a3 { animation-delay: .8s; }
@keyframes run-right { 0% { transform: translateX(-80px); } 100% { transform: translateX(80px); } }
.running-char { font-size: 2.5rem; animation: run-right 1.5s ease-in-out infinite alternate; }
.trophy-anim { text-align: center; position: relative; }
.trophy-item { font-size: 5rem; animation: popIn .6s ease-out forwards; }
.confetti { font-size: 3rem; animation: slideUp .8s ease-out forwards; animation-delay: .5s; opacity: 0; }
.picture-anim { text-align: center; }
.picture-frame { font-size: 5rem; animation: popIn .6s ease-out forwards; }
.list-anim { text-align: left; padding: 0 20px; }
.list-item { font-size: 1.3rem; font-weight: 600; padding: 6px 0; animation: slideUp .4s ease-out forwards; opacity: 0; color: #166534; }
.list-item.li1 { animation-delay: .2s; } .list-item.li2 { animation-delay: .5s; } .list-item.li3 { animation-delay: .8s; }

/* ============================================================
   DESKTOP (>768px) — широкий layout
   ============================================================ */
@media (min-width: 769px) {
  .lesson-workspace {
    grid-template-columns: 1fr 2fr;
    padding: 40px 0 130px; gap: 40px;
    display: grid;
  }
  .mascot-speech-panel { flex-direction: column; position: sticky; top: 110px; }
  .mascot-image-learning { width: 180px; }
  #lesson-footer { padding: 20px 24px calc(16px + var(--safe-bottom)); }
  .footer-content { max-width: 600px; margin: 0 auto; }
}

/* ============================================================
   КОДШЫ АЛАҢЫ — Python-песочница (playground)
   ============================================================ */
.playground-card .arena-card-icon { background: linear-gradient(135deg, #7c5cff, #c44bff); }

#screen-playground { background: #0f0f1a; }
.playground-page { padding: 0 14px calc(24px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 14px; }

/* ---- Hero-шапка ---- */
.pg-hero {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: calc(14px + var(--safe-top)) 16px 18px;
  background: linear-gradient(135deg, #6d28d9 0%, #8b5cf6 50%, #c026d3 100%);
  color: #fff; border-radius: 0 0 24px 24px; box-shadow: 0 8px 28px rgba(124,58,237,.45);
  overflow: hidden;
}
.pg-hero::after {
  content: ''; position: absolute; right: -30px; top: -40px; width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%); pointer-events: none;
}
.pg-hero-back {
  flex: 0 0 auto; width: 38px; height: 38px; border: none; cursor: pointer;
  border-radius: var(--r-full); background: rgba(255,255,255,.18); color: #fff;
  font-size: 1.5rem; line-height: 1; backdrop-filter: blur(6px); transition: transform .15s var(--ease-out);
}
.pg-hero-back:active { transform: scale(.88); }
.pg-hero-titles { flex: 1; min-width: 0; }
.pg-hero-title { font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; }
.pg-hero-sub { font-size: .8rem; opacity: .85; margin-top: 2px; }
.pg-status-badge {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,.25); padding: 6px 11px; border-radius: var(--r-full);
  font-size: .75rem; font-weight: 700; font-family: var(--mono); white-space: nowrap;
}
.pg-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #facc15; box-shadow: 0 0 8px #facc15; animation: pgPulse 1.2s ease-in-out infinite; }
.pg-status-badge.ready .pg-status-dot { background: #4ade80; box-shadow: 0 0 8px #4ade80; animation: none; }
.pg-status-badge.offline .pg-status-dot { background: #f87171; box-shadow: 0 0 8px #f87171; animation: none; }
@keyframes pgPulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ---- Тапсырма-бар маскота ---- */
.pg-challenge {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #1e1b3a, #2a2350);
  border: 1px solid rgba(168,139,255,.35); border-radius: 18px; padding: 12px 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.pg-mascot-ring {
  flex: 0 0 auto; width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #c026d3); padding: 2px;
  display: grid; place-items: center; box-shadow: 0 0 14px rgba(192,38,211,.5);
}
.pg-mascot-ring .pg-mascot { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #0f0f1a; }
.pg-challenge-body { flex: 1; min-width: 0; }
.pg-challenge-label { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: #c4b5fd; }
.pg-challenge-text { font-size: .92rem; font-weight: 600; color: #ece9ff; line-height: 1.35; margin-top: 2px; }
.pg-challenge-text .pg-hint { font-weight: 700; color: #a78bfa; }
.pg-challenge-next {
  flex: 0 0 auto; width: 38px; height: 38px; border: none; cursor: pointer;
  border-radius: var(--r-full); background: rgba(168,139,255,.18); color: #c4b5fd;
  font-size: 1.25rem; line-height: 1; transition: transform .35s var(--ease-spring);
}
.pg-challenge-next:active { transform: rotate(-180deg) scale(.85); }

/* ---- Редактор ---- */
.pg-editor-wrap {
  border-radius: 18px; overflow: hidden; background: #15131f;
  border: 1px solid rgba(255,255,255,.08); box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.pg-editor-bar { display: flex; align-items: center; gap: 7px; padding: 11px 15px; background: #100e18; border-bottom: 1px solid rgba(255,255,255,.06); }
.pg-editor-bar i { width: 12px; height: 12px; border-radius: 50%; }
.pg-editor-bar i:nth-child(1) { background: #ff5f57; }
.pg-editor-bar i:nth-child(2) { background: #febc2e; }
.pg-editor-bar i:nth-child(3) { background: #28c840; }
.pg-editor-name { margin-left: 8px; color: #8b8aa3; font-family: var(--mono); font-size: .8rem; }
.pg-editor-scroll { display: flex; align-items: stretch; }
.pg-gutter {
  flex: 0 0 auto; padding: 16px 0 16px 14px; min-width: 22px; text-align: right;
  font-family: var(--mono); font-size: .95rem; line-height: 1.6; color: #4b4866;
  user-select: none; white-space: pre; background: #15131f;
}
.pg-editor {
  flex: 1; min-height: 190px; resize: vertical; border: none; outline: none;
  background: transparent; color: #e6e6f0; font-family: var(--mono); font-size: .95rem;
  line-height: 1.6; padding: 16px 14px; box-sizing: border-box; tab-size: 4; caret-color: #c026d3;
}
.pg-editor::placeholder { color: #4b4866; }

/* ---- Кнопки ---- */
.pg-actions { display: flex; gap: 10px; }
.pg-run-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; border: none; cursor: pointer;
  font-weight: 800; font-size: 1rem; border-radius: 16px; padding: 14px;
  box-shadow: 0 8px 22px rgba(34,197,94,.45); transition: transform .12s var(--ease-out), box-shadow .2s;
}
.pg-run-btn span { font-size: .9rem; }
.pg-run-btn:active { transform: scale(.97); box-shadow: 0 4px 14px rgba(34,197,94,.4); }
.pg-run-btn.running { background: linear-gradient(135deg, #64748b, #475569); box-shadow: none; }
.pg-icon-btn {
  flex: 0 0 auto; width: 52px; padding: 14px 0; font-size: 1.15rem; border-radius: 16px; cursor: pointer;
  background: #211d33; color: #c4b5fd; border: 1px solid rgba(168,139,255,.25); transition: transform .12s;
}
.pg-icon-btn:active { transform: scale(.92); }

/* ---- Вывод / терминал ---- */
.pg-output-wrap { border-radius: 18px; overflow: hidden; border: 1px solid rgba(255,255,255,.08); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.pg-output-bar { display: flex; align-items: center; gap: 8px; padding: 10px 15px; background: #100e18; color: #8b8aa3; font-weight: 700; font-size: .76rem; letter-spacing: .03em; text-transform: uppercase; }
.pg-out-led { width: 8px; height: 8px; border-radius: 50%; background: #28c840; box-shadow: 0 0 8px #28c840; }
.pg-output {
  margin: 0; padding: 15px; background: #0c0a14; color: #b9f5c8;
  font-family: var(--mono); font-size: .92rem; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word; min-height: 64px; max-height: 240px; overflow: auto;
}
.pg-output.pg-output-error { color: #fda4af; background: #1a0f14; }
