/* ═══════════════════════════════════════════════════════════════════════
   ISO/IEC 42001 Exam Simulator — "Swiss Governance" Design System
   ═══════════════════════════════════════════════════════════════════════
   Aesthetic: Swiss institutional precision meets warm certification gold.
   Deep slate foundation. Frosted glass panels. Noise texture. Editorial.
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── Design Tokens ─────────────────────────────────────────────────── */

:root {
  color-scheme: light;

  /* Type */
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;

  /* Palette — Deep Slate + Certification Gold */
  --slate-950: #0c111d;
  --slate-900: #111827;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;

  --gold-500: #d97706;
  --gold-400: #f59e0b;
  --gold-300: #fbbf24;
  --gold-200: #fde68a;
  --gold-100: #fef3c7;
  --gold-50: #fffbeb;

  --emerald-600: #059669;
  --emerald-500: #10b981;
  --emerald-100: #d1fae5;
  --emerald-50: #ecfdf5;

  --red-600: #dc2626;
  --red-500: #ef4444;
  --red-100: #fee2e2;
  --red-50: #fef2f2;

  /* Semantic */
  --bg: var(--slate-100);
  --panel: rgba(255, 255, 255, 0.72);
  --panel-solid: #ffffff;
  --text: var(--slate-900);
  --text-secondary: var(--slate-600);
  --muted: var(--slate-500);
  --accent: var(--gold-500);
  --accent-hover: var(--gold-400);
  --accent-soft: var(--gold-50);
  --border: var(--slate-200);
  --border-hover: var(--slate-300);
  --good: var(--emerald-600);
  --good-bg: var(--emerald-50);
  --good-border: var(--emerald-100);
  --bad: var(--red-600);
  --bad-bg: var(--red-50);
  --bad-border: var(--red-100);

  /* Geometry */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Depth */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-gold: 0 4px 16px rgba(217, 119, 6, 0.2);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 120ms;
  --duration: 200ms;
  --duration-slow: 400ms;
}

/* ─── Reset ─────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

/* ─── Noise Grain Overlay ───────────────────────────────────────────── */

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ─── Body ──────────────────────────────────────────────────────────── */

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(217, 119, 6, 0.06), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(100, 116, 139, 0.06), transparent);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 28px 64px;
}

/* ─── Hero Header ───────────────────────────────────────────────────── */

.hero {
  margin-bottom: 36px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.hero-badge {
  display: inline-block;
  padding: 4px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-500);
  background: var(--gold-50);
  border: 1px solid var(--gold-200);
  border-radius: 100px;
  margin-bottom: 12px;
}

h1 {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
  color: var(--slate-950);
}

.hero-year {
  color: var(--gold-500);
  font-weight: 400;
}

.hero-subtitle {
  margin-top: 6px;
  font-size: 16px;
  font-weight: 500;
  color: var(--slate-500);
  letter-spacing: -0.01em;
}

.hero .small {
  margin-top: 12px;
  max-width: 640px;
}

/* ─── Layout ────────────────────────────────────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 28px;
  align-items: start;
}

/* ─── Panel — Frosted Glass ─────────────────────────────────────────── */

.panel {
  background: var(--panel);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-md);
  transition:
    box-shadow var(--duration) var(--ease-in-out),
    border-color var(--duration) var(--ease-in-out);
}

.sidebar-panel {
  position: sticky;
  top: 24px;
}

.question-panel:not([hidden]) {
  animation: cardEnter 500ms var(--ease-out) both;
}

.result-panel:not([hidden]) {
  animation: cardEnter 600ms var(--ease-out) both;
}

/* ─── Divider ───────────────────────────────────────────────────────── */

.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ─── Typography ────────────────────────────────────────────────────── */

h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 16px;
}

h3 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--slate-400);
  margin: 24px 0 10px;
}

/* ─── Topic Pills ───────────────────────────────────────────────────── */

.topic-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
}

.topic-pill {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-in-out),
    border-color var(--duration-fast) var(--ease-in-out),
    color var(--duration-fast) var(--ease-in-out),
    box-shadow var(--duration-fast) var(--ease-in-out);
}

.topic-pill:hover {
  background: var(--gold-50);
  border-color: var(--gold-200);
  color: var(--text);
}

.topic-pill:has(input:checked) {
  background: var(--gold-50);
  border-color: var(--gold-300);
  color: var(--slate-800);
  box-shadow: 0 0 0 1px var(--gold-300);
}

.topic-pill input[type='checkbox'] {
  accent-color: var(--gold-500);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* ─── Mode Labels ───────────────────────────────────────────────────── */

.inline-options,
.settings-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.mode-label {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-in-out),
    border-color var(--duration-fast) var(--ease-in-out),
    color var(--duration-fast) var(--ease-in-out);
}

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

.mode-label:has(input:checked) {
  background: var(--slate-900);
  border-color: var(--slate-900);
  color: #fff;
}

.mode-label:has(input:checked) input {
  accent-color: #fff;
}

.settings-row label,
.inline-options label:not(.mode-label) {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-in-out);
}

.settings-row label:hover,
.inline-options label:not(.mode-label):hover {
  color: var(--text);
}

input[type='radio'],
input[type='checkbox'] {
  accent-color: var(--gold-500);
  cursor: pointer;
}

input[type='number'] {
  width: 72px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  background: var(--panel-solid);
  transition:
    border-color var(--duration-fast) var(--ease-in-out),
    box-shadow var(--duration-fast) var(--ease-in-out);
}

input[type='number']:focus {
  outline: none;
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

/* ─── Buttons ───────────────────────────────────────────────────────── */

button {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 9px 20px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-in-out),
    box-shadow var(--duration) var(--ease-in-out),
    transform 80ms var(--ease-in-out);
}

button:active {
  transform: scale(0.97);
}

button.primary {
  background: var(--slate-900);
  color: #fff;
  box-shadow: var(--shadow-xs);
}

button.primary:hover {
  background: var(--slate-800);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

button.secondary {
  background: var(--slate-100);
  color: var(--slate-700);
  border: 1px solid var(--border);
}

button.secondary:hover {
  background: var(--slate-200);
  border-color: var(--border-hover);
}

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

.footer-actions {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ─── Question Meta ─────────────────────────────────────────────────── */

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate-400);
  margin-bottom: 16px;
}

/* ─── Scenario Box ──────────────────────────────────────────────────── */

.scenario {
  position: relative;
  background: var(--gold-50);
  border: 1px solid var(--gold-200);
  border-left: 3px solid var(--gold-400);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-bottom: 24px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--slate-700);
}

/* ─── Answer Options ────────────────────────────────────────────────── */

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  cursor: pointer;
  background: var(--panel-solid);
  transition:
    background var(--duration-fast) var(--ease-in-out),
    border-color var(--duration-fast) var(--ease-in-out),
    box-shadow var(--duration-fast) var(--ease-in-out),
    transform var(--duration-fast) var(--ease-in-out);
}

.option:hover {
  background: var(--gold-50);
  border-color: var(--gold-300);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
  transform: translateX(3px);
}

.option:has(input:checked) {
  background: var(--gold-50);
  border-color: var(--gold-400);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.option input[type='radio'] {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--gold-500);
}

.option span {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.option span strong {
  color: var(--text);
  font-weight: 600;
}

/* ─── Explanation ───────────────────────────────────────────────────── */

.explanation {
  margin-top: 24px;
  padding: 20px;
  background: var(--slate-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  animation: slideReveal 400ms var(--ease-out) both;
}

.explanation p {
  margin: 8px 0 0;
}

.correct {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--emerald-600);
  background: var(--emerald-50);
  border: 1px solid var(--emerald-100);
  border-radius: 100px;
  animation: badgePop 300ms var(--ease-out) both;
}

.correct::before {
  content: '\2713';
  font-size: 14px;
}

.incorrect {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--red-600);
  background: var(--red-50);
  border: 1px solid var(--red-100);
  border-radius: 100px;
  animation: badgePop 300ms var(--ease-out) both;
}

.incorrect::before {
  content: '\2717';
  font-size: 14px;
}

/* ─── EU AI Act Regulatory Context Panel ───────────────────────────── */

.eu-ai-act-panel {
  margin-top: 16px;
  padding: 16px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-left: 3px solid #6366f1;
  border-radius: var(--radius-sm);
  animation: slideReveal 400ms var(--ease-out) 100ms both;
}

.eu-panel-header {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #4338ca;
  margin-bottom: 12px;
}

.eu-ref-card {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid #e0e7ff;
  border-radius: var(--radius-xs);
  padding: 12px 14px;
  margin-bottom: 8px;
}

.eu-ref-card:last-child {
  margin-bottom: 0;
}

.eu-ref-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.eu-ref-article {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: #4338ca;
}

.eu-ref-badge {
  display: inline-block;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 100px;
}

.coverage-full {
  color: var(--emerald-600);
  background: var(--emerald-50);
  border: 1px solid var(--emerald-100);
}

.coverage-partial {
  color: var(--gold-500);
  background: var(--gold-50);
  border: 1px solid var(--gold-200);
}

.coverage-supporting-only {
  color: var(--slate-600);
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
}

.coverage-none {
  color: var(--red-600);
  background: var(--red-50);
  border: 1px solid var(--red-100);
}

.eu-ref-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.eu-ref-obligation {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.eu-ref-gap {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gold-500);
}

/* ─── Result Card ───────────────────────────────────────────────────── */

#result-card h2 {
  font-size: 24px;
  letter-spacing: -0.03em;
}

#result-card p {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 8px;
}

#result-breakdown h3 {
  font-size: 11px;
  margin-top: 20px;
}

#result-breakdown ul {
  margin-top: 6px;
}

/* ─── Lists ─────────────────────────────────────────────────────────── */

ul {
  padding-left: 18px;
  margin: 8px 0;
}

ul li {
  margin-bottom: 4px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
}

ul li strong {
  color: var(--text);
}

/* ─── Small / Muted ─────────────────────────────────────────────────── */

.small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

/* ─── Timer ─────────────────────────────────────────────────────────── */

#timer:not(:empty) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  background: var(--slate-900);
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-300);
  letter-spacing: 0.04em;
  box-shadow: var(--shadow-sm);
  animation: timerPulse 2s ease-in-out infinite;
}

/* ─── Animations ────────────────────────────────────────────────────── */

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slideReveal {
  from {
    opacity: 0;
    transform: translateY(12px);
    max-height: 0;
  }
  to {
    opacity: 1;
    transform: translateY(0);
    max-height: 600px;
  }
}

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

@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

/* Staggered option appearance */
.option:nth-child(1) { animation: optionSlide 300ms var(--ease-out) 50ms both; }
.option:nth-child(2) { animation: optionSlide 300ms var(--ease-out) 100ms both; }
.option:nth-child(3) { animation: optionSlide 300ms var(--ease-out) 150ms both; }
.option:nth-child(4) { animation: optionSlide 300ms var(--ease-out) 200ms both; }

@keyframes optionSlide {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ─── Responsive ────────────────────────────────────────────────────── */

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar-panel {
    position: static;
  }

  main {
    padding: 24px 18px 48px;
  }

  h1 {
    font-size: 28px;
  }

  .panel {
    padding: 22px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 24px;
  }

  .hero-subtitle {
    font-size: 14px;
  }

  .footer-actions,
  .actions {
    flex-direction: column;
  }

  button {
    width: 100%;
    text-align: center;
  }

  .inline-options {
    flex-direction: column;
    gap: 6px;
  }
}

/* ─── Selection ─────────────────────────────────────────────────────── */

::selection {
  background: var(--gold-200);
  color: var(--slate-900);
}

/* ─── Scrollbar ─────────────────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--slate-300);
  border-radius: 100px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--slate-400);
}
