/* ===== 기본 ===== */
:root {
  --orange: #ff6b35;
  --orange-dark: #e8521a;
  --ink: #1b2430;
  --muted: #6b7785;
  --bg: #f6f8fb;
  --card: #ffffff;
  --line: #e6eaf0;
  --green: #18a558;
  --red: #e23b3b;
  --shadow: 0 6px 24px rgba(20, 30, 50, 0.08);
  --radius: 16px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Noto Sans KR", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}
h1, h2, h3 { font-family: "Poppins", "Noto Sans KR", sans-serif; line-height: 1.25; }
button { font-family: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ===== 상단바 ===== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 22px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand .flag { font-size: 1.5rem; }
.brand-text { font-family: "Poppins", sans-serif; font-weight: 600; font-size: 1.15rem; }
.brand-text b { color: var(--orange); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-link {
  text-decoration: none; color: var(--muted); font-weight: 500;
  padding: 8px 14px; border-radius: 10px; transition: .15s;
}
.nav-link:hover { background: #eef1f6; color: var(--ink); }
.nav-link.active { background: var(--orange); color: #fff; }

/* 상단바 레벨 전환 */
.level-switch { display: inline-flex; gap: 2px; margin-left: 8px; background: #eef1f6; border-radius: 10px; padding: 3px; }
.ls-btn { border: none; background: none; padding: 6px 12px; border-radius: 8px; font-weight: 700; font-size: 0.82rem; color: var(--muted); }
.ls-btn.active { background: var(--orange); color: #fff; }

/* 히어로 레벨 토글 */
.level-toggle { display: flex; align-items: center; gap: 6px; margin-top: 16px; }
.lt-label { font-size: 0.85rem; color: #6a4a35; font-weight: 600; }
.lt-btn { border: 1px solid #ffd9bf; background: #fff; color: var(--orange-dark); padding: 6px 16px; border-radius: 999px; font-weight: 700; }
.lt-btn.active { background: var(--orange); color: #fff; border-color: var(--orange); }

/* ===== 레이아웃 ===== */
.container { max-width: 920px; margin: 0 auto; padding: 26px 18px 60px; }
.section-title { margin: 34px 0 14px; font-size: 1.25rem; }
.footer { text-align: center; padding: 24px; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--line); }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; margin-bottom: 10px; }
.footer-links a { color: var(--muted); text-decoration: none; font-weight: 600; }
.footer-links a:hover { color: var(--orange); text-decoration: underline; }

/* ===== 문서(약관/소개 등) 페이지 ===== */
.doc-top { display: flex; align-items: center; padding: 12px 22px; border-bottom: 1px solid var(--line); background: #fff; }
.doc { max-width: 760px; line-height: 1.7; }
.doc h1 { font-size: 1.8rem; margin: 8px 0 4px; }
.doc h2 { font-size: 1.2rem; margin: 26px 0 8px; }
.doc ul { padding-left: 22px; }
.doc li { margin: 6px 0; }
.doc a { color: var(--orange-dark); }
.doc hr { border: none; border-top: 1px solid var(--line); margin: 36px 0; }
.contact-email { font-size: 1.15rem; background: #fff4ee; border: 1px solid #ffd9bf; border-radius: 12px; padding: 14px 18px; }

/* ===== 광고 슬롯 ===== */
.ad-slot { margin: 20px auto; text-align: center; min-height: 0; overflow: hidden; }
.ad-label { display: block; font-size: 0.7rem; color: #b3bac4; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }

/* ===== 쿠키 동의 배너 ===== */
.consent {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 200;
  max-width: 760px; margin: 0 auto;
  background: var(--ink); color: #fff; border-radius: 14px;
  padding: 14px 18px; box-shadow: 0 10px 40px rgba(0,0,0,.25);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.consent p { margin: 0; font-size: 0.88rem; flex: 1 1 280px; line-height: 1.5; }
.consent a { color: #ffd2b8; }
.consent .consent-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.consent button { border: none; border-radius: 9px; padding: 9px 16px; font-weight: 700; font-size: 0.85rem; cursor: pointer; }
.consent .accept { background: var(--orange); color: #fff; }
.consent .reject { background: #3a4452; color: #fff; }

/* ===== 히어로 ===== */
.hero {
  background: linear-gradient(135deg, #fff4ee 0%, #ffe9d6 100%);
  border: 1px solid #ffd9bf;
  border-radius: 22px; padding: 34px 30px; margin-bottom: 12px;
}
.hero-badge {
  display: inline-block; background: var(--orange); color: #fff;
  font-size: 0.75rem; font-weight: 600; letter-spacing: .04em;
  padding: 5px 12px; border-radius: 999px; margin-bottom: 12px;
}
.hero h1 { margin: 0 0 8px; font-size: 2.1rem; }
.hero-sub { margin: 0; color: #6a4a35; max-width: 620px; }

/* ===== 카드 그리드 ===== */
.grid { display: grid; gap: 14px; }
.skills { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.themes { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.lessons { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; text-align: left;
  box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
}
button.card { width: 100%; font-size: 1rem; color: inherit; }
.card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(20,30,50,.12); }
.card h3 { margin: 6px 0 4px; font-size: 1.08rem; }

.skill-card .skill-emoji { font-size: 2rem; }
.stat-pill {
  display: inline-block; margin-top: 10px; font-size: 0.8rem; font-weight: 600;
  background: #eafaf1; color: var(--green); padding: 4px 10px; border-radius: 999px;
}
.stat-pill.ghost { background: #f0f2f6; color: var(--muted); }

/* 테마 카드 */
.theme-card { border-top: 4px solid var(--accent, var(--orange)); }
.theme-top { display: flex; align-items: center; justify-content: space-between; }
.theme-emoji { font-size: 1.6rem; }
.theme-num { font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.theme-ko { color: var(--accent, var(--orange)); font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.btn-link {
  background: none; border: none; color: var(--orange); font-weight: 600; padding: 8px 0 0; font-size: 0.9rem;
}
.theme-card.pick { cursor: pointer; }

/* 레슨 카드 */
.lesson-card .lesson-theme { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.lesson-card .nl-title { font-size: 0.85rem; margin-bottom: 4px; }

/* ===== 스킬 헤더 ===== */
.skill-header { margin-bottom: 16px; }
.skill-header h2 { margin: 6px 0 2px; font-size: 1.5rem; }
.back {
  background: none; border: none; color: var(--orange); font-weight: 600; padding: 0; font-size: 0.9rem;
}

/* ===== 탭 ===== */
.tabbar { display: inline-flex; background: #eef1f6; border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.tab { background: none; border: none; padding: 8px 18px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.08); }

/* ===== 버튼 ===== */
.btn {
  background: var(--orange); color: #fff; border: none;
  padding: 11px 20px; border-radius: 11px; font-weight: 600; font-size: 0.95rem;
  transition: .15s;
}
.btn:hover { background: var(--orange-dark); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: #eef1f6; color: var(--ink); }
.btn.ghost:hover { background: #e2e7ef; }
.btn.next { margin-top: 14px; }
.controls { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.counter { color: var(--muted); font-weight: 600; font-size: 0.9rem; margin-bottom: 12px; }

/* 스피커 버튼 */
.speaker {
  background: #fff3ec; border: 1px solid #ffd2b8; color: var(--orange-dark);
  border-radius: 999px; padding: 4px 12px; font-size: 1rem; margin-left: 8px;
}
.speaker:hover { background: #ffe7d8; }

/* ===== 플래시카드 ===== */
.flashcard {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: var(--shadow);
  min-height: 230px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; padding: 28px; cursor: pointer;
  text-align: center; transition: .15s;
}
.flashcard:hover { box-shadow: 0 12px 30px rgba(20,30,50,.14); }
.flashcard.flipped { background: #fffaf6; }
.fc-art { color: var(--orange); font-weight: 700; }
.fc-front { font-size: 2rem; font-weight: 700; font-family: "Poppins", sans-serif; }
.fc-hint { color: var(--muted); font-size: 0.82rem; }
.fc-back-ko { font-size: 1.7rem; font-weight: 700; }
.fc-ex { font-style: italic; color: #3a4a5a; margin-top: 8px; }
.fc-ex-ko { color: var(--muted); font-size: 0.9rem; }

/* ===== 퀴즈 / 연습문제 ===== */
.quiz { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.quiz-q { font-size: 1.4rem; font-weight: 700; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.quiz-sub { color: var(--muted); margin-bottom: 14px; }
.options { display: grid; gap: 10px; }
.option {
  text-align: left; background: #f7f9fc; border: 2px solid var(--line);
  border-radius: 12px; padding: 13px 16px; font-size: 1rem; transition: .12s;
}
.option:hover { border-color: var(--orange); background: #fff5ef; }
.option.right { border-color: var(--green); background: #eafaf1; color: #0f7c43; font-weight: 600; }
.option.wrong { border-color: var(--red); background: #fdecec; color: #b32424; }

.fill-row { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.fill-input { flex: 1; min-width: 180px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 11px; font-size: 1rem; }
.fill-input:focus { outline: none; border-color: var(--orange); }
.fill-input.right { border-color: var(--green); background: #eafaf1; }
.fill-input.wrong { border-color: var(--red); background: #fdecec; }

.explain { margin-top: 14px; padding: 13px 16px; border-radius: 12px; font-size: 0.95rem; }
.explain.ok { background: #eafaf1; border: 1px solid #b6e6c9; }
.explain.no { background: #fff6e9; border: 1px solid #ffd9a3; }
.explain-tag { font-weight: 700; margin-bottom: 4px; }

/* 결과 */
.result { text-align: center; padding: 22px; }
.result-emoji { font-size: 3rem; }
.result h3 { margin: 8px 0 18px; }
.result .btn { margin: 4px; }

/* ===== 문법 설명 ===== */
.lesson-body { line-height: 1.7; }
.lesson-body p { margin: 10px 0; }
.lesson-body ul { padding-left: 22px; }
.lesson-body li { margin: 4px 0; }
.lesson-body .ex { background: #f7f9fc; border-left: 3px solid var(--orange); padding: 8px 14px; border-radius: 0 8px 8px 0; }
.lesson-body .ex b { color: var(--orange-dark); }
.lesson-body .ko { display: block; color: var(--muted); font-size: 0.88rem; }
.lesson-body table.gram { width: 100%; border-collapse: collapse; margin: 12px 0; }
.lesson-body table.gram th, .lesson-body table.gram td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.lesson-body table.gram th { background: #f3f6fa; font-family: "Poppins"; }
.lesson-body table.gram td:first-child { font-weight: 600; }

/* ===== 단어 목록 ===== */
.wordlist { display: flex; flex-direction: column; gap: 8px; }
.wl-row {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 6px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px;
}
.wl-nl { font-size: 1.05rem; }
.wl-ko { color: var(--muted); align-self: center; }
.wl-ex { grid-column: 1 / -1; display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.9rem; font-style: italic; border-top: 1px dashed var(--line); padding-top: 8px; }

/* ===== 문장짓기 ===== */
.sentence-stage { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.sent-ko { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; }
.sent-hint { color: var(--muted); font-size: 0.9rem; margin-bottom: 16px; }
.answer-row {
  min-height: 56px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: #f7f9fc; border: 2px dashed var(--line); border-radius: 12px; padding: 12px; margin-bottom: 14px;
}
.answer-row .placeholder { color: #aab3bf; }
.pool-row { display: flex; flex-wrap: wrap; gap: 8px; }
.token {
  background: #fff; border: 2px solid var(--orange); color: var(--orange-dark);
  border-radius: 10px; padding: 9px 15px; font-size: 1rem; font-weight: 600; transition: .12s;
}
.token:hover { background: #fff5ef; }
.token.used { opacity: .3; pointer-events: none; }
.token.in-answer { background: var(--orange); color: #fff; }
.token.in-answer.right { background: var(--green); border-color: var(--green); }
.token.in-answer.wrong { background: var(--red); border-color: var(--red); }
.sent-feedback { margin-top: 8px; }
.sent-feedback .speaker { margin-top: 10px; display: inline-block; }

/* ===== 말하기 ===== */
.notice { background: #fff6e9; border: 1px solid #ffd9a3; border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-size: 0.9rem; }
.speak-stage { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.speak-card { background: linear-gradient(135deg,#fff4ee,#ffe9d6); border-radius: 16px; padding: 26px; text-align: center; margin-bottom: 6px; }
.speak-nl { font-size: 1.6rem; font-weight: 700; font-family: "Poppins", "Noto Sans KR"; }
.speak-ko { color: #6a4a35; margin-top: 8px; }
.btn.mic.listening { background: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:.6;} }
.speak-feedback { margin-top: 16px; }
.score-ring {
  display: inline-flex; align-items: center; justify-content: center;
  width: 84px; height: 84px; border-radius: 50%; font-size: 1.5rem; font-weight: 700; color: #fff;
}
.score-ring.good { background: var(--green); }
.score-ring.ok { background: var(--orange); }
.score-ring.low { background: var(--red); }
.heard { margin-top: 10px; }
.pw-row { margin-top: 6px; font-size: 1.1rem; }
.pw.hit { color: var(--green); font-weight: 600; }
.pw.miss { color: var(--red); text-decoration: underline; }

/* ===== 토스트 ===== */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 999px;
  font-size: 0.9rem; opacity: 0; pointer-events: none; transition: .25s; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 헤더 추가 링크 ===== */
.nav-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; align-self: center; }
.nav-link.accent { color: var(--orange-dark); }
.nav-link.accent:hover { background: #fff1e8; }
.nav-link.accent.active { background: var(--orange); color: #fff; }

/* ===== 학습 도구 카드 ===== */
.tools { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.tool-card { border-top: 4px solid var(--orange); }
.tool-card.path { border-top-color: #2a9d8f; }
.tool-card.exam { border-top-color: #457b9d; }
.tool-card.review { border-top-color: #e63946; }
.tool-emoji { font-size: 2rem; }
.stat-pill.warn { background: #fff1e8; color: var(--orange-dark); }

/* ===== 종합 시험 ===== */
.exam-intro { text-align: center; padding: 28px; }
.exam-intro .btn { margin-top: 12px; }
.exam-progress { height: 8px; background: #eef1f6; border-radius: 999px; overflow: hidden; margin-bottom: 14px; }
.exam-bar-fill { height: 100%; background: var(--orange); transition: width .3s; }
.exam-cat { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; margin-bottom: 10px; }
.exam-cat.vocab { background: #eafaf1; color: #0f7c43; }
.exam-cat.grammar { background: #e9f1fb; color: #2a5d8f; }
.exam-cat.sentence { background: #fff1e8; color: var(--orange-dark); }
.exam-lesson { font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
.exam-breakdown { max-width: 320px; margin: 0 auto 18px; }
.eb-row { display: flex; justify-content: space-between; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.eb-row b { color: var(--orange-dark); }
.controls.center { justify-content: center; }

/* ===== 오답노트 ===== */
.empty { text-align: center; padding: 32px; }
.empty-emoji { font-size: 3rem; }
.miss-badge { font-size: 0.72rem; font-weight: 700; background: #fff1e8; color: var(--orange-dark); padding: 2px 8px; border-radius: 999px; margin-left: 8px; }
.wl-row { position: relative; }
.remove-btn { position: absolute; top: 10px; right: 12px; border: none; background: #f0f2f6; color: var(--muted); width: 26px; height: 26px; border-radius: 50%; font-weight: 700; }
.remove-btn:hover { background: var(--red); color: #fff; }
.btn.ghost.danger { color: var(--red); }
.btn.ghost.danger:hover { background: #fdecec; }

/* ===== 학습 경로 ===== */
.path-overall { padding: 16px 18px; }
.po-top { display: flex; justify-content: space-between; margin-bottom: 8px; }
.pbar { height: 10px; background: #eef1f6; border-radius: 999px; overflow: hidden; }
.pbar-fill { height: 100%; background: linear-gradient(90deg, #2a9d8f, var(--orange)); border-radius: 999px; transition: width .4s; }
.next-step { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; border-left: 4px solid var(--orange); }
.next-step.done-all { border-left-color: var(--green); }
.ns-tag { display: inline-block; font-size: 0.72rem; font-weight: 700; background: var(--orange); color: #fff; padding: 2px 9px; border-radius: 999px; margin-right: 6px; }
.path-level { margin-top: 26px; }
.path-level.current .pl-head h2 { color: var(--orange); }
.pl-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.pl-head h2 { margin: 0; font-size: 1.3rem; }
.path-theme { padding: 14px 16px; margin-bottom: 12px; border-left: 4px solid var(--accent, var(--orange)); }
.pt-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.pt-head .theme-emoji { font-size: 1.4rem; }
.pt-ko { font-weight: 400; font-size: 0.85rem; }
.pt-count { margin-left: auto; font-size: 0.8rem; font-weight: 700; color: var(--muted); background: #f0f2f6; padding: 3px 10px; border-radius: 999px; }
.pt-count.full { background: #eafaf1; color: var(--green); }
.step-list { display: flex; flex-direction: column; gap: 6px; }
.step-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: #f7f9fc; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 0.95rem; transition: .12s; }
.step-row:hover { border-color: var(--orange); background: #fff5ef; }
.step-check { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: #e2e7ef; color: #fff; font-weight: 700; font-size: 0.8rem; flex-shrink: 0; }
.step-row.done .step-check { background: var(--green); }
.step-row.done { background: #f3faf6; }
.step-label { flex: 1; }
.step-go { font-size: 0.8rem; font-weight: 600; color: var(--orange); }
.step-row.done .step-go { color: var(--muted); }

/* ===== 언어 선택 ===== */
.lang-select {
  margin-left: 6px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--ink); cursor: pointer;
}
.lang-select:focus { outline: none; border-color: var(--orange); }

/* RTL (아랍어 등) */
html[dir="rtl"] .lesson-body .ex { border-left: none; border-right: 3px solid var(--orange); border-radius: 8px 0 0 8px; }
html[dir="rtl"] .next-step, html[dir="rtl"] .path-theme { border-left: none; border-right: 4px solid var(--accent, var(--orange)); }
html[dir="rtl"] .step-row { text-align: right; }
html[dir="rtl"] .remove-btn { right: auto; left: 12px; }

/* ===== 인증 (상단바 + 로그인 화면) ===== */
.auth-area { display: flex; align-items: center; margin-left: 6px; }
.login-btn { background: var(--orange); color: #fff; border: none; padding: 8px 16px; border-radius: 10px; font-weight: 700; font-size: 0.85rem; }
.login-btn:hover { background: var(--orange-dark); }
.user-chip { display: flex; align-items: center; gap: 8px; background: #f0f2f6; padding: 4px 8px 4px 4px; border-radius: 999px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.avatar-letter { display: inline-flex; align-items: center; justify-content: center; background: var(--orange); color: #fff; font-weight: 700; font-size: 0.85rem; }
.user-name { font-size: 0.85rem; font-weight: 600; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn { border: none; background: none; color: var(--muted); font-size: 0.8rem; font-weight: 600; padding: 2px 6px; }
.logout-btn:hover { color: var(--red); }

.auth-card { max-width: 420px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.google-btn { background: #fff; color: var(--ink); border: 2px solid var(--line); font-weight: 600; }
.google-btn:hover { background: #f7f9fc; border-color: #d8dee8; }
.auth-divider { display: flex; align-items: center; text-align: center; color: var(--muted); font-size: 0.82rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-divider span { padding: 0 12px; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form .fill-input { width: 100%; }
.auth-error { color: var(--red); font-size: 0.85rem; min-height: 1em; }
.auth-toggle { text-align: center; font-size: 0.88rem; }
.link-btn { border: none; background: none; color: var(--orange); font-weight: 700; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* ===== 관리자 페이지 ===== */
.admin-link { border: none; background: #fff1e8; color: var(--orange-dark); font-weight: 700; font-size: 0.78rem; padding: 5px 10px; border-radius: 8px; }
.admin-link:hover { background: #ffe0cc; }
.admin-stats { grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 8px 0 18px; }
.admin-stat { text-align: center; padding: 16px 10px; }
.admin-stat-n { font-size: 1.9rem; font-weight: 800; font-family: "Poppins", sans-serif; color: var(--orange); }
.admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 12px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; white-space: nowrap; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.admin-table th { background: #f3f6fa; font-family: "Poppins", "Noto Sans KR"; font-weight: 600; position: sticky; top: 0; }
.admin-table tbody tr:hover { background: #fafbfd; }
.admin-table td.num { text-align: center; font-weight: 600; }

/* ===== TTS 설정 / 상태 배너 ===== */
.tts-settings { margin-bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
.tts-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tts-label { font-weight: 700; font-size: 0.9rem; min-width: 72px; }
.tabbar.small { margin: 0; }
.tabbar.small .tab { padding: 6px 12px; font-size: 0.85rem; }
.voice-select { padding: 8px 12px; border: 2px solid var(--line); border-radius: 10px; font-size: 0.95rem; font-family: inherit; background: #fff; }
.voice-select:focus { outline: none; border-color: var(--orange); }
.tts-hint { font-size: 0.82rem; line-height: 1.5; }

.tts-status {
  position: fixed; left: 18px; bottom: 18px; z-index: 120;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px;
  font-size: 0.85rem; font-weight: 600; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(12px); pointer-events: none; transition: .25s; max-width: 80vw;
}
.tts-status.show { opacity: 1; transform: translateY(0); }

/* 상단바 도구(레벨·언어·로그인) */
.topbar-tools { display: flex; align-items: center; gap: 6px; }

/* ===== 반응형 ===== */
@media (max-width: 820px) {
  .topbar {
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 8px 10px;
  }
  .brand { order: 1; }
  .topbar-tools { order: 2; margin-left: auto; }
  .nav {
    order: 3;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
  }
  .nav::-webkit-scrollbar { display: none; /* Chrome/Safari */ }
  .nav-link { flex-shrink: 0; white-space: nowrap; }
  .nav-sep { display: none; }
}

@media (max-width: 560px) {
  .container { padding: 16px 12px 56px; }
  .section-title { margin: 26px 0 12px; font-size: 1.15rem; }
  .hero { padding: 22px 18px; border-radius: 18px; }
  .hero h1 { font-size: 1.55rem; }
  .hero-sub { font-size: 0.92rem; }
  .brand-text { font-size: 1.05rem; }
  .nav-link { padding: 8px 11px; font-size: 0.92rem; }
  .lang-select { padding: 6px 8px; font-size: 0.8rem; }
  .login-btn, .logout-btn { font-size: 0.8rem; }

  /* 한 칸 그리드로 — 카드가 화면 폭을 꽉 채우게 */
  .grid.skills, .grid.themes, .grid.lessons, .grid.tools { grid-template-columns: 1fr; }

  .wl-row { grid-template-columns: 1fr; }
  .quiz-q, .sent-ko, .speak-nl { font-size: 1.2rem; }
  .flashcard { min-height: 200px; padding: 22px; }
  .fc-front { font-size: 1.7rem; }
  .fc-back-ko { font-size: 1.45rem; }

  /* 터치 영역 확대 */
  .btn { padding: 13px 18px; font-size: 1rem; }
  .controls { gap: 8px; }
  .controls .btn { flex: 1 1 auto; }          /* 버튼이 가로로 넓게 */
  .option { padding: 15px 16px; }
  .token { padding: 11px 15px; font-size: 1.05rem; }
  .tab { padding: 10px 14px; }
  .speaker { padding: 8px 14px; font-size: 1.05rem; }
  .quiz, .sentence-stage, .speak-stage, .lesson-body { padding: 18px 16px; }
  .voice-select { max-width: 60vw; }
  .step-row { padding: 13px 14px; }
  .answer-row, .pool-row { gap: 7px; }
}
