/* ============================================================
   Пневматик — Design System
   Тёмная индустриальная тема с неоновыми акцентами
   ============================================================ */

/* ── Google Fonts ──────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;600&display=swap');

/* ── Variables ─────────────────────────────────────────── */
:root {
  --bg-deepest:  #050810;
  --bg-primary:  #0a0f1a;
  --bg-card:     rgba(12, 18, 32, 0.88);
  --bg-card-hover: rgba(18, 26, 46, 0.92);
  --bg-overlay:  rgba(4, 6, 12, 0.85);

  --border-subtle:  rgba(0, 200, 255, 0.08);
  --border-card:    rgba(0, 200, 255, 0.15);
  --border-glow:    rgba(0, 200, 255, 0.3);

  --text-primary:   #e4eaf4;
  --text-secondary: #7c869a;
  --text-muted:     #4a5268;

  --accent-cyan:    #00c8ff;
  --accent-blue:    #3b82f6;
  --accent-green:   #00ff88;
  --accent-amber:   #ffaa00;
  --accent-red:     #ff4466;
  --accent-purple:  #a855f7;

  --success-bg:  rgba(0, 255, 136, 0.08);
  --success-border: rgba(0, 255, 136, 0.3);
  --warning-bg:  rgba(255, 170, 0, 0.08);
  --warning-border: rgba(255, 170, 0, 0.3);
  --danger-bg:   rgba(255, 68, 102, 0.08);
  --danger-border:  rgba(255, 68, 102, 0.3);
  --critical-bg: rgba(255, 20, 40, 0.12);
  --critical-border: rgba(255, 20, 40, 0.5);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-card: 0 8px 32px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.3);
  --shadow-glow: 0 0 30px rgba(0, 200, 255, 0.1);

  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ── Reset & Base ──────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  background: var(--bg-deepest);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.65;
}

/* Фоновая сетка */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(0,200,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,200,255,0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* Градиентное свечение сверху */
body::after {
  content: "";
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 500px;
  background: radial-gradient(ellipse, rgba(0,200,255,0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.screen {
  display: none;
  position: relative;
  z-index: 1;
}
.screen.active {
  display: flex;
}

/* ── TITLE SCREEN ─────────────────────────────────────── */
#title-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  text-align: center;
  gap: 0;
}

.title-hero {
  width: min(500px, 90vw);
  height: min(320px, 50vw);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2rem;
  position: relative;
  box-shadow: var(--shadow-card), var(--shadow-glow);
  border: 1px solid var(--border-card);
}

.title-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.title-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg-deepest) 0%, transparent 50%);
}

.title-badge {
  display: inline-block;
  padding: 0.35rem 1rem;
  border-radius: 100px;
  background: rgba(0, 200, 255, 0.1);
  border: 1px solid rgba(0, 200, 255, 0.25);
  color: var(--accent-cyan);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.title-name {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #ffffff 0%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.title-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  max-width: 520px;
}

.title-stats-preview {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.preview-stat {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 0.4rem 0.9rem;
  background: var(--bg-card);
  border-radius: 100px;
  border: 1px solid var(--border-subtle);
}

.btn-start {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 2.5rem;
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--bg-deepest);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(0, 200, 255, 0.3);
  animation: pulse-glow 2s ease-in-out infinite;
}

.btn-start:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 30px rgba(0, 200, 255, 0.45);
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 4px 20px rgba(0, 200, 255, 0.3); }
  50% { box-shadow: 0 4px 30px rgba(0, 200, 255, 0.5); }
}

.title-footer {
  margin-top: 2rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── GAME SCREEN ──────────────────────────────────────── */
#game-screen {
  flex-direction: column;
  min-height: 100vh;
}

/* Stats Bar */
.stats-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  background: rgba(5, 8, 16, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: var(--transition);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.stat-value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-primary);
}

.stat-bar {
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 100px;
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.3s ease;
}
.stat-fill.stat-high { background: linear-gradient(90deg, var(--accent-green), #22ff99); }
.stat-fill.stat-mid  { background: linear-gradient(90deg, var(--accent-amber), #ffcc00); }
.stat-fill.stat-low  { background: linear-gradient(90deg, var(--accent-red), #ff6688); }

.stat-pulse {
  animation: stat-bounce 0.5s ease;
}
@keyframes stat-bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Progress Bar */
.progress-bar-container {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 1rem 0.5rem;
  background: rgba(5, 8, 16, 0.8);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.progress-bar {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.05);
  border-radius: 100px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-cyan);
  border-radius: 100px;
  transition: width 0.6s ease;
  width: 0%;
}

/* Scene Card */
.scene-wrapper {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.5rem 1rem 2rem;
}

.scene-card {
  width: 100%;
  max-width: 700px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 2rem;
  backdrop-filter: blur(12px);
}

.scene-enter {
  animation: scene-slide-in 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes scene-slide-in {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.scene-location {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  background: rgba(0, 200, 255, 0.08);
  border: 1px solid rgba(0, 200, 255, 0.15);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.scene-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1.2rem;
  line-height: 1.3;
}

.scene-text {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  cursor: pointer;
  min-height: 60px;
}

.scene-hint {
  display: none;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(168, 85, 247, 0.2);
  color: #c4a5f7;
  font-size: 0.88rem;
  margin-bottom: 1rem;
}

.scene-question {
  display: none;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 1.2rem;
}

/* Choices */
.choices-container {
  display: none;
  flex-direction: column;
  gap: 0.7rem;
}

.choice-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 1rem 1.2rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  animation: choice-appear 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

@keyframes choice-appear {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}

.choice-btn:hover {
  background: rgba(0, 200, 255, 0.06);
  border-color: var(--border-glow);
  transform: translateX(4px);
  box-shadow: 0 0 20px rgba(0, 200, 255, 0.08);
}

.choice-btn:active {
  transform: scale(0.98);
}

.choice-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.choice-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 10px;
  background: rgba(0, 200, 255, 0.1);
  border: 1px solid rgba(0, 200, 255, 0.2);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
}

.choice-text {
  flex: 1;
}

/* Narrative Button */
.btn-narrative {
  display: none;
  width: 100%;
  padding: 1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--bg-deepest);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  margin-top: 0.5rem;
}

.btn-narrative:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 200, 255, 0.35);
}

.btn-appear {
  animation: choice-appear 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── FEEDBACK OVERLAY ─────────────────────────────────── */
#feedback-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
}
#feedback-overlay.active {
  display: flex;
  animation: fade-in 0.3s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.feedback-panel {
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
  animation: slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

.fb-success { border: 1.5px solid var(--success-border); }
.fb-warning { border: 1.5px solid var(--warning-border); }
.fb-danger  { border: 1.5px solid var(--danger-border); }
.fb-critical { border: 2px solid var(--critical-border); box-shadow: 0 0 40px rgba(255,20,40,0.15); }

.feedback-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.feedback-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.fb-success .feedback-title { color: var(--accent-green); }
.fb-warning .feedback-title { color: var(--accent-amber); }
.fb-danger  .feedback-title { color: var(--accent-red); }
.fb-critical .feedback-title { color: #ff1428; }

.feedback-explanation {
  font-size: 0.92rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 1.2rem;
  padding: 1rem;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.feedback-effects {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.effect-tag {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
}
.effect-positive {
  background: rgba(0, 255, 136, 0.1);
  color: var(--accent-green);
  border: 1px solid rgba(0, 255, 136, 0.2);
}
.effect-negative {
  background: rgba(255, 68, 102, 0.1);
  color: var(--accent-red);
  border: 1px solid rgba(255, 68, 102, 0.2);
}

.btn-feedback {
  width: 100%;
  padding: 0.9rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.btn-feedback:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--border-glow);
}

/* ── SCREEN SHAKE ─────────────────────────────────────── */
.shake {
  animation: shake-anim 0.6s ease;
}
@keyframes shake-anim {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-8px); }
  20% { transform: translateX(8px); }
  30% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  50% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
  70% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

/* ── ENDING SCREEN ────────────────────────────────────── */
#ending-screen {
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 2rem 1rem;
}

.ending-card {
  width: 100%;
  max-width: 700px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 2.5rem 2rem;
  text-align: center;
  animation: scene-slide-in 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.ending-icon {
  font-size: 4rem;
  margin-bottom: 0.5rem;
}

.ending-title {
  font-size: 1.8rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
}

.ending-badge {
  display: inline-block;
  padding: 0.3rem 1rem;
  border-radius: 100px;
  background: rgba(0, 200, 255, 0.1);
  border: 1px solid rgba(0, 200, 255, 0.25);
  color: var(--accent-cyan);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.ending-score {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.ending-text {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text-primary);
  text-align: left;
  padding: 1.2rem;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
}

/* Final Stats */
.ending-stats {
  text-align: left;
  margin-bottom: 1.5rem;
}

.end-stat-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.5rem 0;
}

.end-stat-label {
  width: 160px;
  min-width: 120px;
  font-size: 0.85rem;
  font-weight: 600;
}

.end-stat-bar-bg {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 100px;
  overflow: hidden;
}

.end-stat-bar {
  height: 100%;
  border-radius: 100px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.end-stat-high { background: linear-gradient(90deg, var(--accent-green), #22ff99); }
.end-stat-mid  { background: linear-gradient(90deg, var(--accent-amber), #ffcc00); }
.end-stat-low  { background: linear-gradient(90deg, var(--accent-red), #ff6688); }

.end-stat-val {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.9rem;
  width: 30px;
  text-align: right;
}

/* Decision History */
.ending-history {
  text-align: left;
  margin-top: 1rem;
}

.ending-history h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
  color: var(--text-secondary);
}

.hist-item {
  display: flex;
  gap: 0.8rem;
  padding: 0.8rem;
  margin-bottom: 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.hist-success { border-left: 3px solid var(--accent-green); }
.hist-warning { border-left: 3px solid var(--accent-amber); }
.hist-danger  { border-left: 3px solid var(--accent-red); }
.hist-critical { border-left: 3px solid #ff1428; background: rgba(255,20,40,0.04); }

.hist-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.hist-body {
  flex: 1;
}

.hist-scene {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}

.hist-choice {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.hist-feedback {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.hist-accuracy {
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 200, 255, 0.06);
  border: 1px solid rgba(0, 200, 255, 0.15);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-cyan);
  text-align: center;
}

.btn-restart {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding: 0.9rem 2rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  color: var(--bg-deepest);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.btn-restart:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 200, 255, 0.35);
}

/* ── TOP BAR (play.html) ──────────────────────────────── */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: rgba(5, 8, 16, 0.95);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 101;
}

.back-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
}
.back-link:hover { color: var(--accent-cyan); }

.difficulty-badge {
  padding: 0.3rem 0.8rem;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.diff-easy   { background: rgba(0,255,136,0.1);  color: var(--accent-green); border: 1px solid rgba(0,255,136,0.25); }
.diff-normal { background: rgba(255,170,0,0.1);  color: var(--accent-amber); border: 1px solid rgba(255,170,0,0.25); }
.diff-hard   { background: rgba(255,68,102,0.1); color: var(--accent-red);   border: 1px solid rgba(255,68,102,0.25); }

/* Timer */
.timer-display {
  display: none;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.8rem;
  border-radius: 100px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: all 0.3s ease;
}
.timer-icon { font-size: 0.85rem; }
.timer-warning {
  border-color: rgba(255,170,0,0.5);
  color: var(--accent-amber);
  animation: timer-pulse 0.8s ease infinite;
}
.timer-critical {
  border-color: rgba(255,20,40,0.6);
  color: var(--accent-red);
  background: rgba(255,20,40,0.1);
  animation: timer-pulse 0.4s ease infinite;
}
@keyframes timer-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* ── HUB PAGE ────────────────────────────────────────── */
.hub-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  position: relative;
  z-index: 1;
}

.hub-header {
  text-align: center;
  margin-bottom: 3rem;
}

.hub-hero-img {
  width: min(420px, 90vw);
  height: min(260px, 45vw);
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card), var(--shadow-glow);
  border: 1px solid var(--border-card);
  margin-bottom: 1.5rem;
}

.hub-badge {
  display: inline-block;
  padding: 0.35rem 1rem;
  border-radius: 100px;
  background: rgba(0, 200, 255, 0.1);
  border: 1px solid rgba(0, 200, 255, 0.25);
  color: var(--accent-cyan);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.hub-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  background: linear-gradient(135deg, #ffffff 0%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.hub-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.6;
}

.section-heading {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  color: var(--text-primary);
}

/* ── Difficulty Cards ────────────────────────────────── */
.difficulty-section {
  margin-bottom: 3rem;
}

.difficulty-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
}

.diff-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: var(--font-body);
  color: var(--text-primary);
}

.diff-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-2px);
}

.diff-card.active {
  background: rgba(0, 200, 255, 0.06);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(0, 200, 255, 0.12);
}

.diff-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.diff-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.7rem; }

.diff-features {
  list-style: none;
  text-align: left;
  width: 100%;
}
.diff-features li {
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 0.2rem 0;
}

.diff-recommended {
  position: absolute;
  top: -10px;
  right: 10px;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: var(--bg-deepest);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Scenario Cards ──────────────────────────────────── */
.scenarios-section { margin-bottom: 3rem; }

.scenario-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.scenario-card {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
}
.scenario-card:hover:not(.locked) {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.scenario-card.locked {
  opacity: 0.45;
  filter: grayscale(0.3);
}

.scenario-number {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 900;
  color: rgba(0, 200, 255, 0.15);
  min-width: 50px;
  text-align: center;
}

.scenario-body { flex: 1; }

.scenario-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.scenario-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.6rem;
}

.scenario-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.meta-tag {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-subtle);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.scenario-best {
  display: none;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.best-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-amber);
}
.best-badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  background: rgba(255,170,0,0.1);
  border: 1px solid rgba(255,170,0,0.2);
  color: var(--accent-amber);
}
.best-diff {
  font-size: 0.68rem;
  padding: 0.15rem 0.4rem;
  border-radius: 100px;
}
.diff-tag-easy   { background: rgba(0,255,136,0.1); color: var(--accent-green); }
.diff-tag-normal { background: rgba(255,170,0,0.1); color: var(--accent-amber); }
.diff-tag-hard   { background: rgba(255,68,102,0.1); color: var(--accent-red); }

.scenario-play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--bg-deepest);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border: none;
  border-radius: var(--radius-md);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}
.scenario-play-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(0, 200, 255, 0.3);
}

.locked-btn {
  background: rgba(255,255,255,0.05) !important;
  color: var(--text-muted) !important;
  cursor: default !important;
  pointer-events: none;
  border: 1px solid var(--border-subtle) !important;
  font-size: 0.8rem !important;
}

/* ── Ending Actions ─────────────────────────────────── */
.ending-actions {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.btn-hub {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 2rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: var(--transition);
}
.btn-hub:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--border-glow);
}

/* ── Ending Difficulty Info ──────────────────────────── */
.ending-diff-info {
  text-align: center;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-subtle);
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.hist-timeout-info {
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(255,68,102,0.06);
  border: 1px solid rgba(255,68,102,0.15);
  font-size: 0.82rem;
  color: var(--accent-red);
  text-align: center;
}

/* Footer */
.hub-footer {
  text-align: center;
  padding: 2rem 0;
  border-top: 1px solid var(--border-subtle);
  margin-top: 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.hub-footer a {
  color: var(--accent-cyan);
  text-decoration: none;
}
.hub-footer a:hover { text-decoration: underline; }
.hub-version {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.6;
}

/* ── Progress Overview on Hub ───────────────────────── */
.progress-overview {
  margin-bottom: 2rem;
}
.progress-overview-inner {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}
.progress-overview-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 100px;
  font-size: 0.9rem;
}
.progress-overview-icon {
  font-size: 1.1rem;
}
.progress-overview-label {
  color: var(--text-secondary);
}
.progress-overview-value {
  font-weight: 700;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

/* ── Scenario Card Completed States ─────────────────── */
.scenario-completed {
  border-color: rgba(0,255,136,0.25) !important;
}
.scenario-completed .scenario-number {
  color: var(--accent-green);
}
.scenario-excellent {
  border-color: rgba(0,255,136,0.4) !important;
  box-shadow: 0 0 20px rgba(0,255,136,0.08);
}
.scenario-master::after {
  content: '⭐';
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 1.2rem;
}
.scenario-card {
  position: relative;
}

/* ── Sound Toggle Button ────────────────────────────── */
.btn-sound {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: var(--transition);
  color: var(--text-primary);
  padding: 0;
}
.btn-sound:hover {
  background: rgba(0, 200, 255, 0.15);
  border-color: var(--accent-cyan);
  transform: scale(1.1);
}

/* ── Coupon Section ─────────────────────────────────── */
.coupon-section {
  margin: 1.5rem 0;
}
.coupon-card {
  position: relative;
  background: linear-gradient(135deg, rgba(0,255,136,0.08) 0%, rgba(0,200,255,0.08) 100%);
  border: 2px dashed var(--accent-green);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  overflow: hidden;
}
.coupon-glow {
  position: absolute;
  inset: -50%;
  background: radial-gradient(circle at 50% 50%, rgba(0,255,136,0.12) 0%, transparent 60%);
  animation: coupon-pulse 3s ease-in-out infinite;
  pointer-events: none;
}
@keyframes coupon-pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}
.coupon-header {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-green);
  margin-bottom: 0.75rem;
}
.coupon-discount {
  font-size: 2.2rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent-green) 0%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}
.coupon-code {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  background: rgba(0,0,0,0.4);
  padding: 0.6rem 1.5rem;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-bottom: 0.75rem;
  letter-spacing: 0.12em;
  border: 1px solid rgba(0,255,136,0.3);
  user-select: all;
}
.coupon-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}
.coupon-desc a {
  color: var(--accent-cyan);
  text-decoration: none;
}
.coupon-desc a:hover {
  text-decoration: underline;
}
.coupon-copy-btn {
  background: linear-gradient(135deg, var(--accent-green), #00c893);
  color: #000;
  border: none;
  padding: 0.6rem 1.5rem;
  border-radius: 100px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
}
.coupon-copy-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(0,255,136,0.3);
}
.coupon-reveal {
  animation: coupon-appear 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes coupon-appear {
  0% { opacity: 0; transform: scale(0.8) translateY(20px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Achievements Section ───────────────────────────── */
.new-achievements-section {
  margin: 1.5rem 0;
  background: linear-gradient(135deg, rgba(168,85,247,0.08) 0%, rgba(0,200,255,0.08) 100%);
  border: 1px solid rgba(168,85,247,0.3);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}
.new-ach-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-purple);
  margin-bottom: 1rem;
  text-align: center;
}
.new-ach-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem;
  background: rgba(168,85,247,0.08);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}
.new-ach-item:last-child { margin-bottom: 0; }
.new-ach-icon {
  font-size: 2rem;
  flex-shrink: 0;
}
.new-ach-item strong {
  color: var(--text-primary);
  font-size: 0.95rem;
}
.new-ach-item small {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.achievements-full-section {
  margin: 1.5rem 0;
  padding: 1.5rem;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.achievements-full-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.achievements-full-title span {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.6rem;
}
.ach-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  transition: var(--transition);
}
.ach-unlocked {
  background: rgba(0,255,136,0.05);
  border-color: rgba(0,255,136,0.2);
}
.ach-locked {
  background: rgba(255,255,255,0.02);
  opacity: 0.5;
}
.ach-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}
.ach-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
}
.ach-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

/* ── Achievement Popup ──────────────────────────────── */
.achievement-popup {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  transition: top 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
.achievement-popup.show {
  top: 20px;
}
.achievement-popup-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, rgba(168,85,247,0.95) 0%, rgba(88,28,200,0.95) 100%);
  border: 1px solid rgba(168,85,247,0.5);
  border-radius: var(--radius-md);
  padding: 0.8rem 1.5rem;
  box-shadow: 0 8px 40px rgba(168,85,247,0.4), 0 0 60px rgba(168,85,247,0.15);
  backdrop-filter: blur(20px);
  min-width: 280px;
}
.achievement-popup-icon {
  font-size: 2rem;
}
.achievement-popup-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.7);
}
.achievement-popup-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

/* ── Share Section ──────────────────────────────────── */
.share-section {
  margin: 1.5rem 0;
  padding: 1.5rem;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  text-align: center;
}
.share-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}
.share-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: 100px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-body);
}
.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.share-tg:hover {
  background: rgba(0,136,204,0.2);
  border-color: #0088cc;
  color: #29b6f6;
}
.share-wa:hover {
  background: rgba(37,211,102,0.2);
  border-color: #25d366;
  color: #25d366;
}
.share-vk:hover {
  background: rgba(0,119,179,0.2);
  border-color: #0077b3;
  color: #4c9fe0;
}
.share-copy:hover {
  background: rgba(255,170,0,0.15);
  border-color: var(--accent-amber);
  color: var(--accent-amber);
}
.share-btn svg {
  flex-shrink: 0;
}

/* ── Scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 100px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.2);
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 640px) {
  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
    padding: 0.6rem;
  }

  .scene-card {
    padding: 1.2rem;
  }

  .scene-title {
    font-size: 1.2rem;
  }

  .title-name {
    font-size: 1.8rem;
  }

  .title-stats-preview {
    gap: 0.5rem;
  }

  .ending-card {
    padding: 1.5rem 1rem;
  }

  .end-stat-label {
    width: 100px;
    min-width: 80px;
    font-size: 0.75rem;
  }

  .feedback-panel {
    padding: 1.5rem;
  }

  .difficulty-cards {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .diff-card {
    flex-direction: row;
    gap: 1rem;
    padding: 1rem;
  }

  .diff-features {
    width: auto;
  }

  .scenario-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
  }

  .scenario-play-btn {
    width: 100%;
    justify-content: center;
  }

  .ending-actions {
    flex-direction: column;
  }

  .btn-restart, .btn-hub {
    width: 100%;
    justify-content: center;
  }

  .top-bar {
    flex-wrap: wrap;
    gap: 0.4rem;
  }
}

/* ═══════════════════════════════════════════════════════════
   Error Review Block — Разбор ошибок на экране результатов
   ═══════════════════════════════════════════════════════════ */
.error-review {
  margin-top: 1.5rem;
  padding: 1.2rem 1.5rem;
  background: linear-gradient(135deg,
    rgba(26, 26, 46, 0.9),
    rgba(22, 33, 62, 0.9)
  );
  border-radius: 12px;
  border-left: 4px solid var(--accent-cyan);
}
.error-review-perfect {
  border-left-color: var(--accent-green);
}
.error-review h3 {
  color: var(--accent-cyan);
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.8rem 0;
}
.error-review-perfect h3 {
  color: var(--accent-green);
}
.error-review-subtitle {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin: 0 0 0.5rem 0;
}
.error-review-links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.error-review-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.8rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  color: var(--accent-cyan);
  text-decoration: none;
  font-size: 0.88rem;
  transition: all 0.2s;
}
.error-review-link:hover {
  background: rgba(0, 229, 255, 0.08);
  border-color: rgba(0, 229, 255, 0.2);
  transform: translateX(3px);
}
.error-review-catalog {
  color: var(--accent-amber);
}
.error-review-catalog:hover {
  background: rgba(255, 170, 0, 0.08);
  border-color: rgba(255, 170, 0, 0.2);
}
.error-review-icon {
  font-size: 1rem;
  flex-shrink: 0;
}
.error-review-text {
  flex: 1;
  font-weight: 500;
}
.error-review-arrow {
  opacity: 0.4;
  font-size: 0.8rem;
  transition: opacity 0.2s;
}
.error-review-link:hover .error-review-arrow {
  opacity: 1;
}
.error-review-catalog-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.8rem;
  margin-bottom: 0.3rem;
  font-weight: 600;
}
