/* ===== CSS VARIABLES ===== */
:root {
  --bg-grad-from: #0f0c29;
  --bg-grad-to: #302b63;
  --card: rgba(255,255,255,0.08);
  --card-solid: #1e2947;
  --accent: #f7b731;
  --primary: #667eea;
  --correct: #51cf66;
  --wrong: #ff6b6b;
  --text: #f8f9fa;
  --text-muted: rgba(248,249,250,0.65);
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.35);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Nunito', sans-serif;
  background: linear-gradient(135deg, var(--bg-grad-from) 0%, var(--bg-grad-to) 100%);
  background-attachment: fixed;
  color: var(--text);
  overflow-x: hidden;
}

body { min-height: 100vh; }

/* ===== SCREENS ===== */
.screen {
  display: none;
  min-height: 100vh;
  padding: 16px;
  flex-direction: column;
  animation: fadeIn 0.25s ease;
}
.screen.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== SCREEN HEADER ===== */
.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-shrink: 0;
}
.screen-header h2 {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: 800;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: clamp(0.9rem, 2.5vw, 1rem);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, background 0.15s;
  min-height: 44px;
  min-width: 44px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.95); }
.btn:hover  { transform: scale(1.03); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(102,126,234,0.45);
}
.btn-primary:hover { background: #7a8ff0; }

.btn-accent {
  background: var(--accent);
  color: #1a1a2e;
  box-shadow: 0 4px 16px rgba(247,183,49,0.45);
}
.btn-accent:hover { background: #fcc83d; }

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.15);
}
.btn-secondary:hover { background: rgba(255,255,255,0.14); }

.btn-big {
  font-size: clamp(1rem, 3vw, 1.2rem);
  padding: 16px 32px;
  border-radius: 16px;
}

.btn-back {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  min-height: 44px;
  transition: background 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.btn-back:hover { background: rgba(255,255,255,0.14); transform: scale(1.03); }
.btn-back:active { transform: scale(0.95); }


.btn-home {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.12s;
  flex-shrink: 0;
  margin-left: auto;
  -webkit-tap-highlight-color: transparent;
}
.btn-home:hover { background: rgba(255,255,255,0.18); transform: scale(1.05); }
.btn-home:active { transform: scale(0.93); }

.btn-icon {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background 0.15s;
  min-height: 44px;
  min-width: 44px;
  display: flex; align-items: center; justify-content: center;
}
.btn-icon:hover { background: rgba(255,255,255,0.1); }

.btn-choice {
  background: var(--card);
  color: var(--text);
  border: 2px solid transparent;
  font-size: 0.95rem;
}
.btn-choice.active {
  border-color: var(--accent);
  background: rgba(247,183,49,0.15);
  color: var(--accent);
}
.btn-choice:hover { background: rgba(255,255,255,0.12); }

/* ===== HOME SCREEN ===== */
#screen-home { position: relative; }

.sound-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
}

.home-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 18px;
  padding: 20px 0 40px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

.home-logo { font-size: clamp(3rem, 10vw, 5rem); }
.home-title {
  font-size: clamp(1.6rem, 6vw, 2.8rem);
  font-weight: 900;
  text-align: center;
  background: linear-gradient(90deg, #fff 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.home-greeting {
  font-size: clamp(1rem, 3.5vw, 1.3rem);
  color: var(--text-muted);
  font-weight: 600;
}

.progress-section { width: 100%; }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.progress-bar-wrap {
  width: 100%;
  height: 12px;
  background: rgba(255,255,255,0.12);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 99px;
  transition: width 0.6s cubic-bezier(.4,0,.2,1);
  width: 0%;
}

.best-scores {
  width: 100%;
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 0.85rem;
  color: var(--text-muted);
  min-height: 48px;
  border: 1px solid rgba(255,255,255,0.08);
}
.best-scores h4 { color: var(--text); margin-bottom: 8px; font-size: 0.9rem; }
.best-score-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.best-score-row:last-child { border-bottom: none; }
.best-score-val { color: var(--accent); font-weight: 700; }

.home-btns {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}
.home-btns .btn { flex: 1; min-width: 140px; max-width: 200px; }

/* ===== CATEGORY GRID ===== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  padding: 4px 0 24px;
}

.cat-tile {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
  min-height: 110px;
  position: relative;
}
.cat-tile:hover { transform: translateY(-3px) scale(1.03); background: rgba(255,255,255,0.13); box-shadow: var(--shadow); }
.cat-tile:active { transform: scale(0.97); }
.cat-tile .cat-icon { font-size: 2.2rem; }
.cat-tile .cat-name { font-size: 0.9rem; font-weight: 700; text-align: center; }
.cat-tile.completed { border-color: var(--correct); background: rgba(81,207,102,0.1); }
.cat-tile .completion-badge {
  position: absolute;
  top: 8px; right: 8px;
  font-size: 1rem;
}

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.tab-btn {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}
.tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
}
.tab-btn:hover:not(.active) { background: rgba(255,255,255,0.12); color: var(--text); }

.tab-content { flex: 1; overflow-y: auto; padding-bottom: 24px; }
.tab-content.hidden { display: none; }

/* ===== PŘEHLED TAB ===== */
.prehled-chain {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  overflow-x: auto;
}
.prehled-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
}
.prehled-unit-kod {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
}
.prehled-unit-name {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 70px;
  line-height: 1.2;
}
.prehled-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 0 4px;
  line-height: 1.3;
  white-space: nowrap;
}
.prehled-arrow .arrow-sym { font-size: 1.2rem; color: var(--primary); }

.prehled-info {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 0.88rem;
  color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 12px;
  line-height: 1.6;
}
.prehled-info strong { color: var(--text); }

.vazby-box {
  background: rgba(102,126,234,0.15);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-top: 10px;
}

/* ===== PRŮVODCE TAB ===== */
.pruvodce-section { margin-bottom: 22px; }
.pruvodce-section h3 {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--accent);
}

.decimal-shift-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.08);
  position: relative;
  overflow: hidden;
}
.decimal-example {
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.decimal-val { color: var(--accent); }
.decimal-arrow {
  color: var(--primary);
  font-size: 1.1rem;
  animation: pulseArrow 1.5s infinite;
}
@keyframes pulseArrow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.15); }
}
.decimal-result { color: var(--correct); }
.decimal-note { font-size: 0.8rem; color: var(--text-muted); margin-top: 8px; }

.slider-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.08);
}
.slider-section label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}
.slider-range {
  width: 100%;
  accent-color: var(--primary);
  height: 6px;
  cursor: pointer;
  margin-bottom: 14px;
}
.slider-values { display: flex; flex-wrap: wrap; gap: 8px; }
.slider-val-item {
  background: rgba(255,255,255,0.07);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.85rem;
}
.slider-val-item strong { color: var(--accent); margin-left: 4px; }

/* Category animations */
.anim-container {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 14px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Ruler animation */
.ruler-wrap { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.ruler-track {
  height: 24px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.ruler-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 4px;
  transition: width 0.3s;
}
.ruler-label { font-size: 0.78rem; color: var(--text-muted); text-align: right; }

/* Scale animation */
.scale-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.scale-screen {
  background: #111;
  border: 2px solid var(--accent);
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 1.3rem;
  font-weight: 800;
  color: #0f0;
  font-family: monospace;
  letter-spacing: 2px;
}
.scale-base {
  width: 80px;
  height: 14px;
  background: var(--card-solid);
  border-radius: 0 0 6px 6px;
}
.scale-platform {
  width: 120px;
  height: 8px;
  background: #555;
  border-radius: 4px;
}

/* Clock animation */
.clock-svg-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
#clock-svg { width: 100px; height: 100px; }
.clock-hand { transform-origin: 50% 50%; transition: transform 0.3s; }
.clock-labels { font-size: 0.78rem; color: var(--text-muted); text-align: center; }

/* Grid/area animation */
.area-grid-wrap { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.area-grid {
  display: grid;
  gap: 2px;
  width: fit-content;
}
.area-cell {
  width: 18px; height: 18px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 2px;
  background: rgba(255,255,255,0.04);
  transition: background 0.2s;
}
.area-cell.filled { background: var(--primary); }
.area-label { font-size: 0.78rem; color: var(--text-muted); }

/* Glass/volume animation */
.glass-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.glass {
  width: 60px; height: 100px;
  border: 3px solid rgba(255,255,255,0.4);
  border-top: none;
  border-radius: 0 0 12px 12px;
  position: relative;
  overflow: hidden;
  background: rgba(255,255,255,0.05);
}
.glass-water {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(180deg, rgba(102,176,255,0.6), rgba(50,130,255,0.9));
  transition: height 0.35s cubic-bezier(.4,0,.2,1);
  border-radius: 0 0 9px 9px;
}
.glass-label { font-size: 0.78rem; color: var(--text-muted); }

/* Speed animation */
.speed-wrap { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.speed-road {
  background: #333;
  border-radius: 8px;
  height: 48px;
  position: relative;
  overflow: hidden;
  border: 2px solid #555;
}
.speed-road::after {
  content: '';
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 3px;
  background: repeating-linear-gradient(90deg, #fff 0px, #fff 20px, transparent 20px, transparent 40px);
  transform: translateY(-50%);
  opacity: 0.3;
}
.speed-car {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.6rem;
  transition: left 0.35s cubic-bezier(.4,0,.2,1);
}
.speed-values { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.85rem; }
.speed-val-item strong { color: var(--accent); }

/* ===== MINI-KVÍZ ===== */
.minikviz-wrap { max-width: 500px; margin: 0 auto; }
.minikviz-q-num { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 10px; font-weight: 600; }
.minikviz-task {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 14px;
  border: 1px solid rgba(255,255,255,0.08);
}
.minikviz-answers { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.minikviz-answer {
  background: var(--card);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 13px 16px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}
.minikviz-answer:hover:not(:disabled) { background: rgba(255,255,255,0.12); border-color: var(--primary); }
.minikviz-answer:active:not(:disabled) { transform: scale(0.98); }
.minikviz-answer.correct { background: rgba(81,207,102,0.2); border-color: var(--correct); animation: bounce 0.4s; }
.minikviz-answer.wrong { background: rgba(255,107,107,0.2); border-color: var(--wrong); animation: shake 0.4s; }
.minikviz-answer.show-correct { background: rgba(81,207,102,0.12); border-color: var(--correct); }
.minikviz-answer:disabled { cursor: default; opacity: 0.9; }

.minikviz-explanation {
  background: rgba(102,126,234,0.15);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 10px;
}

.minikviz-result {
  text-align: center;
  padding: 24px 16px;
}
.minikviz-result .result-score {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--accent);
}
.minikviz-result .result-label { color: var(--text-muted); margin-bottom: 14px; }
.minikviz-result .record-badge {
  display: inline-block;
  background: var(--accent);
  color: #1a1a2e;
  padding: 4px 14px;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 800;
  margin-bottom: 14px;
  animation: celebPulse 0.6s ease;
}

/* ===== PRAVIDLA TAB ===== */
.pravidla-list {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid rgba(255,255,255,0.08);
}
.pravidla-list li {
  padding: 8px 0;
  padding-left: 22px;
  position: relative;
  font-size: 0.93rem;
  line-height: 1.6;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: var(--text-muted);
}
.pravidla-list li:last-child { border-bottom: none; }
.pravidla-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-size: 0.8rem;
  top: 10px;
}
.pravidla-list li strong { color: var(--text); }

/* ===== GAME SELECT ===== */
.game-select-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 540px;
  margin: 0 auto;
  width: 100%;
  padding-bottom: 24px;
}
.select-group h3 {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.select-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.select-row .btn { flex: 1; min-width: 110px; }
.select-cats .btn { min-width: 90px; flex: unset; }

/* ===== CATCHER GAME ===== */
#screen-game-catcher {
  padding: 0;
  overflow: hidden;
  position: relative;
}

.catcher-hud {
  display: flex;
  flex-direction: column;
  padding: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
  z-index: 10;
  position: relative;
}
.catcher-hud-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  width: 100%;
}
.catcher-level-bar-wrap {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.1);
}
.catcher-level-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.4s cubic-bezier(.4,0,.2,1);
  width: 0%;
}
.hud-level {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
  background: rgba(247,183,49,0.15);
  padding: 3px 8px;
  border-radius: 99px;
  border: 1px solid rgba(247,183,49,0.3);
  flex-shrink: 0;
}
.btn-hud-icon {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text);
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
  min-width: 44px; min-height: 44px;
}
.btn-hud-icon:hover { background: rgba(255,255,255,0.2); transform: scale(1.08); }
.btn-hud-icon:active { transform: scale(0.93); }
.btn-hud-exit { background: rgba(255,107,107,0.15); border-color: rgba(255,107,107,0.3); }
.btn-hud-exit:hover { background: rgba(255,107,107,0.32); }
.hud-score {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 50px;
}
.hud-score span:last-child {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
}
.hud-task {
  flex: 1;
  text-align: center;
  font-size: clamp(0.85rem, 2.5vw, 1.1rem);
  font-weight: 800;
  line-height: 1.3;
  padding: 0 8px;
}
.hud-lives {
  font-size: 1.2rem;
  min-width: 60px;
  text-align: right;
}

.catcher-area {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: transparent;
}

.falling-card {
  position: absolute;
  background: var(--card-solid);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: clamp(0.85rem, 2.5vw, 1.1rem);
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  box-shadow: var(--shadow);
  transition: transform 0.1s;
  display: flex; align-items: center; justify-content: center;
  min-width: 80px;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  will-change: transform, top;
}
.falling-card:hover { background: rgba(255,255,255,0.15); }
.falling-card.card-correct { border-color: var(--correct); animation: bounce 0.35s; }
.falling-card.card-wrong { animation: shake 0.35s; }
.falling-card.card-missed { border-color: var(--wrong); opacity: 0.5; }

/* ===== QUIZ GAME ===== */
.quiz-header {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.quiz-progress-wrap { flex: 1; min-width: 120px; display: flex; flex-direction: column; gap: 4px; }
.quiz-prog-bar { height: 8px; }
#quiz-progress-text { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.quiz-header .btn-home { margin-left: 0; }
.quiz-header .btn-hud-exit { border-radius: var(--radius-sm); width: auto; height: auto;
  padding: 8px 10px; border-radius: var(--radius-sm); }

.quiz-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  max-width: 540px;
  margin: 0 auto;
  width: 100%;
}
.quiz-task-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid rgba(255,255,255,0.08);
}
.quiz-task {
  font-size: clamp(1rem, 3vw, 1.3rem);
  font-weight: 800;
  text-align: center;
  line-height: 1.4;
}
.quiz-answers { display: flex; flex-direction: column; gap: 10px; }
.quiz-answer-btn {
  background: var(--card);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}
.quiz-answer-btn:hover:not(:disabled) { background: rgba(255,255,255,0.12); border-color: var(--primary); }
.quiz-answer-btn:active:not(:disabled) { transform: scale(0.98); }
.quiz-answer-btn.correct { background: rgba(81,207,102,0.2); border-color: var(--correct); animation: bounce 0.4s; }
.quiz-answer-btn.wrong { background: rgba(255,107,107,0.2); border-color: var(--wrong); animation: shake 0.4s; }
.quiz-answer-btn.show-correct { background: rgba(81,207,102,0.12); border-color: var(--correct); }
.quiz-answer-btn:disabled { cursor: default; opacity: 0.9; }

.quiz-explanation {
  background: rgba(102,126,234,0.15);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.88rem;
  line-height: 1.6;
}
.quiz-next {
  align-self: flex-end;
}

.quiz-end-msg {
  color: var(--text-muted);
  text-align: center;
  font-size: 0.95rem;
  margin-top: 4px;
}

/* ===== GAME OVERLAY ===== */
.game-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.25s;
}
.game-overlay.hidden { display: none; }
.overlay-box {
  background: var(--card-solid);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 340px;
  width: 90%;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.overlay-box h2 { font-size: 1.6rem; font-weight: 900; }
.overlay-box p { color: var(--text-muted); font-size: 1rem; }
.record-text { color: var(--accent); font-weight: 800; }
.overlay-box .btn { width: 100%; }

/* ===== ANIMATIONS ===== */
@keyframes bounce {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.12); }
  70%  { transform: scale(0.96); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}

@keyframes celebPulse {
  0%   { transform: scale(0.7); opacity: 0; }
  60%  { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes correctGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(81,207,102,0); }
  50%       { box-shadow: 0 0 0 8px rgba(81,207,102,0.35); }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 99px; }

/* ===== UTILITIES ===== */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-correct { color: var(--correct); }
.text-wrong { color: var(--wrong); }

/* ===== RESPONSIVE ===== */
@media (max-width: 400px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .prehled-chain { padding: 14px 10px; }
  .prehled-unit-kod { font-size: 0.95rem; }
}

@media (min-width: 768px) {
  .screen { padding: 24px; }
  .category-grid { grid-template-columns: repeat(3, 1fr); }
  .minikviz-wrap { max-width: 520px; }
}
