:root {
  --bg-1: #fff7fb;
  --bg-2: #f3e8ff;
  --bg-radial-1: rgba(255, 228, 242, 0.95);
  --bg-radial-2: rgba(233, 213, 255, 0.9);
  --ink: #2b2440;
  --muted: #6b5f8a;
  --card: rgba(255, 255, 255, 0.85);
  --card-border: rgba(255, 255, 255, 0.7);
  --card-glow: rgba(255, 160, 210, 0.22);
  --shadow: 0 20px 45px rgba(124, 90, 255, 0.18);
  --ring: 0 0 0 4px rgba(255, 160, 210, 0.35);
  --accent: #ff7ab6;
  --accent-strong: #ff4fa0;
  --ghost: #ffffff;
  --ghost-border: rgba(116, 90, 255, 0.18);
  --result-bg: rgba(255, 255, 255, 0.7);
  --result-border: rgba(139, 92, 246, 0.25);
  --input-bg: rgba(255, 255, 255, 0.92);
  --input-border: rgba(116, 90, 255, 0.2);
  --input-border-focus: rgba(255, 122, 182, 0.55);
  --input-shadow: 0 10px 18px rgba(80, 60, 170, 0.08);
  
  /* Quiz styles variables */
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --bg-secondary: #f8fafc;
  --border-color: #e2e8f0;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
}

:root[data-theme="dark"] {
  --bg-1: #0f1020;
  --bg-2: #1a1630;
  --bg-radial-1: rgba(255, 122, 182, 0.18);
  --bg-radial-2: rgba(139, 92, 246, 0.22);
  --ink: #f7f4ff;
  --muted: #c9c2ea;
  --card: rgba(24, 22, 45, 0.88);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-glow: rgba(255, 122, 182, 0.18);
  --shadow: 0 24px 60px rgba(8, 7, 24, 0.6);
  --ring: 0 0 0 4px rgba(255, 122, 182, 0.25);
  --ghost: #1c1a33;
  --ghost-border: rgba(255, 255, 255, 0.12);
  --result-bg: rgba(30, 27, 56, 0.78);
  --result-border: rgba(196, 181, 253, 0.38);
  --input-bg: rgba(24, 22, 45, 0.92);
  --input-border: rgba(255, 255, 255, 0.12);
  --input-border-focus: rgba(255, 122, 182, 0.6);
  --input-shadow: 0 14px 26px rgba(8, 7, 24, 0.55);
  
  /* Quiz styles variables - dark mode */
  --primary-color: #60a5fa;
  --primary-hover: #3b82f6;
  --bg-secondary: #1e293b;
  --border-color: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
}

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

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Pretendard", "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at -10% -20%, var(--bg-radial-1) 0%, transparent 60%),
    radial-gradient(1000px 500px at 120% 10%, var(--bg-radial-2) 0%, transparent 65%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2));
  display: grid;
  place-items: center;
  padding: 24px;
  transition: background 220ms ease, color 220ms ease;
}

.app {
  width: min(720px, 100%);
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 28px;
  padding: 36px clamp(20px, 4vw, 44px) 40px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  overflow: hidden;
  transition: background-color 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.topik-app {
  width: min(920px, 100%);
}

.topik-card {
  padding: 28px clamp(16px, 4vw, 40px) 32px;
}

.topik-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.topik-title {
  margin: 0;
  text-align: center;
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 800;
}

.topik-header-actions {
  display: flex;
  justify-content: flex-end;
}

.topik-section-bar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.topik-exam-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topik-exam-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.exam-history-btn {
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--ghost-border);
  background: var(--ghost);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-strong);
  cursor: pointer;
}

.exam-history-btn:hover {
  background: rgba(255, 122, 182, 0.1);
  border-color: rgba(255, 122, 182, 0.4);
}

.topik-section-pills {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.topik-section-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--ghost-border);
  background: var(--ghost);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  min-height: 42px;
  cursor: pointer;
}

.topik-section-pill.is-active {
  border-color: rgba(34, 197, 94, 0.6);
  background: rgba(34, 197, 94, 0.15);
}

.pill-nav-icon {
  opacity: 0.5;
  font-size: 16px;
  transition: opacity 0.2s ease;
}

.topik-section-pill:hover .pill-nav-icon {
  opacity: 0.8;
}

.topik-section-pill.is-active .pill-nav-icon {
  opacity: 0.9;
}

.topik-section-time {
  font-size: 12px;
  color: var(--muted);
}

.topik-section-count {
  justify-self: end;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.12);
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
}

.topik-body {
  display: grid;
  gap: 14px;
}

.exam-select {
  display: grid;
  gap: 12px;
  text-align: center;
  padding: 20px 12px;
}

.exam-select-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.exam-select-subtitle {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}

.exam-select-legend {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.exam-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.exam-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exam-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 14px;
  border-radius: 16px;
  border: 1px solid var(--ghost-border);
  background: var(--ghost);
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 120ms ease;
  min-height: 90px;
}

.exam-card-history-btn {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--ghost-border);
  background: var(--ghost);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-light);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  white-space: nowrap;
}

.exam-card-history-btn:hover:not(:disabled) {
  border-color: rgba(116, 90, 255, 0.38);
  background: rgba(116, 90, 255, 0.05);
  color: var(--ink);
}

.exam-card-history-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.exam-option:hover {
  border-color: rgba(116, 90, 255, 0.38);
  transform: translateY(-1px);
}

.exam-option.is-selected {
  border-color: rgba(255, 122, 182, 0.7);
  background: rgba(255, 122, 182, 0.16);
  box-shadow: 0 12px 22px rgba(255, 122, 182, 0.18);
}

/* 완료 항목 선택 시: 초록 v 유지, 배경만 pink */
.exam-option.is-completed.is-selected {
  border-color: rgba(255, 122, 182, 0.7);
  background: rgba(255, 122, 182, 0.16);
  box-shadow: 0 12px 22px rgba(255, 122, 182, 0.18);
}

.exam-option-title {
  font-size: 14px;
  letter-spacing: 0.02em;
}

.exam-option-round {
  font-size: 22px;
  font-weight: 800;
}

.exam-option.is-locked {
  color: var(--muted);
  border-style: dashed;
  cursor: not-allowed;
  position: relative;
}

.exam-option-lock {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 14px;
  opacity: 0.75;
  pointer-events: none;
}

.exam-option.is-locked.is-locked-active {
  transform: translateY(-1px) scale(0.98);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.08);
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.12);
}

.exam-option.is-locked.is-locked-active {
  animation: lock-flash 240ms ease-out;
}

@keyframes lock-flash {
  0% {
    background: rgba(245, 158, 11, 0.26);
  }
  100% {
    background: rgba(245, 158, 11, 0.12);
  }
}

.exam-option.is-locked.is-locked-active .exam-option-lock {
  color: rgba(234, 179, 8, 0.9);
  text-shadow: 0 0 12px rgba(250, 204, 21, 0.45);
}

.exam-option.is-completed {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.08);
}

.exam-option-check {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 14px;
  color: #22c55e;
  font-weight: 700;
}

/* 140점 이상: 골드 배경·체크, 왕관 아이콘 */
.exam-option.is-gold {
  border-color: rgba(212, 175, 55, 0.6);
  background: rgba(212, 175, 55, 0.12);
}

.exam-option.is-gold .exam-option-check {
  color: #d4af37;
  top: 22px;
  right: 10px;
}

.exam-option.is-gold.is-selected {
  border-color: rgba(255, 122, 182, 0.7);
  background: rgba(255, 122, 182, 0.16);
  box-shadow: 0 12px 22px rgba(255, 122, 182, 0.18);
}

.exam-option.is-gold.is-selected .exam-option-check {
  color: #d4af37;
}

.exam-option-crown {
  position: absolute;
  top: 5px;
  right: 6px;
  width: 20px;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}

/* 최고총점 79점 이하: 붉은오렌지 배경, 체크 자리에 붉은 느낌표 */
.exam-option.is-low-score {
  border-color: rgba(234, 88, 12, 0.55);
  background: rgba(234, 88, 12, 0.1);
}

.exam-option-warn {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 16px;
  font-weight: 800;
  color: #ea580c;
  line-height: 1;
}

.exam-option.is-low-score.is-selected {
  border-color: rgba(255, 122, 182, 0.7);
  background: rgba(255, 122, 182, 0.16);
  box-shadow: 0 12px 22px rgba(255, 122, 182, 0.18);
}

.exam-option.is-low-score.is-selected .exam-option-warn {
  color: #ea580c;
}

/* 연습모드만 응시: 하늘색 배경, 책 아이콘 */
.exam-option.is-practice-only {
  border-color: rgba(14, 165, 233, 0.5);
  background: rgba(14, 165, 233, 0.1);
}

.exam-option-book {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 16px;
  line-height: 1;
  pointer-events: none;
}

.exam-option.is-practice-only.is-selected {
  border-color: rgba(255, 122, 182, 0.7);
  background: rgba(255, 122, 182, 0.16);
  box-shadow: 0 12px 22px rgba(255, 122, 182, 0.18);
}

.result-recommendation {
  margin-top: 16px;
  padding: 14px 16px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
}

.result-recommendation::before {
  content: "📚 학습 추천";
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
  color: #6366f1;
}

.topik-prompt {
  margin: 0;
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
}

.topik-panel {
  background: var(--result-bg);
  border: 1px solid var(--result-border);
  border-radius: 18px;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}

.topik-audio-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.audio-control {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 56px;
}

.audio-progress-text {
  font-size: 11px;
  color: var(--text-secondary);
  min-height: 14px;
  line-height: 1;
}

.audio-progress-text[data-status="ready"] {
  color: #16a34a;
}

.audio-progress-text[data-status="error"] {
  color: #ef4444;
}

.audio-progress-text[data-status="default"]:not(:empty),
.audio-progress-text[data-status="loading"],
.audio-progress-text[data-status="error"] {
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.speed-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--ghost-border);
  background: var(--ghost);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.speed-label {
  color: var(--muted);
}

.speed-range {
  width: 120px;
  accent-color: var(--accent);
}

.speed-value {
  min-width: 38px;
  text-align: right;
}

.topik-stem {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.5;
}

.topik-single-image {
  display: none;
  max-width: 720px;
  margin: 14px auto 0;
  text-align: center;
}

.topik-single-image.is-visible {
  display: block;
}

.topik-single-image img {
  max-width: min(520px, 100%);
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.28);
}

.topik-options {
  max-width: 640px;
}

.topik-explain {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.topik-explain-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topik-explain-head .quiz-input {
  max-width: 220px;
}

.card::after {
  content: "";
  position: absolute;
  inset: -40% auto auto -30%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, var(--card-glow), transparent 70%);
  pointer-events: none;
  transform: rotate(12deg);
}

.badge {
  display: inline-block;
  margin: 0 0 12px;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.3px;
  color: #a83a73;
  background: linear-gradient(120deg, #ffd6ec, #ffe9f6);
  border: 1px solid rgba(255, 122, 182, 0.35);
  box-shadow: 0 10px 18px rgba(255, 122, 182, 0.2);
}

.title {
  margin: 4px 0 8px;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.subtitle {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 15px;
}

.controls {
  display: flex;
  gap: 10px;
  margin-bottom: 26px;
}

button {
  border: 0;
  cursor: pointer;
  font-weight: 700;
  transition: transform 120ms ease, box-shadow 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

button:active {
  transform: translateY(1px) scale(0.995);
}

button:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.theme-btn {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0;
  min-width: 2.5em;
  color: var(--ink);
  background: var(--ghost);
  border: 1px solid var(--ghost-border);
  box-shadow: 0 8px 16px rgba(80, 60, 170, 0.12);
  position: relative;
}

.theme-btn::before {
  content: '🌙';
  font-size: 18px;
  display: inline-block;
  line-height: 1;
}

:root[data-theme="dark"] .theme-btn::before {
  content: '☀️';
}

.theme-btn:hover {
  border-color: rgba(116, 90, 255, 0.38);
}

.generate-btn {
  flex: 1;
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 16px;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow:
    0 14px 26px rgba(255, 79, 160, 0.28),
    inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.generate-btn:hover {
  filter: brightness(1.02);
  box-shadow:
    0 18px 30px rgba(255, 79, 160, 0.32),
    inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.ghost-btn {
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 15px;
  color: var(--ink);
  background: var(--ghost);
  border: 1px solid var(--ghost-border);
  box-shadow: 0 10px 18px rgba(80, 60, 170, 0.08);
}

.ghost-btn:hover {
  border-color: rgba(116, 90, 255, 0.32);
  background: #ffffff;
}

.result {
  padding: 18px;
  border-radius: 22px;
  background: var(--result-bg);
  border: 1px dashed var(--result-border);
  transition: background-color 220ms ease, border-color 220ms ease;
}

/* Admin Menu */
.admin-menu-wrap {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

.admin-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}

.admin-menu-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.inquiry-btn-wrap {
  margin-top: 22px;
  display: flex;
  justify-content: center;
}

.inquiry-btn {
  padding: 14px 28px;
  border-radius: 16px;
  font-size: 15px;
  color: var(--ink);
  background: var(--ghost);
  border: 1px solid var(--ghost-border);
  box-shadow: 0 10px 18px rgba(80, 60, 170, 0.08);
}

.inquiry-btn:hover {
  border-color: rgba(116, 90, 255, 0.32);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  animation: fadeIn 200ms ease;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal {
  width: min(480px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  padding: 0;
  border-radius: 22px;
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  animation: slideUp 300ms cubic-bezier(0.2, 0.7, 0.2, 1);
  display: flex;
  flex-direction: column;
}

/* Wrong Note Modal Specific */
.wrong-note-modal {
  max-height: calc(100vh - 96px);
}

/* History Modal Specific */
.history-modal {
  max-height: calc(100vh - 96px);
}

.modal-sticky-header {
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 10;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--card-border);
  flex-shrink: 0;
}

.modal-scrollable-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 24px;
}

.modal-scrollable-content::-webkit-scrollbar {
  width: 8px;
}

.modal-scrollable-content::-webkit-scrollbar-track {
  background: transparent;
}

.modal-scrollable-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.modal-scrollable-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

.wrong-note-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 24px;
}

.wrong-note-content::-webkit-scrollbar {
  width: 8px;
}

.wrong-note-content::-webkit-scrollbar-track {
  background: transparent;
}

.wrong-note-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.wrong-note-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

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

.modal-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  background: var(--result-bg);
  border-color: var(--ghost-border);
}

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

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.comments {
  margin-top: 22px;
  padding: 18px;
  border-radius: 22px;
  background: var(--result-bg);
  border: 1px dashed var(--result-border);
  transition: background-color 220ms ease, border-color 220ms ease;
}

.comments-head {
  margin-bottom: 8px;
}

.comments-title {
  margin: 2px 2px 4px;
  font-size: 18px;
  letter-spacing: -0.2px;
}

.comments-subtitle {
  margin: 0 2px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.disqus-thread {
  min-height: 120px;
}

#disqus_thread .placeholder-label {
  display: none !important;
}

.disqus-hint {
  margin: 10px 2px 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.inquiry-head {
  margin-bottom: 12px;
}

.inquiry-title {
  margin: 2px 2px 4px;
  font-size: 18px;
  letter-spacing: -0.2px;
}

.inquiry-subtitle {
  margin: 0 2px 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.inquiry-form {
  display: grid;
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  margin-left: 4px;
}

.field-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--input-shadow);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 200ms ease, color 200ms ease;
}

.field-input::placeholder {
  color: var(--muted);
  opacity: 0.9;
}

.field-input:focus-visible {
  outline: none;
  border-color: var(--input-border-focus);
  box-shadow: var(--ring);
}

.field-textarea {
  resize: vertical;
  min-height: 110px;
}

.submit-btn {
  margin-top: 2px;
  padding: 13px 16px;
  border-radius: 16px;
  font-size: 15px;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow:
    0 14px 26px rgba(255, 79, 160, 0.28),
    inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.submit-btn:hover {
  filter: brightness(1.02);
  box-shadow:
    0 18px 30px rgba(255, 79, 160, 0.32),
    inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.balls {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.ball {
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 800;
  color: white;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
  position: relative;
  isolation: isolate;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow:
    inset 0 -4px 0 rgba(0, 0, 0, 0.12),
    0 14px 22px rgba(124, 90, 255, 0.18);
  transform: translateY(6px) scale(0.96);
  opacity: 0;
  animation: pop 500ms cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

.ball::after {
  content: "";
  position: absolute;
  inset: 8px auto auto 10px;
  width: 18px;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  filter: blur(0.2px);
  z-index: -1;
}

.ball.delay-1 { animation-delay: 40ms; }
.ball.delay-2 { animation-delay: 90ms; }
.ball.delay-3 { animation-delay: 140ms; }
.ball.delay-4 { animation-delay: 190ms; }
.ball.delay-5 { animation-delay: 240ms; }

.ball.range-1 { background: linear-gradient(160deg, #ffd166, #ffb703); }
.ball.range-2 { background: linear-gradient(160deg, #7bdff2, #48bfe3); }
.ball.range-3 { background: linear-gradient(160deg, #b8f2a1, #7ad66d); }
.ball.range-4 { background: linear-gradient(160deg, #cdb4ff, #9b5de5); }
.ball.range-5 { background: linear-gradient(160deg, #ffadad, #ff6392); }

.result-text {
  margin: 6px 4px 2px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}

@keyframes pop {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.92) rotate(-2deg);
  }
  60% {
    opacity: 1;
    transform: translateY(-4px) scale(1.04) rotate(1deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0);
  }
}

@media (max-width: 560px) {
  .card {
    padding: 30px 20px 34px;
    border-radius: 24px;
  }

  .balls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

/* Landing Page */
.landing-card {
  text-align: center;
}

.landing-hero {
  margin-bottom: 32px;
}

.landing-badge {
  display: inline-block;
  margin: 0 0 16px;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.5px;
  color: #7c3aed;
  background: linear-gradient(120deg, #e9d5ff, #f3e8ff);
  border: 1px solid rgba(139, 92, 246, 0.3);
  box-shadow: 0 10px 20px rgba(139, 92, 246, 0.15);
}

:root[data-theme="dark"] .landing-badge {
  color: #c4b5fd;
  background: linear-gradient(120deg, rgba(139, 92, 246, 0.25), rgba(167, 139, 250, 0.2));
  border-color: rgba(167, 139, 250, 0.3);
}

.landing-title {
  margin: 0 0 16px;
  font-size: clamp(42px, 10vw, 72px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -2px;
  background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 45%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.landing-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  font-weight: 500;
}

/* Menu Grid */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.menu-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 16px;
  border-radius: 20px;
  background: var(--result-bg);
  border: 1px solid var(--result-border);
  text-decoration: none;
  color: inherit;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.menu-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(139, 92, 246, 0.15);
  border-color: var(--accent);
}

.menu-card--coming {
  opacity: 0.6;
  cursor: default;
}

.menu-card--coming:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--result-border);
}

.menu-icon {
  font-size: 36px;
  line-height: 1;
}

.menu-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.menu-desc {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

/* Back Link */
.back-link {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  background: var(--ghost);
  border: 1px solid var(--ghost-border);
  text-decoration: none;
  transition: border-color 160ms ease;
}

.back-link:hover {
  border-color: rgba(116, 90, 255, 0.38);
}

.theme-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.theme-row:has(.back-link) {
  justify-content: space-between;
}

.theme-row-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Language Selector */
.lang-selector {
  position: relative;
  z-index: 100;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--ghost);
  border: 1px solid var(--ghost-border);
  box-shadow: 0 8px 16px rgba(80, 60, 170, 0.12);
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn:hover {
  border-color: rgba(116, 90, 255, 0.38);
  transform: translateY(-1px);
}

.lang-flag-img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  border-radius: 2px;
  display: inline-block;
  vertical-align: middle;
}

.lang-text {
  font-size: 13px;
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  padding: 8px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
  z-index: 9999;
}

/* 다크모드 */
[data-theme="dark"] .lang-menu {
  background: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.lang-option:hover {
  background: var(--ghost);
}

.lang-option.active {
  background: rgba(116, 90, 255, 0.15);
  color: var(--accent);
  font-weight: 600;
}

.lang-option .lang-flag-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 3px;
}

.lang-name {
  flex: 1;
}

/* Quiz specific styles */
.quiz-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  padding: 20px;
}

.quiz-title {
  font-size: clamp(24px, 5vw, 36px);
  font-weight: 700;
  margin-bottom: 10px;
}

.quiz-meta {
  width: 100%;
  max-width: 560px;
  display: grid;
  gap: 8px;
  margin-bottom: 4px;
}

.quiz-user {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.quiz-user-name {
  color: var(--ink);
  font-size: 15px;
}

.quiz-type-name {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  color: var(--ink);
  background: var(--result-bg);
  border: 1px solid var(--result-border);
}

.quiz-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.stat-chip {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  border: 1px solid transparent;
  background: var(--result-bg);
  color: var(--ink);
}

.stat-correct {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.12);
}

.stat-wrong {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.12);
}

.quiz-mini-btn {
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  background: var(--ghost);
  border: 1px solid var(--ghost-border);
  box-shadow: 0 8px 14px rgba(80, 60, 170, 0.08);
}

.quiz-mini-btn:hover {
  border-color: rgba(116, 90, 255, 0.38);
}

.quiz-question {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 15px;
}

.quiz-question-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.quiz-word-display {
  font-size: clamp(36px, 8vw, 60px);
  font-weight: 800;
  color: var(--ink);
  margin: 0;
  user-select: text;
}

.quiz-pos-display {
  font-size: clamp(16px, 3vw, 24px);
  color: var(--muted);
  margin: 0;
}

.quiz-answer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 400px;
}

.quiz-options {
  width: 100%;
  max-width: 520px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 4px auto 0;
}

.quiz-option-wrap {
  display: flex;
  gap: 6px;
}

.quiz-option {
  flex: 1;
  padding: 14px 12px;
  border-radius: 16px;
  border: 1px solid var(--ghost-border);
  background: var(--ghost);
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 10px 18px rgba(80, 60, 170, 0.08);
  transition: transform 120ms ease, border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.quiz-option:hover {
  border-color: rgba(116, 90, 255, 0.38);
  transform: translateY(-1px);
}

.quiz-option.selected {
  border-color: rgba(255, 122, 182, 0.7);
  background: rgba(255, 122, 182, 0.16);
  box-shadow: 0 12px 22px rgba(255, 122, 182, 0.18);
}

.quiz-option:disabled {
  cursor: default;
  opacity: 0.92;
  transform: none;
}

.quiz-option.correct {
  border-color: rgba(34, 197, 94, 0.6);
  background: rgba(34, 197, 94, 0.18);
  box-shadow: 0 12px 22px rgba(34, 197, 94, 0.2);
}

.quiz-option.wrong {
  border-color: rgba(239, 68, 68, 0.6);
  background: rgba(239, 68, 68, 0.16);
  box-shadow: 0 12px 22px rgba(239, 68, 68, 0.18);
}

.quiz-option.image-option {
  padding: 10px;
  display: grid;
  place-items: center;
}

.image-option-img {
  width: 100%;
  height: auto;
  max-height: 180px;
  object-fit: contain;
  border-radius: 12px;
}

.speak-btn {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--ghost-border);
  background: var(--ghost);
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 14px rgba(80, 60, 170, 0.08);
}

.speak-btn:hover {
  border-color: rgba(116, 90, 255, 0.38);
}

.speak-btn.speak-mini {
  padding: 12px;
  min-width: 46px;
}

.quiz-input {
  width: 100%;
  padding: 12px 18px;
  border-radius: 14px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  box-shadow: var(--input-shadow);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 200ms ease, color 200ms ease;
}

.quiz-input::placeholder {
  color: var(--muted);
  opacity: 0.9;
}

.quiz-input:focus-visible {
  outline: none;
  border-color: var(--input-border-focus);
  box-shadow: var(--ring);
}

.quiz-btn {
  width: 100%;
  padding: 13px 16px;
  border-radius: 16px;
  font-size: 15px;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow:
    0 14px 26px rgba(255, 79, 160, 0.28),
    inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.quiz-btn:hover {
  filter: brightness(1.02);
  box-shadow:
    0 18px 30px rgba(255, 79, 160, 0.32),
    inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.quiz-btn.secondary { /* For Next Word, Back to Main */
  color: var(--ink);
  background: var(--ghost);
  border: 1px solid var(--ghost-border);
  box-shadow: 0 10px 18px rgba(80, 60, 170, 0.08);
}

.quiz-btn.secondary:hover {
  border-color: rgba(116, 90, 255, 0.32);
  background: #ffffff;
  filter: none;
}

.quiz-feedback {
  margin: 15px 0;
  font-size: 18px;
  font-weight: 700;
  min-height: 25px; /* Prevent layout shift */
}

.example-box {
  width: 100%;
  max-width: 620px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px dashed var(--result-border);
  background: var(--result-bg);
  display: grid;
  gap: 6px;
  text-align: left;
}

.example-title {
  margin: 0;
  font-size: 14px;
  font-weight: 900;
  color: var(--muted);
}

.example-sentence {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.5;
  text-align: center;
}

.example-translation {
  margin: 8px 0 0 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  font-style: italic;
  text-align: center;
}

.wrong-note {
  width: 100%;
  max-width: 620px;
  padding: 16px;
  border-radius: 18px;
  border: 1px dashed var(--result-border);
  background: var(--result-bg);
  display: grid;
  gap: 10px;
}

.wrong-note-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.wrong-note-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wrong-note-title {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.2px;
}

.wrong-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.wrong-item {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--ghost-border);
  background: var(--ghost);
  text-align: left;
  box-shadow: 0 8px 14px rgba(80, 60, 170, 0.06);
}

.wrong-item-word {
  font-weight: 900;
  font-size: 18px;
  margin: 0 0 2px;
}

.wrong-item-meta {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 6px;
}

.wrong-item-answer {
  font-size: 13px;
  font-weight: 700;
  margin: 0;
}

.wrong-item-example {
  font-size: 13px; /* Slightly smaller than word/answer */
  color: var(--muted); /* Muted color for less emphasis */
  margin: 6px 0 0; /* Some top margin to separate from answer */
  line-height: 1.4;
  font-style: italic; /* Emphasize it's an example */
}

.wrong-empty {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.quiz-controls {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 520px;
  margin: 10px auto 0;
}

.quiz-controls .quiz-btn {
  flex: 1;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%) translateY(12px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(20, 16, 40, 0.9);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 50;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.center-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  padding: 24px 32px;
  border-radius: 16px;
  background: rgba(20, 16, 40, 0.95);
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  text-align: center;
  line-height: 1.6;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  opacity: 0;
  z-index: 9999;
  transition: opacity 300ms ease, transform 300ms ease;
}

.center-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.nav-modal {
  max-width: 560px;
}

.nav-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.nav-btn {
  padding: 10px 0;
  border-radius: 12px;
  border: 1px solid var(--ghost-border);
  background: var(--ghost);
  font-weight: 800;
  color: var(--ink);
}

.nav-btn.active {
  border-color: rgba(255, 122, 182, 0.7);
  background: rgba(255, 122, 182, 0.16);
}

.nav-btn.submitted {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.1);
}

.nav-btn.submitted.active {
  border-color: rgba(34, 197, 94, 0.7);
  background: rgba(34, 197, 94, 0.2);
}

.nav-check {
  display: block;
  font-size: 10px;
  color: #22c55e;
  margin-top: 2px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.submit-summary {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  color: var(--ink);
  font-weight: 600;
}

.submit-line {
  margin: 0;
  font-size: 14px;
}

.result-modal {
  max-width: 520px;
}

.result-card {
  border-radius: 16px;
  border: 1px solid var(--ghost-border);
  background: var(--ghost);
  padding: 16px;
  display: grid;
  gap: 8px;
}

.result-line {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.result-total {
  font-size: 16px;
}

.result-stats {
  display: flex;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--ghost-border);
}

.result-stat {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.result-stat strong {
  color: var(--accent-strong);
}

.history-modal {
  max-width: 480px;
}

.history-list {
  max-height: 320px;
  overflow-y: auto;
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.history-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--ghost-border);
  background: var(--ghost);
}

.history-item.is-best {
  border-color: rgba(255, 122, 182, 0.5);
  background: rgba(255, 122, 182, 0.08);
}

.history-rank {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.1);
  font-size: 12px;
  font-weight: 800;
}

.history-item.is-best .history-rank {
  background: var(--accent);
  color: #fff;
}

.history-info {
  display: grid;
  gap: 2px;
}

.history-score-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-score {
  font-weight: 700;
  font-size: 15px;
}

.history-mode {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

.history-mode.mode-practice {
  background: rgba(148, 163, 184, 0.15);
  color: #64748b;
}

.history-mode.mode-real {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.history-date {
  font-size: 12px;
  color: var(--muted);
}

.history-detail {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.history-feedback {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 122, 182, 0.08);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.5;
}

.history-item.is-expanded {
  border-color: rgba(255, 122, 182, 0.4);
}

.history-item:has(.history-feedback):hover {
  border-color: rgba(255, 122, 182, 0.3);
}

.back-home-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.user-gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 16, 40, 0.45);
  backdrop-filter: blur(6px);
}

.user-gate-card {
  width: min(420px, 100%);
  padding: 22px;
  border-radius: 20px;
  border: 1px solid var(--card-border);
  background: var(--card);
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
  text-align: center;
}

.user-gate-title {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.3px;
}

.user-gate-subtitle {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.user-gate-form {
  display: grid;
  gap: 8px;
}

.type-fieldset {
  margin: 2px 0 0;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--ghost-border);
  background: var(--result-bg);
  display: grid;
  gap: 6px;
  text-align: left;
}

.type-legend {
  padding: 0 6px;
  font-size: 13px;
  font-weight: 900;
  color: var(--ink);
}

.type-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: var(--ink);
  font-size: 14px;
}

.type-option input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

@media (max-width: 560px) {
  .quiz-input, .quiz-btn {
    font-size: 14px;
    padding: 10px 15px;
  }
  .quiz-title {
    font-size: 20px;
  }
  .quiz-word-display {
    font-size: 32px;
  }
  .quiz-pos-display {
    font-size: 14px;
  }

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

  .quiz-controls {
    flex-direction: column;
    max-width: 520px;
  }
}

/* ============================================
   Auth UI Styles
   ============================================ */

/* User Container */
.user-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-btn {
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.user-btn:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.user-avatar-placeholder {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ghost);
  border-radius: 50%;
  font-size: 16px;
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.user-status {
  font-size: 11px;
  color: #22c55e;
  font-weight: 500;
}

.user-btn-small {
  padding: 6px 12px;
  background: var(--ghost);
  color: var(--muted);
  border: 1px solid var(--ghost-border);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.user-btn-small:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Auth Modal */
.auth-modal {
  max-width: 400px;
  width: 90%;
}

.auth-content {
  padding: 8px 0;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-btn-google {
  background: #fff;
  color: #333;
  border: 1px solid #ddd;
}

.auth-btn-google:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

.auth-btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
}

.auth-btn-primary:hover {
  background: var(--accent-strong);
}

.auth-btn-secondary {
  background: var(--ghost);
  color: var(--muted);
  border: 1px solid var(--ghost-border);
}

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

.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--ghost-border);
}

.email-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-switch {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  margin: 8px 0;
}

.auth-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
}

.auth-link:hover {
  color: var(--accent-strong);
}

.auth-error {
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: #dc2626;
  font-size: 14px;
  text-align: center;
}

/* Email Verification */
.verification-notice {
  text-align: center;
  padding: 20px 0;
}

.verification-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.verification-notice h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--ink);
}

.verification-email {
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 8px;
}

.verification-desc {
  font-size: 14px;
  color: var(--ink-light);
  line-height: 1.5;
  margin-bottom: 24px;
}

/* Dark mode adjustments */
:root[data-theme="dark"] .auth-btn-google {
  background: var(--ghost);
  color: var(--ink);
  border-color: var(--ghost-border);
}

:root[data-theme="dark"] .auth-btn-google:hover {
  background: var(--input-bg);
}

:root[data-theme="dark"] .auth-error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* ============================================
   Mobile Responsive Styles - Header & UI
   ============================================ */

@media (max-width: 768px) {
  /* 시험 선택 UI */
  .exam-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .exam-option {
    padding: 16px 12px;
    gap: 6px;
    min-height: 85px;
  }

  .exam-option-title {
    font-size: 13px;
  }

  .exam-option-round {
    font-size: 20px;
  }

  .exam-card-history-btn {
    padding: 8px 10px;
    font-size: 12px;
  }

  .exam-select {
    padding: 16px 8px;
  }

  .exam-select-title {
    font-size: 18px;
  }

  .exam-select-subtitle {
    font-size: 13px;
  }

  /* 헤더 전체 간격 조정 */
  .theme-row {
    gap: 6px;
    padding: 0 4px;
  }

  .theme-row-right {
    gap: 6px;
  }

  /* 홈 아이콘 */
  .home-icon {
    font-size: 20px;
    line-height: 1;
  }

  .back-link {
    padding: 8px 10px;
    font-size: 0;
    min-width: auto;
  }

  .back-link .home-icon {
    font-size: 20px;
  }

  /* 사용자 프로필 - 이름만 표시 */
  .user-profile {
    gap: 6px;
  }

  .user-name {
    font-size: 13px;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .user-btn-small {
    padding: 6px 10px;
    font-size: 11px;
  }

  /* 언어 선택 버튼 - 텍스트 숨기기 */
  .lang-btn {
    padding: 8px;
    gap: 0;
    min-width: auto;
  }

  .lang-btn .lang-text {
    display: none;
  }

  .lang-flag-img {
    width: 22px;
    height: 22px;
  }

  /* 다크모드 버튼 - 아이콘만 */
  .theme-btn {
    padding: 8px 10px;
    font-size: 0;
    min-width: auto;
    position: relative;
  }

  .theme-btn::before {
    content: '🌙';
    font-size: 16px;
    display: inline-block;
  }

  :root[data-theme="dark"] .theme-btn::before {
    content: '☀️';
  }

  /* 버튼 로딩 중 표시 */
  .theme-btn[data-loading="true"]::after {
    content: '⏳';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
  }

  /* TOPIK 헤더 */
  .topik-header {
    gap: 8px;
    padding: 12px 8px;
  }

  .topik-title {
    font-size: 16px;
  }

  .topik-header-actions {
    gap: 6px;
  }

  /* 사용자 컨테이너 */
  .user-container {
    gap: 6px;
  }

  .user-btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  /* 로그인 버튼 */
  #loginBtn {
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* 더 작은 모바일 (360px 이하) */
@media (max-width: 360px) {
  .user-name {
    max-width: 60px;
  }

  .lang-flag-img {
    width: 20px;
    height: 20px;
  }

  .back-link,
  .theme-btn,
  .lang-btn {
    padding: 6px 8px;
  }

  .topik-title {
    font-size: 14px;
  }

  /* 시험 선택 UI - 소형 모바일 */
  .exam-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .exam-option {
    padding: 14px 10px;
    min-height: 80px;
  }

  .exam-option-title {
    font-size: 12px;
  }

  .exam-option-round {
    font-size: 18px;
  }

  .exam-card-history-btn {
    font-size: 11px;
    padding: 7px 8px;
  }
}
