/* ============================================================
   ELEKTRIKÁŘ - SILNOPROUD | MODERN CLEAN MINIMALIST THEME
   Focused on typography, breathing space, no bulky nested boxes
   ============================================================ */

:root {
  --bg: #090d16;
  --surface: #0f1523;
  --surface-hover: #161e31;
  --surface-active: #1d2740;
  
  --border: #1a2337;
  --border-subtle: #131b2c;
  --border-focus: #3b82f6;

  --text: #f1f5f9;
  --text-muted: #8896ab;
  --text-dim: #55657e;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #38bdf8;
  --primary-soft: rgba(56, 189, 248, 0.1);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --success-border: #059669;

  --danger: #f43f5e;
  --danger-bg: rgba(244, 63, 94, 0.12);
  --danger-border: #e11d48;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", Helvetica, Arial, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding-bottom: max(30px, env(safe-area-inset-bottom));
}

/* --- HEADER --- */
.site-header {
  background: rgba(9, 13, 22, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top);
}

.header-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--primary-light);
  background: rgba(56, 189, 248, 0.1);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(56, 189, 248, 0.25);
  flex-shrink: 0;
}

.brand-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- REŽIMY TESTU --- */
.mode-switch {
  display: flex;
  background: #0d121f;
  padding: 2px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}

.mode-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.mode-btn:hover {
  color: var(--text);
}

.mode-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 6px rgba(37, 99, 235, 0.4);
}

/* --- WRAPPER --- */
.app-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 14px 16px 0;
}

/* --- STATUS ROW & PROGRESS --- */
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.82rem;
}

.status-counter {
  font-weight: 700;
  color: var(--text);
}

.status-counter strong {
  color: var(--primary-light);
}

.status-counter .dim {
  color: var(--text-dim);
  font-weight: 500;
}

.status-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.progress-track {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-fill {
  height: 100%;
  background: var(--primary-light);
  border-radius: 99px;
  transition: width 0.25s ease;
}

/* --- PROCVIČOVÁNÍ: DROPDOWN TÉMAT --- */
.topic-select-wrap {
  position: relative;
  display: inline-block;
  max-width: 220px;
}

.topic-select {
  appearance: none;
  -webkit-appearance: none;
  background: #0d121f;
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 24px 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  outline: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  width: 100%;
  display: block;
}

.topic-select-wrap::after {
  content: "▾";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: var(--primary-light);
  pointer-events: none;
}

.correction-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.25);
  border-radius: var(--radius);
  padding: 6px 12px;
  margin-bottom: 10px;
  font-size: 0.8rem;
  color: #fda4af;
  font-weight: 600;
}

/* --- KARTA OTÁZKY (CLEAN MINIMAL CARD) --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  margin-bottom: 16px;
  animation: fadeIn 0.2s ease-out;
}

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

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.meta-topic {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary-light);
}

.meta-points {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
}

.card-title {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 16px;
}

/* --- SCHÉMATA A DIAGRAMY --- */
.schema-box {
  background: transparent;
  border: none;
  padding: 4px 0 12px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

.motor-terminal-svg {
  display: block;
  width: 140px;
  height: 110px;
  margin: 2px 0;
  max-width: 100%;
}

.schema-symbol-svg {
  display: block;
  width: 48px;
  height: 48px;
  margin: 0 auto;
}

/* --- MATEMATICKÉ ZLOMKY A VZORCE --- */
.math-frac {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  text-align: center;
  padding: 0 4px;
  font-style: normal;
}

.math-frac .num {
  border-bottom: 1.5px solid var(--text);
  padding-bottom: 1px;
  font-size: 0.9em;
}

.math-frac .den {
  padding-top: 1px;
  font-size: 0.9em;
}

.math-over {
  text-decoration: overline;
}

/* --- MOŽNOSTI ODPOVĚDÍ --- */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opt-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: #0d121f;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  text-align: left;
  width: 100%;
  color: var(--text);
  font-family: inherit;
  transition: all 0.12s ease;
  touch-action: manipulation;
  min-height: 48px;
}

.opt-btn:active:not(:disabled) {
  transform: scale(0.99);
  background: var(--surface-hover);
}

.opt-btn:hover:not(:disabled) {
  border-color: rgba(56, 189, 248, 0.4);
  background: var(--surface-hover);
}

.opt-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-muted);
  flex-shrink: 0;
}

.opt-content {
  flex: 1;
  font-size: 0.94rem;
  line-height: 1.38;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Stavy voleb */
.opt-btn.is-selected {
  background: rgba(37, 99, 235, 0.14);
  border-color: var(--primary-light);
}

.opt-btn.is-selected .opt-letter {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary-light);
}

.opt-btn.is-correct {
  background: var(--success-bg) !important;
  border-color: var(--success) !important;
}

.opt-btn.is-correct .opt-letter {
  background: var(--success);
  color: #ffffff;
  border-color: var(--success);
}

.opt-btn.is-wrong {
  background: var(--danger-bg) !important;
  border-color: var(--danger) !important;
}

.opt-btn.is-wrong .opt-letter {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

/* --- VYSVĚTLENÍ (FEEDBACK) --- */
.explain-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #070a12;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary-light);
  animation: fadeIn 0.2s ease-out;
}

.explain-header {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.explain-body {
  font-size: 0.88rem;
  color: #cbd5e1;
  line-height: 1.45;
}

/* --- FOOTER & NAVIGACE --- */
.nav-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
  touch-action: manipulation;
  min-height: 42px;
}

.btn:active:not(:disabled) {
  transform: scale(0.985);
}

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

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #0d121f;
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-focus);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  background: #0d121f;
}

.btn-finish-subtle {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 8px;
}

.btn-finish-subtle:hover {
  color: var(--text-muted);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.78rem;
  min-height: 32px;
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* --- VÝSLEDKY TESTU --- */
.results-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  margin-bottom: 18px;
}

.results-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.score-num {
  font-size: 2.8rem;
  font-weight: 900;
  color: var(--primary-light);
  line-height: 1;
}

.score-denom {
  font-size: 1.1rem;
  color: var(--text-dim);
  font-weight: 700;
}

.grade-badge {
  padding: 6px 14px;
  border-radius: var(--radius);
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.grade-1 { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid #059669; }
.grade-2 { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid #0284c7; }
.grade-3 { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid #d97706; }
.grade-4 { background: rgba(249, 115, 22, 0.15); color: #fb923c; border: 1px solid #ea580c; }
.grade-5 { background: rgba(244, 63, 94, 0.15); color: #f43f5e; border: 1px solid #e11d48; }

.topics-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px;
  margin: 12px 0 16px 0;
}

.topic-item {
  background: #0d121f;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.filter-bar {
  display: flex;
  gap: 4px;
  background: #0d121f;
  padding: 3px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

.filter-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 4px;
  border-radius: var(--radius-full);
  cursor: pointer;
  text-align: center;
}

.filter-btn.active {
  background: var(--primary);
  color: #ffffff;
}

.review-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px;
  margin-bottom: 10px;
}

.review-item.is-correct-left {
  border-left: 3px solid var(--success);
}

.review-item.is-wrong-left {
  border-left: 3px solid var(--danger);
}

/* ============================================================
   RESPONZIVITA PRO MOBILY (< 600px)
   ============================================================ */
@media (max-width: 600px) {
  html {
    font-size: 14.5px;
  }

  .header-inner {
    padding: 8px 12px;
  }

  .brand-name {
    font-size: 0.86rem;
  }

  .app-wrap {
    padding: 10px 12px 0;
  }

  .card {
    padding: 16px 14px;
  }

  .card-title {
    font-size: 1.02rem;
    margin-bottom: 14px;
  }

  .opt-btn {
    padding: 10px 12px;
    gap: 10px;
  }

  .opt-letter {
    width: 26px;
    height: 26px;
    font-size: 0.8rem;
  }

  .opt-content {
    font-size: 0.9rem;
  }

  .nav-footer {
    flex-wrap: wrap;
  }

  .nav-footer .btn {
    flex: 1;
    min-height: 44px;
  }

  .topics-list {
    grid-template-columns: 1fr;
  }
}
