/* === PIN JLPT — 디자인 시스템 === */
:root {
  --bg: #f6f5fb;
  --bg-2: #ffffff;
  --bg-3: #f0eef9;
  --ink: #1c1933;
  --ink-2: #4b476b;
  --ink-3: #8985a4;
  --line: #e7e4f1;
  --primary: #6c4cff;
  --primary-2: #4f2fe0;
  --accent: #ff7eb3;
  --mint: #6dd3b3;
  --indigo: #5764ec;
  --amber: #ffb547;
  --danger: #ef5b6b;
  --ok: #19b886;
  --shadow: 0 8px 24px rgba(33, 24, 80, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
}
[data-theme="dark"] {
  --bg: #15132a; --bg-2: #1d1a38; --bg-3: #252147;
  --ink: #f1eefb; --ink-2: #c8c3e0; --ink-3: #8c87a8;
  --line: #2e2a52; --primary: #9b85ff; --primary-2: #b8a6ff;
  --shadow: 0 8px 24px rgba(0,0,0,0.4);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased; line-height: 1.5;
}
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
i { font-style: normal; }

/* 키보드 포커스 표시. :focus 가 아니라 :focus-visible 이라 마우스 클릭 시에는 나타나지 않는다. */
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 8px;
}

/* 기기에서 "동작 줄이기"를 켠 사용자에게는 애니메이션을 없앤다 (멀미·어지럼 방지) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* iOS 텍스트 줌 방지 + safe-area 대응 (PWA) */
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
/* 스크롤바·기본 폼 컨트롤이 테마를 따라가게 한다 */
:root { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
/* PWA standalone에서 스크롤 점프 방지 */
.content { padding-bottom: max(60px, calc(60px + env(safe-area-inset-bottom))); }

/* === 레이아웃 === */
.app-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100dvh; }
.sidebar {
  background: linear-gradient(180deg, #221c4a 0%, #16123a 100%);
  color: #fff; padding: 22px 18px;
  display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100dvh;
}
.sidebar .brand { display: flex; flex-direction: column; align-items: flex-start;
  background: rgba(255,255,255,0.05); padding: 14px 16px; border-radius: var(--radius); color: #fff; }
.sidebar .brand .logo { font-size: 28px; }
.sidebar .brand b { font-size: 22px; letter-spacing: 0.04em; }
.sidebar .brand small { color: #b8b3da; font-size: 12px; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav button {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: 12px; color: #d2cdef; font-size: 15px; text-align: left; width: 100%; transition: all .15s;
}
.sidebar nav button i {
  width: 26px; height: 26px; display: grid; place-items: center;
  background: rgba(255,255,255,0.06); border-radius: 8px; font-size: 13px;
}
.sidebar nav button:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar nav button.active {
  background: linear-gradient(90deg, var(--primary) 0%, var(--indigo) 100%);
  color: #fff; box-shadow: 0 6px 18px rgba(108,76,255,0.45);
}
.sidebar nav button.active i { background: rgba(255,255,255,0.18); }
.sidebar-goal { margin-top: auto; background: rgba(255,255,255,0.05); border-radius: var(--radius); padding: 14px 16px; }
.goal-label { display: block; font-size: 11px; color: #b8b3da; letter-spacing: 0.18em; }
.sidebar-goal strong { font-size: 22px; display: block; margin: 4px 0 10px; }
.mini-track { height: 6px; background: rgba(255,255,255,0.08); border-radius: 999px; overflow: hidden; }
.mini-track i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--amber)); width: 0%; transition: width .3s; }
.content { padding: 28px 36px 60px; min-width: 0; }
.mobile-head { display: none; }

/* === 페이지 공통 === */
.page { display: flex; flex-direction: column; gap: 20px; max-width: 980px; margin: 0 auto; }
.page-head h1 { font-size: 28px; margin: 0 0 6px; letter-spacing: -0.01em; }
.page-head p { color: var(--ink-2); margin: 0; }
.section-title { font-size: 13px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.18em; margin: 6px 0 -4px; }
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }

/* === 오늘(홈) === */
.welcome { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.welcome h1 { font-size: 28px; margin: 0; }
.welcome p { color: var(--ink-2); margin: 0; }
.overview-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .overview-grid { grid-template-columns: 1fr; } }
.goal-card {
  background: linear-gradient(135deg, #6c4cff 0%, #5764ec 50%, #ff7eb3 100%);
  color: #fff; border-radius: 22px; padding: 24px; position: relative; overflow: hidden;
}
.goal-card::after { content: ''; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,0.08); }
.goal-card h2 { margin: 0 0 4px; font-size: 16px; opacity: 0.9; font-weight: 500; }
.goal-card .big { font-size: 42px; font-weight: 700; }
.goal-card small { opacity: 0.85; }
.goal-track { height: 10px; background: rgba(255,255,255,0.18); border-radius: 999px; margin: 14px 0; overflow: hidden; }
.goal-track i { display: block; height: 100%; background: linear-gradient(90deg, #fff, #ffe0b2); width: 0%; transition: width .4s; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .num { font-size: 30px; font-weight: 700; }
.stat .lbl { color: var(--ink-3); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
.streak .num { color: var(--amber); }
.action-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 760px) { .action-grid { grid-template-columns: repeat(2, 1fr); } }
.action-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 6px; text-align: left; transition: transform .15s, box-shadow .15s; }
.action-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.action-card .em { font-size: 26px; }
.action-card b { font-size: 15px; }
.action-card small { color: var(--ink-3); font-size: 12px; }
.bar-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.bar-row .name { width: 86px; color: var(--ink-2); font-size: 13px; }
.bar-row .bar { flex: 1; height: 8px; background: var(--bg-3); border-radius: 999px; overflow: hidden; }
.bar-row .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.bar-row .pct { width: 44px; text-align: right; color: var(--ink-2); font-size: 12px; }

/* === 학습(플래시카드) === */
.level-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.level-tabs button { padding: 10px 16px; min-height: 44px; min-width: 52px; border-radius: 999px; background: var(--bg-3); color: var(--ink-2); font-size: 14px; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.level-tabs button.active { background: var(--primary); color: #fff; }
.mode-switch { display: inline-flex; background: var(--bg-3); border-radius: 999px; padding: 4px; gap: 4px; }
.mode-switch button { padding: 10px 18px; min-height: 44px; min-width: 70px; border-radius: 999px; color: var(--ink-2); font-size: 14px; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.mode-switch button.on { background: var(--bg-2); color: var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,0.06); }
.study-wrap { display: flex; flex-direction: column; gap: 18px; }
.study-wrap.compact { gap: 14px; }    /* 한 화면에 다 보이게 */
.study-progress { display: flex; align-items: center; gap: 12px; }
.study-progress .track { flex: 1; height: 6px; background: var(--bg-3); border-radius: 999px; overflow: hidden; }
.study-progress .track i { display: block; height: 100%; background: var(--primary); width: 0%; transition: width .3s; }
.study-progress .counter { font-size: 13px; color: var(--ink-2); min-width: 60px; text-align: right; }
.flash-card { perspective: 1000px; height: 320px; position: relative; }
.flash-card .card-top { position: absolute; top: -38px; left: 0; right: 0; text-align: center; font-size: 12px; color: var(--ink-3); letter-spacing: 0.16em; text-transform: uppercase; }
.flash-card .inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.4,.2,.2,1); }
.flash-card.flipped .inner { transform: rotateY(180deg); }
.flash-card .face { position: absolute; inset: 0; backface-visibility: hidden; background: var(--bg-2); border: 1px solid var(--line); border-radius: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px; text-align: center; box-shadow: var(--shadow); }
.flash-card .back { transform: rotateY(180deg); background: linear-gradient(180deg, var(--bg-2), var(--bg-3)); }
.flash-card .word { font-size: 56px; font-weight: 700; letter-spacing: 0.02em; }
.flash-card .word.word-grammar { font-size: 30px; }                   /* 문법 패턴 */
.quiz-word { font-size: 48px; font-weight: 700; }                     /* 퀴즈 카드 단어 */
.flash-card .reading { color: var(--ink-2); font-size: 18px; margin-top: 6px; }
.flash-card .pos { color: var(--ink-3); font-size: 12px; margin-top: 4px; letter-spacing: 0.1em; }
.flash-card .meaning { font-size: 28px; font-weight: 600; }
.flash-card .example { margin-top: 14px; color: var(--ink-2); font-size: 15px; }
.flash-card .example mark.hl { background: rgba(255, 196, 0, 0.35); color: var(--ink); padding: 1px 4px; border-radius: 4px; font-weight: 600; box-shadow: inset 0 -2px 0 rgba(255, 152, 0, 0.5); }
.flash-card .word-recap { font-size: 16px; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px dashed var(--bg-3); }
.flash-card .example[data-spk] { cursor: pointer; display: inline-block; padding: 4px 8px; border-radius: 8px; transition: background 0.15s; }
.flash-card .example[data-spk]:hover { background: var(--bg-3); }
.flash-card .example[data-spk]:active { background: var(--primary); color: #fff; }
.flash-card .example-ko { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.flash-card .speak-btn { position: absolute; top: 16px; right: 16px; background: var(--bg-3); border-radius: 999px; padding: 8px 14px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.flash-card .speak-btn:hover { background: var(--primary); color: #fff; }
.flash-card .tap-hint { position: absolute; bottom: 12px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--ink-3); }
.answer-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.answer-buttons.two { grid-template-columns: repeat(2, 1fr); gap: 12px; }            /* 2지선다: 모르겠어요 / 알고있어요 */
.answer-buttons button { padding: 14px; border-radius: 12px; font-weight: 600; font-size: 13px; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink); }
.answer-buttons.two button { padding: 18px 16px; font-size: 15px; min-height: 56px; } /* 2지선다: 더 크게 */
.answer-buttons button:hover { transform: translateY(-1px); }
.answer-buttons button.bad { background: #fde7ea; color: var(--danger); border-color: #f6c1c8; }
.answer-buttons button.ok { background: #e1f6ee; color: var(--ok); border-color: #b6e8d4; }
.controls { display: flex; gap: 10px; justify-content: center; }
.primary-btn { padding: 12px 22px; border-radius: 12px; font-weight: 600; background: var(--primary); color: #fff; box-shadow: 0 6px 14px rgba(108,76,255,0.35); }
.primary-btn:hover { background: var(--primary-2); }
.primary-btn.big-btn { padding: 16px 24px; font-size: 16px; min-height: 52px; }
.ghost-btn { padding: 12px 22px; border-radius: 12px; font-weight: 600; background: var(--bg-3); color: var(--ink); }
.icon-btn { padding: 8px 10px; border-radius: 10px; background: var(--bg-3); font-size: 14px; }
.icon-btn.sound-toggle { font-size: 18px; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 6px 12px; }
.icon-btn.sound-toggle.off { background: var(--bg-2); opacity: 0.7; }
.study-mini-controls { display: flex; gap: 10px; justify-content: center; }
.study-mini-controls .icon-btn { width: 48px; height: 48px; display: grid; place-items: center; font-size: 20px; padding: 0; border-radius: 14px; }

/* === 고정 세트 진행도 === */
.set-progress { margin: 0 0 12px; padding: 10px 14px; background: var(--bg-2); border-radius: 12px; }
.set-progress-info { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.set-progress-info .set-label { font-weight: 700; color: var(--ink); background: var(--bg-3); padding: 3px 10px; border-radius: 8px; }
.set-progress-info .set-count b { color: var(--ink); font-size: 15px; }
.set-progress-info .set-mastered { margin-left: auto; opacity: 0.85; }
.set-progress-bar { height: 8px; background: var(--bg-3); border-radius: 999px; overflow: hidden; }
.set-progress-fill { height: 100%; background: linear-gradient(90deg, #4ade80, #22c55e); transition: width 0.3s ease; border-radius: 999px; }

/* === 세트 탭 === */
.set-tabs-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.set-tab { padding: 6px 12px; border-radius: 8px; background: var(--bg-2); color: var(--ink-2); font-size: 13px; font-weight: 600; border: 1px solid transparent; cursor: pointer; transition: all 0.15s ease; }
.set-tab:hover { background: var(--bg-3); }
.set-tab.current { background: var(--accent, #4ade80); color: #fff; }
.set-tab.done { color: var(--ink-2); opacity: 0.85; }
.set-tab.done.current { background: var(--accent, #4ade80); color: #fff; opacity: 1; }
.set-tab.locked { opacity: 0.4; cursor: not-allowed; background: var(--bg-2); }
.set-tab.locked:hover { background: var(--bg-2); }
.quiz-mini-score { font-size: 13px; color: var(--ink-2); padding: 6px 12px; background: var(--bg-3); border-radius: 999px; align-self: center; }

/* === 문법 === */
.grammar-card { display: flex; flex-direction: column; gap: 10px; }
.grammar-top { display: flex; justify-content: space-between; align-items: center; }
.grammar-top h3 { margin: 0; font-size: 18px; }
.grammar-top .pattern { background: var(--bg-3); padding: 4px 10px; border-radius: 8px; font-size: 12px; color: var(--ink-2); font-family: ui-monospace, monospace; }
.grammar-info .meaning { font-weight: 600; }
.grammar-info .note { color: var(--ink-3); font-size: 13px; margin-top: 4px; }
.grammar-copy { background: var(--bg-3); padding: 12px 16px; border-radius: 12px; font-size: 18px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.grammar-copy .ko { color: var(--ink-2); font-size: 13px; }

/* === 퀴즈 === */
.quiz-card { display: flex; flex-direction: column; gap: 18px; }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .quiz-options { grid-template-columns: 1fr; } }
.quiz-options button { padding: 18px; border-radius: 14px; font-size: 16px; text-align: left; background: var(--bg-2); border: 2px solid var(--line); color: var(--ink); font-weight: 500; transition: all .15s; }
.quiz-options button:hover { border-color: var(--primary); }
.quiz-options button.selected { border-color: var(--primary); background: rgba(108,76,255,0.06); }
.quiz-options button.correct { border-color: var(--ok); background: #e1f6ee; color: var(--ok); }
.quiz-options button.wrong { border-color: var(--danger); background: #fde7ea; color: var(--danger); }
.feedback { padding: 14px 18px; border-radius: 12px; font-size: 14px; }
.feedback.ok { background: #e1f6ee; color: var(--ok); }
.feedback.bad { background: #fde7ea; color: var(--danger); }
.quiz-page { max-width: 720px; margin: 0 auto; }

/* === 복습 === */
.stage-toolbar { display: flex; gap: 10px; flex-wrap: wrap; }
.segmented { display: inline-flex; background: var(--bg-3); border-radius: 12px; padding: 3px; }
.segmented button { padding: 8px 14px; border-radius: 9px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.segmented button.on { background: var(--bg-2); color: var(--ink); }
.stepper { display: flex; gap: 8px; align-items: center; }
.stepper button { width: 32px; height: 32px; border-radius: 8px; background: var(--bg-3); font-weight: 700; }
.stepper span { min-width: 50px; text-align: center; font-weight: 600; }

/* === 한자 필기 === */
.kanji-board { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.kanji-board canvas { background: #fff; border: 2px dashed var(--line); border-radius: 18px; width: 280px; height: 280px; touch-action: none; background-image: linear-gradient(rgba(108,76,255,0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(108,76,255,0.06) 1px, transparent 1px); background-size: 28px 28px; }
[data-theme="dark"] .kanji-board canvas { background: var(--bg-2); border-color: var(--line); }
.kanji-prompt { font-size: 14px; color: var(--ink-2); }
.kanji-prompt .target { font-size: 22px; font-weight: 600; }

/* === 저장 === */
.collection-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.collection-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.collection-actions .danger-row { margin-left: auto; }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }

/* === 설정 === */
.settings-card { display: flex; flex-direction: column; gap: 0; }
.setting-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .label b { display: block; font-size: 14px; }
.setting-row .label small { color: var(--ink-3); font-size: 12px; }
.switch { width: 46px; height: 26px; background: var(--bg-3); border-radius: 999px; position: relative; transition: background .15s;
  /* <button> 으로 바뀌어도 크기가 변하지 않도록 기본값을 눌러둔다 */
  flex: 0 0 auto; padding: 0; display: block; -webkit-appearance: none; appearance: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.2); transition: left .15s; }
.switch.on { background: var(--primary); }
.switch.on::after { left: 23px; }

/* === 토스트 === */
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px); background: #1c1933; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .3s; z-index: 100; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* === 모바일 === */
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: 12px 14px 100px; }
  .page { gap: 12px; }                                          /* 페이지 간격 축소 → 스크롤 줄이기 */
  .mobile-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 0 12px; }
  .mobile-head .brand.compact { display: flex; gap: 8px; align-items: center; padding: 8px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; }
  .mobile-head .brand.compact b { letter-spacing: 0.06em; }
  .mobile-goal { font-size: 13px; color: var(--ink-2); background: var(--bg-2); padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; }
  .bottom-nav { position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px)); display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; box-shadow: 0 10px 30px rgba(33,24,80,0.15); z-index: 50; }
  .bottom-nav button { display: flex; flex-direction: column; gap: 1px; align-items: center; padding: 6px 2px; border-radius: 12px; font-size: 9px; color: var(--ink-3); min-width: 0; }
  .bottom-nav button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .bottom-nav button i { width: 24px; height: 24px; display: grid; place-items: center; background: var(--bg-3); border-radius: 8px; font-size: 12px; }
  .bottom-nav button.active { color: var(--primary); }
  .bottom-nav button.active i { background: var(--primary); color: #fff; }
  /* === 학습/복습 카드: 한 화면에 다 보이게 === */
  .flash-card { height: 280px; }                                  /* 카드 높이 줄임 (320→280) */
  .flash-card .card-top { top: -22px; font-size: 10px; letter-spacing: 0.12em; }
  .flash-card .face { padding: 16px; }
  .flash-card .word { font-size: 42px; }
  .flash-card .word.word-grammar { font-size: 20px; }
  .flash-card .reading { font-size: 15px; }
  .flash-card .pos { font-size: 12px; }
  .flash-card .meaning { font-size: 22px; }
  .flash-card .example { font-size: 13px; }
  .flash-card .example-ko { font-size: 12px; }
  .flash-card .speak-btn { top: 10px; right: 10px; padding: 6px 10px; font-size: 12px; }
  .flash-card .tap-hint { bottom: 8px; font-size: 10px; }
  .quiz-word { font-size: 32px; }
  .answer-buttons.two button { padding: 14px 12px; font-size: 14px; min-height: 48px; }   /* 2지선다 모바일 */
  .study-wrap.compact { gap: 10px; }
  .study-mini-controls .icon-btn { width: 42px; height: 42px; font-size: 18px; }
  /* === 툴바: 한 줄에 다 들어가게 (히트박스 크게 유지) === */
  .level-tabs { padding: 3px; gap: 4px; }
  .level-tabs button { padding: 10px 12px; min-height: 44px; min-width: 48px; font-size: 13px; }
  .mode-switch { padding: 3px; }
  .mode-switch button { padding: 10px 14px; min-height: 44px; min-width: 64px; font-size: 13px; }
  .quiz-mini-score { font-size: 11px; padding: 4px 8px; }
  .action-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .action-card { padding: 10px 8px; }
  .action-card .em { font-size: 18px; }
  .action-card b { font-size: 11px; }
  .action-card small { font-size: 10px; }
  .stage-toolbar { flex-direction: column; align-items: stretch; }
  .stage-toolbar > * { width: 100%; }
  .stage-toolbar .level-tabs, .stage-toolbar .mode-switch { justify-content: center; }
  .collection-grid { grid-template-columns: 1fr; }
  .welcome h1 { font-size: 20px; }
  .page-head h1 { font-size: 20px; }
  .page-head p { font-size: 12px; }
  .goal-card { padding: 16px; }
  .goal-card .big { font-size: 30px; }
  .stat .num { font-size: 22px; }
  .feedback { padding: 10px 12px; font-size: 12px; }
  .quiz-page .card { padding: 16px; }
  .quiz-options button { padding: 12px; font-size: 13px; }
  .controls { gap: 8px; }
  .primary-btn, .ghost-btn { padding: 10px 16px; font-size: 13px; }
}

/* === 작은 모바일 (Galaxy S22 등 360px 이하) === */
@media (max-width: 380px) {
  .bottom-nav { padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); }
  .bottom-nav button { font-size: 8px; padding: 4px 1px; }
  .bottom-nav button i { width: 22px; height: 22px; font-size: 11px; }
  .flash-card { height: 260px; }
  .flash-card .word { font-size: 36px; }
  .flash-card .word.word-grammar { font-size: 17px; }
  .content { padding: 10px 12px 90px; }
  .answer-buttons.two button { padding: 12px 8px; font-size: 13px; min-height: 44px; }
}

/* === 유틸 === */
.row { display: flex; gap: 10px; align-items: center; }
.gap-12 { gap: 12px; }
.between { justify-content: space-between; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.text-mute { color: var(--ink-3); }
.hidden { display: none !important; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--bg-3); color: var(--ink-2); font-size: 11px; font-weight: 600; }
.badge.ok { background: #e1f6ee; color: var(--ok); }
.badge.bad { background: #fde7ea; color: var(--danger); }
