:root {
  /* ── PRIMARY (k-uplearning 파란 톤 통일) ── */
  --p:  #1B65E3;
  --pd: #0F4ABF;
  --pl: #EBF2FF;
  --accent:       #1B65E3;
  --accent-light: #EBF2FF;
  --accent-mid:   #93B4F0;

  /* ── AMBER (CTA/토큰 강조) ── */
  --amber:       #f59e0b;
  --amber-light: #fffbeb;

  /* ── SEMANTIC ── */
  --green: #059669;  --green-light: #ecfdf5;
  --red:   #EF4444;  --red-light:   #fef2f2;
  --purple: #7C3AED; --pink: #EC4899; --cyan: #06B6D4; --orange: #FF8C00;
  --pro: #7c3de0;    --pro-light: #f3eeff;
  --token: #c47f00;  --token-bg: #fff8e6; --token-border: #fde68a;

  /* ── GRAY (Tailwind Gray 기준) ── */
  --g50:#F9FAFB; --g100:#F3F4F6; --g200:#E5E7EB; --g300:#D1D5DB;
  --g400:#9CA3AF; --g500:#6B7280; --g600:#4B5563; --g700:#374151;
  --g800:#1F2937; --g900:#111827;

  /* ── SURFACE (app.teamsky 호환) ── */
  --bg:       #F8F9FF;
  --bg2:      #F3F4F6;
  --white:    #ffffff;
  --surface:  #ffffff;
  --surface2: #F3F4F6;
  --border:   #E5E7EB;
  --border2:  #D1D5DB;
  --ink:      #1F2937;
  --ink2:     #4B5563;
  --muted:    #9CA3AF;
  --card:     #ffffff;

  /* ── RADIUS & SHADOW ── */
  --r: 12px;
  --radius: 16px;
  --sh:  0 4px 12px rgba(0,0,0,.08);
  --shl: 0 8px 30px rgba(0,0,0,.12);
  --shadow:    0 1px 8px rgba(18,18,42,.06);
  --shadow-md: 0 4px 20px rgba(18,18,42,.09);
  --shadow-lg: 0 8px 40px rgba(18,18,42,.13);

  /* ── TYPOGRAPHY ── */
  --font-primary: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Noto Sans KR', sans-serif;
  --font-mono:    'DM Sans', 'Roboto Mono', monospace;
}
* { margin:0; padding:0; box-sizing:border-box; }
body { background:var(--bg); color:var(--ink); font-family:var(--font-primary); min-height:100vh; }

/* ── EXAM INPUT TABS ── */
.exam-input-tabs {
  display:flex; gap:6px; margin-bottom:14px;
}
.exam-input-tab {
  flex:1; padding:9px 0; border-radius:9px; border:1.5px solid var(--border2);
  background:var(--surface2); color:var(--muted); font-size:13.5px; font-weight:600;
  cursor:pointer; font-family:var(--font-primary); transition:all .18s;
}
.exam-input-tab.active {
  background:var(--accent); color:#fff; border-color:var(--accent);
}
.exam-text-input {
  width:100%; min-height:160px; background:var(--bg);
  border:1.5px solid var(--border2); border-radius:10px;
  padding:12px 14px; font-family:var(--font-primary);
  font-size:13.5px; color:var(--ink); line-height:1.7;
  resize:vertical; outline:none; transition:border-color .18s;
}
.exam-text-input:focus { border-color:var(--accent); background:var(--white); }

/* ── BLOG RSS ── */
.blog-rss-item {
  display:flex; flex-direction:column; gap:5px;
  padding:10px 8px; margin:0 -8px;
  border-bottom:1px solid var(--border);
  cursor:pointer;
  text-decoration:none;
  border-radius:10px;
  transition:background .15s;
}
.blog-rss-item:last-child { border-bottom:none; }
.blog-rss-item:hover { background:var(--surface2); }
.blog-rss-cat {
  font-size:10.5px; font-weight:700; color:#6d28d9;
  background:linear-gradient(135deg,#ede9fe,#ddd6fe); border-radius:20px;
  padding:2px 8px; display:inline-block; width:fit-content;
  border:1px solid #c4b5fd;
}
.blog-rss-title {
  font-size:13px; font-weight:600; color:var(--ink);
  line-height:1.5;
  display:-webkit-box; -webkit-line-clamp:2;
  -webkit-box-orient:vertical; overflow:hidden;
  transition:color .15s;
}
.blog-rss-item:hover .blog-rss-title { color:var(--accent); }
.blog-rss-date {
  font-size:11px; color:var(--muted); font-weight:500;
}
.auth-overlay {
  position:fixed; inset:0; z-index:1000;
  background:rgba(26,25,22,.55);
  backdrop-filter:blur(6px);
  align-items:center; justify-content:center;
  padding:20px;
  display:none;
  animation:fadeInOverlay .22s ease;
}
.auth-overlay.open { display:flex; }
@keyframes fadeInOverlay { from{opacity:0} to{opacity:1} }

.auth-modal {
  background:var(--white); border-radius:22px;
  width:100%; max-width:420px;
  padding:36px 36px 32px;
  box-shadow:var(--shadow-lg);
  transform:translateY(16px) scale(.97);
  transition:transform .3s cubic-bezier(.34,1.3,.64,1);
  position:relative;
}
.auth-overlay.open .auth-modal { transform:none; }

.auth-close {
  position:absolute; top:16px; right:18px;
  background:none; border:none; cursor:pointer;
  font-size:20px; color:var(--muted); line-height:1;
  transition:color .15s;
}
.auth-close:hover { color:var(--ink); }

.auth-logo {
  font-family:var(--font-display); font-size:26px; font-weight:700;
  color:var(--accent); margin-bottom:6px; text-align:center;
}
.auth-logo span { color:var(--amber); }

.auth-subtitle {
  text-align:center; font-size:14px; color:var(--muted); margin-bottom:28px;
}

.auth-tabs {
  display:flex; background:var(--surface2); border-radius:10px;
  padding:3px; margin-bottom:24px; border:1px solid var(--border);
}
.auth-tab {
  flex:1; padding:8px; border-radius:7px; border:none; cursor:pointer;
  font-family:var(--font-primary); font-size:14px; font-weight:500;
  color:var(--muted); background:transparent; transition:all .18s;
}
.auth-tab.active { background:var(--white); color:var(--ink); box-shadow:var(--shadow); }

.form-group { margin-bottom:14px; }
.form-label { display:block; font-size:12px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.5px; margin-bottom:6px; }
.form-input {
  width:100%; background:var(--bg); border:1.5px solid var(--border2);
  border-radius:10px; padding:11px 14px;
  font-family:var(--font-primary); font-size:14.5px; color:var(--ink);
  outline:none; transition:border-color .18s;
}
.form-input:focus { border-color:var(--accent); background:var(--white); }
.form-input.error { border-color:var(--red); }

.error-msg { font-size:12px; color:var(--red); margin-top:5px; display:none; }
.error-msg.visible { display:block; }

.btn-auth {
  width:100%; padding:13px; border-radius:11px; border:none; cursor:pointer;
  font-family:var(--font-primary); font-size:15px; font-weight:700;
  background:var(--accent); color:#fff;
  box-shadow:0 3px 14px rgba(61,82,230,.3);
  transition:all .18s; margin-top:4px;
}
.btn-auth:hover { background:#2e40c8; transform:translateY(-1px); }
.btn-auth:disabled { opacity:.5; cursor:default; transform:none; }

.divider-text {
  display:flex; align-items:center; gap:12px;
  margin:18px 0; font-size:13px; color:var(--muted);
}
.divider-text::before, .divider-text::after {
  content:''; flex:1; height:1px; background:var(--border);
}

.btn-google {
  width:100%; padding:12px; border-radius:11px;
  border:1.5px solid var(--border2); background:var(--white);
  cursor:pointer; font-family:var(--font-primary);
  font-size:14.5px; font-weight:600; color:var(--ink2);
  display:flex; align-items:center; justify-content:center; gap:10px;
  transition:all .18s; box-shadow:var(--shadow);
}
.btn-google:hover { border-color:var(--accent); box-shadow:var(--shadow-md); transform:translateY(-1px); }

.google-icon {
  width:20px; height:20px; flex-shrink:0;
}

/* ── NAV ── */
nav {
  position:sticky; top:0; z-index:500;
  background:rgba(255,255,255,.85); backdrop-filter:blur(20px) saturate(180%);
  -webkit-backdrop-filter:blur(20px) saturate(180%);
  border-bottom:1px solid var(--border);
  padding:0 32px; height:64px;
  display:flex; align-items:center; gap:20px;
  pointer-events:auto;
  isolation:isolate;
  transform:translateZ(0);
  box-shadow:0 1px 0 rgba(18,18,42,.06);
}
.logo {
  font-family:var(--font-display); font-size:23px; font-weight:700;
  color:var(--accent); letter-spacing:-.5px; flex-shrink:0;
  transition:opacity .15s;
  background:linear-gradient(135deg,#4f46e5,#7c3aed);
  -webkit-background-clip:text; -webkit-text-fill-color:transparent;
  background-clip:text;
}
.logo:hover { opacity:.8; }
.logo span { background:linear-gradient(135deg,#f59e0b,#ef4444); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
.nav-tabs {
  display:flex; gap:1px; background:var(--surface2);
  border-radius:12px; padding:4px; border:1px solid var(--border);
}
.nav-tab {
  padding:6px 18px; border-radius:8px; border:none; cursor:pointer;
  font-family:var(--font-primary); font-size:13.5px; font-weight:500;
  color:var(--muted); background:transparent; transition:all .2s;
  letter-spacing:-.1px;
}
.nav-tab.active {
  background:var(--white); color:var(--ink); font-weight:600;
  box-shadow:0 1px 6px rgba(18,18,42,.1);
}
.nav-tab:hover:not(.active) { color:var(--ink2); background:rgba(255,255,255,.5); }
.nav-right { margin-left:auto; display:flex; gap:8px; align-items:center; }
.btn {
  padding:7px 18px; border-radius:10px; border:none; cursor:pointer;
  font-family:var(--font-primary); font-size:13.5px; font-weight:600;
  transition:all .18s; letter-spacing:-.1px;
}
.btn-outline { background:var(--white); color:var(--ink2); border:1.5px solid var(--border2); }
.btn-outline:hover { border-color:var(--accent); color:var(--accent); background:var(--accent-light); }
.btn-primary {
  background:linear-gradient(135deg,#4f46e5,#7c3aed); color:#fff;
  box-shadow:0 2px 12px rgba(79,70,229,.3); border:none;
}
.btn-primary:hover { box-shadow:0 4px 20px rgba(79,70,229,.45); transform:translateY(-1px); }

/* user avatar in nav */
.nav-user {
  display:none; align-items:center; gap:8px;
}
.nav-user.visible { display:flex; }
.nav-avatar {
  width:32px; height:32px; border-radius:50%;
  background:linear-gradient(135deg,var(--accent),#7b8ff0);
  display:flex; align-items:center; justify-content:center;
  font-size:13px; font-weight:700; color:#fff; overflow:hidden;
  border:2px solid var(--accent-mid); cursor:pointer;
  flex-shrink:0;
}
.nav-avatar img { width:100%; height:100%; object-fit:cover; }
.nav-username { font-size:13.5px; font-weight:600; color:var(--ink2); max-width:120px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.btn-signout { background:none; border:1.5px solid var(--border2); color:var(--muted); padding:5px 12px; border-radius:8px; cursor:pointer; font-size:12.5px; font-family:var(--font-primary); transition:all .15s; }
.btn-signout:hover { border-color:var(--red); color:var(--red); }

/* ── MAIN ── */
main { max-width:1080px; margin:0 auto; padding:32px 28px 48px; padding-top:28px; position:relative; z-index:0; }
.page { display:none; animation:slideUp .25s ease; position:relative; z-index:0; }
.page.active { display:block; }
@keyframes slideUp { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:none} }

/* ── FEED ── */
.feed-layout { display:grid; grid-template-columns:1fr 280px; gap:28px; }
@media(max-width:760px){.feed-layout{grid-template-columns:1fr}}
.feed-main h1 {
  font-family:var(--font-display); font-size:26px; font-weight:700;
  margin-bottom:18px; color:var(--ink); letter-spacing:-.5px;
}
.tag-row { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:20px; }
.pill {
  padding:5px 14px; border-radius:20px; font-size:13px; font-weight:500;
  border:1px solid var(--border2); color:var(--muted); background:var(--white);
  cursor:pointer; transition:all .18s; font-family:var(--font-primary);
}
.pill.active {
  border-color:var(--accent); color:var(--accent);
  background:var(--accent-light); font-weight:600;
  box-shadow:0 2px 8px rgba(79,70,229,.15);
}
.pill:hover:not(.active) { border-color:var(--ink2); color:var(--ink2); background:var(--surface2); }
.quiz-list { display:flex; flex-direction:column; gap:12px; }
.qcard {
  background:var(--white); border:1px solid var(--border);
  border-radius:18px; padding:20px 22px; cursor:pointer;
  transition:all .22s cubic-bezier(.25,.46,.45,.94);
  box-shadow:var(--shadow);
  position:relative; overflow:hidden;
}
.qcard::before {
  content:''; position:absolute; inset:0;
  background:linear-gradient(135deg,rgba(79,70,229,.03),transparent);
  opacity:0; transition:opacity .22s;
}
.qcard:hover { border-color:var(--accent); box-shadow:0 8px 32px rgba(79,70,229,.12); transform:translateY(-3px); }
.qcard:hover::before { opacity:1; }
.qcard-top { display:flex; align-items:center; gap:8px; margin-bottom:11px; }
.avatar { width:30px; height:30px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; color:#fff; flex-shrink:0; overflow:hidden; }
.avatar img { width:100%; height:100%; object-fit:cover; }
.av1{background:linear-gradient(135deg,#3d52e6,#7b8ff0)} .av2{background:linear-gradient(135deg,#e07c2a,#f0a865)} .av3{background:linear-gradient(135deg,#1e8a5e,#5abf96)} .av4{background:linear-gradient(135deg,#9b3de0,#c87ff0)}
.author { font-size:13px; font-weight:600; color:var(--ink2); font-family:var(--font-primary); }
.qtime { font-size:12px; color:var(--muted); margin-left:auto; }
.tags { display:flex; gap:5px; }
.tag {
  padding:2px 10px; border-radius:6px; font-size:11.5px; font-weight:600;
  letter-spacing:.1px; font-family:var(--font-primary);
}
.tag-grammar{background:#ede9fe;color:#6d28d9} .tag-vocab{background:#fef3c7;color:#b45309} .tag-reading{background:#d1fae5;color:#065f46}
.tag-easy{background:#d1fae5;color:#065f46} .tag-medium{background:#fef3c7;color:#b45309} .tag-hard{background:#fee2e2;color:#991b1b}
.qcard-q {
  font-size:15.5px; font-weight:500; line-height:1.55; color:var(--ink); margin-bottom:4px;
  display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden;
  transition: all .2s ease;
}
.qcard-q.expanded { -webkit-line-clamp:unset; display:block; }
.qcard-toggle {
  display:none; background:none; border:none; cursor:pointer;
  font-family:var(--font-primary); font-size:12.5px; font-weight:600;
  color:var(--accent); padding:4px 0; margin-bottom:10px;
  transition:color .15s;
}
.qcard-toggle:hover { color:#3730a3; }
.qcard-toggle.visible { display:inline-block; }
.qcard-foot { display:flex; gap:14px; align-items:center; padding-top:12px; border-top:1px solid var(--border); }
.stat-empty {
  font-size:12px; color:var(--accent); font-weight:600;
  background:var(--accent-light); padding:2px 10px; border-radius:20px;
}
.stat { display:flex; align-items:center; gap:4px; font-size:12.5px; color:var(--muted); }
.type-badge { margin-left:auto; padding:3px 9px; border-radius:5px; font-size:11px; font-weight:700; letter-spacing:.3px; background:var(--surface2); color:var(--muted); border:1px solid var(--border); }

/* sidebar */
.sidebar { display:flex; flex-direction:column; gap:16px; }
.sbox {
  background:var(--white); border:1px solid var(--border);
  border-radius:20px; padding:22px; box-shadow:var(--shadow);
  transition:box-shadow .2s;
}
.sbox:hover { box-shadow:var(--shadow-md); }
.sbox-title {
  font-family:var(--font-display); font-size:15px; font-weight:700;
  margin-bottom:16px; color:var(--ink);
  display:flex; align-items:center; gap:8px;
}
.stats-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.stat-box {
  background:linear-gradient(135deg,var(--accent-light),var(--surface2));
  border-radius:12px; padding:14px 12px; text-align:center;
  border:1px solid var(--border);
  transition:transform .18s;
}
.stat-box:hover { transform:translateY(-2px); }
.stat-box-val {
  font-size:22px; font-weight:800; color:var(--accent);
  font-family:var(--font-display); letter-spacing:-.5px;
}
.stat-box-label { font-size:11px; color:var(--muted); margin-top:3px; font-weight:500; }
.leaderboard-row {
  display:flex; align-items:center; gap:10px; padding:9px 0;
  border-bottom:1px solid var(--border); transition:background .15s;
  border-radius:8px; margin:0 -8px; padding:9px 8px;
}
.leaderboard-row:hover { background:var(--surface2); }
.leaderboard-row:last-child { border-bottom:none; }
.rank { font-size:13px; font-weight:800; width:20px; color:var(--muted); text-align:center; }
.rank.gold{ color:#d97706; } .rank.silver{ color:#64748b; } .rank.bronze{ color:#92400e; }
.lb-name { font-size:13.5px; font-weight:500; flex:1; color:var(--ink2); }
.lb-score { font-size:12.5px; color:var(--accent); font-weight:700; }

/* ── DETAIL ── */
.detail-wrap { max-width:720px; margin:0 auto; }
.back-btn { display:inline-flex; align-items:center; gap:5px; font-size:13.5px; color:var(--muted); cursor:pointer; background:none; border:none; margin-bottom:24px; transition:color .15s; padding:0; }
.back-btn:hover { color:var(--ink); }
.quiz-progress-bar { height:4px; background:var(--border); border-radius:2px; margin-bottom:20px; overflow:hidden; }
.quiz-progress-fill { height:100%; background:var(--accent); border-radius:2px; transition:width .4s ease; }
.detail-card { background:var(--white); border:1.5px solid var(--border); border-radius:18px; padding:28px 32px; box-shadow:var(--shadow-md); margin-bottom:14px; }
.detail-meta { display:flex; gap:7px; margin-bottom:16px; align-items:center; }
.detail-q { font-family:var(--font-display); font-size:20px; font-weight:600; line-height:1.5; color:var(--ink); margin-bottom:6px; }
.fill-blank { background:var(--accent-light); border:2px dashed var(--accent-mid); border-radius:8px; padding:4px 10px; font-size:18px; color:var(--accent); font-weight:700; letter-spacing:2px; display:inline-block; min-width:80px; text-align:center; }
.choices { display:flex; flex-direction:column; gap:9px; margin-top:20px; }
.choice { display:flex; align-items:center; gap:13px; padding:13px 16px; border-radius:11px; border:1.5px solid var(--border); cursor:pointer; transition:all .18s; font-size:15px; background:var(--bg); user-select:none; }
.choice:hover:not(.disabled) { border-color:var(--accent); background:var(--accent-light); }
.choice.selected { border-color:var(--accent); background:var(--accent-light); box-shadow:0 0 0 3px rgba(61,82,230,.1); }
.choice.correct { border-color:var(--green); background:var(--green-light); animation:popIn .3s cubic-bezier(.34,1.56,.64,1); }
.choice.wrong { border-color:var(--red); background:var(--red-light); animation:shake .35s ease; }
.choice.dim { opacity:.45; }
.choice.disabled { cursor:default; }
@keyframes popIn{from{transform:scale(.97)}to{transform:scale(1)}}
@keyframes shake{0%,100%{transform:translateX(0)}25%{transform:translateX(-5px)}75%{transform:translateX(5px)}}
.choice-lbl { width:30px; height:30px; border-radius:8px; flex-shrink:0; background:var(--white); border:1.5px solid var(--border2); display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:700; color:var(--muted); transition:all .18s; }
.choice.selected .choice-lbl { background:var(--accent); border-color:var(--accent); color:#fff; }
.choice.correct .choice-lbl { background:var(--green); border-color:var(--green); color:#fff; }
.choice.wrong .choice-lbl { background:var(--red); border-color:var(--red); color:#fff; }
.ox-choices { display:flex; gap:12px; margin-top:22px; }
.ox-choice { flex:1; padding:28px 0; border-radius:14px; border:2px solid var(--border); background:var(--bg); cursor:pointer; transition:all .18s; display:flex; flex-direction:column; align-items:center; gap:6px; }
.ox-choice .ox-symbol { font-size:40px; }
.ox-choice .ox-label { font-size:14px; font-weight:600; color:var(--muted); }
.ox-choice:hover:not(.disabled) { border-color:var(--accent); background:var(--accent-light); }
.ox-choice.selected { border-color:var(--accent); background:var(--accent-light); box-shadow:0 0 0 3px rgba(61,82,230,.1); }
.ox-choice.correct { border-color:var(--green); background:var(--green-light); animation:popIn .3s cubic-bezier(.34,1.56,.64,1); }
.ox-choice.wrong { border-color:var(--red); background:var(--red-light); animation:shake .35s ease; }
.fill-input { width:100%; padding:14px 18px; border-radius:11px; border:2px solid var(--border2); background:var(--bg); font-family:var(--font-primary); font-size:16px; color:var(--ink); outline:none; transition:border-color .18s; margin-top:22px; }
.fill-input:focus { border-color:var(--accent); background:var(--white); }
.fill-input.correct { border-color:var(--green); background:var(--green-light); }
.fill-input.wrong { border-color:var(--red); background:var(--red-light); }
.essay-input { width:100%; min-height:110px; padding:14px 18px; border-radius:11px; border:2px solid var(--border2); background:var(--bg); font-family:var(--font-primary); font-size:15px; color:var(--ink); outline:none; transition:border-color .18s; resize:vertical; margin-top:20px; }
.essay-input:focus { border-color:var(--accent); background:var(--white); }
.submit-row { display:flex; align-items:center; gap:12px; margin-top:16px; }
.btn-submit { padding:11px 30px; border-radius:11px; border:none; cursor:pointer; font-family:var(--font-primary); font-size:15px; font-weight:700; background:var(--accent); color:#fff; box-shadow:0 3px 14px rgba(61,82,230,.3); transition:all .18s; }
.btn-submit:hover:not(:disabled) { background:#2e40c8; transform:translateY(-1px); }
.btn-submit:disabled { opacity:.4; cursor:default; transform:none; box-shadow:none; }
.result-pill { display:none; align-items:center; gap:7px; padding:9px 16px; border-radius:9px; font-size:14px; font-weight:600; }
.result-pill.correct { display:flex; background:var(--green-light); color:var(--green); border:1.5px solid #a8d8c2; }
.result-pill.wrong { display:flex; background:var(--red-light); color:var(--red); border:1.5px solid #f0b8b8; }
.explanation-block { margin-top:16px; background:linear-gradient(135deg,var(--accent-light),#f3f5fd); border:1.5px solid var(--accent-mid); border-radius:13px; padding:18px 20px; display:none; animation:slideUp .25s ease; }
.explanation-block.visible { display:block; }
.expl-head { font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.5px; color:var(--accent); margin-bottom:8px; }
.expl-text { font-size:14px; line-height:1.7; color:var(--ink2); }

/* ── COMMENTS ── */
.comments-section { margin-top:24px; }
.comments-hd { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
.comments-hd h3 { font-family:var(--font-display); font-size:18px; font-weight:600; display:flex; align-items:center; gap:8px; }
.cnt-badge { background:var(--accent-light); color:var(--accent); font-size:12px; font-weight:700; padding:2px 8px; border-radius:6px; }
.sort-tabs { display:flex; gap:4px; }
.sort-tab { padding:4px 12px; border-radius:6px; font-size:12.5px; font-weight:500; border:1px solid var(--border); color:var(--muted); background:var(--white); cursor:pointer; transition:all .15s; }
.sort-tab.active { background:var(--accent); color:#fff; border-color:var(--accent); }
.comment-list { display:flex; flex-direction:column; gap:10px; margin-bottom:14px; }
.comment { background:var(--white); border:1.5px solid var(--border); border-radius:13px; padding:16px 18px; transition:border-color .15s; }
.comment:hover { border-color:var(--border2); }
.comment.expl { border-color:var(--accent-mid); background:linear-gradient(135deg,#fafbff,#f3f5fd); }
.comment-meta { display:flex; align-items:center; gap:7px; margin-bottom:9px; }
.expert-tag { background:var(--accent); color:#fff; font-size:10.5px; font-weight:700; padding:2px 7px; border-radius:4px; letter-spacing:.3px; }
.comment-author { font-size:13.5px; font-weight:600; }
.comment-time { font-size:12px; color:var(--muted); margin-left:auto; }
.comment-body { font-size:14px; line-height:1.7; color:var(--ink2); white-space:pre-line; }
.comment-actions { display:flex; gap:12px; margin-top:10px; padding-top:10px; border-top:1px solid var(--border); }
.caction { display:flex; align-items:center; gap:4px; font-size:12.5px; color:var(--muted); cursor:pointer; background:none; border:none; transition:color .15s; padding:0; }
.caction:hover { color:var(--accent); }
.caction.liked { color:var(--accent); }
.reply-thread { margin-top:10px; padding-top:10px; border-top:1px solid var(--border); padding-left:16px; border-left:2px solid var(--border); display:flex; flex-direction:column; gap:8px; }
.reply { display:flex; gap:8px; align-items:flex-start; }
.reply-body { font-size:13.5px; color:var(--ink2); line-height:1.6; }
.reply-author { font-size:13px; font-weight:600; color:var(--ink2); }
.comment-input-box { background:var(--white); border:1.5px solid var(--border); border-radius:13px; padding:4px; display:flex; transition:border-color .18s; box-shadow:var(--shadow); }
.comment-input-box:focus-within { border-color:var(--accent); }
.comment-input { flex:1; background:none; border:none; outline:none; padding:11px 14px; font-family:var(--font-primary); font-size:14px; color:var(--ink); resize:none; }
.comment-input::placeholder { color:var(--muted); }
.btn-comment { background:var(--accent); color:#fff; border:none; cursor:pointer; border-radius:10px; padding:10px 18px; margin:3px; font-family:var(--font-primary); font-size:13px; font-weight:700; transition:all .15s; white-space:nowrap; }
.btn-comment:hover { background:#2e40c8; }
/* login required notice */
.login-notice { background:var(--amber-light); border:1.5px solid #f0c896; border-radius:11px; padding:12px 16px; font-size:13.5px; color:#7a4a10; display:flex; align-items:center; gap:10px; }
.login-notice button { background:var(--amber); color:#fff; border:none; border-radius:7px; padding:6px 14px; font-size:13px; font-weight:600; cursor:pointer; white-space:nowrap; font-family:var(--font-primary); }

/* ── CREATE ── */
.create-wrap { display:grid; grid-template-columns:1fr 340px; gap:28px; align-items:start; }
@media(max-width:760px){.create-wrap{grid-template-columns:1fr}}
.create-form { background:var(--white); border:1.5px solid var(--border); border-radius:18px; padding:32px; box-shadow:var(--shadow-md); }
.create-title { font-family:var(--font-display); font-size:24px; font-weight:700; margin-bottom:28px; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.fg { margin-bottom:18px; }
.fl { display:block; font-size:12px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.6px; margin-bottom:7px; }
.fi, .fta, .fse { width:100%; background:var(--bg); border:1.5px solid var(--border2); border-radius:10px; padding:11px 14px; font-family:var(--font-primary); font-size:14.5px; color:var(--ink); outline:none; transition:border-color .18s; appearance:none; }
.fi:focus,.fta:focus,.fse:focus { border-color:var(--accent); background:var(--white); }
.fta { min-height:95px; resize:vertical; }
.fse option { background:#fff; }
.type-tabs { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-bottom:22px; }
.type-tab { padding:11px 8px; border-radius:10px; border:1.5px solid var(--border2); background:var(--bg); cursor:pointer; transition:all .18s; text-align:center; }
.type-tab .type-icon { font-size:20px; display:block; margin-bottom:4px; }
.type-tab .type-name { font-size:11.5px; font-weight:600; color:var(--muted); }
.type-tab.active { border-color:var(--accent); background:var(--accent-light); }
.type-tab.active .type-name { color:var(--accent); }
.type-tab:hover:not(.active) { background:var(--white); }
.choices-builder { display:flex; flex-direction:column; gap:8px; }
.choice-row { display:flex; align-items:center; gap:9px; }
.choice-row-num { width:30px; height:30px; border-radius:7px; flex-shrink:0; background:var(--surface2); border:1px solid var(--border); display:flex; align-items:center; justify-content:center; font-size:12.5px; font-weight:700; color:var(--muted); }
.correct-btn { width:34px; height:34px; border-radius:8px; flex-shrink:0; background:var(--bg); border:1.5px solid var(--border2); cursor:pointer; transition:all .18s; font-size:15px; display:flex; align-items:center; justify-content:center; }
.correct-btn.active { background:var(--green-light); border-color:var(--green); }
.ox-builder { display:flex; gap:12px; margin-top:4px; }
.ox-btn { flex:1; padding:20px 0; border-radius:12px; border:2px solid var(--border2); background:var(--bg); cursor:pointer; transition:all .18s; font-size:30px; display:flex; flex-direction:column; align-items:center; gap:4px; }
.ox-btn span { font-size:12px; font-weight:600; color:var(--muted); }
.ox-btn.active.o-btn { border-color:var(--green); background:var(--green-light); }
.ox-btn.active.x-btn { border-color:var(--red); background:var(--red-light); }
.ox-btn:hover:not(.active) { background:var(--white); }
.char-counter { text-align:right; font-size:11.5px; color:var(--muted); margin-top:4px; }
.divider { height:1px; background:var(--border); margin:22px 0; }
.btn-post { width:100%; padding:14px; border-radius:12px; border:none; cursor:pointer; font-family:var(--font-display); font-size:17px; font-weight:700; background:var(--accent); color:#fff; box-shadow:0 4px 20px rgba(61,82,230,.32); transition:all .2s; }
.btn-post:hover { background:#2e40c8; transform:translateY(-1px); box-shadow:0 6px 28px rgba(61,82,230,.42); }
.preview-card { background:var(--white); border:1.5px solid var(--border); border-radius:16px; padding:22px; box-shadow:var(--shadow); position:sticky; top:76px; }
.preview-title { font-family:var(--font-display); font-size:14px; font-weight:600; color:var(--muted); margin-bottom:14px; display:flex; align-items:center; gap:6px; }
.preview-q { font-size:15px; font-weight:500; color:var(--ink); line-height:1.55; margin-bottom:14px; min-height:48px; word-break:break-word; }
.preview-choices { display:flex; flex-direction:column; gap:7px; }
.preview-choice { display:flex; align-items:center; gap:9px; padding:9px 12px; border-radius:8px; border:1.5px solid var(--border); background:var(--bg); font-size:13.5px; color:var(--ink2); }
.preview-choice.is-answer { border-color:var(--green); background:var(--green-light); color:var(--green); }
.preview-choice-lbl { width:22px; height:22px; border-radius:5px; flex-shrink:0; background:var(--white); border:1px solid var(--border2); display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:700; color:var(--muted); }
.preview-choice.is-answer .preview-choice-lbl { background:var(--green); border-color:var(--green); color:#fff; }
.tips-box { background:var(--amber-light); border:1.5px solid #f0c896; border-radius:12px; padding:14px 16px; margin-top:14px; }
.tips-box h4 { font-size:13px; font-weight:700; color:var(--amber); margin-bottom:7px; }
.tips-box ul { padding-left:16px; }
.tips-box li { font-size:12.5px; color:#7a4a10; line-height:1.65; margin-bottom:3px; }

/* ── TOAST ── */
.toast { position:fixed; bottom:28px; left:50%; transform:translateX(-50%) translateY(70px); background:var(--ink); color:#f5f4f0; padding:11px 22px; border-radius:11px; font-size:14px; font-weight:500; z-index:9999; transition:transform .3s cubic-bezier(.34,1.56,.64,1); box-shadow:0 8px 28px rgba(0,0,0,.25); white-space:nowrap; pointer-events:none; }
.toast.show { transform:translateX(-50%) translateY(0); }

::-webkit-scrollbar{width:5px} ::-webkit-scrollbar-track{background:var(--bg)} ::-webkit-scrollbar-thumb{background:var(--border2);border-radius:3px}

/* ══════════════════════════════════════
   📱 MOBILE BOTTOM TAB BAR
══════════════════════════════════════ */
.mobile-tabbar {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 300;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid var(--border);
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  box-shadow: 0 -4px 24px rgba(18,18,42,.08);
}
.mobile-tabbar-inner {
  display: flex; justify-content: space-around; align-items: center;
}
.mb-tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 14px; border-radius: 14px; border: none; background: none;
  cursor: pointer; transition: all .2s; min-width: 56px;
  font-family: var(--font-primary);
}
.mb-tab-icon { font-size: 22px; line-height: 1; transition: transform .2s cubic-bezier(.34,1.56,.64,1); }
.mb-tab-label { font-size: 10.5px; font-weight: 600; color: var(--muted); letter-spacing: .2px; transition: color .2s; }
.mb-tab.active .mb-tab-label { color: var(--accent); font-weight: 700; }
.mb-tab.active .mb-tab-icon { transform: scale(1.15) translateY(-1px); }

/* ══════════════════════════════════════
   📱 GLOBAL MOBILE OVERRIDES (≤ 640px)
══════════════════════════════════════ */
@media (max-width: 640px) {

  /* ── body padding for bottom tabbar ── */
  body { padding-bottom: 72px; }

  /* ── show mobile tabbar, hide desktop nav tabs ── */
  .mobile-tabbar { display: block; }
  .nav-tabs { display: none; }

  /* ── nav shrink ── */
  nav {
    padding: 0 16px; height: 52px; gap: 12px;
  }
  .logo { font-size: 19px; }
  .btn-signout { display: none; }
  .nav-username { max-width: 72px; font-size: 12.5px; }
  .btn { padding: 6px 12px; font-size: 12.5px; }

  /* ── main padding ── */
  main { padding: 20px 16px; }

  /* ── feed ── */
  .feed-layout { grid-template-columns: 1fr; gap: 0; }
  .feed-main h1 { font-size: 21px; margin-bottom: 14px; }
  .sidebar { display: none; } /* hide sidebar on mobile — stats accessible via mypage */

  .qcard { padding: 16px; }
  .qcard-q { font-size: 14.5px; }
  .tag-row { gap: 5px; margin-bottom: 14px; }
  .pill { padding: 5px 11px; font-size: 12.5px; }

  /* ── detail / quiz view ── */
  .detail-card { padding: 20px 18px; border-radius: 14px; }
  .detail-q { font-size: 17px; }
  .choice { padding: 13px 14px; font-size: 14.5px; gap: 10px; }
  .choice-lbl { width: 26px; height: 26px; font-size: 12px; }
  .ox-choices { gap: 10px; }
  .ox-choice { padding: 22px 0; border-radius: 12px; }
  .ox-choice .ox-symbol { font-size: 34px; }
  .submit-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .btn-submit { padding: 14px; font-size: 15px; text-align: center; border-radius: 12px; }
  .result-pill { font-size: 13.5px; }

  /* ── comments ── */
  .comments-hd { flex-direction: column; align-items: flex-start; gap: 10px; }
  .comment { padding: 13px 14px; }
  .comment-input-box { flex-direction: column; }
  .btn-comment { margin: 4px; width: calc(100% - 8px); padding: 11px; border-radius: 9px; }

  /* ── create form ── */
  .create-wrap { grid-template-columns: 1fr; gap: 16px; }
  .create-form { padding: 20px 18px; border-radius: 14px; }
  .create-title { font-size: 20px; margin-bottom: 20px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .type-tabs { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .type-tab { padding: 12px 8px; }
  .preview-card { position: static; border-radius: 14px; }

  /* ── mypage profile banner ── */
  .profile-banner {
    flex-direction: column; align-items: flex-start;
    padding: 22px 20px; gap: 16px; border-radius: 16px;
  }
  .profile-stats {
    width: 100%; justify-content: space-between; gap: 8px;
  }
  .pstat { flex: 1; padding: 10px 8px; }
  .pstat-val { font-size: 20px; }
  .pstat-label { font-size: 10.5px; }
  .profile-name { font-size: 21px; }
  .profile-email { font-size: 12.5px; margin-bottom: 6px; }

  /* ── mypage activity ── */
  .activity-grid { gap: 3px; }
  .section-title { font-size: 16px; }

  /* ── mypage tabs ── */
  .mypage-tab { font-size: 13px; padding: 9px 6px; }

  /* ── history cards ── */
  .history-card { padding: 13px 14px; gap: 12px; }
  .history-q { font-size: 13.5px; }

  /* ── toast position — above tabbar ── */
  .toast { bottom: 84px; }

  /* ── auth modal ── */
  .auth-modal { border-radius: 18px 18px 0 0; position: fixed; bottom: 0; left: 0; right: 0; max-width: 100%; margin: 0; }
  .auth-overlay { align-items: flex-end; padding: 0; }

  /* ── 모바일 터치 최적화 ── */

  /* 필터 pill — 최소 터치 영역 44px 확보 */
  .pill { padding: 8px 14px; font-size: 13px; min-height: 36px; }
  .tag-row { gap: 6px; margin-bottom: 16px; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 4px; }
  .tag-row::-webkit-scrollbar { display: none; }

  /* 카드 footer — 모바일에서 wrap 허용 + 간격 조정 */
  .qcard-foot { gap: 8px; flex-wrap: wrap; padding-top: 10px; font-size: 12px; }
  .stat-empty { font-size: 11px; padding: 3px 8px; }

  /* Q&A 필터 — 터치 영역 확대 */
  .qna-filter-btn { padding: 8px 16px; font-size: 12.5px; min-height: 36px; }

  /* 브랜드 홈페이지 링크 — 모바일에서 숨김 */
  nav > a[href*="k-uplearning.com"] { display: none; }

  /* 학교 시험 섹션 모바일 여백 */
  .school-exam-section { padding: 18px 16px; border-radius: 14px; margin-bottom: 18px; }
  .school-exam-header { flex-direction: column; gap: 12px; }
  .school-exam-upload-btn { width: 100%; justify-content: center; }
  .school-exam-title { font-size: 18px; }
  .school-exam-sub { font-size: 12px; }
  .school-exam-badge { font-size: 10.5px; }

  /* 구독 배너 모바일 최적화 */
  #feed-sub-banner { margin: 18px 0 8px; }

  /* 카드 내 아바타/메타 — 줄바꿈 방지 */
  .qcard-top { gap: 8px; }
  .qcard-meta { flex-wrap: wrap; gap: 4px; }
  .qcard-time { font-size: 11px; }
  .qcard-author { font-size: 13px; }

  /* footer ── */
  .footer-links-wrap { grid-template-columns: 1fr 1fr; gap: 20px; }
  .footer-inner { padding: 32px 16px 20px; }
  .footer-brand { text-align: center; }
  .footer-top { gap: 24px; }
  .footer-bottom { flex-direction: column; align-items: center; text-align: center; gap: 10px; }
  .qr-img { width: 70px; height: 70px; }
}

/* ══════════════════════════════════════
   📱 SMALL MOBILE (≤ 390px) — iPhone SE / 소형 기기
══════════════════════════════════════ */
@media (max-width: 390px) {
  nav { padding: 0 10px; height: 48px; gap: 8px; }
  .logo { font-size: 16px; }
  .nav-username { max-width: 56px; font-size: 11px; }
  .btn { padding: 5px 10px; font-size: 11.5px; }
  main { padding: 14px 10px; }

  /* 피드 */
  .qcard { padding: 12px; }
  .qcard-q { font-size: 13.5px; }
  .pill { padding: 6px 10px; font-size: 11.5px; }
  .feed-main h1 { font-size: 18px; }

  /* 디테일/퀴즈 */
  .detail-card { padding: 16px 14px; }
  .detail-q { font-size: 15px; }
  .choice { padding: 11px 12px; font-size: 13.5px; }

  /* 프로필 */
  .profile-banner { padding: 18px 14px; gap: 12px; }
  .profile-name { font-size: 18px; }
  .pstat-val { font-size: 17px; }

  /* 히어로 배너 */
  .hero-welcome { padding: 24px 18px 22px; border-radius: 14px; }
  .hero-welcome-title { font-size: 19px !important; }
  .hero-welcome-desc { font-size: 12.5px; }
  .hero-btn-start { padding: 10px 20px; font-size: 13.5px; }
  .hero-btn-explore { padding: 9px 16px; font-size: 12.5px; }

  /* create */
  .create-form { padding: 16px 14px; }
  .create-title { font-size: 17px; }

  /* 모바일 탭바 */
  .mobile-tabbar { padding: 6px 4px; }
  .mb-tab { font-size: 9.5px; }
  .mb-tab-icon { font-size: 17px; }

  /* 푸터 */
  .footer-inner { padding: 24px 10px 16px; }
  .footer-links-wrap { grid-template-columns: 1fr; gap: 16px; }
}

/* ══════════════════════════════════════
   📱 SAFE AREA (노치/홈바 대응)
══════════════════════════════════════ */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .mobile-tabbar {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
  @media (max-width: 640px) {
    body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
    .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
    .auth-modal { padding-bottom: env(safe-area-inset-bottom); }
  }
}

/* ── tablet (641–900px) ── */
@media (min-width: 641px) and (max-width: 900px) {
  main { padding: 24px 20px; }
  .feed-layout { grid-template-columns: 1fr 220px; gap: 20px; }
  .create-wrap { grid-template-columns: 1fr 280px; }
  .profile-banner { flex-wrap: wrap; padding: 24px 28px; }
  .profile-stats { flex-wrap: wrap; }
}

/* ══════════════════════════════════════
   접근성: 고대비 모드 (App 전용 요소)
   ══════════════════════════════════════ */
html.a11y-hc {
  --bg: #1a1a1a; --bg2: #222; --white: #2a2a2a; --surface: #252525;
  --g50: #222; --g100: #2a2a2a; --g200: #444; --g300: #555;
  --g400: #888; --g500: #aaa; --g600: #ccc; --g700: #ddd;
  --g800: #eee; --g900: #f5f5f5;
}
html.a11y-hc nav { background: #111 !important; }
html.a11y-hc .mobile-tabbar { background: #111 !important; border-color: #444 !important; }
html.a11y-hc .mobile-tabbar button { color: #aaa !important; }
html.a11y-hc .mobile-tabbar button.active { color: #60a5fa !important; }
html.a11y-hc .hero-welcome { background: #252525 !important; }
html.a11y-hc .card, html.a11y-hc .question-card { background: #252525 !important; border-color: #444 !important; }
html.a11y-hc .card h3, html.a11y-hc .card h4 { color: #f5f5f5 !important; }
html.a11y-hc .sidebar-card { background: #252525 !important; border-color: #444 !important; }
html.a11y-hc .profile-banner { background: #252525 !important; }
html.a11y-hc .streak-card { background: #252525 !important; border-color: #444 !important; }
html.a11y-hc .toast { background: #333 !important; color: #f5f5f5 !important; }
html.a11y-hc .auth-modal { background: rgba(0,0,0,0.85) !important; }
html.a11y-hc .auth-modal > div { background: #222 !important; }
html.a11y-hc .league-podium { background: #252525 !important; }
html.a11y-hc .league-table { background: #252525 !important; }
html.a11y-hc .league-table tr:nth-child(even) { background: #2a2a2a !important; }
html.a11y-hc .quiz-container { background: #252525 !important; }
html.a11y-hc .choice-btn { background: #333 !important; border-color: #555 !important; color: #eee !important; }
html.a11y-hc .choice-btn:hover { background: #3a3a3a !important; }

/* 접근성: 글자 크기 — App 전용 보정 */
html.a11y-font-lg .card, html.a11y-font-lg .question-card { padding: 20px !important; }
html.a11y-font-xl .card, html.a11y-font-xl .question-card { padding: 24px !important; }
html.a11y-font-lg .mobile-tabbar button { font-size: 11px !important; }
html.a11y-font-xl .mobile-tabbar button { font-size: 12px !important; }

/* ── HERO WELCOME BANNER ── */
.hero-welcome {
  position: relative;
  border-radius: 22px;
  padding: 40px 36px 32px;
  margin-bottom: 24px;
  overflow: hidden;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #4338ca 100%);
  box-shadow: 0 8px 32px rgba(30,27,75,.25);
}
.hero-welcome-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 80% 20%, rgba(139,92,246,.3) 0%, transparent 50%),
    radial-gradient(circle at 20% 80%, rgba(79,70,229,.2) 0%, transparent 50%);
  pointer-events: none;
}
.hero-welcome-content { position: relative; z-index: 1; }
.hero-welcome-badge {
  display: inline-block;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
  border-radius: 20px; padding: 4px 14px;
  font-size: 12px; font-weight: 700; color: rgba(255,255,255,.9);
  margin-bottom: 16px;
}
.hero-welcome-title {
  font-family: var(--font-display);
  font-size: clamp(22px, 4vw, 30px); font-weight: 700;
  color: #fff; line-height: 1.35;
  margin-bottom: 12px; letter-spacing: -.3px;
}
.hero-welcome-desc {
  font-size: 14px; color: rgba(255,255,255,.6);
  line-height: 1.7; margin-bottom: 24px;
}
.hero-welcome-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 28px; }
.hero-btn-start {
  padding: 12px 28px; border-radius: 12px; border: none;
  background: linear-gradient(90deg, #fde68a, #f59e0b);
  color: #78350f; font-size: 15px; font-weight: 700;
  cursor: pointer; font-family: var(--font-primary);
  box-shadow: 0 4px 16px rgba(245,158,11,.35);
  transition: all .2s;
}
.hero-btn-start:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(245,158,11,.45); }
.hero-btn-explore {
  padding: 11px 22px; border-radius: 12px;
  border: 1.5px solid rgba(255,255,255,.25);
  background: transparent; color: rgba(255,255,255,.85);
  font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: var(--font-primary); transition: all .2s;
}
.hero-btn-explore:hover { border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.06); }
.hero-welcome-stats {
  display: flex; align-items: center; gap: 20px;
  padding-top: 20px; border-top: 1px solid rgba(255,255,255,.1);
}
.hero-stat { display: flex; flex-direction: column; align-items: center; }
.hero-stat-num {
  font-family: var(--font-display); font-size: 22px; font-weight: 700;
  color: #fff;
}
.hero-stat-label { font-size: 11px; color: rgba(255,255,255,.45); margin-top: 2px; }
.hero-stat-divider { width: 1px; height: 28px; background: rgba(255,255,255,.12); }

/* ── HERO USER (logged in) ── */
.hero-user {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(90deg, var(--accent-light), var(--white));
  border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 20px;
  margin-bottom: 20px;
}
.hero-user-greeting {
  font-size: 15px; font-weight: 700; color: var(--ink);
}
.hero-user-tip {
  font-size: 13px; color: var(--muted);
}

@media (max-width: 768px) {
  .hero-welcome { padding: 28px 20px 24px; border-radius: 16px; }
  .hero-welcome-title { font-size: 22px; }
  .hero-welcome-desc { font-size: 13px; }
  .hero-welcome-stats { gap: 14px; flex-wrap: wrap; justify-content: center; }
  .hero-btn-start { width: 100%; text-align: center; }
  .hero-btn-explore { width: 100%; text-align: center; }
  .hero-user { flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px 16px; }
}

/* ── SCHOOL EXAM SECTION ── */
.school-exam-section {
  background: linear-gradient(135deg, #faf9ff 0%, var(--white) 100%);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 26px 28px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-md);
  position: relative;
  z-index: 0;
  overflow: hidden;
}
.school-exam-section::before {
  display: block;
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #4f46e5, #7c3aed, #ec4899);
  border-radius: 22px 22px 0 0;
}

.school-exam-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin-bottom: 0;
}
.school-exam-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: linear-gradient(135deg,#ede9fe,#ddd6fe); color: #6d28d9;
  font-size: 11.5px; font-weight: 700; letter-spacing: .3px;
  padding: 3px 10px; border-radius: 20px;
  margin-bottom: 8px; border: 1px solid #c4b5fd;
}
.school-exam-title {
  font-family: var(--font-display); font-size: 21px; font-weight: 700;
  color: var(--ink); margin-bottom: 5px; letter-spacing: -.4px;
}
.school-exam-sub { font-size: 13px; color: var(--muted); line-height: 1.5; }

.school-exam-upload-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 20px; border-radius: 12px; border: none; cursor: pointer;
  font-family: var(--font-primary); font-size: 14px; font-weight: 700;
  background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff;
  box-shadow: 0 4px 16px rgba(79,70,229,.3);
  transition: all .2s; white-space: nowrap; flex-shrink: 0;
}
.school-exam-upload-btn:hover { box-shadow: 0 6px 24px rgba(79,70,229,.45); transform: translateY(-2px); }

/* upload area */
.exam-upload-area {
  margin-top: 18px; animation: slideUp .2s ease;
}
.exam-upload-inner {
  border: 2px dashed var(--border2); border-radius: 14px;
  padding: 32px 20px; text-align: center; background: var(--bg);
  transition: border-color .18s;
}
.exam-upload-inner:hover { border-color: var(--accent); }
.exam-upload-icon { font-size: 36px; margin-bottom: 10px; }
.exam-upload-text { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.exam-file-label {
  display: inline-block; padding: 9px 22px; border-radius: 9px;
  background: var(--accent-light); color: var(--accent);
  font-size: 14px; font-weight: 700; cursor: pointer;
  border: 1.5px solid var(--accent-mid); transition: all .15s;
}
.exam-file-label:hover { background: var(--accent); color: #fff; }
.exam-upload-hint { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* preview */
.exam-preview-wrap {
  margin-top: 16px; position: relative; animation: slideUp .2s ease;
}
.exam-preview-img {
  width: 100%; max-height: 300px; object-fit: contain;
  border-radius: 12px; border: 1.5px solid var(--border);
  background: var(--bg);
}
.exam-reset-btn {
  position: absolute; top: 10px; right: 10px;
  background: rgba(26,25,22,.6); color: #fff; border: none; border-radius: 7px;
  padding: 5px 11px; font-size: 12.5px; cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: background .15s;
}
.exam-reset-btn:hover { background: var(--red); }

/* options */
.exam-options { margin-top: 16px; animation: slideUp .2s ease; }
.exam-opt-row { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 16px; }
.exam-opt-group { display: flex; flex-direction: column; gap: 8px; }
.exam-opt-label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.exam-opt-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.exam-opt-btn {
  padding: 6px 14px; border-radius: 8px; border: 1.5px solid var(--border2);
  background: var(--bg); color: var(--muted); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s; font-family: 'Plus Jakarta Sans', sans-serif;
}
.exam-opt-btn.active { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }

.exam-generate-btn {
  width: 100%; padding: 14px; border-radius: 12px; border: none; cursor: pointer;
  font-family: var(--font-display); font-size: 16px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #6875ee);
  color: #fff; box-shadow: 0 4px 20px rgba(61,82,230,.32);
  transition: all .2s;
}
.exam-generate-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 28px rgba(61,82,230,.42); }
.exam-generate-btn:disabled { opacity: .5; cursor: default; transform: none; }

/* result */
.exam-result { margin-top: 20px; animation: slideUp .25s ease; }
.exam-result-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.exam-result-title {
  font-family: var(--font-display); font-size: 17px; font-weight: 700;
}
.exam-pdf-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 18px; border-radius: 9px;
  border: none; cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 13.5px; font-weight: 700;
  background: var(--ink); color: #fff;
  box-shadow: 0 2px 10px rgba(26,25,22,.18);
  transition: all .18s;
}
.exam-pdf-btn:hover { background: #2e40c8; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(61,82,230,.32); }
.exam-pdf-btn:disabled { opacity: .5; cursor: default; transform: none; }

.exam-q-card {
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 14px; padding: 18px 20px; margin-bottom: 12px;
}
.exam-q-type-badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 5px; margin-bottom: 10px;
  background: var(--amber-light); color: var(--amber); letter-spacing: .3px;
}
.exam-q-text { font-size: 15px; font-weight: 500; line-height: 1.65; color: var(--ink); margin-bottom: 12px; }
.exam-q-choices { display: flex; flex-direction: column; gap: 7px; }
.exam-q-choice {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px;
  border-radius: 9px; border: 1.5px solid var(--border); background: var(--white);
  font-size: 14px; color: var(--ink2); cursor: pointer; transition: all .15s;
}
.exam-q-choice:hover { border-color: var(--accent); background: var(--accent-light); }
.exam-q-choice.selected { border-color: var(--accent); background: var(--accent-light); }
.exam-q-choice.reveal-correct { border-color: var(--green); background: var(--green-light); }
.exam-q-choice.reveal-wrong { border-color: var(--red); background: var(--red-light); }
.exam-q-num { font-weight: 700; color: var(--muted); flex-shrink: 0; font-size: 13px; }
.exam-q-answer-row {
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
  display: none;
}
.exam-q-answer-row.visible { display: block; }
.exam-q-answer { font-size: 13.5px; color: var(--green); font-weight: 700; margin-bottom: 4px; }
.exam-q-expl { font-size: 13px; color: var(--muted); line-height: 1.6; }
.exam-check-btn {
  margin-top: 10px; padding: 8px 18px; border-radius: 8px; border: none;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 700;
  cursor: pointer; font-family: 'Plus Jakarta Sans', sans-serif; transition: all .15s;
}
.exam-check-btn:hover { background: #2e40c8; }

/* loading skeleton */
.exam-loading {
  display: flex; flex-direction: column; gap: 12px; padding: 10px 0;
}
.exam-skel {
  background: linear-gradient(90deg, var(--border) 25%, var(--surface2) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 10px;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

@media (max-width: 640px) {
  /* school-exam 모바일은 글로벌 모바일 블록에서 일괄 처리 */
  .exam-opt-row { flex-direction: column; gap: 14px; }
}


.mypage-wrap { max-width: 860px; margin: 0 auto; }

.profile-banner {
  background: linear-gradient(135deg, var(--accent) 0%, #6875ee 60%, var(--amber) 100%);
  border-radius: 20px; padding: 32px 36px;
  display: flex; align-items: center; gap: 24px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-md); position: relative; overflow: hidden;
}
.profile-banner::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='30' cy='30' r='20'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.profile-big-avatar {
  width: 80px; height: 80px; border-radius: 50%; flex-shrink: 0;
  background: rgba(255,255,255,.25);
  border: 3px solid rgba(255,255,255,.5);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 32px; font-weight: 700; color: #fff;
  overflow: hidden; position: relative; z-index: 1;
}
.profile-big-avatar img { width:100%; height:100%; object-fit:cover; }

.profile-info { flex: 1; position: relative; z-index: 1; }
.profile-name {
  font-family: var(--font-display); font-size: 26px; font-weight: 700;
  color: #fff; margin-bottom: 4px;
}
.profile-email { font-size: 13.5px; color: rgba(255,255,255,.75); margin-bottom: 12px; }
.profile-join { font-size: 12px; color: rgba(255,255,255,.6); }

.profile-stats {
  display: flex; gap: 20px; position: relative; z-index: 1;
}
.pstat {
  text-align: center; background: rgba(255,255,255,.15);
  border-radius: 12px; padding: 12px 18px;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,.2);
}
.pstat-val {
  font-family: var(--font-display); font-size: 24px; font-weight: 700; color: #fff;
}
.pstat-label { font-size: 11.5px; color: rgba(255,255,255,.75); margin-top: 2px; }

/* activity bar */
.activity-section { margin-bottom: 28px; }
.section-title {
  font-family: var(--font-display); font-size: 18px; font-weight: 600;
  margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}

.activity-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  margin-bottom: 8px;
}
.aday {
  aspect-ratio: 1; border-radius: 4px;
  background: var(--border); transition: background .15s; cursor: default;
}
.aday.lv1 { background: #c2c9f8; }
.aday.lv2 { background: #7b8ff0; }
.aday.lv3 { background: var(--accent); }
.aday.lv4 { background: #2e40c8; }
.activity-legend {
  display: flex; align-items: center; gap: 6px; justify-content: flex-end;
  font-size: 11.5px; color: var(--muted);
}
.aleg { width: 12px; height: 12px; border-radius: 3px; }

/* tabs */
.mypage-tabs {
  display: flex; gap: 4px; background: var(--surface2);
  border-radius: 11px; padding: 4px; border: 1px solid var(--border);
  margin-bottom: 20px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mypage-tabs::-webkit-scrollbar { display: none; }
.mypage-tab {
  flex: 1; min-width: fit-content; padding: 9px 12px; border-radius: 8px; border: none; cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 13.5px; font-weight: 500;
  color: var(--muted); background: transparent; transition: all .18s; white-space: nowrap;
}
.mypage-tab.active { background: var(--white); color: var(--ink); box-shadow: var(--shadow); }

.mypage-panel { display: none; }
.mypage-panel.active { display: block; animation: slideUp .2s ease; }

/* history cards */
.history-list { display: flex; flex-direction: column; gap: 10px; }

.history-card {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: 13px; padding: 16px 20px;
  display: flex; align-items: center; gap: 16px;
  transition: all .18s; box-shadow: var(--shadow);
}
.history-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.history-result {
  width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.history-result.correct { background: var(--green-light); }
.history-result.wrong   { background: var(--red-light); }
.history-result.posted  { background: var(--accent-light); }

.history-body { flex: 1; min-width: 0; }
.history-q {
  font-size: 14.5px; font-weight: 500; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 5px;
}
.history-meta { display: flex; gap: 8px; align-items: center; }

.history-time { font-size: 12px; color: var(--muted); margin-left: auto; flex-shrink: 0; }

/* streak badge */
.streak-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, #ff9040, #e07c2a);
  color: #fff; border-radius: 8px; padding: 5px 12px;
  font-size: 13px; font-weight: 700; margin-bottom: 16px;
}

/* empty state */
.empty-state {
  text-align: center; padding: 48px 20px; color: var(--muted);
}
.empty-state .empty-icon { font-size: 44px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }
.empty-state small { font-size: 13px; color: var(--muted); }

/* login required for mypage */
.mypage-login-req {
  text-align: center; padding: 60px 20px;
}
.mypage-login-req .big-icon { font-size: 52px; margin-bottom: 16px; }
.mypage-login-req h3 { font-family: var(--font-display); font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.mypage-login-req p { font-size: 14px; color: var(--muted); margin-bottom: 24px; }

/* ── K-UP TOKEN (변수는 상단 :root에 통합됨) ── */
.token-banner {
  background: linear-gradient(135deg, #fff8e6 0%, #fffbf0 60%, #fff3d0 100%);
  border: 1.5px solid var(--token-border);
  border-radius: 16px; padding: 20px 24px;
  display: flex; align-items: center; gap: 18px;
  margin-bottom: 20px; position: relative; overflow: hidden;
}
.token-banner::before {
  content: '🪙'; position: absolute; right: 20px; top: 50%;
  transform: translateY(-50%); font-size: 56px; opacity: .12; pointer-events: none;
}
.token-coin { font-size: 36px; flex-shrink: 0; }
.token-info { flex: 1; }
.token-label { font-size: 12px; font-weight: 600; color: var(--token); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 2px; }
.token-amount {
  font-family: var(--font-display); font-size: 36px; font-weight: 700;
  color: var(--token); line-height: 1;
}
.token-amount span { font-size: 15px; font-weight: 500; margin-left: 4px; color: #b06a00; }
.token-history-btn {
  padding: 8px 16px; border-radius: 8px; border: 1.5px solid var(--token-border);
  background: #fff; color: var(--token); font-size: 13px; font-weight: 700;
  cursor: pointer; font-family: 'Plus Jakarta Sans', sans-serif; transition: all .15s;
  white-space: nowrap;
}
.token-history-btn:hover { background: var(--token-bg); }

.token-earn-row {
  display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap;
}
.token-earn-card {
  flex: 1; min-width: 140px; background: var(--white);
  border: 1.5px solid var(--border); border-radius: 12px;
  padding: 14px 16px; text-align: center;
}
.token-earn-icon { font-size: 22px; margin-bottom: 6px; }
.token-earn-pts { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--token); }
.token-earn-desc { font-size: 12px; color: var(--muted); margin-top: 3px; }

.token-log { display: flex; flex-direction: column; gap: 0; }
.token-log-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.token-log-item:last-child { border-bottom: none; }
.token-log-icon { font-size: 18px; width: 32px; text-align: center; flex-shrink: 0; }
.token-log-desc { flex: 1; font-size: 13.5px; color: var(--ink2); }
.token-log-time { font-size: 11.5px; color: var(--muted); }
.token-log-pts { font-size: 14px; font-weight: 700; color: var(--token); white-space: nowrap; }
.token-log-pts.minus { color: var(--red); }

/* toast for token earn */
.token-toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: linear-gradient(135deg, #fff8e6, #fffde0);
  border: 1.5px solid var(--token-border); border-radius: 50px;
  padding: 10px 22px; font-size: 14px; font-weight: 700; color: var(--token);
  box-shadow: 0 4px 20px rgba(196,127,0,.2); z-index: 9999;
  opacity: 0; transition: all .35s; pointer-events: none;
  white-space: nowrap;
}
.token-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── SUBSCRIPTION PLANS ── */
.sub-section { margin-bottom: 28px; }
.sub-header { margin-bottom: 20px; }
.sub-header h2 {
  font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--ink);
  margin-bottom: 6px;
}
.sub-header p { font-size: 13.5px; color: var(--muted); }

.plan-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px;
}
@media (max-width: 700px) { .plan-cards { grid-template-columns: 1fr; } }

.plan-card {
  background: var(--white); border: 2px solid var(--border);
  border-radius: 18px; padding: 24px 20px;
  display: flex; flex-direction: column; gap: 0;
  position: relative; transition: all .2s;
}
.plan-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.plan-card.popular {
  border-color: var(--pro); box-shadow: 0 0 0 3px rgba(124,61,224,.12);
}
.plan-card.current-plan {
  border-color: var(--green); background: var(--green-light);
}
.plan-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--pro); color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 12px; border-radius: 20px; white-space: nowrap;
  letter-spacing: .04em;
}
.plan-badge.current { background: var(--green); }
.plan-name {
  font-family: var(--font-display); font-size: 18px; font-weight: 700;
  color: var(--ink); margin-bottom: 4px; margin-top: 8px;
}
.plan-price {
  font-family: var(--font-display); font-size: 30px; font-weight: 700;
  color: var(--ink); margin-bottom: 2px; line-height: 1.1;
}
.plan-price span { font-size: 14px; font-weight: 500; color: var(--muted); }
.plan-period { font-size: 12px; color: var(--muted); margin-bottom: 16px; }
.plan-divider { border: none; border-top: 1px solid var(--border); margin: 0 0 16px; }
.plan-features { list-style: none; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.plan-features li {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13px; color: var(--ink2); line-height: 1.4;
}
.plan-features li .feat-icon { flex-shrink: 0; margin-top: 1px; }
.plan-features li.off { color: var(--muted); }
.plan-features li.off .feat-icon { opacity: .4; }
.plan-cta {
  margin-top: 20px; width: 100%; padding: 12px 0;
  border-radius: 10px; border: none; font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: 'Plus Jakarta Sans', sans-serif; transition: all .18s;
}
.plan-cta.free-cta {
  background: var(--surface2); color: var(--muted); cursor: default;
}
.plan-cta.month-cta {
  background: var(--pro); color: #fff;
}
.plan-cta.month-cta:hover { background: #6425c8; }
.plan-cta.year-cta {
  background: linear-gradient(135deg, var(--pro), #e07c2a);
  color: #fff;
}
.plan-cta.year-cta:hover { filter: brightness(1.07); }
.plan-cta.active-cta {
  background: var(--green); color: #fff; cursor: default;
}

.plan-save-badge {
  display: inline-block; background: #fff3e0; color: #e07c2a;
  font-size: 11px; font-weight: 700; border-radius: 4px;
  padding: 1px 6px; margin-left: 6px; vertical-align: middle;
}

/* subscriber benefits strip */
.sub-benefits-strip {
  background: linear-gradient(135deg, var(--pro) 0%, #4a2aab 60%, var(--amber) 100%);
  border-radius: 16px; padding: 20px 24px; margin-bottom: 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.sub-benefits-strip .sub-icon { font-size: 32px; flex-shrink: 0; }
.sub-benefits-title { color: #fff; font-family: var(--font-display); font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.sub-benefits-list { display: flex; gap: 12px; flex-wrap: wrap; }
.sub-benefit-chip {
  background: rgba(255,255,255,.18); color: #fff;
  border-radius: 20px; padding: 4px 12px; font-size: 12.5px; font-weight: 600;
}

/* subscriber badge on profile */
.sub-badge-pro {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--pro); color: #fff;
  border-radius: 6px; padding: 3px 10px;
  font-size: 11.5px; font-weight: 700; margin-left: 8px;
}
.sub-badge-year {
  background: linear-gradient(135deg, var(--pro), var(--amber));
}


/* ══════════════════════════════════════
   🇰🇷 KOREAN LEARNING PAGE
══════════════════════════════════════ */
.klvl-btn {
  padding:7px 16px; border-radius:20px;
  border:1.5px solid rgba(255,255,255,.2);
  background:rgba(255,255,255,.08); color:rgba(255,255,255,.75);
  font-size:12.5px; font-weight:600; cursor:pointer;
  font-family:var(--font-primary); transition:all .18s;
}
.klvl-btn:hover { background:rgba(255,255,255,.18); color:#fff; }
.klvl-active { background:rgba(255,255,255,.22) !important; color:#fff !important; border-color:rgba(255,255,255,.5) !important; }

.korean-topic-btn {
  padding:10px 8px; border-radius:12px;
  border:1.5px solid var(--border2);
  background:var(--white); color:var(--ink2);
  font-size:12.5px; font-weight:600; cursor:pointer;
  font-family:var(--font-primary);
  transition:all .18s; text-align:center; line-height:1.4;
}
.korean-topic-btn:hover {
  border-color:var(--accent); background:var(--accent-light); color:var(--accent);
  transform:translateY(-1px); box-shadow:var(--shadow);
}

.kmsg { display:flex; gap:10px; align-items:flex-start; }
.kmsg-hana { flex-direction:row; }
.kmsg-user { flex-direction:row-reverse; }
.kmsg-avatar {
  width:34px; height:34px; border-radius:50%; flex-shrink:0;
  background:linear-gradient(135deg,#3d52e6,#7b8ff0);
  display:flex; align-items:center; justify-content:center; font-size:16px;
}
.kmsg-user .kmsg-avatar { background:linear-gradient(135deg,var(--amber),#f0a865); }
.kmsg-bubble {
  max-width:78%; padding:12px 15px; border-radius:16px;
  font-size:14px; line-height:1.7; color:var(--ink);
  background:var(--surface2); border:1px solid var(--border);
}
.kmsg-hana .kmsg-bubble { border-radius:4px 16px 16px 16px; }
.kmsg-user .kmsg-bubble {
  background:var(--accent); color:#fff; border-color:transparent;
  border-radius:16px 4px 16px 16px;
}
.kmsg-typing .kmsg-bubble { display:flex; align-items:center; gap:5px; padding:14px 18px; }
.typing-dot {
  width:7px; height:7px; border-radius:50%;
  background:var(--muted); animation:typingBounce 1.2s infinite;
}
.typing-dot:nth-child(2){animation-delay:.2s}
.typing-dot:nth-child(3){animation-delay:.4s}
@keyframes typingBounce {
  0%,60%,100%{transform:translateY(0);opacity:.4}
  30%{transform:translateY(-6px);opacity:1}
}
.korean-phrase-row {
  display:flex; flex-direction:column; gap:2px;
  padding:9px 0; border-bottom:1px solid var(--border);
  cursor:pointer; transition:all .15s;
}
.korean-phrase-row:last-child{border-bottom:none}
.korean-phrase-row:hover .korean-phrase-kr{color:var(--accent)}
.korean-phrase-kr{font-size:15px;font-weight:700;color:var(--ink);font-family:var(--font-display);transition:color .15s}
.korean-phrase-en{font-size:12px;color:var(--muted)}
@media(max-width:640px){
  #korean-topic-grid{grid-template-columns:repeat(2,1fr)}
  #korean-messages{height:340px}
  .kmsg-bubble{max-width:88%;font-size:13.5px}
}


/* ══════════════════════════════════════
   ✏️ 문제 입력창 서식 툴바
══════════════════════════════════════ */
.q-toolbar {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 10px; margin-bottom: -1px;
  background: var(--surface2); border: 1.5px solid var(--border2);
  border-radius: 10px 10px 0 0;
  border-bottom: none;
}
.q-tool-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 7px;
  border: 1.5px solid var(--border2); background: var(--white);
  color: var(--ink2); font-size: 12.5px; font-weight: 600;
  cursor: pointer; font-family: var(--font-primary);
  transition: all .15s; line-height: 1;
}
.q-tool-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.q-tool-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.q-tool-divider { width: 1px; height: 20px; background: var(--border2); margin: 0 4px; }
.q-tool-hint { font-size: 11.5px; color: var(--muted); margin-left: 4px; }

/* contenteditable 스타일 */
.q-editor {
  min-height: 95px; resize: vertical; overflow-y: auto;
  border-radius: 0 0 10px 10px !important;
  white-space: pre-wrap; word-break: break-word;
  line-height: 1.7; cursor: text;
}
.q-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted); pointer-events: none;
}
.q-editor:focus { outline: none; border-color: var(--accent) !important; background: var(--white) !important; }
.q-editor u { text-decoration: underline; text-underline-offset: 3px; }
.q-editor b, .q-editor strong { font-weight: 700; }

@media(max-width:640px) {
  .q-tool-hint { display: none; }
  .q-tool-btn { padding: 5px 9px; font-size: 12px; }
}

/* ══════════════════════════════════════
   🌐 LANGUAGE GATE & SWITCH
══════════════════════════════════════ */
#lang-gate {
  position:fixed; inset:0; z-index:2000;
  background:rgba(15,12,41,.93);
  backdrop-filter:blur(14px);
  display:flex; align-items:center; justify-content:center;
  padding:20px;
  animation:fadeInOverlay .28s ease;
}
#lang-gate.hidden { display:none; }

.lang-gate-card {
  background:rgba(255,255,255,.07);
  border:1px solid rgba(255,255,255,.14);
  border-radius:26px;
  padding:48px 38px 42px;
  text-align:center;
  max-width:460px; width:100%;
  box-shadow:0 24px 64px rgba(0,0,0,.45);
}
.lang-gate-logo {
  font-family:var(--font-display);
  font-size:30px; font-weight:700;
  color:#fff; margin-bottom:6px; letter-spacing:-.5px;
}
.lang-gate-logo span { color:var(--amber); }
.lang-gate-sub {
  font-size:16px; font-weight:500;
  color:rgba(255,255,255,.78); margin-bottom:3px;
}
.lang-gate-sub2 {
  font-size:13px; color:rgba(255,255,255,.32);
  margin-bottom:38px;
}
.lang-gate-grid {
  display:grid; grid-template-columns:1fr 1fr; gap:14px;
}
.lang-gate-btn {
  background:rgba(255,255,255,.08);
  border:1.5px solid rgba(255,255,255,.15);
  border-radius:18px; padding:28px 16px;
  cursor:pointer; display:flex;
  flex-direction:column; align-items:center; gap:8px;
  transition:all .22s; color:#fff;
  font-family:var(--font-primary);
}
.lang-gate-btn:hover {
  background:rgba(255,255,255,.16);
  border-color:rgba(255,255,255,.38);
  transform:translateY(-3px);
  box-shadow:0 12px 32px rgba(0,0,0,.3);
}
.lang-gate-flag  { font-size:40px; }
.lang-gate-en    { font-size:15px; font-weight:700; }
.lang-gate-ko    { font-size:12px; color:rgba(255,255,255,.42); }
.lang-gate-desc  { font-size:11px; color:rgba(255,255,255,.28); margin-top:2px; }

/* 헤더 언어 전환 버튼 */
#lang-switch-btn {
  display:flex; align-items:center; gap:6px;
  background:linear-gradient(135deg,var(--accent-light),#f5f3ff);
  border:1px solid var(--accent-mid);
  border-radius:20px; padding:6px 14px;
  cursor:pointer;
  font-family:var(--font-primary);
  font-size:13px; font-weight:600; color:var(--accent);
  transition:all .2s; margin-right:4px; flex-shrink:0;
  box-shadow:0 2px 8px rgba(79,70,229,.12);
}
#lang-switch-btn:hover {
  background:var(--accent);
  border-color:var(--accent);
  color:#fff;
  box-shadow:0 4px 16px rgba(79,70,229,.3);
  transform:translateY(-1px);
}
@media(max-width:640px){
  #lang-switch-btn { padding:4px 10px; font-size:12px; }
  #lang-btn-text   { display:none; }
}
/* ── Q&A STYLES (from second style block) ── */

/* ══════════════════════════════════════
   💬 Q&A STYLES
══════════════════════════════════════ */
.qna-layout { max-width: 760px; margin: 0 auto; }

.qna-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.qna-title {
  font-family: var(--font-display); font-size: 26px; font-weight: 700;
  color: var(--ink); margin-bottom: 4px;
}
.qna-subtitle { font-size: 13.5px; color: var(--muted); line-height: 1.5; }

.btn-qna-write {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 20px; border-radius: 11px; border: none; cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 14px; font-weight: 700;
  background: var(--accent); color: #fff;
  box-shadow: 0 3px 14px rgba(61,82,230,.28);
  transition: all .18s; white-space: nowrap; flex-shrink: 0;
}
.btn-qna-write:hover { background: #2e40c8; transform: translateY(-1px); }

.qna-filter-row {
  display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap;
}
.qna-filter-btn {
  padding: 6px 16px; border-radius: 20px; border: 1.5px solid var(--border2);
  background: var(--white); color: var(--muted); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.qna-filter-btn.active {
  border-color: var(--accent); color: var(--accent); background: var(--accent-light);
}
.qna-filter-btn:hover:not(.active) { border-color: var(--ink2); color: var(--ink2); }

/* 질문 카드 */
.qna-card {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px;
  cursor: pointer; transition: all .2s; box-shadow: var(--shadow);
  margin-bottom: 10px;
}
.qna-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.qna-card-top {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.qna-cat-badge {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 5px;
  background: var(--accent-light); color: var(--accent);
}
.qna-card-title {
  font-size: 15.5px; font-weight: 700; color: var(--ink); line-height: 1.45;
  margin-bottom: 7px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.qna-card-body {
  font-size: 13.5px; color: var(--muted); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 12px;
}
.qna-card-foot {
  display: flex; align-items: center; gap: 12px;
  padding-top: 10px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted);
}
.qna-answered-badge {
  margin-left: auto; padding: 3px 9px; border-radius: 5px;
  font-size: 11px; font-weight: 700;
}
.qna-answered-badge.answered { background: var(--green-light); color: var(--green); }
.qna-answered-badge.unanswered { background: var(--amber-light); color: var(--amber); }

/* 스켈레톤 */
.qna-loading { display: flex; flex-direction: column; gap: 10px; }
.qna-skel {
  border-radius: 14px; background: linear-gradient(90deg, var(--border) 25%, var(--surface2) 50%, var(--border) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* 질문 작성 폼 */
.qna-write-card {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: 18px; padding: 32px; box-shadow: var(--shadow-md);
}
.qna-write-title {
  font-family: var(--font-display); font-size: 22px; font-weight: 700;
  margin-bottom: 24px; color: var(--ink);
}

/* 상세 뷰 */
.qna-detail-card {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: 18px; padding: 28px 32px; box-shadow: var(--shadow-md); margin-bottom: 20px;
}
.qna-detail-cat {
  font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 6px;
  background: var(--accent-light); color: var(--accent); display: inline-block;
  margin-bottom: 10px;
}
.qna-detail-title {
  font-family: var(--font-display); font-size: 22px; font-weight: 700;
  color: var(--ink); line-height: 1.4; margin-bottom: 14px;
}
.qna-detail-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted); margin-bottom: 20px;
  padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.qna-detail-body {
  font-size: 15px; line-height: 1.8; color: var(--ink2); white-space: pre-line;
}

/* 답변 섹션 */
.qna-answers-section { margin-top: 8px; }
.qna-answers-hd {
  font-family: var(--font-display); font-size: 18px; font-weight: 600;
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.qna-answer-card {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: 14px; padding: 20px 22px; margin-bottom: 10px;
  transition: border-color .15s;
}
.qna-answer-card.accepted {
  border-color: var(--green); background: linear-gradient(135deg, #f8fdf9, var(--green-light));
}
.qna-answer-meta {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.qna-accept-badge {
  background: var(--green); color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 5px; letter-spacing: .3px;
}
.qna-answer-body {
  font-size: 14.5px; line-height: 1.75; color: var(--ink2); white-space: pre-line;
  margin-bottom: 12px;
}
.qna-answer-actions {
  display: flex; gap: 10px; align-items: center;
  padding-top: 10px; border-top: 1px solid var(--border);
}
.btn-accept {
  padding: 5px 14px; border-radius: 8px; border: 1.5px solid var(--green);
  color: var(--green); background: var(--green-light); font-size: 12.5px;
  font-weight: 700; cursor: pointer; font-family: 'Plus Jakarta Sans', sans-serif;
  transition: all .15s;
}
.btn-accept:hover { background: var(--green); color: #fff; }
.btn-accept.accepted { background: var(--green); color: #fff; cursor: default; }

/* 답변 작성 */
.qna-answer-write {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: 14px; padding: 20px; box-shadow: var(--shadow); margin-top: 16px;
  transition: border-color .18s;
}
.qna-answer-write:focus-within { border-color: var(--accent); }
.qna-answer-input {
  width: 100%; background: var(--bg); border: 1.5px solid var(--border2);
  border-radius: 10px; padding: 12px 14px; font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px; color: var(--ink); resize: vertical; outline: none;
  transition: border-color .18s; min-height: 100px; margin-bottom: 10px;
}
.qna-answer-input:focus { border-color: var(--accent); background: var(--white); }
.btn-post-answer {
  padding: 10px 24px; border-radius: 10px; border: none; cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 14px; font-weight: 700;
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 10px rgba(61,82,230,.25);
  transition: all .18s;
}
.btn-post-answer:hover { background: #2e40c8; transform: translateY(-1px); }

/* 빈 상태 */
.qna-empty {
  text-align: center; padding: 60px 20px; color: var(--muted);
}
.qna-empty-icon { font-size: 40px; margin-bottom: 12px; }
.qna-empty-msg { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: var(--ink2); }
.qna-empty-sub { font-size: 13px; }

/* 모바일 */
@media (max-width: 640px) {
  .qna-title { font-size: 21px; }
  .qna-write-card { padding: 20px 18px; border-radius: 14px; }
  .qna-detail-card { padding: 20px 18px; border-radius: 14px; }
  .qna-detail-title { font-size: 19px; }
  .qna-card { padding: 16px; }
}

footer {
  background: var(--ink);
  color: #c8c6be;
  margin-top: 64px;
  border-top: 1px solid #2e2d28;
}
.footer-inner {
  max-width: 1060px; margin: 0 auto;
  padding: 48px 24px 28px;
}
.footer-top {
  display: grid; grid-template-columns: 260px 1fr; gap: 48px;
  margin-bottom: 36px;
}
@media(max-width:760px){ .footer-top { grid-template-columns:1fr; gap:32px; } }

.footer-logo {
  font-family: var(--font-display); font-size: 24px; font-weight: 700;
  color: #fff; margin-bottom: 12px; letter-spacing: -.5px;
}
.footer-logo span { color: var(--amber); }
.footer-desc {
  font-size: 13.5px; line-height: 1.7; color: #8c8a82; margin-bottom: 14px;
}
.footer-powered {
  font-size: 12px; color: #5a5852;
  padding: 8px 12px; background: #1f1e1a;
  border-radius: 8px; border: 1px solid #2e2d28;
  line-height: 1.6;
}
.footer-powered strong { color: #a8a69e; }

.footer-links-wrap {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px;
}
@media(max-width:600px){ .footer-links-wrap { grid-template-columns:1fr 1fr; } }

.footer-col { display: flex; flex-direction: column; gap: 6px; }

.footer-col-logo { margin-bottom: 6px; }
.footer-logo-img {
  height: 36px; width: auto; object-fit: contain;
  border-radius: 6px; background: #fff;
  padding: 4px 6px;
}
.footer-logo-fallback {
  font-family: var(--font-display); font-size: 16px; font-weight: 700; color: #fff;
}

.footer-col-title {
  font-size: 14px; font-weight: 600; color: #e8e6de; margin-bottom: 2px;
}
.footer-col-sub { font-size: 12px; color: #5a5852; line-height: 1.6; margin-bottom: 4px; }

.footer-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: #8c8a82; text-decoration: none;
  transition: color .15s; padding: 4px 0;
}
.footer-link:hover { color: var(--amber); }
.footer-link svg { flex-shrink: 0; opacity: .6; }

.footer-qr { margin-top: 4px; }
.qr-img {
  width: 90px; height: 90px; object-fit: cover;
  border-radius: 8px; display: block;
}
.qr-label {
  font-size: 11px; color: #5a5852; text-align: center; margin-top: 4px;
}
.qr-caption {
  font-size: 11px; color: #5a5852; text-align: center; margin-top: 4px;
}
.footer-bottom {
  border-top: 1px solid #2e2d28;
  padding-top: 20px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px;
}
.footer-copy { font-size: 12px; color: #5a5852; }
.footer-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.footer-badge {
  padding: 4px 12px; border-radius: 6px;
  border: 1px solid #2e2d28; color: #5a5852;
  font-size: 11.5px; font-weight: 500; text-decoration: none;
  transition: all .15s;
}
.footer-badge:hover { border-color: #5a5852; color: #e0ddd4; }

/* ── 사업자 정보 ── */
.footer-biz {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 6px 4px;
  padding: 14px 0 16px;
  border-top: 1px solid #2a2928;
  font-size: 11.5px; color: #5a5852; line-height: 1.6;
}
.footer-biz-dot { color: #3a3935; }
@media(max-width: 640px) {
  .footer-biz { font-size: 11px; gap: 4px 3px; }
  .footer-biz-dot { display: none; }
  .footer-biz span { display: block; width: 100%; }
}

/* ══════════════════════════════════════
   온보딩 모달
   ══════════════════════════════════════ */
.onboarding-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.55); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: onb-fadeIn .3s ease;
}
@keyframes onb-fadeIn { from { opacity: 0; } to { opacity: 1; } }

.onboarding-card {
  background: var(--card); border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  max-width: 420px; width: 100%;
  overflow: hidden;
  animation: onb-slideUp .35s ease;
}
@keyframes onb-slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.onboarding-progress {
  height: 4px; background: var(--border);
}
.onboarding-progress-fill {
  height: 100%; background: var(--amber);
  border-radius: 0 4px 4px 0;
  transition: width .35s ease;
}

.onboarding-step {
  display: none;
  padding: 36px 32px 28px;
  text-align: center;
}
.onboarding-step.active { display: block; }

.onboarding-emoji {
  font-size: 48px; margin-bottom: 16px;
  animation: onb-bounce .5s ease;
}
@keyframes onb-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.onboarding-title {
  font-size: 20px; font-weight: 700; color: var(--ink);
  margin-bottom: 10px; line-height: 1.4;
}
.onboarding-desc {
  font-size: 14.5px; color: var(--muted); line-height: 1.65;
  margin-bottom: 28px;
}

.onboarding-btn {
  display: inline-flex; align-items: center; j