:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --accent: #7c3aed;
  --accent-light: #ede9fe;
  --correct: #059669;
  --correct-bg: #d1fae5;
  --wrong: #dc2626;
  --wrong-bg: #fee2e2;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --radius: 12px;
  --radius-lg: 20px;
  --touch-min: 48px;
  --font-base: 1rem;
}

html[data-font-size="small"] {
  --font-base: 0.9375rem;
}

html[data-font-size="normal"] {
  --font-base: 1rem;
}

html[data-font-size="large"] {
  --font-base: 1.125rem;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "Noto Sans KR", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: var(--font-base);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.6;
  padding-top: env(safe-area-inset-top);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 0.75rem;
  padding-top: calc(3.5rem + env(safe-area-inset-top, 0px));
}

.screen {
  display: none;
  animation: fadeIn 0.3s ease;
}

.screen.active {
  display: block;
}

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

.hidden {
  display: none !important;
}

/* 코드 입력 · Pro */
.btn-access-code {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top));
  left: max(0.75rem, env(safe-area-inset-left));
  z-index: 200;
  min-height: 32px;
  padding: 0.35rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f1f5f9;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
}

.btn-access-code.pro-badge {
  background: linear-gradient(135deg, #fde68a, #f59e0b);
  border-color: #d97706;
  color: #78350f;
  font-size: 0.85rem;
  font-weight: 700;
  min-height: 34px;
  padding: 0.4rem 0.85rem;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.45);
  cursor: default;
}

.lock-toast {
  position: fixed;
  top: 3.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 250;
  background: #1e293b;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.65rem 1.15rem;
  border-radius: 999px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  max-width: calc(100% - 2rem);
  text-align: center;
}

.code-input {
  width: 100%;
  margin: 0.75rem 0 0.5rem;
  padding: 1rem;
  font-size: 1.1rem;
  font-family: inherit;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  letter-spacing: 0.06em;
}

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

.code-error {
  color: var(--wrong);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.code-modal-box .confirm-actions {
  margin-top: 0.5rem;
}

/* 설정 */
.btn-settings {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  z-index: 200;
  width: var(--touch-min);
  height: var(--touch-min);
  border: none;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 1.35rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 300;
}

.settings-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 301;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: min(340px, calc(100% - 2rem));
  max-height: min(85dvh, calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 2rem));
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}

.notif-settings {
  margin-bottom: 1rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}

.notif-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.65rem 0;
  font-size: 0.92rem;
  cursor: pointer;
}

.notif-row input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--primary);
}

.notif-time-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.25rem 0 0.75rem 1.6rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.notif-time-input {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.settings-panel h3 {
  font-size: 1.15rem;
  margin-bottom: 1rem;
}

.settings-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.font-size-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.font-size-btn {
  flex: 1;
  min-height: var(--touch-min);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.font-size-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

/* 카드 공통 */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 2rem 1.5rem;
  margin-top: 2rem;
  text-align: center;
}

.logo-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.875rem;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.card h1,
.menu-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.35;
}

.subtitle,
.menu-sub {
  color: var(--text-muted);
  margin-top: 0.35rem;
  font-size: 1rem;
}

/* 쿠폰 */
.coupon-input {
  width: 100%;
  margin: 1.5rem 0 0.5rem;
  padding: 1rem 1.15rem;
  font-size: 1.125rem;
  font-family: inherit;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.coupon-error {
  color: var(--wrong);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  font-weight: 500;
}

/* 버튼 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-weight: 600;
  font-size: 1rem;
  min-height: var(--touch-min);
  cursor: pointer;
  transition: background 0.2s, transform 0.12s;
  padding: 0.75rem 1.25rem;
}

.btn:active {
  transform: scale(0.98);
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--border);
}

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

.btn-accent:hover {
  background: #6d28d9;
}

.btn-lg {
  width: 100%;
  padding: 1rem;
  font-size: 1.05rem;
}

.btn-sm {
  width: 100%;
  min-height: 44px;
  font-size: 0.95rem;
}

.btn-text {
  background: none;
  border: none;
  color: var(--primary);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  min-height: var(--touch-min);
  padding: 0 0.5rem;
  cursor: pointer;
}

.btn-mode {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text);
  margin-bottom: 0.5rem;
}

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

.btn-explain {
  width: 100%;
  background: var(--bg);
  border: 2px solid var(--border);
  color: var(--text);
  margin-top: 1rem;
}

.btn-explain:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* 메인 메뉴 */
.menu-header {
  text-align: center;
  padding: 1rem 0 1.25rem;
}

.grade-cards {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 0.25rem;
}

.grade-card {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.12s;
}

.grade-card:not(.grade-card-disabled):hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.grade-card:not(.grade-card-disabled):active {
  transform: scale(0.99);
}

.grade-card-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f8fafc;
}

.grade-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.grade-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.grade-soon-badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  background: #e2e8f0;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.grade-card-meta {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.grade-card-meta li {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.grade-meta-note {
  font-size: 0.82rem;
  color: #94a3b8;
}

.round-select-top {
  margin-bottom: 0.75rem;
}

.grade-round-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 0.35rem;
  padding-left: 0.5rem;
}

.menu-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.round-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

#jeonggi-grid {
  grid-template-columns: repeat(5, 1fr);
}

.round-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0.5rem 0.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.round-btn .round-num {
  font-size: 1rem;
  font-weight: 700;
}

.round-btn .round-soon {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  font-weight: 500;
}

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

.round-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.round-btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f1f5f9;
}

.round-btn.locked {
  background: #f8fafc;
  border-color: #cbd5e1;
  cursor: not-allowed;
  opacity: 0.65;
}

.round-btn.locked .round-num {
  color: #94a3b8;
}

.round-lock {
  display: block;
  font-size: 0.7rem;
  line-height: 1;
  margin-bottom: 0.15rem;
}

.mode-panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-top: 0.5rem;
}

.patchnotes-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  margin-top: 1rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow);
}

.patchnotes-collapsible {
  padding-bottom: 1rem;
}

.patchnotes-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.patchnotes-title {
  margin-bottom: 0;
}

.patchnotes-arrow {
  flex-shrink: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: transform 0.3s ease;
}

.patchnotes-collapsible.open .patchnotes-arrow {
  transform: rotate(180deg);
}

.patchnotes-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin-top: 0;
  transition: max-height 0.35s ease, opacity 0.3s ease, margin-top 0.3s ease;
}

.patchnotes-collapsible.open .patchnotes-body {
  max-height: 600px;
  opacity: 1;
  margin-top: 1rem;
}

/* 스마트스토어 강의 광고 카드 (웹) */
.promo-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(180deg, #fbfdff 0%, var(--primary-light) 100%);
  border: 1.5px solid #cdddff;
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.25rem;
  margin-top: 1rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.promo-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.18);
}

.promo-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  background: #fff;
  border: 1px solid #cdddff;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
}

.promo-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.35;
  color: var(--text);
}

.promo-headline {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.45;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.promo-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 0.45rem;
  line-height: 1.5;
}

.promo-plans {
  margin-top: 1rem;
  padding-top: 0.5rem;
  border-top: 1px dashed #cdddff;
}

.promo-plan {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

.promo-plan-left,
.promo-plan-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.promo-term {
  font-weight: 600;
  color: #5a6478;
}

.promo-price {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.promo-sale {
  font-size: 0.72rem;
  font-weight: 800;
  color: #e0436b;
  background: #ffeef2;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.promo-plan-best .promo-price {
  color: var(--primary);
}

.promo-tag-best {
  font-size: 0.66rem;
  font-weight: 800;
  color: #fff;
  background: var(--primary);
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  letter-spacing: 0.03em;
}

.promo-cta {
  margin-top: 1rem;
  text-align: center;
  font-weight: 700;
  color: var(--primary);
  font-size: 0.95rem;
}

.promo-card-result {
  margin-top: 1rem;
  margin-bottom: 0;
  padding: 1.25rem;
  border-radius: 18px;
}

.promo-card-result .promo-headline {
  font-size: 1.03rem;
  margin-top: 0;
}

.promo-card-result .promo-desc {
  font-size: 0.8125rem;
  margin-top: 0.55rem;
}

.promo-card-result .promo-cta {
  margin-top: 1rem;
  text-align: center;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border-radius: 12px;
  padding: 0.75rem;
  font-size: 0.9rem;
}

/* 무료 채널 홍보 카드 (앱 — 결제·가격 없음) */
.channel-card {
  background: linear-gradient(180deg, #fbfdff 0%, var(--accent-light) 100%);
  border: 1.5px solid #ddd6fe;
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.25rem;
  margin-top: 1rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow);
}

.channel-card-result {
  margin-top: 1rem;
  margin-bottom: 0;
}

.channel-title {
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.35;
  color: var(--text);
}

.channel-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 0.45rem;
  line-height: 1.5;
}

.channel-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 1rem;
}

.channel-btn {
  width: 100%;
  min-height: var(--touch-min);
  border: none;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.65rem 1rem;
  text-align: center;
}

.channel-btn-secondary {
  background: var(--surface);
  color: var(--accent);
  border: 2px solid #c4b5fd;
}

.channel-btn:active {
  transform: scale(0.98);
}

.support-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.25rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.support-title {
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 0.85rem;
}

.support-body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.support-body p {
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.support-account {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: var(--radius);
  background: var(--primary-light);
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.12s;
}

.support-account:hover {
  background: #bfdbfe;
}

.support-account:active {
  transform: scale(0.99);
}

.support-account-text {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.45;
  word-break: keep-all;
}

.support-account-hint {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--primary);
}

.patchnotes-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.patchnotes-list li {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
  padding-left: 0.85rem;
  border-left: 3px solid var(--primary-light);
}

.patchnotes-date {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  margin-right: 0.35rem;
}

.patchnotes-footer {
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.mode-panel-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.resume-banner {
  background: var(--accent-light);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  text-align: center;
}

.resume-banner p {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  color: var(--accent);
  font-weight: 600;
}

.mode-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.mode-buttons {
  margin-bottom: 0.75rem;
}

#btn-new-start {
  margin-top: 0.25rem;
}

/* 퀴즈 상단 */
.quiz-top {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 0.65rem;
  box-shadow: var(--shadow);
}

.quiz-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.exam-badge {
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--wrong-bg);
  color: var(--wrong);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

.exam-timer {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
  margin-left: auto;
  flex-shrink: 0;
}

body.is-exam-quiz .quiz-top-row {
  padding-right: 3.25rem;
}

body.is-exam-quiz .btn-settings {
  z-index: 210;
}

.exam-timer.warning {
  color: var(--wrong);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.7;
  }
}

.quiz-round-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  font-weight: 500;
}

/* 문제 네비 */
.q-nav {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.65rem 0.25rem;
  margin-bottom: 0.65rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.q-nav::-webkit-scrollbar {
  display: none;
}

.q-nav-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}

.q-nav-btn.current {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.q-nav-btn.correct:not(.current) {
  border-color: var(--correct);
  background: var(--correct-bg);
  color: var(--correct);
}

.q-nav-btn.wrong:not(.current) {
  border-color: var(--wrong);
  background: var(--wrong-bg);
  color: var(--wrong);
}

.q-nav-btn.answered-neutral:not(.current) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.q-nav-btn.answered-neutral.current {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

/* 문제 본문 */
.quiz-main {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.question-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.question-meta-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-review-done {
  flex-shrink: 0;
  padding: 0.45rem 0.75rem;
  min-height: 40px;
  border: 2px solid var(--correct);
  border-radius: var(--radius);
  background: var(--correct-bg);
  color: #065f46;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.q-number {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
}

.subject-tag {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.question-text {
  font-size: calc(var(--font-base) * 1.05);
  font-weight: 500;
  line-height: 1.75;
  white-space: pre-wrap;
  margin-bottom: 0.5rem;
}

.question-image-wrap {
  margin: 0.75rem 0 1rem;
}

.question-image-wrap img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
  background: #fff;
}

.question-image-wrap:empty {
  display: none;
  margin: 0;
}

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

.options.options-image-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.option-btn {
  width: 100%;
  text-align: left;
  padding: 1rem 1.1rem;
  min-height: var(--touch-min);
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: var(--font-base);
  color: var(--text);
  cursor: pointer;
  line-height: 1.5;
}

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

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

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

.option-btn.correct {
  border-color: var(--correct);
  background: var(--correct-bg);
  color: #065f46;
}

.option-btn.wrong {
  border-color: var(--wrong);
  background: var(--wrong-bg);
  color: #991b1b;
}

.option-btn-image {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  padding: 0.75rem;
}

.option-btn-image .option-label {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.95rem;
}

.option-btn-image .option-img {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  border: 1px solid var(--border);
  background: #fff;
}

.option-btn.selected-exam {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}

.feedback-area {
  margin-top: 1.25rem;
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}

.explain-panel {
  margin-top: 0.75rem;
}

.explain-block {
  background: #f8fafc;
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.65rem;
  border-left: 3px solid var(--primary);
}

.explain-block h4 {
  font-size: 0.9rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.explain-block p {
  font-size: calc(var(--font-base) * 0.95);
  line-height: 1.75;
  white-space: pre-wrap;
  color: var(--text-muted);
}

.quiz-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.quiz-actions-two {
  grid-template-columns: 1fr 1fr;
}

.btn-nav {
  min-height: var(--touch-min);
  padding: 0.75rem 0.5rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.btn-nav:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

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

.btn-nav-submit {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-nav-submit:hover {
  background: #6d28d9;
}

.btn-mode-note {
  border-color: var(--correct);
  color: #065f46;
}

/* 랜덤 · 빈 오답노트 */
.random-card,
.empty-card {
  margin-top: 1.5rem;
}

.random-card .btn-lg + .btn-lg {
  margin-top: 0.65rem;
}

.btn-text-block {
  display: block;
  width: 100%;
  margin-top: 1.25rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  min-height: var(--touch-min);
  cursor: pointer;
}

.empty-emoji {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.empty-card h2 {
  font-size: 1.35rem;
}

.confirm-box .modal-desc {
  margin-bottom: 1.25rem;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.confirm-actions .btn {
  width: 100%;
  min-height: var(--touch-min);
}

/* 모달 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2);
}

.modal-box.correct-theme {
  border-top: 4px solid var(--correct);
}

.modal-box.wrong-theme {
  border-top: 4px solid var(--wrong);
}

.modal-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.modal-box.correct-theme .modal-title {
  color: var(--correct);
}

.modal-box.wrong-theme .modal-title {
  color: var(--wrong);
}

.modal-desc {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 1.25rem;
}

.modal-box .btn-primary {
  width: 100%;
}

/* 결과 */
.result-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 2rem 1.5rem;
  margin-top: 0.5rem;
  text-align: center;
}

.result-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.result-score-line {
  font-size: 1.25rem;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.result-score-line strong {
  font-size: 2rem;
  color: var(--primary);
  font-weight: 700;
}

.result-passfail {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.result-passfail.pass {
  color: var(--correct);
}

.result-passfail.fail {
  color: var(--wrong);
}

.result-criteria {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  text-align: left;
  margin-bottom: 1.25rem;
}

.criteria-heading {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.65rem;
  color: var(--text);
}

.result-criteria ul {
  list-style: none;
  padding: 0;
}

.result-criteria li {
  font-size: calc(var(--font-base) * 0.95);
  color: var(--text-muted);
  padding: 0.3rem 0;
  padding-left: 1rem;
  position: relative;
}

.result-criteria li::before {
  content: "·";
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 700;
}

.result-time {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.result-card .btn-lg {
  margin-top: 0.5rem;
}

.result-card .btn-lg + .btn-lg {
  margin-top: 0.65rem;
}

@media (max-width: 400px) {
  .round-grid,
  #jeonggi-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.35rem;
  }

  .round-btn {
    min-height: 52px;
  }

  .round-btn .round-num {
    font-size: 0.9rem;
  }

  #app {
    padding: 0.65rem;
    padding-top: 3rem;
  }

  .btn-nav {
    font-size: 0.85rem;
    padding: 0.7rem 0.35rem;
  }

  .btn-review-done {
    font-size: 0.72rem;
    padding: 0.4rem 0.5rem;
  }
}

@media (min-width: 376px) and (max-width: 480px) {
  #app {
    max-width: 100%;
  }
}
