@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&family=DM+Sans:wght@300;400;500&display=swap');

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

:root {
  --primary:        #1a1a2e;
  --primary-light:  #3d5f99;
  --accent:         #2d4a7a;
  --accent-light:   #3d5f99;
  --success:        #1e8449;
  --success-light:  #27ae60;
  --danger:         #c0392b;
  --warning:        #d35400;
  --bg:             #f7f5f0;
  --bg-white:       #ffffff;
  --text:           #1a1a2e;
  --text-muted:     #3a3a5c;
  --border:         #d8d4cc;
  --gold:           #b08c5a;
  --gold-lt:        #c9a97a;
  --shadow:         0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md:      0 4px 16px rgba(0, 0, 0, 0.12);
  --radius:         8px;
  --radius-lg:      12px;
}

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
}

main {
  flex: 1;
  padding: 48px 0;
}

a {
  color: var(--accent);
}

/* ===== LAYOUT ===== */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== HEADER ===== */

.site-header {
  background: var(--primary);
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #f7f5f0;
}

.logo-icon {
  font-size: 2rem;
  line-height: 1;
  color: var(--gold-lt);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #f7f5f0;
}

.logo-brand-co {
  color: var(--gold-lt);
}

.logo-sub {
  font-size: 0.75rem;
  color: var(--gold-lt);
  letter-spacing: 0.03em;
}

/* ===== NAVIGATION ===== */

.site-nav {
  display: flex;
  gap: 4px;
}

.nav-link {
  background: transparent;
  border: none;
  color: rgba(247, 245, 240, 0.75);
  padding: 8px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  display: inline-block;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f7f5f0;
}

.nav-link.active {
  background: rgba(176, 140, 90, 0.25);
  color: #f7f5f0;
}

/* ===== BUTTONS ===== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--primary-light);
  border-color: var(--primary-light);
  color: white;
}

.btn-secondary {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

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

.btn-large {
  padding: 14px 36px;
  font-size: 1rem;
}

.btn-full {
  width: 100%;
}

.btn-success {
  background: var(--success-light);
  color: white;
  border-color: var(--success-light);
}

.btn-success:hover {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

/* ===== PAGE HEADER ===== */

.page-header {
  margin-bottom: 36px;
  max-width: 680px;
}

.page-header h1 {
  font-size: 1.9rem;
  color: var(--primary);
  margin-bottom: 10px;
}

.page-header p {
  color: var(--text-muted);
  font-size: 1rem;
}

/* ===== HOME: HERO ===== */

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 48px;
  align-items: center;
  padding: 48px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}

.hero-tag {
  display: inline-block;
  background: rgba(176, 140, 90, 0.12);
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.hero-title {
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 32px;
  max-width: 520px;
}

.hero-actions {
  display: flex;
  gap: 12px;
}

.hero-stats {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stat-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 28px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-number {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  font-family: 'Cormorant Garamond', Georgia, serif;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== HOME: INFO CARDS ===== */

.info-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.info-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
}

.info-card h2 {
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 12px;
  font-weight: 600;
}

.info-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ===== UPDATE BANNER ===== */

.update-banner {
  background: #fdf8f2;
  border-bottom: 3px solid var(--gold);
  padding: 16px 0;
}

.update-banner-inner {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.update-banner-content {
  flex: 1;
}

.update-banner-heading {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  color: #5c3d12;
  margin-bottom: 6px;
}

.update-banner-intro {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.5;
}

.update-banner-list {
  list-style: none;
  margin-bottom: 12px;
}

.update-banner-list li {
  font-size: 0.82rem;
  color: var(--text);
  padding: 4px 0 4px 18px;
  position: relative;
  line-height: 1.5;
}

.update-banner-list li::before {
  content: '\2192';
  position: absolute;
  left: 0;
  color: var(--gold);
  font-size: 0.8rem;
}

.update-banner-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.update-banner-link:hover {
  text-decoration: underline;
}

.update-banner-close {
  background: transparent;
  border: 1px solid var(--gold);
  cursor: pointer;
  color: #5c3d12;
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: var(--radius);
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.update-banner-close:hover {
  background: var(--gold);
  color: white;
}

/* ===== LEARN: CONTROLS ===== */

.learn-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  padding: 20px 24px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.progress-tracker {
  flex: 1;
  min-width: 200px;
}

.progress-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 8px;
}

.progress-bar-container {
  background: var(--bg);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  border-radius: 20px;
  transition: width 0.4s ease;
  width: 0%;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.filter-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ===== LEARN: LEVEL TOGGLE ===== */

.level-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.level-toggle {
  display: flex;
  background: var(--bg);
  border: 2px solid var(--primary);
  border-radius: 24px;
  padding: 3px;
  gap: 2px;
}

.level-btn {
  background: transparent;
  border: none;
  color: var(--primary);
  padding: 5px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.level-btn.active {
  background: var(--primary);
  color: white;
}

.level-btn:not(.active):hover {
  background: rgba(26, 26, 46, 0.1);
}

/* ===== LEARN: PHASE CARDS ===== */

.phases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.phase-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}

.phase-card.hidden {
  display: none;
}

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

.phase-card.studied {
  border-left: 4px solid var(--gold);
}

.phase-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 20px 16px;
  cursor: pointer;
  user-select: none;
}

.phase-header:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.phase-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  line-height: 1;
}

.phase-meta {
  flex: 1;
}

.phase-clause {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  display: block;
  margin-bottom: 2px;
}

.phase-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}

.phase-summary {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.phase-classes {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.class-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.class-badge.A { background: #eaf7f0; color: #1a7a4a; }
.class-badge.B { background: #eaeeF5; color: var(--accent); }
.class-badge.C { background: #fdf0ee; color: #a93226; }

.phase-chevron {
  flex-shrink: 0;
  font-size: 0.65rem;
  color: var(--text-muted);
  transition: transform 0.2s;
  padding-top: 6px;
}

.phase-card.expanded .phase-chevron {
  transform: rotate(180deg);
}

.phase-details {
  display: none;
  padding: 4px 20px 8px;
}

.phase-card.expanded .phase-details {
  display: block;
}

.phase-details ul {
  list-style: none;
  margin-bottom: 16px;
  border-top: 1px solid var(--bg);
  padding-top: 8px;
}

.phase-details ul li {
  font-size: 0.85rem;
  color: var(--text);
  padding: 7px 0 7px 22px;
  border-bottom: 1px solid var(--bg);
  position: relative;
}

.phase-details ul li::before {
  content: '\2192';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 0.8rem;
}

.phase-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid var(--bg);
  gap: 12px;
}

.studied-badge {
  font-size: 0.78rem;
  color: var(--gold);
  font-weight: 600;
  display: none;
}

.phase-card.studied .studied-badge {
  display: inline;
}

.mark-studied-btn {
  font-size: 0.78rem;
  padding: 6px 14px;
}

.phase-card.studied .mark-studied-btn {
  background: rgba(176, 140, 90, 0.1);
  color: var(--gold);
  border-color: var(--gold-lt);
  cursor: default;
}

/* ===== LEARN: COMPLETION BANNER ===== */

.completion-banner {
  display: flex;
  align-items: center;
  gap: 32px;
  background: var(--primary);
  border: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: 32px 40px;
  margin-top: 40px;
  box-shadow: var(--shadow-md);
  animation: fadeSlideIn 0.4s ease;
}

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

.completion-icon {
  font-size: 3rem;
  flex-shrink: 0;
  line-height: 1;
}

.completion-text h2 {
  font-size: 1.5rem;
  color: #f7f5f0;
  margin-bottom: 6px;
}

.completion-text p {
  font-size: 0.95rem;
  color: var(--gold-lt);
}

.completion-banner .btn-primary {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.completion-banner .btn-primary:hover {
  background: var(--gold-lt);
  border-color: var(--gold-lt);
  color: var(--primary);
}

@media (max-width: 768px) {
  .completion-banner {
    flex-direction: column;
    text-align: center;
    padding: 28px 24px;
    gap: 20px;
  }
}

/* ===== QUIZ: LEVEL NOTICE ===== */

.quiz-level-notice {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 auto 24px;
  max-width: 360px;
  text-align: left;
  line-height: 1.5;
}

.level-notice-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 12px;
  margin-right: 6px;
  vertical-align: middle;
}

.level-notice-intro {
  background: #eaeeF5;
  color: var(--accent);
}

.level-notice-advanced {
  background: #eaf7f0;
  color: var(--success);
}

/* ===== QUIZ: NAME FIELD ===== */

.quiz-name-group {
  max-width: 360px;
  margin: 0 auto 24px;
  text-align: left;
}

/* ===== QUIZ: LAYOUT ===== */

.quiz-screen {
  display: none;
  max-width: 740px;
  margin: 0 auto;
}

.quiz-screen.active {
  display: block;
}

/* ===== QUIZ: START SCREEN ===== */

.quiz-intro {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 56px 48px;
  text-align: center;
  box-shadow: var(--shadow);
}

.quiz-intro h1 {
  font-size: 1.8rem;
  color: var(--primary);
  margin-bottom: 16px;
}

.quiz-intro > p {
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 1rem;
}

.quiz-rules {
  list-style: none;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 20px 28px;
  margin: 0 auto 32px;
  max-width: 360px;
  text-align: left;
}

.quiz-rules li {
  font-size: 0.9rem;
  color: var(--text);
  padding: 6px 0 6px 24px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.quiz-rules li:last-child {
  border-bottom: none;
}

.quiz-rules li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: var(--success-light);
  font-weight: 700;
}

/* ===== QUIZ: ACTIVE SCREEN ===== */

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}

.quiz-progress-info {
  flex: 1;
}

#question-counter {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.quiz-progress-bar-container {
  background: var(--bg);
  border-radius: 20px;
  height: 6px;
  overflow: hidden;
}

.quiz-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 20px;
  transition: width 0.3s ease;
  width: 0%;
}

.quiz-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--bg);
  padding: 8px 16px;
  border-radius: var(--radius);
  min-width: 76px;
  justify-content: center;
  transition: background 0.3s, color 0.3s;
}

.quiz-timer.warning {
  color: var(--warning);
  background: #fdf3e8;
}

.quiz-timer.danger {
  color: var(--danger);
  background: #fdecea;
}

.question-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.question-text {
  font-size: 1.05rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 28px;
  line-height: 1.5;
}

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

.option-btn {
  text-align: left;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
  line-height: 1.4;
  width: 100%;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(45, 74, 122, 0.06);
}

.option-btn.correct {
  background: #eaf7f0;
  border-color: var(--success-light);
  color: var(--success);
  font-weight: 600;
}

.option-btn.incorrect {
  background: #fdecea;
  border-color: var(--danger);
  color: var(--danger);
  font-weight: 600;
}

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

.question-feedback {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  display: none;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.question-feedback.visible {
  display: flex;
}

.feedback-text {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
  flex: 1;
}

/* ===== QUIZ: RESULTS SCREEN ===== */

.results-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 56px 48px;
  text-align: center;
  box-shadow: var(--shadow);
}

.results-icon {
  font-size: 4rem;
  margin-bottom: 20px;
}

.results-card h2 {
  font-size: 1.8rem;
  color: var(--primary);
  margin-bottom: 24px;
}

.results-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.score-number {
  font-size: 4rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  font-family: 'Cormorant Garamond', Georgia, serif;
}

.score-label {
  font-size: 1rem;
  color: var(--text-muted);
}

#results-message {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 32px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.results-breakdown {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 32px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.breakdown-item {
  text-align: center;
}

.breakdown-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
  font-family: 'Cormorant Garamond', Georgia, serif;
}

.breakdown-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.results-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ===== CONTACT ===== */

.contact-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 40px;
  align-items: start;
}

.contact-info h2 {
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 16px;
}

.contact-reasons {
  list-style: none;
  margin-bottom: 24px;
}

.contact-reasons li {
  font-size: 0.87rem;
  color: var(--text-muted);
  padding: 8px 0 8px 20px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.contact-reasons li::before {
  content: '\2022';
  position: absolute;
  left: 0;
  color: var(--gold);
}

.contact-detail {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* ===== CONTACT FORM ===== */

.contact-form {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.required {
  color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.2s, background 0.2s;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: 3px solid var(--accent-light);
  outline-offset: 1px;
  border-color: var(--accent);
  background: var(--bg-white);
}

.form-group input.error,
.form-group textarea.error {
  border-color: var(--danger);
}

.field-error {
  display: block;
  font-size: 0.78rem;
  color: var(--danger);
  margin-top: 4px;
  min-height: 1em;
}

.form-success {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 56px 36px;
  text-align: center;
  box-shadow: var(--shadow);
}

.success-icon {
  font-size: 2rem;
  color: var(--gold);
  background: rgba(176, 140, 90, 0.1);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-weight: 700;
}

.form-success h2 {
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: 12px;
}

.form-success p {
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* ===== FOOTER ===== */

/* IEC 62304 IN CONTEXT SECTION */
.context-section {
  background: var(--primary);
  padding: 60px 0 48px;
  margin-top: 48px;
}

.context-section-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.5rem;
}

.context-section-title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 500;
  color: #f7f5f0;
  margin: 0 0 0.75rem;
}

.context-section-lead {
  font-size: 1rem;
  color: rgba(247, 245, 240, 0.75);
  max-width: 740px;
  line-height: 1.7;
  margin: 0 0 1.5rem;
}

.context-progress-tracker {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.context-progress-tracker .progress-label {
  color: rgba(247, 245, 240, 0.7);
  font-size: 0.875rem;
  white-space: nowrap;
}

.context-progress-tracker .progress-bar-container {
  flex: 1;
  min-width: 120px;
  max-width: 260px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  height: 6px;
}

.context-progress-tracker .progress-bar {
  background: linear-gradient(90deg, var(--accent), var(--gold));
  height: 6px;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.context-quiz-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: 3rem;
  padding: 2rem 2.5rem;
  background: rgba(176, 140, 90, 0.12);
  border: 1px solid rgba(176, 140, 90, 0.35);
  border-radius: var(--radius-lg);
}

.context-quiz-cta-text h3 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: #f7f5f0;
  margin: 0 0 0.4rem;
}

.context-quiz-cta-text p {
  font-size: 0.9rem;
  color: rgba(247, 245, 240, 0.7);
  margin: 0;
  line-height: 1.6;
  max-width: 520px;
}

.context-card {
  background: var(--bg-white) !important;
  border: 1px solid var(--border) !important;
}

.context-card:hover {
  border-color: var(--gold) !important;
  transform: translateY(-2px);
}

.context-card .phase-clause {
  color: var(--accent) !important;
}

.context-card .phase-title {
  color: var(--text) !important;
}

.context-card .phase-summary {
  color: var(--text-muted) !important;
}

.context-card .phase-chevron {
  color: var(--text-muted) !important;
}

.context-card .phase-details {
  border-top-color: var(--border) !important;
  background: var(--bg) !important;
}

.context-card .phase-details li {
  color: var(--text) !important;
  border-bottom-color: var(--border) !important;
}

.context-card .phase-footer {
  border-top-color: var(--border) !important;
  background: var(--bg) !important;
}

.context-card.studied {
  border-left: 3px solid var(--accent) !important;
}

.context-card.studied .studied-badge {
  color: var(--gold) !important;
}

.context-card .btn-secondary {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}

.context-card .btn-secondary:hover:not(:disabled) {
  background: var(--bg-white);
  border-color: var(--accent);
  color: var(--accent);
}

/* PRIVACY NOTICE PAGE */
.privacy-content {
  max-width: 720px;
  margin: 0 auto 4rem;
}

.privacy-section {
  margin-bottom: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.privacy-section:last-child {
  border-bottom: none;
}

.privacy-section h2 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--text);
  margin: 0 0 0.75rem;
}

.privacy-section p,
.privacy-section li {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.privacy-section ul {
  margin: 0.5rem 0 0.75rem 1.25rem;
}

.privacy-section li {
  margin-bottom: 0.35rem;
}

/* QUIZ DATA NOTICE */
.quiz-data-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(176, 140, 90, 0.08);
  border: 1px solid rgba(176, 140, 90, 0.25);
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.quiz-data-notice-icon {
  font-style: normal;
  flex-shrink: 0;
  margin-top: 1px;
}

.site-footer {
  background: var(--primary);
  color: rgba(247, 245, 240, 0.75);
  padding: 20px 0;
  font-size: 0.82rem;
  text-align: center;
  border-top: 1px solid var(--gold);
}

.site-footer a {
  color: var(--gold-lt);
}

.site-footer a:hover {
  color: #f7f5f0;
}

/* ===== UTILITIES ===== */

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  padding: 10px 20px;
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 200;
  text-decoration: none;
  border-bottom-right-radius: var(--radius);
  transition: top 0.1s;
}

.skip-link:focus {
  top: 0;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    gap: 16px;
    padding: 16px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 32px 0;
  }

  .hero-stats {
    flex-direction: row;
  }

  .stat-card {
    flex: 1;
    padding: 16px;
  }

  .hero-title {
    font-size: 2rem;
  }

  .info-cards {
    grid-template-columns: 1fr;
  }

  .learn-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .phases-grid {
    grid-template-columns: 1fr;
  }

  .contact-layout {
    grid-template-columns: 1fr;
  }

  .quiz-intro {
    padding: 36px 24px;
  }

  .results-card {
    padding: 40px 24px;
  }

  .results-actions {
    flex-direction: column;
  }

  .question-feedback {
    flex-direction: column;
  }
}

/* ===== CERTIFICATE ===== */

#certificate {
  display: none;
}

.cert-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: white;
}

.cert-inner {
  border: 4px solid var(--primary);
  padding: 56px 72px;
  text-align: center;
  max-width: 700px;
  width: 100%;
  position: relative;
  background: white;
}

.cert-inner::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid var(--gold);
  pointer-events: none;
}

.cert-logo-icon {
  display: block;
  font-size: 2.5rem;
  margin-bottom: 4px;
  color: var(--gold);
}

.cert-site-name {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.cert-heading {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.cert-presented {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.cert-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--primary);
  font-style: italic;
  margin-bottom: 16px;
  line-height: 1.2;
}

.cert-completed {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.cert-course-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 8px;
}

.cert-standard {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 28px;
}

.cert-meta {
  display: flex;
  justify-content: center;
  gap: 48px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-bottom: 20px;
}

.cert-meta-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.cert-meta-value {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
}

.cert-disclaimer {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ===== PRINT ===== */

@media print {
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .site-header,
  main,
  .site-footer,
  .skip-link {
    display: none !important;
  }

  #certificate {
    display: block !important;
  }
}

@media (max-width: 480px) {
  .hero-stats {
    flex-direction: column;
  }

  .hero-actions {
    flex-direction: column;
  }

  .site-nav {
    gap: 2px;
  }

  .nav-link {
    padding: 7px 12px;
    font-size: 0.82rem;
  }

  main {
    padding: 32px 0;
  }

  .results-breakdown {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}
