:root {
  --na-navy: #0c2d4a;
  --na-blue: #1565a8;
  --na-blue-light: #e8f2fa;
  --na-bg: #f4f7fb;
  --surface: #fff;
  --border: #d4e0ec;
  --ink: #1a2b3c;
  --muted: #5a7085;
  --ok: #15803d;
  --ok-bg: #ecfdf5;
  --warn: #a16207;
  --warn-bg: #fefce8;
  --miss: #b91c1c;
  --miss-bg: #fef2f2;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  font-family: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  background: var(--na-bg);
  color: var(--ink);
}

body {
  display: flex;
  flex-direction: column;
  max-width: 640px;
  margin: 0 auto;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: var(--surface);
  border-bottom: 2px solid var(--na-blue);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  min-width: 0;
}

.brand-logo { height: 38px; width: auto; max-width: 120px; object-fit: contain; flex-shrink: 0; }

.brand-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--na-navy);
  line-height: 1.2;
}

.header-progress {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--na-blue);
  white-space: nowrap;
}

.main {
  flex: 1;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.15rem;
  box-shadow: 0 2px 12px rgba(12, 45, 74, 0.06);
}

.intro h1 {
  font-size: 1.25rem;
  color: var(--na-navy);
  margin-bottom: 0.65rem;
}

.intro-hint {
  background: var(--na-blue-light);
  border: 1px solid var(--na-blue);
  border-radius: 10px;
  padding: 0.85rem 0.95rem;
  margin-bottom: 1rem;
}

.intro-hint-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--na-navy);
  margin-bottom: 0.35rem;
}

.intro-hint p {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink);
  margin-bottom: 0.45rem;
}

.intro-hint-sub {
  font-size: 0.82rem !important;
  color: var(--muted) !important;
  margin-bottom: 0 !important;
}

.intro p {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--muted);
  margin-bottom: 1rem;
}

.section-list-hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.audio-meta { margin-bottom: 0.85rem; }

.audio-counter {
  font-size: 1rem;
  font-weight: 700;
  color: var(--na-navy);
}

.audio-filename {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.2rem;
  word-break: break-all;
}

.audio-player {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.audio-player audio { width: 100%; }

.field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--na-blue);
  margin-bottom: 0.35rem;
}

#dictation-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 120px;
  background: var(--na-bg);
}

#dictation-input:focus {
  outline: 2px solid var(--na-blue);
  outline-offset: 1px;
}

.nav-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
}

.btn-primary,
.btn-secondary,
.btn-ghost {
  font-family: inherit;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  border: none;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--na-navy), var(--na-blue));
  color: #fff;
  box-shadow: 0 3px 12px rgba(12, 45, 74, 0.2);
}

.btn-primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--na-blue-light);
  color: var(--na-blue);
  border: 1px solid var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--na-blue);
  border: 1px solid var(--border);
}

.btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-restart { width: 100%; margin-top: 1rem; }

.score-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.75rem 0; }
.score-pill {
  background: var(--na-blue-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
}
.score-pill.main {
  background: var(--na-navy);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  border: none;
}

.results h2 { font-size: 1.15rem; color: var(--na-navy); }
.results h3 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--na-blue);
  margin: 1rem 0 0.4rem;
}

.fb-list { list-style: none; padding: 0; }
.fb-list li { margin-bottom: 0.35rem; font-size: 0.9rem; line-height: 1.45; }

.section-list { display: flex; flex-direction: column; gap: 0.45rem; }

.section-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
  background: var(--surface);
  overflow: hidden;
}

.section-item[open] {
  border-color: var(--na-blue);
  box-shadow: 0 2px 8px rgba(21, 101, 168, 0.08);
}

.section-item[open] .section-chevron {
  transform: rotate(90deg);
}

.section-summary {
  cursor: pointer;
  list-style: none;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 0.15rem 0.5rem;
  padding: 0.65rem 0.75rem;
  align-items: center;
}

.section-summary::-webkit-details-marker { display: none; }

.section-chevron {
  grid-row: 1 / span 2;
  color: var(--na-blue);
  font-size: 0.85rem;
  transition: transform 0.15s ease;
}

.section-summary-main {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--na-navy);
}

.section-summary-meta {
  font-size: 0.8rem;
  color: var(--muted);
  grid-column: 2;
}

.section-summary-action {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--na-blue);
  grid-column: 2;
}

.section-body {
  padding: 0 0.75rem 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--na-bg);
}

.detail-block {
  margin-top: 0.65rem;
}

.detail-block h4 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--na-blue);
  margin-bottom: 0.25rem;
}

.detail-block p,
.detail-list {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink);
}

.detail-sub {
  margin-top: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.detail-list {
  padding-left: 1.1rem;
  margin: 0;
}

.detail-list li { margin-bottom: 0.25rem; }

.closing-message {
  margin-top: 1rem;
  padding: 0.75rem;
  background: var(--ok-bg);
  border-radius: 8px;
  color: var(--ok);
  font-weight: 600;
}

.error-msg { color: var(--miss); }

.ai-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(12, 45, 74, 0.55);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.ai-overlay.is-visible {
  display: flex;
}

.ai-overlay-box {
  background: var(--surface);
  border-radius: 14px;
  padding: 1.5rem 1.25rem;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.ai-overlay-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--warn);
  margin: 0.75rem 0 0.35rem;
}

.ai-overlay-text {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

.ai-spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto;
  border: 4px solid var(--na-blue-light);
  border-top-color: var(--na-blue);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 480px) {
  .brand-title { font-size: 0.78rem; }
  .brand-logo { max-width: 90px; }
}
