/* ==========================================================================
   Certify — Minimalist Editorial CBT Design System
   Modern Web Guidance Standards Applied:
   1. dark-mode: color-scheme on :root + light-dark() with prefers-color-scheme fallback
   2. animate-to-intrinsic-sizes: interpolate-size: allow-keywords + block-size: auto
   3. improve-text-layout-and-legibility: text-wrap: balance & text-wrap: pretty
   4. navigation-drawer: popover="manual" + scroll-snap-type: x mandatory + scroll-timeline
   5. light-dismiss-a-dialog: <dialog closedby="any"> + ::backdrop styling
   ========================================================================== */

@property --drawer-backdrop {
  syntax: '<number>';
  inherits: true;
  initial-value: 0;
}

:root {
  /* MANDATORY (dark-mode): Apply color-scheme to :root for viewport-wide theming */
  color-scheme: light dark;

  /* MANDATORY (animate-to-intrinsic-sizes): Opt-in to keyword interpolation */
  interpolate-size: allow-keywords;

  /* Raw Light / Dark Tokens */
  --bg-canvas-light: #f8f9fb;
  --bg-canvas-dark: #0d1117;

  --bg-surface-light: #ffffff;
  --bg-surface-dark: #161b22;

  --bg-subtle-light: #f1f4f9;
  --bg-subtle-dark: #21262d;

  --text-primary-light: #111827;
  --text-primary-dark: #f0f6fc;

  --text-secondary-light: #4b5563;
  --text-secondary-dark: #8b949e;

  --text-muted-light: #6b7280;
  --text-muted-dark: #6e7681;

  --border-hairline-light: #e5e7eb;
  --border-hairline-dark: #30363d;

  --brand-primary-light: #2563eb;
  --brand-primary-dark: #58a6ff;

  --brand-soft-light: #eff6ff;
  --brand-soft-dark: rgba(56, 139, 253, 0.14);

  --correct-bg-light: #ecfdf5;
  --correct-bg-dark: rgba(46, 160, 67, 0.16);
  --correct-border-light: #10b981;
  --correct-border-dark: #3fb950;
  --correct-text-light: #065f46;
  --correct-text-dark: #56d364;

  --wrong-bg-light: #fef2f2;
  --wrong-bg-dark: rgba(248, 81, 73, 0.16);
  --wrong-border-light: #ef4444;
  --wrong-border-dark: #f85149;
  --wrong-text-light: #991b1b;
  --wrong-text-dark: #ffa198;

  /* Default Fallback Assignments */
  --bg-canvas: var(--bg-canvas-light);
  --bg-surface: var(--bg-surface-light);
  --bg-subtle: var(--bg-subtle-light);
  --text-primary: var(--text-primary-light);
  --text-secondary: var(--text-secondary-light);
  --text-muted: var(--text-muted-light);
  --border-hairline: var(--border-hairline-light);
  --brand-primary: var(--brand-primary-light);
  --brand-soft: var(--brand-soft-light);
  --correct-bg: var(--correct-bg-light);
  --correct-border: var(--correct-border-light);
  --correct-text: var(--correct-text-light);
  --wrong-bg: var(--wrong-bg-light);
  --wrong-border: var(--wrong-border-light);
  --wrong-text: var(--wrong-text-light);

  /* MANDATORY (dark-mode): Fallback for browsers without light-dark() support */
  @media (prefers-color-scheme: dark) {
    --bg-canvas: var(--bg-canvas-dark);
    --bg-surface: var(--bg-surface-dark);
    --bg-subtle: var(--bg-subtle-dark);
    --text-primary: var(--text-primary-dark);
    --text-secondary: var(--text-secondary-dark);
    --text-muted: var(--text-muted-dark);
    --border-hairline: var(--border-hairline-dark);
    --brand-primary: var(--brand-primary-dark);
    --brand-soft: var(--brand-soft-dark);
    --correct-bg: var(--correct-bg-dark);
    --correct-border: var(--correct-border-dark);
    --correct-text: var(--correct-text-dark);
    --wrong-bg: var(--wrong-bg-dark);
    --wrong-border: var(--wrong-border-dark);
    --wrong-text: var(--wrong-text-dark);
  }

  /* Modern light-dark() evaluation */
  @supports (color: light-dark(white, black)) {
    --bg-canvas: light-dark(var(--bg-canvas-light), var(--bg-canvas-dark));
    --bg-surface: light-dark(var(--bg-surface-light), var(--bg-surface-dark));
    --bg-subtle: light-dark(var(--bg-subtle-light), var(--bg-subtle-dark));
    --text-primary: light-dark(var(--text-primary-light), var(--text-primary-dark));
    --text-secondary: light-dark(var(--text-secondary-light), var(--text-secondary-dark));
    --text-muted: light-dark(var(--text-muted-light), var(--text-muted-dark));
    --border-hairline: light-dark(var(--border-hairline-light), var(--border-hairline-dark));
    --brand-primary: light-dark(var(--brand-primary-light), var(--brand-primary-dark));
    --brand-soft: light-dark(var(--brand-soft-light), var(--brand-soft-dark));
    --correct-bg: light-dark(var(--correct-bg-light), var(--correct-bg-dark));
    --correct-border: light-dark(var(--correct-border-light), var(--correct-border-dark));
    --correct-text: light-dark(var(--correct-text-light), var(--correct-text-dark));
    --wrong-bg: light-dark(var(--wrong-bg-light), var(--wrong-bg-dark));
    --wrong-border: light-dark(var(--wrong-border-light), var(--wrong-border-dark));
    --wrong-text: light-dark(var(--wrong-text-light), var(--wrong-text-dark));
  }

  accent-color: var(--brand-primary);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.02);
}

html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

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

body {
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* MANDATORY (improve-text-layout-and-legibility): Balanced headings & pretty body copy */
h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  letter-spacing: -0.02em;
}

p, blockquote, li, .pretty-text {
  text-wrap: pretty;
}

/* ==========================================================================
   Top Header
   ========================================================================== */
.top-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg-surface) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-hairline);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  font-family: inherit;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--brand-primary);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  display: grid;
  place-items: center;
}

.brand-name {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}

.brand-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.live-collector-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.76rem;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border-hairline);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.nav-pill-btn:hover {
  background: var(--bg-subtle);
}

.pass-status-btn {
  background: var(--brand-soft);
  border-color: color-mix(in srgb, var(--brand-primary) 30%, transparent);
  color: var(--brand-primary);
}

.count-badge {
  background: var(--wrong-bg);
  color: var(--wrong-text);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.05rem 0.42rem;
  border-radius: 999px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

/* ==========================================================================
   Main Container & Explorer View
   ========================================================================== */
.app-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 4rem;
}

.hero-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.hero-kicker {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand-primary);
  margin-bottom: 0.4rem;
}

.hero-copy h1 {
  font-size: clamp(1.45rem, 2.5vw, 2rem);
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.hero-copy p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 68ch;
}

.resume-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand-primary) 25%, transparent);
}

.resume-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.resume-badge {
  background: var(--brand-primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
}

.resume-info strong {
  font-size: 0.95rem;
  display: block;
}

.resume-info p {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* 4 Main Category Tabs */
.category-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.cat-tab {
  text-align: left;
  padding: 0.95rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.cat-tab:hover {
  border-color: var(--brand-primary);
}

.cat-tab.is-active {
  background: var(--brand-soft);
  border-color: var(--brand-primary);
}

.cat-title {
  font-weight: 700;
  font-size: 0.92rem;
}

.cat-sub-hint, .cat-count {
  font-size: 0.76rem;
  color: var(--text-secondary);
}

/* Sub-category Chips & Search Bar */
.explorer-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.subcat-scroll {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.subcat-chip {
  padding: 0.36rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.subcat-chip.is-active {
  background: var(--text-primary);
  color: var(--bg-surface);
  border-color: var(--text-primary);
}

.search-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.toggle-ready-only {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.search-box {
  flex: 1;
  min-width: 260px;
  max-width: 460px;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
}

.search-box input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
}

/* Subject Cards Grid */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.9rem;
}

.subject-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.subject-card.is-ready {
  cursor: pointer;
}

.subject-card.is-ready:hover {
  transform: translateY(-2px);
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-card);
}

.subj-card-top {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.subj-badges {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.subj-cat-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.subj-ready-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--correct-bg);
  color: var(--correct-text);
}

.subj-queued-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.subject-card h3 {
  font-size: 1.04rem;
  font-weight: 700;
}

.subj-meta-line {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.subj-card-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-hairline);
}

/* ==========================================================================
   Buttons & Segmented Controls
   ========================================================================== */
.btn-primary, .btn-secondary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--brand-primary);
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border-hairline);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.btn-full {
  width: 100%;
}

/* ==========================================================================
   Active CBT Workspace (Study Mode & Real Exam Mode)
   ========================================================================== */
.workspace-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 0.6rem;
}

.ws-left, .ws-center, .ws-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.ws-title-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.ws-title-group h2 {
  font-size: 1.05rem;
  font-weight: 800;
}

.round-select {
  padding: 0.38rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
}

.segmented-control {
  display: inline-flex;
  background: var(--bg-subtle);
  padding: 0.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
}

.seg-btn {
  padding: 0.36rem 0.75rem;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.seg-btn.is-active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.progress-track {
  height: 4px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.progress-fill {
  height: 100%;
  background: var(--brand-primary);
  transition: width 0.25s ease;
}

/* Main Stage Grid */
.cbt-stage {
  display: grid;
  grid-template-columns: minmax(0, 820px);
  justify-content: center;
  gap: 1.25rem;
}

.cbt-stage[data-mode="exam"] {
  grid-template-columns: minmax(0, 1fr) 310px;
}

.cbt-stage[data-mode="study"] .omr-sidebar {
  display: none;
}

/* Question Card */
.question-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
}

.q-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-hairline);
}

.q-meta-badges {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.q-no-badge {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--brand-primary);
  background: var(--brand-soft);
  padding: 0.22rem 0.6rem;
  border-radius: 6px;
}

.q-sub-badge, .q-type-pill {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.q-acc-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.58rem;
  border-radius: 6px;
  background: var(--correct-bg);
  color: var(--correct-text);
  border: 1px solid var(--correct-border);
}

.q-shared-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.58rem;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand-primary);
  border: 1px solid var(--brand-primary);
}

.shared-passage-box {
  margin-bottom: 1.15rem;
  border: 1.5px solid var(--brand-primary);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  overflow: hidden;
}

.sp-header {
  background: var(--brand-soft);
  color: var(--brand-primary);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--border-hairline);
}

.sp-visuals {
  padding: 0.85rem;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
}

.sp-visuals img {
  max-width: 100%;
  height: auto;
  display: block;
}

[hidden] {
  display: none !important;
}

.q-wrong-streak {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: var(--wrong-bg);
  color: var(--wrong-text);
}

.bookmark-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.bookmark-btn.is-bookmarked {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #b45309;
}

.question-stem {
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.55;
  margin-bottom: 1.15rem;
}

.question-passage {
  background: var(--bg-subtle);
  border-left: 3px solid var(--brand-primary);
  padding: 1rem 1.15rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  margin-bottom: 1.15rem;
  white-space: pre-line;
}

.question-visuals {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 0.85rem;
  background: #ffffff;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
}

.question-visuals img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Choices List */
.choices-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.choice-item {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1.05rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.96rem;
  line-height: 1.5;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.choice-item:hover {
  border-color: var(--brand-primary);
  background: var(--bg-subtle);
}

.choice-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border-hairline);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.82rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 0.05rem;
}

.choice-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.choice-body img {
  max-width: 100%;
  height: auto;
  background: #ffffff;
  padding: 0.25rem;
  border-radius: 4px;
}

/* Selected State in Exam Mode */
.choice-item.is-selected {
  border-color: var(--brand-primary);
  background: var(--brand-soft);
}

.choice-item.is-selected .choice-num {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

/* Instant Feedback States in Study Mode */
.choice-item.is-correct {
  border-color: var(--correct-border);
  background: var(--correct-bg);
  color: var(--correct-text);
  font-weight: 600;
}

.choice-item.is-correct .choice-num {
  background: var(--correct-border);
  border-color: var(--correct-border);
  color: #fff;
}

.choice-item.is-wrong {
  border-color: var(--wrong-border);
  background: var(--wrong-bg);
  color: var(--wrong-text);
}

.choice-item.is-wrong .choice-num {
  background: var(--wrong-border);
  border-color: var(--wrong-border);
  color: #fff;
}

.q-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-hairline);
}

/* ==========================================================================
   AI Explanation Intrinsic-Size Accordion (animate-to-intrinsic-sizes)
   ========================================================================== */
.explanation-drawer {
  block-size: 0;
  overflow: hidden;
  opacity: 0;
  margin-top: 0;
  background: var(--bg-surface);
  border: 0 solid var(--border-hairline);
  border-radius: var(--radius-lg);
  transition: block-size 0.32s ease-out, opacity 0.25s ease, margin-top 0.25s ease;
}

.explanation-drawer.is-expanded {
  block-size: auto;
  opacity: 1;
  margin-top: 0.9rem;
  border-width: 1px;
  box-shadow: var(--shadow-card);
}

.exp-inner {
  padding: 1.4rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.exp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.exp-verdict {
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  background: var(--correct-bg);
  color: var(--correct-text);
}

.exp-verdict.is-wrong-verdict {
  background: var(--wrong-bg);
  color: var(--wrong-text);
}

.exp-answer-num {
  font-weight: 800;
  font-size: 0.95rem;
}

.exp-summary {
  font-size: 0.94rem;
  color: var(--text-primary);
}

.exp-choices-breakdown {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  font-size: 0.86rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.exp-tip-box {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--brand-primary);
  background: var(--brand-soft);
  padding: 0.75rem 0.95rem;
  border-radius: var(--radius-sm);
}

.keyboard-hint {
  margin-top: 0.85rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

kbd {
  padding: 0.1rem 0.38rem;
  border-radius: 4px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  font-size: 0.74rem;
}

/* ==========================================================================
   Real-Time CBT OMR Sidebar
   ========================================================================== */
.omr-card {
  position: sticky;
  top: 4.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: calc(100dvh - 6rem);
}

.omr-timer-box {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.timer-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.timer-digits {
  font-size: 1.25rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--brand-primary);
}

.omr-status-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.omr-sheet-scroll {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-right: 0.25rem;
}

.omr-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
}

.omr-row.is-current {
  background: var(--brand-soft);
  border-color: color-mix(in srgb, var(--brand-primary) 30%, transparent);
}

.omr-qno {
  font-size: 0.8rem;
  font-weight: 700;
  width: 34px;
}

.omr-bubbles {
  display: flex;
  gap: 0.32rem;
}

.omr-bubble {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  font-size: 0.74rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.omr-bubble.is-marked {
  background: var(--text-primary);
  color: var(--bg-surface);
  border-color: var(--text-primary);
}

.exam-result-card {
  background: var(--bg-surface);
  border: 2px solid var(--brand-primary);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
  margin-bottom: 1.25rem;
}

.exam-result-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.exam-result-actions {
  display: flex;
  gap: 0.6rem;
}

/* ==========================================================================
   Navigation Drawer for Question Jump Palette (navigation-drawer guide)
   ========================================================================== */
.Drawer {
  --drawer-width: min(24em, 85dvw);
  --drawer-backdrop: 0;
  width: auto;
  height: auto;
  background: transparent;
  border: 0;
  overflow: visible;
  inset: 0;
}

.Drawer::backdrop {
  background: #000;
  opacity: calc(var(--drawer-backdrop) / 2);
}

.Drawer-scroller {
  position: relative;
  display: grid;
  grid-template-columns: var(--drawer-width) 100%;
  overflow-x: scroll;
  overscroll-behavior: none;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
  width: 100dvw;
  height: 100dvh;
  timeline-scope: --drawer-scroll-timeline;
}

.Drawer-scroller::-webkit-scrollbar {
  display: none;
}

.Drawer-scroller::after {
  content: "";
  scroll-snap-align: start;
  scroll-initial-target: nearest;
}

.Drawer-sheet {
  scroll-snap-align: start;
  width: var(--drawer-width);
  height: 100dvh;
  box-sizing: border-box;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-hairline);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  outline: none;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.eyebrow-badge {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--brand-primary);
  display: block;
}

.palette-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
  background: var(--bg-subtle);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.p-stat {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-unanswered { background: var(--text-muted); }
.dot-correct { background: #10b981; }
.dot-wrong { background: #ef4444; }
.dot-bookmarked { background: #f59e0b; }

.palette-filter-bar {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.p-filter-btn {
  padding: 0.32rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.p-filter-btn.is-active {
  background: var(--text-primary);
  color: var(--bg-surface);
  border-color: var(--text-primary);
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.45rem;
  flex: 1;
  align-content: start;
}

.p-num-btn {
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  position: relative;
  font-family: inherit;
}

.p-num-btn.is-current {
  outline: 2px solid var(--brand-primary);
  outline-offset: 1px;
}

.p-num-btn.is-correct {
  background: var(--correct-bg);
  border-color: var(--correct-border);
  color: var(--correct-text);
}

.p-num-btn.is-wrong {
  background: var(--wrong-bg);
  border-color: var(--wrong-border);
  color: var(--wrong-text);
}

.p-num-btn.is-bookmarked::after {
  content: "★";
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.62rem;
  color: #f59e0b;
}

/* ==========================================================================
   Modal Dialogs (light-dismiss-a-dialog guide)
   ========================================================================== */
.modal-dialog {
  margin: auto;
  width: min(680px, 92dvw);
  max-height: 86dvh;
  overflow: hidden;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  color: var(--text-primary);
  padding: 0;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.modal-dialog.pricing-modal {
  width: min(920px, 94dvw);
}

.modal-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
}

.modal-content {
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  max-height: 86dvh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.history-filter-pills {
  display: flex;
  gap: 0.45rem;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.history-item {
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg-subtle);
}

.history-item-info h4 {
  font-size: 0.92rem;
  margin-bottom: 0.25rem;
}

.history-item-info p {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* Pricing Cards Grid & Per-Subject Selector */
.pricing-subject-selector-box {
  border: 1.5px solid var(--brand-primary);
  background: var(--brand-soft);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.pss-info {
  flex: 1;
  min-width: 260px;
}

.pss-tag {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--brand-primary);
  margin-bottom: 0.3rem;
}

.pss-info p {
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.48;
}

.pss-control {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 240px;
}

.pss-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.pricing-subject-select {
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--brand-primary);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
}

.pricing-owned-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-hairline);
  font-size: 0.82rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.subj-pass-owned-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-primary);
  border: 1px solid var(--brand-primary);
}

.pricing-subcopy {
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.pricing-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.price-card {
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.15rem;
  position: relative;
}

.price-card.is-featured {
  border: 2px solid var(--brand-primary);
  background: var(--brand-soft);
}

.featured-ribbon {
  position: absolute;
  top: -11px;
  right: 14px;
  background: var(--brand-primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
}

.tier-badge {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.tier-badge.best {
  color: var(--brand-primary);
}

.price-amount {
  margin: 0.45rem 0;
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

.price-amount strong {
  font-size: 1.75rem;
  font-weight: 800;
}

.price-amount span {
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.price-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.83rem;
  color: var(--text-secondary);
}

/* MANDATORY (animate-to-intrinsic-sizes & navigation-drawer): Reduced motion safety */
@media (prefers-reduced-motion: no-preference) {
  .Drawer-scroller {
    scroll-behavior: smooth;
  }
}

@media (prefers-reduced-motion: reduce) {
  .explanation-drawer,
  .progress-fill,
  .subject-card {
    transition: none !important;
  }
}

@media (max-width: 900px) {
  .cbt-stage[data-mode="exam"] {
    grid-template-columns: 1fr;
  }
  .omr-card {
    position: static;
    max-height: none;
  }
}

/* ==========================================================================
   Social Auth (Kakao / Naver / Google), Email Forms (:user-invalid),
   Payment Checkout & My Page Styles
   ========================================================================== */
.user-auth-btn {
  font-weight: 700;
}

.user-provider-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  background: var(--brand-primary);
}
.user-provider-dot[data-provider="kakao"] { background: #FEE500; border: 1px solid #191919; }
.user-provider-dot[data-provider="naver"] { background: #03C75A; }
.user-provider-dot[data-provider="google"] { background: #4285F4; }
.user-provider-dot[data-provider="email"] { background: var(--brand-primary); }

.modal-dialog.auth-modal {
  width: min(480px, 94dvw);
}

.modal-dialog.checkout-modal {
  width: min(640px, 95dvw);
  position: fixed;
  inset: 0;
  margin: auto;
  z-index: 1500;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.28), 0 0 0 100vmax rgba(15, 23, 42, 0.65);
  transition: opacity 0.15s ease;
}

.modal-dialog.checkout-modal.is-toss-overlay-active {
  opacity: 0;
  pointer-events: none;
}

.toss-widget-wrap {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.toss-test-mode-tip {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: #1E40AF;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  line-height: 1.45;
  margin-bottom: 0.5rem;
}

.modal-dialog.account-modal {
  width: min(680px, 94dvw);
}

.auth-intent-banner {
  background: var(--brand-soft);
  border: 1.5px solid var(--brand-primary);
  color: var(--brand-primary);
  padding: 0.75rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.45;
}

.social-login-section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.social-subtitle {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.social-buttons-stack {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.social-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.78rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.1s ease, filter 0.12s ease;
}

.social-btn:hover {
  filter: brightness(0.97);
}

.social-kakao {
  background: #FEE500;
  color: #191919;
  border-color: #f2d900;
}

.social-naver {
  background: #03C75A;
  color: #ffffff;
  border-color: #02b350;
}

.social-google {
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #d1d5db;
}

.social-sandbox-box {
  margin-top: 0.35rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--brand-primary);
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.ssb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.ssb-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-primary);
}

.ssb-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.ssb-fields {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 0.6rem;
}

.ssb-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-hairline);
}

.auth-tabs {
  width: 100%;
}
.auth-tabs .seg-btn {
  flex: 1;
  text-align: center;
}

.auth-feedback-msg {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  font-weight: 700;
  background: var(--wrong-bg);
  color: var(--wrong-text);
  border: 1px solid var(--wrong-border);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.form-field label {
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* MANDATORY (validate-input-after-interaction): Hints & rules placed ABOVE input */
.field-hint,
.field-rules-list {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-bottom: 0.15rem;
  list-style-position: inside;
}

.form-field input {
  width: 100%;
  padding: 0.62rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-hairline);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
}

.form-field input:focus {
  outline: none;
  border-color: var(--brand-primary);
}

.field-error-msg {
  display: none;
  color: var(--wrong-text);
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 0.2rem;
}

/* MANDATORY (validate-input-after-interaction): Show error styles only on :user-invalid */
.form-field input:user-invalid {
  border-color: #d93025;
  background-color: var(--wrong-bg);
}

.form-field input:user-invalid + .field-error-msg,
.password-input-wrap:has(input:user-invalid) + .field-error-msg {
  display: block;
}

.form-field input:user-valid {
  border-color: #188038;
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrap input {
  padding-right: 3.6rem;
}

.pw-toggle-btn {
  position: absolute;
  right: 0.45rem;
  padding: 0.25rem 0.55rem;
  border-radius: 5px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.auth-submit-btn {
  margin-top: 0.25rem;
  padding: 0.75rem 1rem;
  font-size: 0.94rem;
}

/* Checkout Modal Styles */
.checkout-summary-card {
  border: 1.5px solid var(--border-hairline);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.chk-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.86rem;
}

.chk-label {
  color: var(--text-secondary);
}

.chk-highlight {
  color: var(--brand-primary);
  font-weight: 800;
}

.chk-total-row {
  padding-top: 0.65rem;
  margin-top: 0.2rem;
  border-top: 1px dashed var(--border-hairline);
}

.chk-total-price {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--brand-primary);
}

.chk-sec-title {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 0.55rem;
}

.pay-methods-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

.pay-method-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-hairline);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.pay-method-btn.is-selected {
  border-color: var(--brand-primary);
  background: var(--brand-soft);
}

.pm-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.18rem 0.45rem;
  border-radius: 5px;
}
.pm-kakao { background: #FEE500; color: #191919; }
.pm-naver { background: #03C75A; color: #fff; }
.pm-toss { background: #0064FF; color: #fff; }
.pm-card { background: var(--bg-subtle); }

.checkout-agree-row {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
  cursor: pointer;
}

.checkout-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.checkout-pay-btn {
  flex: 1;
  padding: 0.8rem 1.2rem;
  font-size: 0.95rem;
}

/* My Page / Account Modal Styles */
.account-profile-card {
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.apc-provider-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-primary);
  margin-bottom: 0.25rem;
}

.apc-left h3 {
  font-size: 1.05rem;
  font-weight: 800;
}

.apc-left p {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.apc-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.account-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.acc-sec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.acc-sec-header h3 {
  font-size: 0.94rem;
  font-weight: 800;
}

.acc-count-pill {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--brand-primary);
  background: var(--brand-soft);
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
}

.account-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.account-card-row {
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.acr-info h4 {
  font-size: 0.9rem;
  font-weight: 800;
  margin-bottom: 0.2rem;
}

.acr-info p {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.acr-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* ==========================================================================
   PG & E-Commerce Law Compliant Site Footer & Legal Policy Modal
   ========================================================================== */
.site-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  color: var(--text-secondary);
  padding: 2rem 1.25rem 2.5rem;
}

.site-footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.footer-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border-hairline);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.footer-logo {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.footer-domain {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-policy-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer-link-btn {
  background: none;
  border: none;
  padding: 0.2rem 0.35rem;
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 4px;
}

.footer-link-btn:hover {
  color: var(--brand-primary);
  text-decoration: underline;
}

.footer-link-btn.is-bold {
  font-weight: 800;
  color: var(--text-primary);
}

.footer-sep {
  font-size: 0.72rem;
  color: var(--border-focus);
}

.footer-biz-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.25rem;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.footer-biz-grid strong {
  color: var(--text-primary);
  font-weight: 700;
}

.footer-disclaimer {
  font-size: 0.74rem;
  line-height: 1.55;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.footer-copy {
  font-weight: 600;
  color: var(--text-secondary);
}

.pricing-policy-notice {
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.95rem;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.pricing-policy-notice strong {
  color: var(--text-primary);
}

.inline-policy-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  font-family: inherit;
  font-weight: 700;
  color: var(--brand-primary);
  text-decoration: underline;
  cursor: pointer;
}

.legal-modal {
  max-width: 720px;
}

.legal-tabs {
  width: 100%;
}

.legal-tabs .seg-btn {
  flex: 1;
}

.legal-body-scroll {
  max-height: 55vh;
  overflow-y: auto;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  padding: 1.15rem 1.25rem;
}

.legal-panel h3 {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 1rem 0 0.45rem;
}

.legal-panel h3:first-child {
  margin-top: 0;
}

.legal-panel p,
.legal-panel li {
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.legal-panel ol,
.legal-panel ul {
  padding-left: 1.25rem;
  margin: 0.35rem 0 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

/* ==========================================================================
   HD Remastered Visuals & Dual-Verified Native Bogi Card
   ========================================================================== */
.hd-exam-img,
#q-pre-visuals img,
#q-visuals img,
.choice-body img {
  border-radius: 6px;
  background: #ffffff;
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--border-hairline);
}

[data-theme="dark"] .hd-exam-img,
[data-theme="dark"] #q-pre-visuals img,
[data-theme="dark"] #q-visuals img,
[data-theme="dark"] .choice-body img {
  filter: invert(0.91) hue-rotate(180deg) contrast(1.06);
  border-color: rgba(255, 255, 255, 0.14);
}

.remastered-bogi-card {
  width: 100%;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-focus);
  border-radius: var(--radius-md);
  padding: 0.95rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.rbc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  border-bottom: 1px dashed var(--border-hairline);
  padding-bottom: 0.45rem;
}

.rbc-badge {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--brand-primary);
}

.rbc-toggle-orig-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: 6px;
  padding: 0.22rem 0.55rem;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
}

.rbc-toggle-orig-btn:hover {
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.rbc-body {
  font-size: 0.96rem;
  line-height: 1.8;
  color: var(--text-primary);
  font-weight: 500;
}

.rbc-body u {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--brand-primary);
  font-weight: 600;
}

.rbc-divider {
  border: 0;
  border-top: 1px dashed var(--border-hairline);
  margin: 0.75rem 0;
}

.rbc-orig-wrap {
  margin-top: 0.45rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

/* Official Multi-Answer & Deep Textbook Explanation Card Styles */
.q-official-ans-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.24rem 0.65rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  background: rgba(16, 185, 129, 0.14);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

[data-theme="dark"] .q-official-ans-badge {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.exp-summary {
  line-height: 1.75;
  font-size: 0.94rem;
  background: var(--bg-subtle);
  padding: 0.95rem 1.15rem;
  border-radius: var(--radius-md);
  border-left: 3.5px solid var(--brand-primary);
}

.exp-choice-card {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.exp-choice-card.is-correct-choice-exp {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.4);
}

.exp-choice-head {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.exp-choice-detail {
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--text-secondary);
  padding-left: 0.4rem;
}




