/* ==========================================================================
   Пайтоша: Школа Магии Python — Стили
   Яркий, дружелюбный и контрастный интерфейс для ребёнка 10 лет
   ========================================================================== */

:root {
  --bg: #f0f6ff;
  --bg-grad-1: #e0eeff;
  --bg-grad-2: #fef6e4;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #52627a;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --secondary: #10b981;
  --secondary-hover: #059669;
  --accent: #f59e0b;
  --accent-soft: #fef3c7;
  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --border: #dbe7ff;
  --shadow: 0 10px 28px rgba(30, 58, 138, 0.08);
  --shadow-sm: 0 4px 12px rgba(30, 58, 138, 0.06);
  --radius: 20px;
  --radius-sm: 12px;
  --font-ui: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Fredoka', 'Nunito', sans-serif;
  --font-code: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--text);
  background: radial-gradient(circle at 10% 10%, var(--bg-grad-1) 0%, var(--bg) 45%, var(--bg-grad-2) 100%);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Режим отключённых анимаций (доступность) */
body.reduced-motion *,
body.reduced-motion *::before,
body.reduced-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* ---------- Верхняя панель ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.brand-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
}

.brand-sub {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

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

.nav-btn {
  border: 2px solid transparent;
  background: #eef3ff;
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.95rem;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  background: #dfe8ff;
  transform: translateY(-1px);
}

.nav-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.topbar-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 800;
  background: #f8fafc;
  border: 2px solid var(--border);
}

.stat-stars { background: #fffbeb; border-color: #fde68a; }
.stat-coins { background: #fefce8; border-color: #fcd34d; }
.stat-streak { background: #fff7ed; border-color: #fdba74; }

.icon-toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: #ffffff;
  font-size: 1.1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.icon-toggle:hover {
  transform: scale(1.08);
  background: #eef3ff;
}

.icon-toggle.off {
  opacity: 0.5;
  background: #f1f5f9;
}

/* ---------- Статус Python-движка ---------- */
.engine-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  background: #eef2ff;
  color: #3730a3;
  border-bottom: 1px solid var(--border);
}

.engine-banner.ready {
  background: #ecfdf5;
  color: #065f46;
}

.engine-banner.fallback {
  background: #fffbeb;
  color: #92400e;
}

.engine-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6366f1;
  animation: pulse 1.2s infinite;
}

.engine-banner.ready .engine-dot {
  background: #10b981;
  animation: none;
}

.engine-banner.fallback .engine-dot {
  background: #f59e0b;
  animation: none;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.5; }
}

/* ---------- Основной контейнер ---------- */
.main-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.view {
  display: none;
  animation: fadeIn 0.25s ease;
}

.view.active {
  display: block;
}

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

.card {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 14px;
  padding: 12px 20px;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:active {
  transform: translateY(1px) scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-run {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  font-size: 1.08rem;
  padding: 14px 26px;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
}

.btn-run:hover:not(:disabled) {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-2px);
}

.btn-hint {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  padding: 10px 16px;
  font-size: 0.95rem;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-hint:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-ghost {
  background: #eef3ff;
  color: var(--primary);
}

.btn-ghost:hover {
  background: #dfe8ff;
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: 10px;
}

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

.btn-danger:hover {
  background: #dc2626;
}

/* ---------- Карта мира ---------- */
.hero-card {
  display: flex;
  align-items: center;
  gap: 24px;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  border-radius: 26px;
  padding: 24px 28px;
  box-shadow: 0 14px 34px rgba(79, 70, 229, 0.25);
  margin-bottom: 28px;
}

.hero-mascot {
  flex-shrink: 0;
  width: 130px;
  height: 130px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: floatY 3s ease-in-out infinite;
}

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

.hero-info h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.9rem;
}

.hero-info p {
  margin: 0 0 16px;
  font-size: 1.05rem;
  opacity: 0.95;
  max-width: 720px;
}

.hero-progress-wrap {
  max-width: 440px;
}

.hero-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.progress-bar {
  height: 14px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #fde047, #4ade80);
  border-radius: 999px;
  transition: width 0.5s ease;
}

.islands-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.island-card {
  background: var(--card-bg);
  border: 3px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.island-card.locked {
  opacity: 0.72;
  background: #f8fafc;
  border-style: dashed;
}

.island-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.island-title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.island-emoji {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: #eef2ff;
}

.island-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
}

.island-desc {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.island-badge {
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.88rem;
  background: #dcfce7;
  color: #166534;
}

.island-badge.coming-soon {
  background: #e2e8f0;
  color: #475569;
}

.levels-path {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.level-node {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  border: 2px solid var(--border);
  background: #f8fbff;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  font-family: var(--font-ui);
}

.level-node:hover:not(:disabled) {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: 0 10px 20px rgba(79, 70, 229, 0.15);
}

.level-node.completed {
  background: #f0fdf4;
  border-color: #86efac;
}

.level-node.current {
  background: #eef2ff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.level-node.boss {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border-color: #f59e0b;
}

.level-node.locked {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f1f5f9;
}

.level-node-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.level-num {
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--primary);
  background: #ffffff;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.level-node.boss .level-num {
  color: #b45309;
  border-color: #fcd34d;
}

.level-node-title {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
}

.level-node-topic {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.level-node-stars {
  font-size: 1.15rem;
  letter-spacing: 2px;
}

/* ---------- Экран уровня ---------- */
.level-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.level-title-block {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.level-title-block h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
}

.level-badge {
  background: var(--primary);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 5px 12px;
  border-radius: 999px;
}

.level-stars-preview {
  font-size: 1.4rem;
  letter-spacing: 3px;
}

.level-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(380px, 1.15fr);
  gap: 20px;
  align-items: start;
}

.level-left,
.level-right {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Сюжет */
.story-card {
  display: flex;
  gap: 16px;
  align-items: center;
  background: linear-gradient(135deg, #eef2ff 0%, #ffffff 100%);
}

.story-mascot {
  flex-shrink: 0;
  width: 78px;
  height: 78px;
}

.story-label {
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--primary);
  letter-spacing: 0.5px;
}

.story-text {
  margin: 4px 0 10px;
  font-size: 0.98rem;
}

.goal-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  background: #fef3c7;
  color: #92400e;
  font-weight: 800;
  font-size: 0.9rem;
}

/* Теория */
.theory-text p {
  margin: 0 0 10px;
  font-size: 0.98rem;
}

.theory-text code,
.task-text code,
.hint-item code {
  font-family: var(--font-code);
  background: #eef2ff;
  color: #4338ca;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.92em;
  font-weight: 700;
}

.example-box {
  margin-top: 12px;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 14px;
  padding: 12px 16px;
}

.example-label {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-bottom: 6px;
  font-weight: 700;
}

.example-box pre {
  margin: 0;
  font-family: var(--font-code);
  font-size: 0.98rem;
  white-space: pre-wrap;
}

/* Задание и подсказки */
.task-text {
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 700;
}

.hints-area {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 10px 12px;
  margin-bottom: 12px;
  transition: all 0.25s ease;
}

.hints-area:hover {
  border-color: #cbd5e1;
}

.editor-header-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.editor-header-title-wrap .card-title {
  margin-bottom: 0;
}

.hint-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 700;
}

.hints-step-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hint-step-btn {
  flex: 1;
  min-width: 105px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 12px;
  border-radius: 14px;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.hint-step-btn:hover {
  border-color: #6366f1;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.16);
}

.hint-step-btn.active {
  border-color: #6366f1;
  background: linear-gradient(180deg, #ffffff 0%, #eef2ff 100%);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25), 0 4px 12px rgba(99, 102, 241, 0.15);
  transform: translateY(-2px);
}

.hint-step-btn.used {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.hbtn-badge {
  font-size: 0.72rem;
  font-weight: 900;
  background: #e2e8f0;
  color: #475569;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.3px;
  transition: all 0.2s;
}

.hint-step-btn.active .hbtn-badge {
  background: #6366f1;
  color: #ffffff;
}

.hbtn-title {
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--text);
}

.hbtn-stars {
  font-size: 0.78rem;
  font-weight: 800;
  color: #f59e0b;
}

.hints-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.hint-item-card {
  padding: 12px 14px;
  border-radius: 14px;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  font-size: 0.92rem;
  animation: popIn 0.25s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.hint-item-card.step-1 {
  border-color: #38bdf8;
  background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 100%);
}

.hint-item-card.step-2 {
  border-color: #fbbf24;
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%);
}

.hint-item-card.step-3 {
  border-color: #a855f7;
  background: linear-gradient(180deg, #faf5ff 0%, #ffffff 100%);
}

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

.hint-card-title {
  font-weight: 800;
  font-size: 0.92rem;
  color: #0f172a;
}

.hint-card-text {
  margin: 4px 0 8px;
  line-height: 1.45;
  color: var(--text);
  font-weight: 600;
}

.hint-card-code-wrap {
  margin: 8px 0;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 8px 12px;
}

.hint-card-code-wrap pre {
  margin: 0;
  font-family: var(--font-code);
  font-size: 0.92rem;
  color: #38bdf8;
  white-space: pre-wrap;
  word-break: break-all;
}

.btn-hint-insert-code {
  width: 100%;
  margin-top: 8px;
  padding: 8px 14px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  font-weight: 800;
  font-size: 0.88rem;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-hint-insert-code:hover {
  background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}

.btn-hint-insert-code:active {
  transform: translateY(0);
}

@keyframes insertPulse {
  0% { border-color: #10b981; box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.45); }
  50% { border-color: #6366f1; box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.35); }
  100% { border-color: #334155; box-shadow: none; }
}

.code-editor-wrap.insert-pulse {
  animation: insertPulse 1.2s ease !important;
}

/* ---------- Визуальная сцена ---------- */
.stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.stage-header .card-title {
  margin-bottom: 0;
}

.stage-step-indicator {
  font-size: 0.82rem;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 999px;
  background: #0f172a;
  color: #38bdf8;
  border: 1px solid #1e293b;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stage-step-indicator::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: ledPulse 1.5s infinite;
}

@keyframes ledPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.visual-stage {
  min-height: 220px;
  border-radius: 18px;
  background: radial-gradient(ellipse at 50% 20%, #ffffff 0%, #f0f7ff 60%, #e2eeff 100%);
  background-image: 
    radial-gradient(ellipse at 50% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
    radial-gradient(#6366f1 1px, transparent 1px);
  background-size: 100% 100%, 18px 18px;
  border: 2px solid #bfdbfe;
  box-shadow: inset 0 2px 10px rgba(59, 130, 246, 0.08), 0 6px 20px rgba(15, 23, 42, 0.05);
  padding: 20px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
}

/* Визуализатор 1: Облачко речи (print) */
.vis-speech-scene {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
  flex-wrap: wrap;
}

.vis-mascot-wrap {
  width: 105px;
  height: 105px;
  transition: transform 0.3s ease;
  animation: floatMascot 3s ease-in-out infinite;
  filter: drop-shadow(0 6px 12px rgba(99, 102, 241, 0.2));
}

@keyframes floatMascot {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
}

.vis-mascot-wrap.speaking {
  animation: none;
  transform: scale(1.12) rotate(-3deg);
}

.speech-bubble {
  position: relative;
  background: #ffffff;
  border: 3px solid var(--primary);
  border-radius: 20px;
  padding: 16px 22px;
  min-width: 190px;
  max-width: 360px;
  font-weight: 800;
  font-size: 1.08rem;
  color: var(--text);
  box-shadow: 0 10px 25px rgba(79, 70, 229, 0.18);
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.speech-bubble.empty {
  border-style: dashed;
  border-color: #94a3b8;
  color: #64748b;
  font-weight: 700;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.85);
}

.magic-sparkles {
  font-size: 1.5rem;
  letter-spacing: 8px;
  min-height: 30px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

@keyframes popIn {
  0% { transform: scale(0.8); opacity: 0; }
  70% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); }
}

/* Визуализатор 2: Карточки типов (str vs int) */
.vis-cards-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 18px;
  border-radius: 16px;
  min-width: 135px;
  background: #ffffff;
  border: 3px solid #cbd5e1;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  animation: popIn 0.35s ease;
  transition: transform 0.2s ease;
}

.type-card:hover {
  transform: translateY(-3px);
}

.type-card.type-str {
  border-color: #10b981;
  background: linear-gradient(180deg, #ffffff 0%, #ecfdf5 100%);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.2);
}

.type-card.type-int,
.type-card.type-float {
  border-color: #f59e0b;
  background: linear-gradient(180deg, #ffffff 0%, #fffbeb 100%);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.2);
}

.type-card-badge {
  font-size: 0.75rem;
  font-weight: 900;
  padding: 2px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.type-str .type-card-badge { background: #10b981; color: #fff; }
.type-int .type-card-badge,
.type-float .type-card-badge { background: #f59e0b; color: #fff; }

.type-card-val {
  font-family: var(--font-code);
  font-size: 1.2rem;
  font-weight: 900;
  word-break: break-word;
  text-align: center;
  color: #0f172a;
}

.type-card-expr {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 700;
}

/* Визуализатор 3: Цепочка фонарей (порядок строк) */
.vis-lanterns {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  width: 100%;
  flex-wrap: wrap;
}

.lantern-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 135px;
  padding: 14px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
  border: 2px dashed #94a3b8;
  transition: all 0.35s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.lantern-slot.lit {
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  border: 3px solid #f59e0b;
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.45);
  transform: translateY(-6px);
}

.lantern-icon {
  font-size: 2.2rem;
  filter: grayscale(1);
  opacity: 0.45;
  transition: all 0.35s ease;
}

.lantern-slot.lit .lantern-icon {
  filter: none;
  opacity: 1;
  transform: scale(1.15);
}

.lantern-step {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--text-muted);
}

.lantern-slot.lit .lantern-step {
  color: #b45309;
}

.lantern-text {
  font-family: var(--font-code);
  font-size: 0.88rem;
  font-weight: 800;
  text-align: center;
  color: var(--text);
  word-break: break-word;
}

/* Визуализатор 4: Комментарии (# очки-невидимки) */
.vis-trace-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 480px;
}

.trace-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 14px;
  background: #ffffff;
  border: 2px solid var(--border);
  font-size: 0.9rem;
  animation: popIn 0.25s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.trace-row.skipped {
  background: #f8fafc;
  border-style: dashed;
  border-color: #94a3b8;
  color: #64748b;
}

.trace-row.executed {
  background: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.trace-code {
  font-family: var(--font-code);
  font-weight: 800;
  font-size: 0.88rem;
}

.trace-tag {
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

/* Визуализатор 5: Босс — Врата с 3 печатями */
.vis-gates {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.gate-door {
  font-size: 2.8rem;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.1));
}

.gate-door.open {
  transform: scale(1.22);
}

.seals-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.seal-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #cbd5e1;
  min-width: 130px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #64748b;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.seal-pill.unlocked {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-color: #f59e0b;
  color: #78350f;
  box-shadow: 0 0 22px rgba(245, 158, 11, 0.45);
  transform: translateY(-4px) scale(1.04);
}

/* ---------- Редактор кода ---------- */
.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.editor-header .card-title {
  margin-bottom: 0;
}

.code-editor-wrap {
  position: relative;
  display: flex;
  background: #1e293b;
  border-radius: 16px;
  overflow: hidden;
  border: 3px solid #334155;
  min-height: 170px;
  font-family: var(--font-code);
  font-size: 16px;
  line-height: 26px;
}

.code-editor-wrap:focus-within {
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.line-numbers {
  padding: 14px 12px;
  background: #0f172a;
  color: #64748b;
  text-align: right;
  user-select: none;
  min-width: 44px;
  white-space: pre;
  overflow: hidden;
  border-right: 1px solid #1e293b;
}

.code-area {
  position: relative;
  flex: 1;
  min-height: 170px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #64748b #0f172a;
}

/* Кастомный красивый скроллбар для редактора кода */
.code-area::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.code-area::-webkit-scrollbar-track {
  background: #0f172a;
  border-radius: 6px;
}
.code-area::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 6px;
  border: 2px solid #0f172a;
}
.code-area::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Слой содержимого: расширяется по ширине самой длинной строки кода */
.code-content-layer {
  position: relative;
  min-width: 100%;
  min-height: 100%;
  display: inline-block;
  vertical-align: top;
}

.active-line-highlight {
  position: absolute;
  left: 0;
  width: 100%;
  min-width: 100%;
  height: 26px;
  top: 14px;
  background: rgba(250, 204, 21, 0.25);
  border-left: 4px solid #facc15;
  pointer-events: none;
  opacity: 0;
  transition: top 0.2s ease, opacity 0.2s ease;
  z-index: 0;
}

.active-line-highlight.visible {
  opacity: 1;
}

.code-highlight,
.code-input {
  margin: 0;
  padding: 14px 16px;
  font-family: var(--font-code);
  font-size: 16px;
  line-height: 26px;
  tab-size: 4;
  white-space: pre;
  word-wrap: normal;
  word-break: normal;
  overflow-wrap: normal;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
  box-sizing: border-box;
}

.code-highlight {
  position: relative;
  z-index: 1;
  color: #f8fafc;
  pointer-events: none;
  min-height: 170px;
  display: inline-block;
  min-width: 100%;
}

.code-input {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: transparent;
  caret-color: #facc15;
  overflow: hidden;
  min-width: 100%;
  min-height: 100%;
}

/* Выделение мышкой длинного текста */
.code-input::selection {
  background: rgba(99, 102, 241, 0.45);
  color: transparent;
}

.code-input::-moz-selection {
  background: rgba(99, 102, 241, 0.45);
  color: transparent;
}

/* Подсветка синтаксиса Python */
.tok-kw { color: #c084fc; font-weight: 700; }
.tok-fn { color: #38bdf8; font-weight: 700; }
.tok-str { color: #4ade80; }
.tok-num { color: #fbbf24; }
.tok-com { color: #94a3b8; font-style: italic; }

/* Быстрые клавиши */
.quick-keys {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.quick-keys-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-muted);
}

.qkey {
  font-family: var(--font-code);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: #f8fafc;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.qkey:hover {
  background: #eef2ff;
  border-color: var(--primary);
}

.editor-footer {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

/* ---------- Консоль и обратная связь ---------- */
.console-output {
  background: #0f172a;
  color: #4ade80;
  font-family: var(--font-code);
  font-size: 1rem;
  padding: 14px 16px;
  border-radius: 14px;
  min-height: 76px;
  white-space: pre-wrap;
  word-break: break-word;
}

.console-placeholder {
  color: #64748b;
  font-family: var(--font-ui);
  font-size: 0.92rem;
}

.feedback-box {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.96rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: fadeIn 0.25s ease;
}

.feedback-box.hidden {
  display: none;
}

.feedback-box.error {
  background: var(--danger-soft);
  border: 2px solid #fca5a5;
  color: #991b1b;
}

.feedback-box.warn {
  background: var(--accent-soft);
  border: 2px solid #fcd34d;
  color: #92400e;
}

.feedback-box.success {
  background: var(--success-soft);
  border: 2px solid #86efac;
  color: #166534;
}

/* Консоль: строка успеха */
.console-success-badge {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid #10b981;
  border-radius: 8px;
  color: #34d399;
  font-family: var(--font-code);
  font-size: 0.88rem;
  font-weight: 700;
}

/* Богатый блок завершения уровня на рабочем экране */
.level-completion-card {
  display: block !important;
  padding: 20px 22px !important;
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%) !important;
  border: 3px solid #34d399 !important;
  border-radius: 20px !important;
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.18) !important;
  animation: popIn 0.35s ease !important;
  color: #065f46 !important;
}

.completion-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.completion-mascot-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.completion-header-text h3 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 900;
  color: #065f46;
}

.completion-header-text p {
  margin: 4px 0 0;
  color: #047857;
  font-size: 0.96rem;
  font-weight: 700;
}

.completion-stats-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0 16px;
}

.cstat-chip {
  background: #ffffff;
  border: 2px solid #a7f3d0;
  border-radius: 12px;
  padding: 7px 14px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
}

.cstat-lbl {
  color: #065f46;
}

.cstat-stars {
  color: #f59e0b;
  font-size: 1.05rem;
}

.cstat-coins {
  color: #b45309;
}

.completion-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-open-victory {
  background: linear-gradient(135deg, #059669, #10b981) !important;
  font-size: 1.05rem !important;
  padding: 12px 22px !important;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35) !important;
}

.btn-open-victory:hover {
  transform: translateY(-2px);
}

.btn-success-ready {
  background: linear-gradient(135deg, #059669, #10b981) !important;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35) !important;
  animation: pulseGlow 1.8s infinite !important;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45); }
  50% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
}

.level-completion-card.minimized .completion-stats-row,
.level-completion-card.minimized .completion-actions button:last-child {
  display: none;
}

/* ---------- Музей и Магазин ---------- */
.section-header {
  margin-bottom: 20px;
}

.section-header h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.7rem;
}

.section-header p {
  margin: 0;
  color: var(--text-muted);
}

.museum-subtitle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  margin: 26px 0 14px;
  color: var(--primary);
}

.sub-counter-pill {
  font-size: 0.85rem;
  font-weight: 900;
  padding: 3px 12px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--primary);
  border: 1px solid #c7d2fe;
}

/* Супернаграда за 100% ачивок */
.super-reward-container {
  margin-bottom: 24px;
}

.super-reward-card {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: 22px 26px;
  display: flex;
  align-items: center;
  gap: 22px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  flex-wrap: wrap;
}

.super-reward-card.locked {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 3px dashed #cbd5e1;
}

.super-reward-card.unlocked-ready {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 50%, #ffffff 100%);
  border: 3px solid #f59e0b;
  box-shadow: 0 12px 35px rgba(245, 158, 11, 0.35);
  animation: popIn 0.4s ease;
}

.super-reward-card.claimed {
  background: linear-gradient(135deg, #e0e7ff 0%, #ede9fe 50%, #fdf4ff 100%);
  border: 3px solid #8b5cf6;
  box-shadow: 0 12px 35px rgba(139, 92, 246, 0.25);
}

.sr-icon {
  font-size: 3.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.sr-icon.bounce {
  animation: boxShake 1.8s infinite;
}

.sr-info {
  flex: 1;
  min-width: 240px;
}

.sr-badge {
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  margin-bottom: 6px;
}

.sr-badge.glow {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.super-reward-card h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: #1e293b;
}

.super-reward-card p {
  margin: 0 0 10px;
  font-size: 0.94rem;
  color: var(--text);
  line-height: 1.45;
}

.sr-progress-wrap {
  width: 100%;
  height: 12px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.sr-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899);
  border-radius: 999px;
  transition: width 0.5s ease;
}

.sr-progress-text {
  font-size: 0.84rem;
  color: var(--text-muted);
  font-weight: 700;
}

.btn-claim-super {
  padding: 14px 24px !important;
  font-size: 1.1rem !important;
  animation: pulseGlow 1.6s infinite;
  flex-shrink: 0;
}

.sr-tag-done {
  font-size: 0.95rem;
  font-weight: 900;
  color: #059669;
  background: #dcfce7;
  padding: 8px 16px;
  border-radius: 14px;
  border: 2px solid #34d399;
  flex-shrink: 0;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.collectible-card {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.collectible-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.collectible-card.locked {
  opacity: 0.65;
  background: #f8fafc;
}

.collectible-card.secret-badge {
  background: #faf5ff;
  border-color: #d8b4fe;
}

.status-pill.secret {
  background: #f3e8ff;
  color: #7e22ce;
  border: 1px dashed #c084fc;
}

.collectible-icon {
  font-size: 2.8rem;
  line-height: 1;
}

.collectible-card.locked .collectible-icon {
  filter: grayscale(1);
}

.collectible-card.secret-badge.locked .collectible-icon {
  filter: none;
}

.collectible-name {
  font-weight: 900;
  font-size: 1.05rem;
}

.collectible-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Превью магазина Пайтоши */
.shop-preview-card {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 18px;
  background: linear-gradient(135deg, #eef2ff 0%, #fefce8 100%);
  border-radius: 24px;
  padding: 22px;
}

.shop-mascot-stage {
  width: 135px;
  height: 135px;
  flex-shrink: 0;
  border-radius: 20px;
  padding: 6px;
  border: 2px solid rgba(99, 102, 241, 0.2);
  background: #ffffff;
  transition: all 0.3s ease;
}

.shop-balance {
  margin-top: 8px;
  font-size: 1.15rem;
}

/* Заметка об ограниченных монетах */
.shop-economy-note {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 2px solid #fde68a;
  border-radius: 16px;
  padding: 12px 18px;
  font-size: 0.92rem;
  color: #92400e;
  margin-bottom: 16px;
  line-height: 1.4;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.1);
}

/* Вкладки категорий магазина */
.shop-categories-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.shop-cat-btn {
  border: 2px solid var(--border);
  background: #ffffff;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.shop-cat-btn:hover {
  border-color: #6366f1;
  color: #4f46e5;
  transform: translateY(-2px);
}

.shop-cat-btn.active {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  border-color: #4f46e5;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  transform: translateY(-2px);
}

.shop-card {
  position: relative;
}

.shop-card.equipped {
  border-color: #10b981;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
  background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
}

.shop-card.owned {
  border-color: #94a3b8;
}

.shop-card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
}

.shop-card.equipped .shop-card-badge {
  background: #10b981;
  color: #ffffff;
}

/* Всплывающие уведомления достижений (Toasts) */
.achievement-toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.achievement-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  background: #ffffff;
  border: 3px solid #f59e0b;
  border-radius: 20px;
  padding: 14px 18px;
  min-width: 320px;
  max-width: 440px;
  box-shadow: 0 12px 35px rgba(245, 158, 11, 0.35);
  animation: toastSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: all 0.35s ease;
}

.achievement-toast.fade-out {
  opacity: 0;
  transform: translateX(60px);
}

@keyframes toastSlideIn {
  0% { opacity: 0; transform: translateX(80px); }
  100% { opacity: 1; transform: translateX(0); }
}

.ach-toast-icon {
  font-size: 2.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.ach-toast-info {
  flex: 1;
}

.ach-toast-tag {
  font-size: 0.7rem;
  font-weight: 900;
  color: #d97706;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.ach-toast-title {
  font-size: 1rem;
  font-weight: 900;
  color: #0f172a;
  margin: 2px 0;
}

.ach-toast-desc {
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.35;
  font-weight: 600;
}

.ach-toast-coins {
  font-size: 1.15rem;
  font-weight: 900;
  color: #b45309;
  background: #fef3c7;
  padding: 6px 12px;
  border-radius: 12px;
  border: 2px solid #fde68a;
  flex-shrink: 0;
}

/* ========================================================
   ТЕМИЗИРОВАННЫЕ ФОНЫ СЦЕНЫ И ВИТРИНЫ (.stage-bg-*)
======================================================== */
.stage-bg-default {
  /* Базовый светлый класс */
}

.stage-bg-hallway {
  background: linear-gradient(180deg, #e0f2fe 0%, #ccfbf1 50%, #f0fdfa 100%) !important;
  border-color: #5eead4 !important;
}

.stage-bg-cafeteria {
  background: radial-gradient(circle at 50% 20%, #fff7ed 0%, #ffedd5 60%, #fed7aa 100%) !important;
  border-color: #fb923c !important;
}

.stage-bg-cyber-lab {
  background: radial-gradient(circle at 50% 20%, #1e1b4b 0%, #0f172a 75%, #020617 100%) !important;
  background-image: 
    linear-gradient(rgba(56, 189, 248, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.12) 1px, transparent 1px) !important;
  background-size: 24px 24px !important;
  border-color: #38bdf8 !important;
  box-shadow: inset 0 0 20px rgba(56, 189, 248, 0.25) !important;
}

.stage-bg-gd-arena {
  background: radial-gradient(circle at 50% 20%, #064e3b 0%, #022c22 75%, #021e17 100%) !important;
  background-image: 
    linear-gradient(rgba(34, 197, 94, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 197, 94, 0.18) 1px, transparent 1px) !important;
  background-size: 20px 20px !important;
  border-color: #22c55e !important;
  box-shadow: inset 0 0 24px rgba(34, 197, 94, 0.3) !important;
}

.stage-bg-space-station {
  background: radial-gradient(circle at 50% 15%, #312e81 0%, #1e1b4b 45%, #05051a 100%) !important;
  border-color: #818cf8 !important;
  box-shadow: inset 0 0 25px rgba(129, 140, 248, 0.3) !important;
}

.stage-bg-throne {
  background: radial-gradient(circle at 50% 20%, #581c87 0%, #3b0764 60%, #1e0038 100%) !important;
  border: 3px solid #facc15 !important;
  box-shadow: inset 0 0 30px rgba(250, 204, 21, 0.35), 0 0 20px rgba(234, 179, 8, 0.3) !important;
}

/* ---------- Экран для родителей ---------- */
.parents-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.summary-tile {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.summary-tile-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-muted);
}

.summary-tile-val {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 4px;
}

.parents-table-card {
  margin-bottom: 20px;
}

.table-wrap {
  overflow-x: auto;
}

.parents-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.parents-table th,
.parents-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.parents-table th {
  font-weight: 800;
  color: var(--text-muted);
  background: #f8fafc;
}

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

.status-pill.done { background: #dcfce7; color: #166534; }
.status-pill.todo { background: #f1f5f9; color: #64748b; }

/* ---------- Модальное окно победы ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}

.victory-card {
  position: relative;
  z-index: 2;
  background: #ffffff;
  border-radius: 28px;
  padding: 28px;
  max-width: 500px;
  width: 100%;
  text-align: center;
  border: 4px solid #fde047;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
  animation: popIn 0.35s ease;
}

.victory-mascot {
  width: 100px;
  height: 100px;
  margin: 0 auto 8px;
}

.victory-card h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--primary);
}

.victory-phrase {
  margin: 0 0 12px;
  font-size: 1.02rem;
  color: var(--text-muted);
  font-weight: 700;
}

.victory-stars {
  font-size: 2.5rem;
  letter-spacing: 6px;
  margin-bottom: 14px;
}

.victory-rewards {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.reward-chip {
  background: #fef3c7;
  border: 2px solid #fcd34d;
  color: #92400e;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.95rem;
}

.artifact-chip {
  background: #eef2ff;
  border-color: #a5b4fc;
  color: #3730a3;
}

.victory-summary {
  background: #f0fdf4;
  border: 2px solid #86efac;
  border-radius: 16px;
  padding: 12px 16px;
  text-align: left;
  margin-bottom: 20px;
}

.summary-label {
  font-weight: 900;
  font-size: 0.85rem;
  color: #166534;
  margin-bottom: 4px;
}

.victory-summary p {
  margin: 0;
  font-size: 0.95rem;
  color: #14532d;
}

.victory-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Адаптивность ---------- */
@media (max-width: 960px) {
  .level-layout {
    grid-template-columns: 1fr;
  }
  .hero-card {
    flex-direction: column;
    text-align: center;
  }
  .hero-progress-wrap {
    margin: 0 auto;
  }
}

@media (max-width: 600px) {
  .topbar {
    padding: 10px 14px;
  }
  .main-container {
    padding: 16px 12px 48px;
  }
  .shop-preview-card {
    flex-direction: column;
    text-align: center;
  }
}

/* ---------- Утилита скрытия ---------- */
.hidden {
  display: none !important;
}

/* ---------- PRIMM: Карточка «Угадай результат» ---------- */
.predict-card {
  background: linear-gradient(135deg, #faf5ff 0%, #ffffff 100%);
  border-color: #d8b4fe;
}

.predict-card .card-title {
  color: #7c3aed;
}

.predict-question {
  margin: 0 0 8px;
  font-weight: 800;
  font-size: 0.96rem;
}

.predict-code-box {
  margin-top: 0;
  margin-bottom: 12px;
  padding: 10px 14px;
}

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

.predict-opt-btn {
  border: 2px solid #c4b5fd;
  background: #ffffff;
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.92rem;
  padding: 8px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.predict-opt-btn:hover:not(:disabled) {
  background: #f3e8ff;
  border-color: #7c3aed;
  transform: translateY(-1px);
}

.predict-opt-btn.correct {
  background: #dcfce7;
  border-color: #16a34a;
  color: #166534;
}

.predict-opt-btn.wrong {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

.predict-feedback {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  background: #eef2ff;
  color: #3730a3;
}

.predict-feedback.ok {
  background: #dcfce7;
  color: #166534;
}

/* ---------- Модальное окно input() ---------- */
.input-modal-card {
  position: relative;
  z-index: 2;
  background: #ffffff;
  border-radius: 24px;
  padding: 24px;
  max-width: 460px;
  width: 100%;
  border: 3px solid var(--primary);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
  animation: popIn 0.25s ease;
}

.input-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.input-modal-mascot {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}

.input-modal-header h3 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--text);
}

.input-modal-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.input-modal-field {
  flex: 1;
  min-width: 180px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 2px solid var(--border);
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 700;
  outline: none;
}

.input-modal-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

/* ---------- Визуализатор Острова 2: Коробки-переменные ---------- */
.var-boxes-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

.var-box {
  position: relative;
  min-width: 140px;
  padding: 24px 16px 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fefce8 100%);
  border: 3px solid #f59e0b;
  box-shadow: 0 8px 22px rgba(245, 158, 11, 0.22);
  text-align: center;
  animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.var-box:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(245, 158, 11, 0.35);
}

.var-box.updated {
  animation: boxShake 0.45s ease;
  border-color: #6366f1;
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.4);
}

@keyframes boxShake {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.12) rotate(-4deg); }
  60% { transform: scale(1.08) rotate(4deg); }
}

.var-box-label {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #ffffff;
  font-family: var(--font-code);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 3px 12px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 3px 8px rgba(79, 70, 229, 0.35);
  letter-spacing: 0.4px;
}

.var-box-value {
  font-family: var(--font-code);
  font-size: 1.25rem;
  font-weight: 900;
  color: #0f172a;
  word-break: break-word;
}

.var-box-type {
  margin-top: 6px;
  font-size: 0.76rem;
  font-weight: 800;
  color: #b45309;
  background: #fef3c7;
  padding: 2px 8px;
  border-radius: 999px;
  display: inline-block;
}

.var-speech-strip {
  width: 100%;
  background: #ffffff;
  border: 2px solid var(--primary);
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 800;
  font-size: 0.96rem;
  text-align: center;
  color: var(--text);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.12);
  transition: opacity 0.3s ease;
}

/* ---------- Визуализатор Острова 2: Диалог input() ---------- */
.input-chat-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 460px;
}

.chat-msg {
  padding: 10px 16px;
  border-radius: 16px;
  font-size: 0.94rem;
  font-weight: 800;
  max-width: 85%;
  animation: popIn 0.25s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  line-height: 1.4;
}

.chat-msg.bot {
  align-self: flex-start;
  background: #ffffff;
  border: 2px solid var(--primary);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  border: 2px solid #16a34a;
  color: #14532d;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.18);
}

/* ---------- Визуализатор Босса 2: Золотой абонемент Столовой №404 ---------- */
.passport-card {
  width: 100%;
  max-width: 440px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 45%, #ffffff 100%);
  border: 3px solid #f59e0b;
  border-radius: 20px;
  padding: 18px 22px;
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.22);
  position: relative;
  overflow: hidden;
}

.passport-card::before {
  content: '🍽️';
  position: absolute;
  right: -8px;
  bottom: -8px;
  font-size: 5.5rem;
  opacity: 0.08;
  pointer-events: none;
}

.passport-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.05rem;
  color: #78350f;
  border-bottom: 2px dashed #fcd34d;
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.passport-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.94rem;
  font-weight: 700;
  color: #334155;
  border-bottom: 1px dotted rgba(245, 158, 11, 0.25);
}

.passport-row:last-of-type {
  border-bottom: none;
}

.passport-row strong {
  color: #4338ca;
  font-family: var(--font-code);
  font-size: 1rem;
}

.passport-stamp {
  margin-top: 14px;
  text-align: center;
  padding: 8px 14px;
  border-radius: 12px;
  font-weight: 900;
  font-size: 0.92rem;
  background: #f1f5f9;
  color: #64748b;
  letter-spacing: 0.4px;
}

.passport-stamp.approved {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #14532d;
  border: 2px solid #16a34a;
  box-shadow: 0 6px 18px rgba(22, 163, 74, 0.25);
  transform: rotate(-1.5deg);
}

/* ---------- Авторизация по промокоду и профиль в шапке ---------- */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 12px;
  border-radius: 999px;
  background: #eef2ff;
  border: 2px solid #c7d2fe;
  font-size: 0.88rem;
  font-weight: 800;
  color: #3730a3;
}

.btn-logout {
  border: none;
  background: #ffffff;
  color: #ef4444;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.78rem;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid #fecaca;
}

.btn-logout:hover {
  background: #fee2e2;
}

.auth-backdrop {
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
}

.auth-card {
  position: relative;
  z-index: 2;
  background: #ffffff;
  border-radius: 26px;
  padding: 26px;
  max-width: 460px;
  width: 100%;
  border: 3px solid var(--primary);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.4);
  animation: popIn 0.25s ease;
}

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

.auth-mascot {
  width: 74px;
  height: 74px;
  flex-shrink: 0;
}

.auth-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--primary);
}

.auth-sub {
  margin: 4px 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 700;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.auth-tab {
  border: 2px solid var(--border);
  background: #f8fafc;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.88rem;
  padding: 9px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text);
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
}

/* ---------- Визуализатор Острова 3: Развилка дороги (if / else / elif) ---------- */
.fork-scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.fork-sign {
  background: linear-gradient(135deg, #ffffff 0%, #eef2ff 100%);
  border: 3px solid var(--primary);
  border-radius: 16px;
  padding: 10px 20px;
  font-weight: 800;
  font-size: 0.96rem;
  color: var(--primary);
  text-align: center;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.15);
}

.fork-paths {
  display: flex;
  gap: 16px;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.fork-branch {
  flex: 1;
  min-width: 140px;
  max-width: 220px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 2px dashed #94a3b8;
  text-align: center;
  font-weight: 800;
  font-size: 0.92rem;
  color: #475569;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.fork-branch.taken {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  border: 3px solid #16a34a;
  color: #14532d;
  box-shadow: 0 0 24px rgba(22, 163, 74, 0.35);
  transform: translateY(-4px) scale(1.05);
}

/* ---------- Визуализатор Острова 4: Лента циклов (for / while / range) ---------- */
.loop-scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.loop-counter-badge {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #ffffff;
  font-weight: 900;
  font-size: 0.96rem;
  padding: 6px 18px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  letter-spacing: 0.3px;
}

.loop-tape {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 6px;
}

.loop-step-chip {
  padding: 8px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fffbeb 100%);
  border: 2px solid #f59e0b;
  font-family: var(--font-code);
  font-weight: 800;
  font-size: 0.92rem;
  color: #92400e;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.18);
  animation: popIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- Визуализатор Острова 5: Полка списков и шкафчик словаря ---------- */
.shelf-scene {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  align-items: center;
}

.shelf-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  background: linear-gradient(180deg, #fef3c7 0%, #fde68a 100%);
  border: 3px solid #d97706;
  border-radius: 18px;
  padding: 14px;
  width: 100%;
  box-shadow: inset 0 2px 6px rgba(217, 119, 6, 0.2), 0 6px 18px rgba(217, 119, 6, 0.15);
}

.shelf-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 82px;
  padding: 8px 12px;
  background: #ffffff;
  border: 2px solid #f59e0b;
  border-radius: 14px;
  animation: popIn 0.25s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease;
}

.shelf-cell:hover {
  transform: translateY(-2px);
}

.shelf-idx {
  font-family: var(--font-code);
  font-size: 0.74rem;
  font-weight: 800;
  color: #6366f1;
}

.shelf-val {
  font-family: var(--font-code);
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text);
}

/* ---------- Визуализатор Острова 6: Машина-заклинание (def / return) ---------- */
.func-machine {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  flex-wrap: wrap;
}

.machine-port {
  min-width: 115px;
  padding: 12px 16px;
  border-radius: 16px;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  text-align: center;
  font-weight: 800;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.machine-core {
  padding: 16px 22px;
  border-radius: 20px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #ffffff;
  font-family: var(--font-code);
  font-weight: 800;
  text-align: center;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35);
  border: 2px solid #a5b4fc;
}

.machine-arrow {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--primary);
  filter: drop-shadow(0 2px 4px rgba(79, 70, 229, 0.3));
}

/* ---------- Визуализатор Острова 7: Черепашка (HTML5 Canvas) ---------- */
.turtle-canvas-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.turtle-canvas {
  background: #ffffff;
  border: 3px solid #6366f1;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.18);
  max-width: 100%;
}

.module-cards-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  width: 100%;
}

.module-chip {
  padding: 12px 18px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #faf5ff 100%);
  border: 3px solid #8b5cf6;
  font-weight: 800;
  font-size: 1rem;
  color: #4c1d95;
  box-shadow: 0 6px 18px rgba(139, 92, 246, 0.18);
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ========================================================
   ЭКРАН 6: ЛИЧНАЯ СТРАНИЧКА (ПРОФИЛЬ)
======================================================== */
.profile-hero-card {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 3px solid #e2e8f0;
  border-radius: 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.profile-avatar-large {
  width: 90px;
  height: 90px;
  font-size: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 4px solid #6366f1;
  border-radius: 50%;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.25);
  animation: popIn 0.3s ease;
}

.profile-hero-info {
  flex: 1;
  min-width: 240px;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.profile-name-row h3 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text);
}

.profile-badge-pill {
  background: #e0e7ff;
  color: #4338ca;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 0.88rem;
}

.profile-status-desc {
  margin: 0 0 14px;
  color: #64748b;
  font-weight: 700;
  font-size: 0.95rem;
}

.profile-quick-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  background: #f1f5f9;
  padding: 10px 16px;
  border-radius: 16px;
  border: 2px solid #e2e8f0;
}

.pstat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
}

.pstat-val {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text);
}

.pstat-lbl {
  font-size: 0.78rem;
  font-weight: 800;
  color: #64748b;
}

.profile-section-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--text);
  margin: 28px 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-section-subtitle {
  color: #64748b;
  font-size: 0.92rem;
  font-weight: 700;
  margin: 0 0 16px;
}

.avatar-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.avatar-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 10px;
  background: #ffffff;
  border: 3px solid #e2e8f0;
  border-radius: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  user-select: none;
}

.avatar-card:hover {
  transform: translateY(-3px);
  border-color: #a5b4fc;
  box-shadow: var(--shadow-sm);
}

.avatar-card.active {
  border-color: #6366f1;
  background: #eef2ff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25), 0 8px 16px rgba(99, 102, 241, 0.2);
  transform: translateY(-3px);
}

.avatar-emoji {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 6px;
}

.avatar-name {
  font-weight: 900;
  font-size: 0.92rem;
  color: var(--text);
}

.avatar-desc {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 700;
  margin-top: 2px;
}

.avatar-check {
  font-size: 0.75rem;
  color: #4338ca;
  font-weight: 900;
  margin-top: 4px;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.pstat-card {
  background: #ffffff;
  border: 3px solid #e2e8f0;
  border-radius: 18px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.pstat-card-icon {
  font-size: 2.2rem;
}

.pstat-card-info h4 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text);
}

.pstat-card-info p {
  margin: 2px 0 0;
  font-size: 0.82rem;
  font-weight: 800;
  color: #64748b;
}

/* ========================================================
   ЭКРАН 7: РЕЙТИНГ МЕЖДУ ПОЛЬЗОВАТЕЛЯМИ (LEADERBOARD)
======================================================== */
.leaderboard-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

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

.filter-btn {
  padding: 8px 18px;
  border-radius: 14px;
  border: 2px solid #cbd5e1;
  background: #ffffff;
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  border-color: #6366f1;
}

.filter-btn.active {
  background: #4f46e5;
  color: #ffffff;
  border-color: #4f46e5;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* Пьедестал почёта */
.leaderboard-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  margin: 24px 0 32px;
  min-height: 220px;
}

.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 140px;
}

.podium-avatar-wrap {
  position: relative;
  margin-bottom: 6px;
}

.podium-avatar {
  font-size: 3rem;
  line-height: 1;
}

.podium-crown {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.4rem;
}

.podium-name {
  font-weight: 900;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.podium-grade {
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
}

.podium-score {
  font-weight: 900;
  font-size: 0.92rem;
  color: #d97706;
  margin: 2px 0 8px;
}

.podium-stand {
  width: 100%;
  border-radius: 16px 16px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.podium-stand.rank-1 {
  height: 110px;
  background: linear-gradient(180deg, #f59e0b, #d97706);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35);
}

.podium-stand.rank-2 {
  height: 85px;
  background: linear-gradient(180deg, #94a3b8, #64748b);
  box-shadow: 0 6px 18px rgba(100, 116, 139, 0.25);
}

.podium-stand.rank-3 {
  height: 65px;
  background: linear-gradient(180deg, #ea580c, #c2410c);
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.25);
}

/* Таблица лидеров */
.leaderboard-card {
  padding: 0;
  overflow: hidden;
}

.leaderboard-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.leaderboard-table th {
  background: #f8fafc;
  padding: 14px 16px;
  text-align: left;
  font-size: 0.88rem;
  font-weight: 800;
  color: #64748b;
  border-bottom: 2px solid #e2e8f0;
}

.leaderboard-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  font-weight: 700;
  font-size: 0.95rem;
  vertical-align: middle;
}

.leaderboard-table tr:hover td {
  background: #f8fafc;
}

.leaderboard-table tr.my-row td {
  background: #eef2ff !important;
  font-weight: 900;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-cell-avatar {
  font-size: 1.5rem;
  line-height: 1;
}

.my-tag {
  display: inline-block;
  background: #6366f1;
  color: #ffffff;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 8px;
  margin-left: 6px;
  font-weight: 900;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-weight: 900;
  font-size: 0.95rem;
}

.rank-badge.top-1 {
  background: #fef3c7;
  color: #b45309;
  border: 2px solid #f59e0b;
}

.rank-badge.top-2 {
  background: #f1f5f9;
  color: #475569;
  border: 2px solid #94a3b8;
}

.rank-badge.top-3 {
  background: #ffedd5;
  color: #9a3412;
  border: 2px solid #ea580c;
}

.rank-badge.other {
  background: transparent;
  color: #64748b;
}

/* ==========================================================================
   ОБНОВЛЕНИЯ: ВЫБОР КЛАССА, ДУЭЛИ, БАГХАНТЕР, БИТВА КЛАССОВ, ВИЗУАЛИЗАТОРЫ 9-10
   ========================================================================== */

.grade-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.grade-num-input {
  width: 80px !important;
  text-align: center;
  font-weight: 800;
  font-size: 1.1rem;
}

.grade-picker-divider {
  font-size: 0.88rem;
  color: #64748b;
  font-weight: 700;
  white-space: nowrap;
}

.grade-letter-select {
  flex: 1;
  font-weight: 800;
  font-size: 1.1rem;
  cursor: pointer;
  background-color: #ffffff;
}

.grade-modal-card {
  max-width: 440px;
}

.grade-modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

/* --- Спидран-Дуэли --- */
.duel-daily-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border: 2px solid #fdba74;
  border-radius: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.daily-badge {
  background: #ea580c;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.5px;
}

.daily-info h3 {
  margin: 0 0 4px 0;
  font-size: 1.15rem;
  color: #9a3412;
}

.daily-info p {
  margin: 0;
  color: #7c2d12;
  font-size: 0.9rem;
}

.daily-status {
  background: #ffffff;
  padding: 8px 16px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.95rem;
  color: #ea580c;
  border: 1px solid #fed7aa;
}

.duels-rivals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.rival-card {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 18px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.rival-card:hover {
  transform: translateY(-4px);
  border-color: #6366f1;
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.15);
}

.rival-card.active {
  border-color: #6366f1;
  background: #f5f3ff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.rival-avatar {
  font-size: 2.8rem;
  margin-bottom: 8px;
  display: block;
}

.rival-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 4px;
}

.rival-diff {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 8px;
}

.diff-easy { background: #dcfce7; color: #166534; }
.diff-medium { background: #dbeafe; color: #1e40af; }
.diff-hard { background: #fef3c7; color: #92400e; }
.diff-boss { background: #fee2e2; color: #991b1b; }

.rival-time {
  font-weight: 900;
  color: #475569;
  font-size: 0.95rem;
}

.duel-arena-card {
  padding: 24px;
  margin-bottom: 24px;
  background: #ffffff;
  border: 2px solid #cbd5e1;
}

.duel-arena-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.duel-rival-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.duel-rival-avatar {
  font-size: 2.5rem;
}

.duel-rival-info h3 {
  margin: 0;
  font-size: 1.25rem;
  color: #0f172a;
}

.duel-quote {
  margin: 2px 0 0 0;
  font-size: 0.88rem;
  color: #64748b;
  font-style: italic;
}

.duel-target-pill {
  background: #f1f5f9;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 0.95rem;
  color: #334155;
  font-weight: 700;
}

.duel-timer-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  border-radius: 20px;
  margin-bottom: 20px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

.duel-stopwatch {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3.2rem;
  font-weight: 900;
  color: #22d3ee;
  letter-spacing: 2px;
  text-shadow: 0 0 20px rgba(34, 211, 238, 0.6);
  margin-bottom: 16px;
}

.duel-stopwatch.ticking {
  color: #4ade80;
  text-shadow: 0 0 20px rgba(74, 222, 128, 0.8);
  animation: timerPulse 1s infinite alternate;
}

@keyframes timerPulse {
  from { transform: scale(1); }
  to { transform: scale(1.02); }
}

.btn-duel-submit {
  width: 100%;
  font-size: 1.05rem;
  padding: 14px;
}

.duel-result-box {
  margin-top: 20px;
  padding: 20px;
  border-radius: 16px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 800;
}

.duel-result-box.victory {
  background: #ecfdf5;
  border: 2px solid #34d399;
  color: #065f46;
}

.duel-result-box.defeat {
  background: #fff1f2;
  border: 2px solid #fda4af;
  color: #9f1239;
}

/* --- Найди баг --- */
.bugs-progress-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 2px solid #86efac;
  border-radius: 20px;
  flex-wrap: wrap;
  gap: 14px;
}

.bugs-badge-pill {
  background: #15803d;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 6px 16px;
  border-radius: 999px;
}

.bugs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.bug-case-card {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bug-case-card:hover {
  transform: translateY(-3px);
  border-color: #059669;
  box-shadow: 0 8px 20px rgba(5, 150, 105, 0.12);
}

.bug-case-card.active {
  border-color: #059669;
  background: #ecfdf5;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2);
}

.bug-case-card.solved {
  border-color: #10b981;
  background: #f0fdf4;
}

.bug-case-badge {
  font-size: 0.75rem;
  font-weight: 800;
  background: #0f172a;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 6px;
}

.bug-case-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #1e293b;
  margin: 0 0 4px 0;
}

.bug-case-stamp {
  font-family: 'Fredoka', sans-serif;
  font-weight: 900;
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 8px;
  border: 2px dashed #059669;
  color: #059669;
  text-transform: uppercase;
}

.bug-case-stamp.solved {
  border-color: #16a34a;
  background: #dcfce7;
  color: #15803d;
}

.bug-workbench-card {
  padding: 24px;
  margin-bottom: 24px;
  border: 2px solid #cbd5e1;
}

.bug-workbench-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.bug-clue-card {
  background: #fffbeb;
  border: 1px solid #fde68a;
  padding: 16px;
  margin-bottom: 16px;
}

.bug-suspect-err {
  margin-top: 8px;
  font-size: 0.88rem;
  color: #b45309;
  font-weight: 700;
}

.bug-suspect-err code {
  background: #fef3c7;
  padding: 2px 6px;
  border-radius: 6px;
  color: #92400e;
}

/* --- Битва Классов --- */
.lb-mode-switcher {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: #e2e8f0;
  padding: 4px;
  border-radius: 14px;
  width: fit-content;
}

.lb-mode-btn {
  padding: 10px 20px;
  border: none;
  background: transparent;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.95rem;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lb-mode-btn.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.class-battle-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border: 2px solid #c7d2fe;
  border-radius: 20px;
}

.cb-icon {
  font-size: 2.5rem;
}

.cb-info h3 {
  margin: 0 0 4px 0;
  color: #3730a3;
  font-size: 1.25rem;
}

.cb-info p {
  margin: 0;
  color: #4338ca;
  font-size: 0.92rem;
}

.my-class-highlight {
  background: #fef9c3 !important;
  border-left: 4px solid #eab308;
  font-weight: 800;
}

.my-class-badge {
  display: inline-block;
  background: #f59e0b;
  color: #ffffff;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 6px;
  margin-left: 6px;
  font-weight: 900;
}

/* --- Визуализаторы: string_editor & file_archive --- */
.string-editor-stage {
  padding: 16px;
  background: #fffbeb;
  border-radius: 18px;
  border: 2px solid #fde68a;
}

.str-stage-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-weight: 800;
  font-size: 0.85rem;
  color: #92400e;
}

.str-paper-desk {
  background: #ffffff;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.1);
  border: 1px dashed #fcd34d;
}

.str-paper-label {
  font-size: 0.78rem;
  color: #78716c;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.str-paper-content {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.25rem;
  font-weight: 800;
  color: #1c1917;
  min-height: 44px;
  padding: 10px;
  background: #fafaf9;
  border-radius: 8px;
  border-left: 4px solid #f59e0b;
  word-break: break-all;
}

.flash-edit {
  animation: flashPaper 0.4s ease;
}

@keyframes flashPaper {
  0% { background: #fef08a; transform: scale(1.02); }
  100% { background: #ffffff; transform: scale(1); }
}

.str-stats-bar {
  display: flex;
  gap: 14px;
  margin-top: 12px;
  font-size: 0.82rem;
  color: #78716c;
  font-weight: 700;
  flex-wrap: wrap;
}

.file-archive-stage {
  padding: 16px;
  background: #0f172a;
  border-radius: 18px;
  border: 2px solid #334155;
  color: #f8fafc;
}

.fa-stage-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #38bdf8;
}

.fa-rack-body {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.fa-files-tree {
  flex: 1;
  min-width: 140px;
  background: #1e293b;
  border-radius: 12px;
  padding: 10px;
  font-size: 0.85rem;
}

.fa-tree-title {
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.fa-file-item {
  padding: 4px 8px;
  border-radius: 6px;
  margin-bottom: 4px;
  color: #cbd5e1;
  cursor: default;
}

.fa-file-item.active {
  background: #0284c7;
  color: #ffffff;
  font-weight: 800;
}

.fa-terminal-screen {
  flex: 2;
  min-width: 220px;
  background: #020617;
  border-radius: 12px;
  padding: 12px;
  border: 1px solid #1e293b;
  position: relative;
  overflow: hidden;
}

.fa-term-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.78rem;
  color: #64748b;
}

.fa-term-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  color: #38bdf8;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}

.fa-laser-beam {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #38bdf8;
  box-shadow: 0 0 10px #38bdf8, 0 0 20px #38bdf8;
  animation: scanLaser 0.5s ease-in-out;
}

@keyframes scanLaser {
  0% { top: 0; }
  100% { top: 100%; }
}

/* ==========================================================================
   ШКОЛЬНАЯ ЛИГА СПИДРАНА: ТУРНИРЫ, АНТИЧИТ И МЕДАЛИ
   ========================================================================== */

.speedrun-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  color: #fff;
  border: 1px solid rgba(165, 180, 252, 0.25);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.speedrun-week-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 9999px;
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
  font-weight: 800;
  font-size: 0.85rem;
  margin-bottom: 8px;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.speedrun-banner-left h3 {
  font-size: 1.35rem;
  margin: 0 0 6px 0;
  color: #fff;
}

.speedrun-banner-left p {
  color: #c7d2fe;
  font-size: 0.95rem;
  margin: 0;
  max-width: 680px;
  line-height: 1.45;
}

.speedrun-anticheat-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.speedrun-anticheat-pill .lock-icon {
  font-size: 1.8rem;
}

.speedrun-anticheat-pill strong {
  display: block;
  color: #f87171;
  font-size: 0.92rem;
}

.speedrun-anticheat-pill small {
  color: #94a3b8;
  font-size: 0.78rem;
}

/* Трассы спидрана */
.speedrun-tracks-wrap {
  margin-bottom: 24px;
}

.speedrun-tracks-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.speedrun-tracks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.speedrun-track-card {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.speedrun-track-card:hover {
  transform: translateY(-2px);
  border-color: #6366f1;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.15);
}

.speedrun-track-card.active {
  border-color: #6366f1;
  background: #eef2ff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.speedrun-track-card.weekly-special {
  border-color: #f59e0b;
  background: #fffbeb;
}

.speedrun-track-card.weekly-special.active {
  border-color: #d97706;
  background: #fef3c7;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}

.speedrun-track-card .track-badge {
  align-self: flex-start;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  background: #e2e8f0;
  color: #475569;
}

.speedrun-track-card.weekly-special .track-badge {
  background: #fde68a;
  color: #92400e;
}

.speedrun-track-card .track-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: #1e293b;
  margin: 0;
}

.speedrun-track-card .track-pb {
  font-size: 0.82rem;
  font-weight: 700;
  color: #059669;
}

/* Всплывающее предупреждение о запрете вставки */
.code-editor-wrap.relative {
  position: relative;
}

.duel-paste-toast {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: #ef4444;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
  z-index: 100;
  animation: shakeToast 0.4s ease;
  pointer-events: none;
}

@keyframes shakeToast {
  0%, 100% { transform: translateX(-50%); }
  20%, 60% { transform: translateX(calc(-50% - 8px)); }
  40%, 80% { transform: translateX(calc(-50% + 8px)); }
}

/* Подиум лидеров недели */
.speedrun-podium-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 16px;
  margin: 20px 0 24px 0;
  flex-wrap: wrap;
}

.podium-slot {
  flex: 1;
  min-width: 170px;
  max-width: 220px;
  background: #f8fafc;
  border-radius: 16px;
  padding: 16px 12px;
  text-align: center;
  border: 2px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  position: relative;
  transition: transform 0.2s;
}

.podium-slot:hover {
  transform: translateY(-4px);
}

.podium-slot.first {
  order: 2;
  border-color: #f59e0b;
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.2);
  transform: scale(1.05);
}

.podium-slot.second {
  order: 1;
  border-color: #94a3b8;
  background: linear-gradient(180deg, #f1f5f9 0%, #ffffff 100%);
}

.podium-slot.third {
  order: 3;
  border-color: #d97706;
  background: linear-gradient(180deg, #fef3c7 0%, #ffffff 100%);
}

.podium-crown {
  font-size: 2rem;
  margin-bottom: 4px;
}

.podium-avatar {
  font-size: 2.2rem;
  display: inline-block;
  margin-bottom: 6px;
}

.podium-name {
  font-weight: 800;
  font-size: 1rem;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.podium-grade {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 700;
  margin-bottom: 8px;
}

.podium-time {
  font-size: 1.15rem;
  font-weight: 900;
  color: #4338ca;
  font-family: 'JetBrains Mono', monospace;
}

.podium-medal-label {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.74rem;
  font-weight: 800;
}

.podium-slot.first .podium-medal-label {
  background: #fde68a;
  color: #92400e;
}

.podium-slot.second .podium-medal-label {
  background: #e2e8f0;
  color: #334155;
}

.podium-slot.third .podium-medal-label {
  background: #fed7aa;
  color: #7c2d12;
}

/* Медали в профиле */
.profile-medals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 14px;
  margin-bottom: 28px;
}

.profile-medal-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 16px;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s;
}

.profile-medal-card:hover {
  transform: translateY(-2px);
}

.profile-medal-card.gold {
  border-color: #f59e0b;
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.15);
}

.profile-medal-card.silver {
  border-color: #94a3b8;
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}

.profile-medal-card.bronze {
  border-color: #d97706;
  background: linear-gradient(135deg, #fef3c7 0%, #ffffff 100%);
}

.profile-medal-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.profile-medal-info {
  flex: 1;
}

.profile-medal-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 2px 0;
}

.profile-medal-track {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0 0 4px 0;
}

.profile-medal-time {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 0.88rem;
  color: #4338ca;
}

.profile-medals-empty {
  grid-column: 1 / -1;
  padding: 24px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  text-align: center;
  color: #64748b;
}

.profile-medals-empty h4 {
  color: #1e293b;
  margin: 0 0 6px 0;
}

/* Исправление ширины выбора класса в модальном окне */
.grade-picker-row { display: flex !important; align-items: center !important; gap: 8px !important; width: 100% !important; box-sizing: border-box !important; }
.grade-picker-row .input-modal-field { min-width: 0 !important; }
.grade-num-input { width: 72px !important; min-width: 72px !important; max-width: 72px !important; flex: 0 0 72px !important; text-align: center !important; }
.grade-letter-select { flex: 1 1 auto !important; min-width: 80px !important; width: auto !important; box-sizing: border-box !important; }
