/* ============================================
   Kinderanästhesie Quiz – iOS-Style CSS
   ============================================ */

:root {
  /* Primary – Elegant Purple */
  --primary: #7C3AED;
  --primary-dark: #6D28D9;
  --primary-light: #EDE9FE;
  --primary-subtle: #F5F3FF;
  --primary-gradient: linear-gradient(135deg, #6D28D9 0%, #8B5CF6 50%, #A78BFA 100%);

  /* Semantic */
  --success: #34C759;
  --success-bg: #F0FFF4;
  --error: #FF3B30;
  --error-bg: #FFF5F5;
  --warning: #FF9500;

  /* Neutrals (iOS) */
  --bg: #F2F2F7;
  --card: #FFFFFF;
  --text-primary: #1C1C1E;
  --text-secondary: #8E8E93;
  --text-tertiary: #AEAEB2;
  --separator: rgba(60, 60, 67, 0.1);
  --overlay: rgba(0, 0, 0, 0.4);

  /* Spacing */
  --container-max: 680px;
  --container-padding: 20px;
  --card-radius: 16px;
  --btn-radius: 14px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.05);

  /* Transitions */
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================
   Reset & Base
   ============================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',
               'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  margin: 0;
  width: 100%;
  max-width: 100%;
}

/* ============================================
   Layout
   ============================================ */

#app {
  position: relative;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.container {
  max-width: var(--container-max);
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--container-padding);
  box-sizing: border-box;
}

.screen {
  display: none;
  opacity: 0;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.screen.active {
  display: block;
  animation: screenIn 0.5s var(--ease) forwards;
}

.screen.leaving {
  animation: screenOut 0.3s var(--ease) forwards;
}

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

@keyframes screenOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-12px); }
}

/* ============================================
   Buttons
   ============================================ */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 32px;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: var(--btn-radius);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  box-shadow: var(--shadow-md);
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
  filter: brightness(1.05);
}

.btn-primary:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
}

.hidden {
  display: none !important;
}

/* ============================================
   START SCREEN
   ============================================ */

/* Hero */
.hero {
  background: var(--primary-gradient);
  padding: 60px var(--container-padding) 48px;
  text-align: center;
  color: white;
  position: relative;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.hero::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -10%;
  width: 60%;
  height: 60%;
  max-width: 500px;
  max-height: 500px;
  background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 50%;
  height: 50%;
  max-width: 400px;
  max-height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-badge {
  display: inline-block;
  padding: 6px 16px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
}

.hero-subtitle {
  font-size: 1.25rem;
  font-weight: 500;
  opacity: 0.85;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.hero-description {
  font-size: 0.9375rem;
  opacity: 0.75;
  max-width: 420px;
  margin: 0 auto;
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

/* Info Bar */
.info-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: var(--card);
  border-radius: var(--card-radius);
  padding: 20px;
  margin: -24px var(--container-padding) 32px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 2;
}

.info-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.info-number {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.info-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.info-divider {
  width: 1px;
  height: 40px;
  background: var(--separator);
}

/* Section Title */
.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* Category Grid */
.category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 32px;
}

.category-card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s var(--ease);
  min-width: 0;
  overflow: hidden;
}

.category-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.category-card-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.category-card-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 4px;
  overflow-wrap: break-word;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.category-card-count {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

#start-screen .btn-primary {
  max-width: var(--container-max);
  margin: 0 auto 48px;
  display: flex;
}

#start-screen .container .btn-primary {
  margin: 0 0 48px;
}

/* ============================================
   CATEGORY INTRO SCREEN
   ============================================ */

.category-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
  padding-top: 0;
  padding-bottom: 40px;
}

.category-intro-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  animation: bounceIn 0.6s var(--ease-spring);
}

@keyframes bounceIn {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 1; transform: scale(1); }
}

.category-intro-label {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  margin-bottom: 8px;
}

.category-intro-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.category-intro-count {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 40px;
}

#category-screen .btn-primary {
  max-width: 320px;
}

/* ============================================
   QUIZ SCREEN
   ============================================ */

/* Progress */
.progress-wrapper {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(242, 242, 247, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 16px var(--container-padding) 12px;
  border-bottom: 1px solid var(--separator);
}

.progress-header {
  max-width: var(--container-max);
  margin: 0 auto 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.progress-category {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
}

.progress-text {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-tertiary);
}

.progress-bar {
  max-width: var(--container-max);
  margin: 0 auto;
  height: 6px;
  background: rgba(124, 58, 237, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: 3px;
  width: 0%;
  transition: width 0.5s var(--ease);
}

/* Question Card */
.question-card {
  background: var(--card);
  border-radius: var(--card-radius);
  padding: 28px 24px;
  margin-top: 24px;
  margin-bottom: 40px;
  box-shadow: var(--shadow-md);
  animation: cardIn 0.4s var(--ease);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

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

.type-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.type-badge.single {
  background: #EFF6FF;
  color: #2563EB;
}

.type-badge.truefalse {
  background: #FFF7ED;
  color: #C2410C;
}

.type-badge.multiple {
  background: var(--primary-subtle);
  color: var(--primary-dark);
}

.question-number {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-tertiary);
}

.question-text {
  font-size: 1.1875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.45;
  margin-bottom: 24px;
  color: var(--text-primary);
}

/* Options */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  padding: 16px;
  background: var(--bg);
  border: 2px solid transparent;
  border-radius: 14px;
  text-align: left;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}

.option-btn:hover:not(.disabled) {
  background: var(--primary-subtle);
  border-color: rgba(124, 58, 237, 0.2);
  transform: translateY(-1px);
}

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

.option-indicator {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-tertiary);
  transition: all 0.2s var(--ease);
  margin-top: 1px;
}

.option-indicator.checkbox {
  border-radius: 8px;
}

.option-btn:hover:not(.disabled) .option-indicator {
  border-color: var(--primary);
  color: var(--primary);
}

/* Selected (Mehrfachauswahl) */
.option-btn.selected {
  background: var(--bg);
  border-color: var(--primary);
}

.option-btn.selected .option-indicator {
  border-color: var(--primary);
  color: var(--primary);
  background: transparent;
}

/* Correct */
.option-btn.correct {
  background: var(--success-bg);
  border-color: var(--success);
}

.option-btn.correct .option-indicator {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

/* Wrong */
.option-btn.wrong {
  background: var(--error-bg);
  border-color: var(--error);
}

.option-btn.wrong .option-indicator {
  background: var(--error);
  border-color: var(--error);
  color: white;
}

.option-btn.disabled {
  cursor: default;
  opacity: 0.7;
}

.option-btn.correct.disabled,
.option-btn.wrong.disabled {
  opacity: 1;
}

/* Multiple choice confirm button */
.confirm-btn-wrapper {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.confirm-btn-wrapper {
  justify-content: center;
}

.btn-confirm {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  font-family: inherit;
}

.btn-confirm:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-confirm:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

/* Explanation */
.explanation-box {
  margin-top: 20px;
  padding: 20px;
  border-radius: 14px;
  animation: fadeUp 0.35s var(--ease);
}

.explanation-box.correct {
  background: var(--success-bg);
  border: 1px solid rgba(52, 199, 89, 0.2);
}

.explanation-box.wrong {
  background: var(--error-bg);
  border: 1px solid rgba(255, 59, 48, 0.2);
}

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

.explanation-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.explanation-icon {
  font-size: 1.25rem;
}

.explanation-title {
  font-size: 0.9375rem;
  font-weight: 700;
}

.explanation-box.correct .explanation-title {
  color: #15803D;
}

.explanation-box.wrong .explanation-title {
  color: #DC2626;
}

.explanation-text {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-primary);
}

/* Next Button */
#quiz-screen .btn-primary {
  margin-top: 24px;
}

/* ============================================
   RESULTS SCREEN
   ============================================ */

.results-container {
  padding-top: 48px;
  padding-bottom: 48px;
  text-align: center;
}

.results-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 32px;
}

/* Score Ring */
.score-ring-wrapper {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 24px;
}

.score-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-ring-bg {
  fill: none;
  stroke: rgba(124, 58, 237, 0.1);
  stroke-width: 12;
}

.score-ring-fill {
  fill: none;
  stroke: url(#scoreGradient);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 534.07;
  stroke-dashoffset: 534.07;
  transition: stroke-dashoffset 1.5s var(--ease);
}

.score-ring-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.score-percent {
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--primary);
}

.score-percent-sign {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary);
  opacity: 0.7;
}

.score-summary {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  margin-bottom: 40px;
  line-height: 1.5;
}

/* Category Breakdown */
.breakdown-title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
  text-align: left;
}

.category-breakdown {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 32px;
  text-align: left;
}

.breakdown-item {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
}

.breakdown-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.breakdown-info {
  flex: 1;
  min-width: 0;
}

.breakdown-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.breakdown-bar-track {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}

.breakdown-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s var(--ease);
  width: 0;
}

.breakdown-bar-fill.excellent { background: var(--success); }
.breakdown-bar-fill.good { background: var(--primary); }
.breakdown-bar-fill.fair { background: var(--warning); }
.breakdown-bar-fill.poor { background: var(--error); }

.breakdown-score {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  min-width: 50px;
  text-align: right;
}

#results-screen .btn-primary {
  max-width: 360px;
  margin: 0 auto;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 480px) {
  .hero h1 {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1.125rem;
  }

  .category-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .category-card {
    padding: 14px;
  }

  .category-card-icon {
    font-size: 1.25rem;
  }

  .question-card {
    padding: 22px 18px;
  }

  .question-text {
    font-size: 1.0625rem;
  }

  .option-btn {
    padding: 14px;
    font-size: 0.875rem;
  }

  .info-number {
    font-size: 1.5rem;
  }

  .score-ring-wrapper {
    width: 170px;
    height: 170px;
  }

  .score-percent {
    font-size: 3rem;
  }
}

@media (min-width: 768px) {
  .hero {
    padding: 80px var(--container-padding) 64px;
  }

  .hero h1 {
    font-size: 3rem;
  }

  .info-bar {
    margin: -28px auto 40px;
    max-width: var(--container-max);
    padding: 24px 32px;
  }

  .category-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ============================================
   SVG Gradient (inline fallback)
   ============================================ */

/* Applied via JS — see quiz.js addSVGDefs() */

/* ============================================
   Disclaimer & Footer
   ============================================ */

.disclaimer-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #F5F3FF;
  border: 1px solid rgba(124, 58, 237, 0.15);
  border-radius: 14px;
  padding: 16px;
  margin-top: 20px;
  margin-bottom: 12px;
}

.disclaimer-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.disclaimer-box p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}

.disclaimer-box p strong {
  color: var(--primary);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 0 40px;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.site-footer a:hover {
  color: var(--primary);
}

/* ============================================
   Rechtliche Seiten (Impressum / Datenschutz)
   ============================================ */

.legal-page {
  min-height: 100vh;
  background: var(--bg);
}

.legal-header {
  background: var(--primary-gradient);
  padding: 40px var(--container-padding) 36px;
  color: white;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  margin-bottom: 20px;
  transition: color 0.2s;
}

.back-link:hover {
  color: white;
}

.legal-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.legal-subtitle {
  font-size: 0.9375rem;
  opacity: 0.75;
}

.legal-card {
  background: var(--card);
  border-radius: var(--card-radius);
  padding: 28px 24px;
  margin-top: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}

.legal-section {
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--separator);
}

.legal-section:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}

.legal-section h2 {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.legal-section h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 14px;
  margin-bottom: 6px;
}

.legal-section p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 10px;
}

.legal-section p:last-child {
  margin-bottom: 0;
}

.legal-section ul {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.65;
  padding-left: 20px;
  margin-top: 8px;
  margin-bottom: 10px;
}

.legal-section ul li {
  margin-bottom: 4px;
}

.legal-section a {
  color: var(--primary);
  text-decoration: none;
}

.legal-section a:hover {
  text-decoration: underline;
}

.legal-placeholder {
  color: var(--error);
  font-weight: 600;
  background: var(--error-bg);
  padding: 2px 8px;
  border-radius: 6px;
}

.legal-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 0 40px;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.legal-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.legal-footer a:hover {
  color: var(--primary);
}
