:root {
  --color-navy: #0a3250;
  --color-orange: #ea7726;
  --color-green: #059669;
  --color-bg: #f4f6f9;
  --color-surface: #ffffff;
  --color-border: #e8ecf1;
  --color-text-primary: #0a1f44;
  --color-text-secondary: #64748b;
  --color-text-muted: #94a3b8;
  --font: 'Barlow', system-ui, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */

.site-header {
  background: var(--color-navy);
  height: 56px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
}

@keyframes spin-clockwise {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.site-logo-spin {
  height: 32px;
  width: 32px;
  animation: spin-clockwise 10s linear infinite;
  display: block;
  flex-shrink: 0;
}

.site-name {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
}

.site-tagline {
  font-size: 13px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.6);
}

/* ── Hero ── */

.hero {
  background: var(--color-bg);
  padding: 48px 24px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  transition: padding 250ms ease, max-height 250ms ease;
  flex-shrink: 0;
}

.hero.is-compact {
  padding: 16px 24px 12px;
}

.hero-title {
  font-size: 28px;
  font-weight: 600;
  color: var(--color-text-primary);
  text-align: center;
  margin-bottom: 20px;
  transition: max-height 250ms ease, opacity 200ms ease, margin 250ms ease;
  max-height: 60px;
  overflow: hidden;
}

.hero.is-compact .hero-title {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
}

/* ── Search ── */

.search-wrap {
  position: relative;
  width: 100%;
  max-width: 560px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 52px;
  background: var(--color-surface);
  border: 1px solid #dde3ea;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
  padding: 0 16px 0 48px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  color: var(--color-text-primary);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input::placeholder {
  color: var(--color-text-muted);
}

.search-input:focus {
  border-color: var(--color-navy);
  box-shadow: 0 0 0 3px rgba(10, 50, 80, 0.1);
}

/* ── Tab bar ── */

.tab-bar {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.tab {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  cursor: pointer;
  background: transparent;
  color: var(--color-text-secondary);
  transition: background 0.15s, color 0.15s;
}

.tab:hover {
  background: rgba(10, 50, 80, 0.06);
}

.tab.is-active {
  background: var(--color-navy);
  color: #fff;
}

/* ── Main area ── */

.main-area {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px 24px;
}

.content-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  display: flex;
  min-height: 520px;
  overflow: hidden;
}

/* ── Question list ── */

.question-list {
  width: 380px;
  flex-shrink: 0;
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  padding: 8px 0;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 6px;
}

.section-head:first-child {
  padding-top: 8px;
}

.section-pill {
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #fff;
}

.pill-mgr {
  background: var(--color-navy);
}

.pill-lrn {
  background: var(--color-green);
}

.section-rule {
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.question-card {
  position: relative;
  padding: 12px 16px 12px 20px;
  font-size: 13px;
  font-weight: 400;
  color: var(--color-navy);
  line-height: 1.5;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
  transition: background 0.12s;
  outline: none;
}

.question-card::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 2px;
  background: transparent;
  transition: background 0.12s;
}

.question-card:hover::before {
  background: var(--color-orange);
}

.question-card.is-active-mgr {
  background: #f0f4f8;
}

.question-card.is-active-mgr::before {
  background: var(--color-navy);
}

.question-card.is-active-lrn {
  background: #f0f7f4;
}

.question-card.is-active-lrn::before {
  background: var(--color-green);
}

.question-card.is-focused {
  outline: 2px dashed var(--color-orange);
  outline-offset: 2px;
}

.question-card mark {
  background: rgba(234, 119, 38, 0.15);
  color: inherit;
  border-radius: 0;
}

.no-results {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  font-size: 13px;
  color: var(--color-text-muted);
  text-align: center;
  padding: 16px;
}

/* ── Answer panel ── */

.answer-panel {
  flex: 1;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  gap: 8px;
  padding: 32px;
}

.empty-state.is-hidden {
  display: none;
}

.empty-icon {
  width: 40px;
  height: 40px;
  color: #cbd5e1;
  margin-bottom: 4px;
}

.empty-title {
  font-size: 14px;
  font-weight: 400;
  color: var(--color-text-muted);
}

.empty-sub {
  font-size: 12px;
  font-weight: 400;
  color: #cbd5e1;
}

.answer-content {
  padding: 32px 36px;
  display: none;
  flex-direction: column;
  flex: 1;
}

.answer-content.is-visible {
  display: flex;
}

.answer-content.is-fading-out {
  opacity: 0;
  transition: opacity 120ms ease;
}

.answer-content.is-fading-in {
  opacity: 0;
  animation: fadeIn 150ms ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.answer-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.4;
  margin-bottom: 20px;
}

.answer-body {
  font-size: 14px;
  font-weight: 400;
  color: #334155;
  line-height: 1.8;
  flex: 1;
}

.answer-body ol,
.answer-body ul {
  padding-left: 1.25rem;
}

.answer-body li {
  margin-bottom: 8px;
}

.answer-body p {
  margin-bottom: 10px;
}

.answer-body a {
  color: var(--color-orange);
  text-decoration: none;
}

.answer-body a:hover {
  text-decoration: underline;
}

.answer-body code {
  font-size: 12px;
  background: #f0f4f8;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

.sb {
  font-weight: 500;
  color: var(--color-text-primary);
}

.sh {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--color-text-primary);
  margin-top: 16px;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Video section ── */

.video-section {
  border-top: 1px solid var(--color-border);
  margin-top: 24px;
  padding-top: 20px;
}

.vid-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-navy);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}

.vid-toggle:hover {
  color: var(--color-orange);
}

.vid-toggle-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.vid-toggle.is-disabled {
  color: #cbd5e1;
  pointer-events: none;
  cursor: default;
}

.vid-unavailable {
  font-size: 12px;
  color: #cbd5e1;
  margin-left: 4px;
}

.video-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  margin-top: 16px;
  border-radius: 8px;
  overflow: hidden;
  background: #0a1f44;
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ── Footer ── */

.site-footer {
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  padding: 24px;
  text-align: center;
  font-size: 13px;
  font-weight: 400;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.site-footer a {
  color: var(--color-orange);
  font-weight: 500;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* ── Mobile overlay ── */

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--color-surface);
  z-index: 100;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 300ms ease;
}

.mobile-overlay.is-open {
  display: flex;
  transform: translateY(0);
}

.mobile-overlay-header {
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-navy);
  cursor: pointer;
  padding: 4px 0;
}

.back-btn:hover {
  color: var(--color-orange);
}

.mobile-overlay-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
}

/* ── Responsive ── */

@media (max-width: 767px) {
  .content-card {
    flex-direction: column;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .question-list {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    max-height: none;
  }

  .answer-panel {
    display: none;
  }

  .main-area {
    padding: 0;
  }

  .hero-title {
    font-size: 22px;
  }

  .search-input {
    height: 46px;
    font-size: 14px;
  }

  .site-header .header-inner {
    padding: 0 16px;
  }

  .hero {
    padding: 32px 16px 24px;
  }

  .hero.is-compact {
    padding: 12px 16px 10px;
  }
}

@media (min-width: 768px) {
  .mobile-overlay {
    display: none !important;
  }
}
