/* =========================================================================
   Cybersecurity Manager Assessment — modern UI
   Vanilla CSS, no dependencies. Dark-first with automatic light support.
   ========================================================================= */

:root {
  /* Brand */
  --brand: #2dd4bf;
  --brand-2: #38bdf8;
  --brand-3: #818cf8;
  --brand-grad: linear-gradient(135deg, #2dd4bf 0%, #38bdf8 55%, #818cf8 100%);

  /* Dark theme (default) */
  --bg: #070b12;
  --bg-grid: rgba(148, 163, 184, 0.04);
  --surface: rgba(17, 25, 39, 0.72);
  --surface-2: rgba(24, 34, 51, 0.78);
  --surface-3: rgba(30, 42, 62, 0.6);
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #eaf2ff;
  --text-soft: #c4d0e2;
  --muted: #8b9bb4;
  --faint: #5f6e85;

  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.14);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.14);
  --warn: #fbbf24;

  --ring: rgba(56, 189, 248, 0.65);
  --shadow-lg: 0 30px 90px -20px rgba(0, 0, 0, 0.65);
  --shadow-md: 0 12px 40px -12px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 18px 50px -16px rgba(45, 212, 191, 0.4);

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

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f1f5fb;
    --bg-grid: rgba(15, 23, 42, 0.035);
    --surface: rgba(255, 255, 255, 0.9);
    --surface-2: rgba(255, 255, 255, 0.96);
    --surface-3: rgba(241, 245, 251, 0.9);
    --border: rgba(15, 23, 42, 0.1);
    --border-strong: rgba(15, 23, 42, 0.18);
    --text: #0f1b2d;
    --text-soft: #243349;
    --muted: #586784;
    --faint: #8493ab;
    --ok: #059669;
    --ok-soft: rgba(5, 150, 105, 0.12);
    --danger: #e11d48;
    --danger-soft: rgba(225, 29, 72, 0.1);
    --ring: rgba(56, 189, 248, 0.6);
    --shadow-lg: 0 30px 80px -28px rgba(15, 23, 42, 0.35);
    --shadow-md: 0 14px 40px -18px rgba(15, 23, 42, 0.22);
    --shadow-glow: 0 18px 50px -20px rgba(45, 212, 191, 0.45);
    color-scheme: light;
  }
}

/* ----------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }

html { min-height: 100%; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-feature-settings: "cv05", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.55;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 50% at 15% -5%, rgba(45, 212, 191, 0.18), transparent 70%),
    radial-gradient(ellipse 50% 45% at 105% 8%, rgba(129, 140, 248, 0.16), transparent 70%),
    radial-gradient(ellipse 70% 60% at 50% 120%, rgba(56, 189, 248, 0.1), transparent 70%),
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: auto, auto, auto, 56px 56px, 56px 56px;
  background-attachment: fixed;
}

button, input { font: inherit; color: inherit; }

::selection { background: rgba(56, 189, 248, 0.3); }

/* ------------------------------------------------------------- container */
.app {
  width: min(1080px, calc(100% - 36px));
  margin-inline: auto;
  padding: clamp(16px, 2.5vw, 28px) 0 48px;
}

.surface {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  padding: clamp(24px, 4vw, 48px);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}

/* subtle top highlight line on cards */
.surface::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  pointer-events: none;
}

/* screen transition */
.screen { animation: rise 420ms var(--ease) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(0.992); }
  to   { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------- typography */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand-grad);
}

h1, h2, h3, p { margin: 0; }

.hero h1 {
  max-width: 18ch;
  margin: 18px 0 16px;
  font-size: clamp(2.1rem, 5.2vw, 3.9rem);
  font-weight: 800;
  line-height: 1.03;
  letter-spacing: -0.035em;
}

.gradient-text {
  font-size: 0.72em;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  max-width: 64ch;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  line-height: 1.7;
}

/* --------------------------------------------------------------- stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 30px 0;
}

.stat {
  padding: 20px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-3);
  transition: transform 260ms var(--ease), border-color 260ms var(--ease);
}
.stat:hover { transform: translateY(-3px); border-color: var(--border-strong); }

.stat strong {
  display: block;
  font-size: clamp(1.6rem, 3.6vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

/* ---------------------------------------------------------------- panel */
.panel {
  margin-top: 26px;
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}

.panel h2 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 18px;
}

/* ------------------------------------------------------- level picker */
.level-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  border: 0;
  padding: 0;
  margin: 0 0 20px;
}
.level-picker legend { padding: 0; }   /* avoid default fieldset indent */

.level-picker label { cursor: pointer; }

.level-picker input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}

.level-opt {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 70px;
  padding: 14px 16px;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-3);
  font-weight: 700;
  transition: transform 200ms var(--ease), border-color 200ms var(--ease),
    background 200ms var(--ease), box-shadow 200ms var(--ease);
}
.level-opt small {
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--muted);
}
.level-picker label:hover .level-opt {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}
.level-picker input:checked + .level-opt {
  border-color: transparent;
  background: var(--brand-grad);
  color: #04141a;
  box-shadow: var(--shadow-glow);
}
.level-picker input:checked + .level-opt small { color: rgba(4, 20, 26, 0.7); }

/* ------------------------------------------------------------- buttons */
.actions, .nav { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 13px 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 180ms var(--ease), background 180ms var(--ease),
    border-color 180ms var(--ease), box-shadow 180ms var(--ease), opacity 180ms var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.985); }
.btn:disabled { cursor: not-allowed; opacity: 0.4; transform: none; box-shadow: none; }

.btn.primary {
  color: #04141a;
  background: var(--brand-grad);
  box-shadow: var(--shadow-glow);
}
.btn.primary:hover { box-shadow: 0 22px 60px -16px rgba(56, 189, 248, 0.55); }

.btn.ghost {
  color: var(--text);
  background: var(--surface-3);
  border-color: var(--border);
}
.btn.ghost:hover { border-color: var(--border-strong); background: var(--surface-2); }

.btn.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: transparent;
}
.btn.danger:hover { background: rgba(251, 113, 133, 0.2); }

.hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}
.hint::before { content: "💡"; filter: grayscale(0.2); flex: none; }

/* ------------------------------------------------------- test header */
.test-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}
.test-header h1 {
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.025em;
}
.test-header .meta { display: flex; align-items: center; gap: 10px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  background: var(--surface-3);
}
.chip.level { color: var(--brand); }

.timer {
  min-width: 96px;
  text-align: center;
  color: var(--text);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.timer::before { content: "⏱"; margin-right: 6px; opacity: 0.8; }

/* --------------------------------------------------------- progress */
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}
.progress {
  flex: 1;
  height: 8px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--brand-grad);
  transition: width 420ms var(--ease);
}
.progress-count {
  flex: none;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.progress-count b { color: var(--brand); }

/* --------------------------------------------------------- question */
.question-card {
  padding: clamp(22px, 3.5vw, 36px);
  margin-bottom: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}
.question-text {
  font-size: clamp(1.2rem, 2.2vw, 1.55rem);
  font-weight: 750;
  line-height: 1.4;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}

.options { display: grid; gap: 12px; }

.option {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  color: var(--text);
  background: var(--surface-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  cursor: pointer;
  transition: transform 160ms var(--ease), border-color 160ms var(--ease),
    background 160ms var(--ease);
}
.option:hover {
  transform: translateX(3px);
  border-color: rgba(56, 189, 248, 0.5);
  background: var(--surface-2);
}
.option.selected {
  border-color: var(--brand);
  background: linear-gradient(0deg, rgba(45, 212, 191, 0.12), rgba(45, 212, 191, 0.12)), var(--surface-2);
}

.badge {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  font-weight: 800;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: 160ms var(--ease);
}
.option:hover .badge { color: var(--text); border-color: var(--border-strong); }
.option.selected .badge {
  color: #04141a;
  background: var(--brand-grad);
  border-color: transparent;
}

/* check mark slot (right column) */
.option .tick {
  width: 22px; height: 22px;
  opacity: 0;
  transform: scale(0.6);
  transition: 160ms var(--ease);
  color: var(--brand);
}
.option.selected .tick { opacity: 1; transform: scale(1); }

.nav { justify-content: space-between; margin-top: 2px; }
/* Three balanced zones so the center group stays truly centered. */
.nav .nav-left, .nav .nav-right { flex: 1 1 0; display: flex; }
.nav .nav-right { justify-content: flex-end; }
.nav .nav-center { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ----------------------------------------------------------- results */
.result-summary {
  text-align: center;
  padding: clamp(28px, 5vw, 44px);
  margin-bottom: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}
.result-ring {
  --p: 0;
  width: 168px; height: 168px;
  margin: 8px auto 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(closest-side, var(--surface-2) 79%, transparent 80% 100%),
    conic-gradient(var(--ring-color, var(--brand)) calc(var(--p) * 1%), var(--surface-3) 0);
  position: relative;
}
.result-ring .pct {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.result-ring .frac { font-size: 0.9rem; color: var(--muted); font-weight: 600; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 9px 18px;
  font-weight: 700;
  margin-bottom: 14px;
}
.status.ok { color: var(--ok); background: var(--ok-soft); }
.status.fail { color: var(--danger); background: var(--danger-soft); }

.result-summary p { color: var(--muted); max-width: 56ch; margin-inline: auto; }
.result-summary .result-meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

/* review list */
.review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 14px;
}
.review-head h2 { font-size: 1.1rem; font-weight: 700; }
.review-head .legend { display: flex; gap: 14px; font-size: 0.8rem; color: var(--muted); }
.review-head .legend i { font-style: normal; display: inline-flex; align-items: center; gap: 6px; }
.review-head .legend .dot { width: 10px; height: 10px; border-radius: 3px; }

.review { display: grid; gap: 12px; }

.review-item {
  padding: 20px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--faint);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.review-item.correct { border-left-color: var(--ok); }
.review-item.wrong { border-left-color: var(--danger); }

.review-item h3 {
  display: flex;
  gap: 10px;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.45;
  margin-bottom: 12px;
}
.review-item h3 .qnum { color: var(--muted); flex: none; }

.answer-line { display: grid; gap: 8px; margin-bottom: 12px; }
.answer-line span {
  display: flex;
  gap: 8px;
  font-size: 0.92rem;
  line-height: 1.5;
}
.answer-line .label { color: var(--faint); flex: none; min-width: 132px; font-weight: 600; }
.answer-line .correct { color: var(--ok); }
.answer-line .wrong { color: var(--danger); }

.explanation {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.explanation b { color: var(--text-soft); font-weight: 700; }

/* --------------------------------------------------------- utilities */
.hidden { display: none !important; }

:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; border-radius: 6px; }
.level-picker input:focus-visible + .level-opt {
  outline: 3px solid var(--ring);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 720px) {
  .app { width: calc(100% - 24px); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  /* Tlačidlá výberu úrovne držíme v jednom riadku aj na mobile. */
  .level-picker { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .level-opt { padding: 12px 8px; min-height: 64px; text-align: center; align-items: center; }
  .level-opt small { font-size: 0.68rem; }
  .test-header { flex-direction: column; align-items: flex-start; }
  .nav { flex-direction: column; align-items: stretch; gap: 12px; }
  .nav .nav-left, .nav .nav-center, .nav .nav-right { flex-direction: column; width: 100%; }
  /* Order on mobile: Ďalej (primary) first, then evaluate group, Späť last. */
  .nav .nav-right { order: 1; }
  .nav .nav-center { order: 2; }
  .nav .nav-left { order: 3; }
  .btn { width: 100%; }
  .answer-line span { flex-direction: column; gap: 2px; }
  .answer-line .label { min-width: 0; }
}

/* ----------------------------------------------------------------- print */
@media print {
  body { background: #fff; color: #000; }
  .hero, .test, .actions, .hint, .review-head .legend { display: none !important; }
  .surface { box-shadow: none; border: 0; padding: 0; background: #fff; }
  .result-summary, .review-item {
    break-inside: avoid;
    border: 1px solid #ccc !important;
    background: #fff !important;
    color: #000;
  }
  .result-ring { background: none; }
  .explanation, .answer-line .correct, .answer-line .wrong, .muted, .lead { color: #333 !important; }
}
