/* 매일 수학 3문제 — 초록 메인 · 노란 XP · 입체 버튼 디자인 */
:root {
  --bg: #f7f7f7;
  --surface: #ffffff;
  --surface-2: #f1f3f1;
  --line: #e5e5e5;
  --text: #3c3c3c;
  --muted: #6b6b6b; /* 배경 위 4.9:1 */
  /* 글자·버튼용 진한 색 (흰 배경/흰 글자 대비 4.5:1 이상). 밝은 원색은 장식·채움에만 */
  --green-btn: #2e8700;
  --green-btn-dark: #1f5f00;
  --blue-ink: #0868a0;
  --orange-ink: #a84f00;
  --gold-ink: #8a6200;
  --purple-ink: #7a35c4;
  --red-ink: #c42121;
  /* 차트 데이터 색 (배경 대비 3:1 이상) */
  --data-ok: #0868a0;
  --data-no: #c25e00;
  --data-progress: #7a35c4;
  --green: #58cc02;
  --green-dark: #46a302;
  --green-soft: #e3f8d1;
  --green-ink: #2f7d00; /* 흰 배경 5.2:1, 연초록 배경 4.6:1 */
  --yellow: #ffc800;
  --yellow-dark: #e0a600;
  --yellow-soft: #fff6d6;
  --blue: #1cb0f6;
  --blue-dark: #1899d6;
  --blue-soft: #ddf4ff;
  --orange: #ff9600;
  --orange-soft: #fff0db;
  --red: #ff4b4b;
  --red-dark: #ea2b2b;
  --red-soft: #ffe5e5;
  --purple: #a560e8;
  --purple-soft: #f3e8ff;
  --on-color: #ffffff;
  /* 기존 코드 호환 토큰 */
  --primary: var(--green);
  --primary-ink: #ffffff;
  --primary-soft: var(--green-soft);
  --ok: var(--green-ink);
  --ok-soft: var(--green-soft);
  --bad: var(--red-ink);
  --bad-soft: var(--red-soft);
  --warn: #b97a00;
  --warn-soft: var(--yellow-soft);
  --hidden: var(--purple);
  --hidden-soft: var(--purple-soft);
  /* 등급 색 (dataviz 팔레트 검증 통과) */
  --bronze: #a85a24;
  --silver: #4a74c9;
  --gold: #a87d00;
  --platinum: #00897d;
  --diamond: #7a5cf5;
  --radius: 20px;
  --shadow: 0 2px 0 var(--line);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131f24;
    --surface: #1c2b33;
    --surface-2: #233640;
    --line: #37464f;
    --text: #f1f7fb;
    --muted: #9bb0bb;
    --green-soft: #1f3a1a;
    --green-ink: #7bdc3a;
    --yellow-soft: #3a3214;
    --blue-soft: #123447;
    --orange-soft: #3a2a12;
    --red-soft: #3d1e22;
    --purple-soft: #2e2242;
    --warn: #f3c34a;
    --green-btn: #2c8200;
    --green-btn-dark: #1a4d00;
    --blue-ink: #5cc8ff;
    --orange-ink: #ffb347;
    --gold-ink: #ffd24d;
    --purple-ink: #c9a3ff;
    --red-ink: #ff7a7a;
    --data-ok: #5cc8ff;
    --data-no: #ffb347;
    --data-progress: #c9a3ff;
    --bronze: #c9733a;
    --silver: #5b8be0;
    --gold: #b58a10;
    --platinum: #1aa596;
    --diamond: #8c7cf5;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  font-size: 16px;
  line-height: 1.55;
  padding-top: var(--native-ad-h, 0px); /* 앱: 네이티브 AdMob 배너 높이 */
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}
body.focus-mode { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
a { color: var(--blue-ink); text-decoration: none; }
button, a, summary, [role="button"] { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ico { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.22em; }
.h-ico { display: flex; align-items: center; gap: 8px; }
.h-ico .ico { color: var(--green-ink); }
.tier-medal { display: inline-flex; }
.tier-medal .ico { width: 1.15em; height: 1.15em; }
.feat-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--green-soft); color: var(--green-ink); display: grid; place-items: center; flex: none; }
.feat-ico .ico { width: 22px; height: 22px; }
.t-gold { --tier-text: var(--gold-ink); }
.t-platinum { --tier-text: #00766b; }
@media (prefers-color-scheme: dark) { .t-platinum { --tier-text: var(--platinum); } }
h1, h2, h3 { line-height: 1.3; margin: 0; letter-spacing: -0.02em; font-weight: 800; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1.02rem; }
p { margin: 0; }
[hidden] { display: none !important; }
.mascot { display: block; flex: none; }
/* 치비 친구들: 원형 프로필 (크기를 정하지 않은 곳에서도 원본 320px로 커지지 않게 기본값) */
:where(img.friend) { width: 64px; height: 64px; }
img.friend { border-radius: 50%; object-fit: cover; border: 3px solid #fff; box-shadow: 0 3px 0 var(--line); background: var(--surface-2); }
.brand-mark.friend { border-width: 2px; box-shadow: none; }
.friends-banner { width: 100%; height: auto; border-radius: 22px; border: 3px solid var(--surface); box-shadow: 0 4px 0 var(--line); display: block; }
.lvup-banner { width: 100%; height: auto; border-radius: 18px; display: block; }
.speaker { color: var(--green-ink); margin-right: 4px; }
.fb-friend { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: .9rem; font-weight: 600; }
.fb-avatar { width: 44px; height: 44px; flex: none; }
.friend-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; text-align: center; }
.friend-grid > div { display: grid; justify-items: center; gap: 2px; }
.friend-grid .mascot { width: 64px; height: 64px; }
@media (max-width: 380px) { .friend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.avatar { width: 52px; height: 52px; display: inline-block; flex: none; }
.avatar svg, .avatar img { width: 100%; height: 100%; }
.empty .mascot { width: 96px; height: 96px; margin: 0 auto 8px; }
.month-sum .mascot { width: 72px; height: 72px; }
.card > .mascot { width: 96px; height: 96px; }
.num { font-family: 'Nunito', 'Pretendard Variable', sans-serif; font-weight: 900; }

/* ── 상단 바 ── */
.topbar {
  position: sticky; top: var(--native-ad-h, 0px); z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  max-width: 520px; margin: 0 auto;
}
.top-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.top-title { font-weight: 800; font-size: 1.08rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  appearance: none; border: 0; background: none; color: var(--text); padding: 10px; margin-left: -10px; border-radius: 14px; min-width: 44px; min-height: 44px;
  display: inline-grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 24px; height: 24px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 900; color: #1e2a5a; font-size: 1.2rem; letter-spacing: -0.03em; } /* 남색 (로그인 화면 워드마크와 같은 색) */
@media (prefers-color-scheme: dark) { .brand { color: #9fb0ff; } }
.brand-mark { width: 30px; height: 30px; }
.top-right { display: flex; align-items: center; gap: 6px; }
.xp-chip, .tier-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px;
  background: var(--surface); border: 2px solid var(--line); color: var(--text); font-weight: 800; font-size: .82rem; white-space: nowrap;
}
.xp-chip { color: var(--gold-ink); }
.xp-chip .ico, .tier-chip .ico { width: 1.05em; height: 1.05em; }
.xp-chip, .tier-chip { min-height: 36px; }

/* 상단 광고: 높이를 미리 확보해 레이아웃이 밀리지 않게 한다 */
.ad-top {
  max-width: 520px; margin: 0 auto 6px; padding: 0 16px;
  min-height: 62px; display: flex; align-items: center; justify-content: center;
}
.ad-top ins { width: 100%; min-height: 50px; }
.ad-placeholder {
  width: 100%; height: 56px; border: 2px dashed var(--line); border-radius: 14px;
  display: grid; place-items: center; color: var(--muted); font-size: .8rem; background: var(--surface);
}

.view { max-width: 520px; margin: 0 auto; padding: 6px 16px 24px; display: grid; gap: 14px; outline: none; }
.loading, .empty { text-align: center; color: var(--muted); padding: 48px 0; }
/* 로딩 스켈레톤: 실제 화면과 비슷한 자리를 미리 잡아 둔다 */
.skeleton { display: grid; gap: 14px; }
.sk { border-radius: 20px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.sk.line { height: 22px; width: 60%; border-radius: 10px; }
.sk.hero { height: 260px; border-radius: 24px; }
.sk.card { height: 140px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── 카드 · 공통 ── */
.card {
  background: var(--surface); border-radius: var(--radius); padding: 18px; border: 2px solid var(--line);
  display: grid; gap: 12px; min-width: 0;
}
.card.flat { border-style: dashed; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.eyebrow { color: var(--muted); font-size: .85rem; font-weight: 700; }
.stack { display: grid; gap: 10px; }

/* ── 입체 버튼 ── */
.btn {
  appearance: none; border: 2px solid var(--line); border-radius: 16px; padding: 12px 18px; font: inherit; font-weight: 800;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface); color: var(--text); min-height: 50px; text-align: center; letter-spacing: -0.01em;
  box-shadow: 0 4px 0 var(--line); transform: translateY(0); transition: transform .06s, box-shadow .06s;
}
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 transparent; }
.btn.primary { background: var(--green-btn); border-color: var(--green-btn); color: var(--on-color); box-shadow: 0 4px 0 var(--green-btn-dark); }
.btn.blue { background: var(--blue-ink); border-color: var(--blue-ink); color: var(--on-color); box-shadow: 0 4px 0 #054b74; }
.btn.yellow { background: var(--yellow); border-color: var(--yellow); color: #5a3a00; box-shadow: 0 4px 0 var(--yellow-dark); }
.btn.danger { background: var(--red-ink); border-color: var(--red-ink); color: var(--on-color); box-shadow: 0 4px 0 #8e1212; }
@media (prefers-color-scheme: dark) { .btn.danger { background: #c42121; border-color: #c42121; } .btn.blue { background: #0868a0; border-color: #0868a0; } }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--blue-ink); min-height: 44px; padding: 8px 12px; }
.btn.block { width: 100%; }
.btn.small { font-size: .9rem; min-height: 44px; padding: 8px 14px; }
@media (hover: hover) { .btn:hover:not(:disabled) { filter: brightness(1.04); } .btn.ghost:hover { background: var(--surface-2); } }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, input:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 55%, transparent); outline-offset: 2px; }

.badge {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
  background: var(--green-soft); color: var(--green-ink); font-weight: 800; font-size: .8rem;
}
.chip {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: .8rem;
}
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-weight: 800; font-size: .8rem; }
.pill.ok { background: var(--blue-soft); color: var(--blue-ink); }
.pill.no { background: var(--orange-soft); color: var(--orange-ink); }
.diff {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 999px; font-weight: 800; font-size: .8rem;
  border: 2px solid currentColor; white-space: nowrap;
}
.diff.easy, .diff.practice { color: var(--green-ink); background: var(--green-soft); }
.diff.normal { color: var(--blue-ink); background: var(--blue-soft); }
.diff.hard { color: var(--orange-ink); background: var(--orange-soft); }
.diff.hidden { color: var(--purple-ink); background: var(--purple-soft); }
.diff.exam { color: var(--gold-ink); background: var(--yellow-soft); }

.notice { border-radius: 16px; padding: 12px 14px; font-weight: 700; font-size: .93rem; border: 2px solid transparent; }
.notice.up { background: var(--green-soft); color: var(--green-ink); border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.notice.down, .notice.warn { background: var(--yellow-soft); color: var(--warn); border-color: color-mix(in srgb, var(--yellow) 50%, transparent); }
.notice.info { background: var(--blue-soft); color: var(--blue-ink); border-color: color-mix(in srgb, var(--blue) 40%, transparent); }

/* ── 홈 ── */
.greet { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 2px 0; }
.greet h1 { font-size: 1.35rem; }
.greet p { font-weight: 700; color: var(--muted); margin-top: 2px; }
.greet p b { color: var(--green-ink); }
.greet .mascot { width: 72px; height: 72px; flex: none; }
.hero-card {
  background: linear-gradient(160deg, #3fa600, var(--green-btn) 70%); color: #fff; border-radius: 24px; overflow: hidden; display: grid; box-shadow: 0 4px 0 var(--green-btn-dark);
}
.hero-top { display: grid; justify-items: center; gap: 4px; padding: 20px 18px 16px; text-align: center; }
.hero-avatar { width: 108px; height: 108px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 4px 0 rgba(0,0,0,.12); margin-bottom: 4px; }
.hero-top .mascot { width: 100px; height: 100px; border: 0; box-shadow: none; }
.hero-top h2 { font-size: 1.3rem; }
.hero-top p { opacity: .92; font-weight: 600; font-size: .95rem; }
.hero-bottom { background: var(--surface); color: var(--text); padding: 14px 16px; display: grid; gap: 10px; }
.hero-bottom .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-weight: 700; font-size: .9rem; }
.tag { display: inline-flex; padding: 2px 8px; border-radius: 6px; font-size: .75rem; font-weight: 800; color: #fff; }
.tag.green { background: var(--green-btn); } .tag.orange { background: #a84f00; } .tag.purple { background: #7a35c4; }
.dots { display: flex; gap: 6px; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.35); border: 2px solid rgba(255,255,255,.7); }
.dot.ok { background: #fff; border-color: #fff; }
.dot.bad { background: var(--orange); border-color: #fff; }
.hidden-card {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 20px; border: 2px solid var(--purple);
  background: var(--purple-soft); color: var(--text); box-shadow: 0 4px 0 color-mix(in srgb, var(--purple) 60%, transparent);
}
.hidden-card .big { width: 48px; height: 48px; border-radius: 14px; background: var(--purple); color: #fff; display: grid; place-items: center; flex: none; }
.hidden-card .big .ico { width: 26px; height: 26px; }
.hidden-card b { color: var(--purple-ink); }
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.quick a {
  display: grid; justify-items: center; gap: 6px; padding: 12px 4px; border-radius: 18px; background: var(--surface);
  border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line); color: var(--text); font-weight: 800; font-size: .82rem; min-height: 88px;
  transition: transform .06s, box-shadow .06s;
}
.quick a:active { transform: translateY(3px); box-shadow: none; }
.quick .q-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.quick .q-ico .ico { width: 22px; height: 22px; }
.q-ico.c1 { background: var(--green-btn); } .q-ico.c2 { background: #a84f00; } .q-ico.c3 { background: #0868a0; } .q-ico.c4 { background: #7a35c4; }

/* 오늘의 진행률 (세로 막대) */
.progress-chart { display: grid; grid-template-columns: 30px 1fr; gap: 6px; margin-top: 24px; }
.pc-axis { display: grid; align-content: space-between; font-size: .7rem; color: var(--muted); text-align: right; height: 150px; font-variant-numeric: tabular-nums; }
.pc-plot { position: relative; height: 150px; display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; justify-items: center;
  background: repeating-linear-gradient(to top, var(--line) 0 1px, transparent 1px 37.5px); }
.pc-col { position: relative; width: 22px; height: 100%; display: flex; align-items: flex-end; }
.pc-bar { width: 100%; border-radius: 11px; min-height: 22px; position: relative; }
.pc-bar::after { content: ''; position: absolute; top: 4px; left: 50%; transform: translateX(-50%); width: 12px; height: 12px; border-radius: 50%; background: var(--surface); }
.pc-val { position: absolute; left: 50%; transform: translate(-50%, -130%); font-size: .78rem; font-weight: 800; padding: 1px 7px; border-radius: 8px;
  color: var(--text); background: var(--surface); border: 2px solid currentColor; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pc-labels { grid-column: 2; display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; font-size: .82rem; font-weight: 700; color: var(--muted); }

/* XP */
.xp-card { display: grid; gap: 8px; }
.xp-bar { height: 14px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.xp-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--yellow); box-shadow: inset 0 -3px 0 rgba(0,0,0,.08); transition: width .6s ease; }
.xp-bar.green > span { background: var(--green); }

/* ── 문제 풀이 (한 문제씩) ── */
.solve-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.solve-count { font-weight: 800; color: var(--muted); }
.solve-count b { color: var(--text); }
.q-card { text-align: center; justify-items: center; gap: 10px; padding: 22px 18px; }
.q-card .mascot { width: 76px; height: 76px; }
.q-prompt { color: var(--muted); font-weight: 700; font-size: .92rem; }
.source { font-size: .85rem; font-weight: 800; color: var(--purple-ink); display: inline-flex; align-items: center; gap: 4px; }
.question { font-size: 1.15rem; font-weight: 700; word-break: keep-all; overflow-wrap: anywhere; }
.q-card .question { font-size: 1.25rem; }
.q-card .question .katex { font-size: 1.35em; }
.question .katex { max-width: 100%; overflow-x: auto; overflow-y: hidden; }
.answer-input {
  width: 100%; font: inherit; font-size: 1.3rem; font-weight: 800; text-align: center; padding: 14px 16px; border-radius: 16px;
  border: 2px solid var(--line); border-bottom-width: 4px; background: var(--surface); color: var(--text);
}
.answer-input:focus { border-color: var(--blue); outline: none; }
.hint-box { background: var(--yellow-soft); color: var(--warn); border-radius: 14px; padding: 10px 12px; font-size: .93rem; font-weight: 600; border: 2px solid color-mix(in srgb, var(--yellow) 50%, transparent); }
.feedback { display: grid; gap: 8px; border-radius: 18px; padding: 14px 16px; border: 2px solid; }
.feedback.ok { background: var(--green-soft); border-color: var(--green); color: var(--green-ink); }
.feedback.bad { background: var(--red-soft); border-color: var(--red); color: var(--red-ink); }
.field-label { font-size: .85rem; font-weight: 800; color: var(--muted); margin-bottom: -6px; }
.feedback .fb-title { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 1.1rem; }
.feedback .fb-line { color: var(--text); font-size: .93rem; }
.feedback details summary { color: var(--text); }
.form-error { color: var(--red-ink); font-size: .88rem; font-weight: 700; }
.form-error:empty { display: none; }
details summary { cursor: pointer; color: var(--blue); font-weight: 800; font-size: .93rem; }
.steps { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; overflow-wrap: anywhere; color: var(--text); text-align: left; }

.solve-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 2px solid var(--line);
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
}
.solve-bottom-inner { max-width: 520px; margin: 0 auto; display: grid; gap: 10px; }
.solve-bottom.ok { background: var(--green-soft); border-top-color: var(--green); }
.solve-bottom.bad { background: var(--red-soft); border-top-color: var(--red); }
.xp-line { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; font-size: .8rem; font-weight: 800; color: var(--muted); }
.xp-line .xp-bar { height: 10px; }

/* 예전 카드형 문제 (히든·연습 목록 등) */
.problem-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.answer-form { display: flex; gap: 8px; }
.answer-form input, .input {
  flex: 1; min-width: 0; font: inherit; font-size: 1.05rem; padding: 12px 14px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--surface); color: var(--text);
}
.answer-form input:focus, .input:focus { border-color: var(--blue); outline: none; }

/* ── 모달 · 축하 ── */
.modal-back { position: fixed; inset: 0; z-index: 70; background: rgba(20, 25, 30, .55); display: grid; place-items: center; padding: 16px; animation: fade .18s; }
.modal {
  width: min(380px, 100%); background: var(--surface); border-radius: 26px; padding: 26px 22px 20px; text-align: center;
  display: grid; gap: 12px; justify-items: center; border: 4px solid var(--yellow); animation: pop .32s cubic-bezier(.2, 1.4, .4, 1);
}
.modal.green { border-color: var(--green); }
.modal .ring { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: var(--yellow-soft); border: 4px solid var(--yellow); }
.modal .ring .mascot { width: 88px; height: 88px; border: 0; box-shadow: none; }
.modal .ring.trophy { font-size: 3.2rem; }
.modal h2 { font-size: 1.5rem; }
.xp-gain { font-size: 1.9rem; padding: 10px 26px; border-radius: 18px; background: var(--yellow); color: #5a3a00; box-shadow: 0 5px 0 var(--yellow-dark); display: inline-flex; align-items: center; gap: 8px; }
.xp-box { width: 100%; background: var(--surface-2); border-radius: 16px; padding: 12px 14px; display: grid; gap: 8px; text-align: left; }
.xp-box .between { font-weight: 800; font-size: .9rem; }
.xp-box .between b { color: var(--green-ink); }
.xp-box p { text-align: center; font-size: .82rem; color: var(--muted); font-weight: 700; }
.xp-box p b { color: var(--orange-ink); }
.lvup-num { font-size: 4.2rem; line-height: 1; color: var(--text); }
.lvup-title { color: var(--gold-ink); font-size: 1.3rem; }
.modal .btn { width: 100%; }
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate3d(var(--dx), 110vh, 0) rotate(var(--rot)); } }

/* ── 내 학습: 탭 · 달력 · 타임라인 ── */
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 2px solid var(--line); }
.tabs a { padding: 10px 2px; font-weight: 800; font-size: .93rem; text-align: center; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs a.active { color: var(--green-ink); border-bottom-color: var(--green); }
.month-nav { display: flex; align-items: center; justify-content: space-between; font-weight: 800; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px 0; text-align: center; font-weight: 700; font-size: .92rem; }
.cal .wd { font-size: .78rem; color: var(--muted); padding-bottom: 4px; }
.cal .wd.sun { color: var(--red); }
.cal button { appearance: none; border: 0; background: none; font: inherit; color: var(--text); height: 40px; cursor: default; position: relative; }
.cal button.studied { background: var(--green-soft); color: var(--green-ink); font-weight: 900; cursor: pointer; }
.cal button.studied.s-start { border-radius: 18px 0 0 18px; }
.cal button.studied.s-end { border-radius: 0 18px 18px 0; }
.cal button.studied.s-start.s-end { border-radius: 18px; }
.cal button.today::after { content: ''; position: absolute; bottom: 3px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--green); }
.cal button.other { color: var(--line); }
.month-sum { display: grid; gap: 8px; text-align: center; justify-items: center; }
.month-sum h2 b { color: var(--green-ink); }
.sum-bar { width: 100%; position: relative; }
.sum-bar .xp-bar { height: 12px; }
.sum-pct { position: absolute; top: -32px; transform: translateX(-50%); background: var(--green-btn); color: #fff; font-size: .78rem; font-weight: 900; padding: 2px 8px; border-radius: 10px; }
.timeline-day { display: grid; gap: 8px; }
.day-head { display: flex; align-items: baseline; gap: 10px; font-weight: 900; font-size: 1.05rem; }
.day-head span { font-size: .82rem; color: var(--muted); font-weight: 700; }
.entry { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; }
.entry-time { font-size: .8rem; color: var(--muted); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.entry-card { background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 10px 12px; display: grid; gap: 6px; }
.entry-card b { font-size: .95rem; }
.entry-badge { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; font-weight: 900; text-align: center; line-height: 1.15;
  background: var(--surface-2); color: var(--muted); border: 2px solid var(--line); }
.entry-badge.pass { background: var(--green-btn); color: #fff; border-color: var(--green-btn-dark); }
.entry-badge.fail { background: var(--orange-soft); color: var(--orange-ink); border-color: var(--orange); }

/* 오답노트 */
.note { display: grid; gap: 10px; }
.note-meta { display: flex; justify-content: space-between; gap: 8px; font-size: .8rem; color: var(--muted); font-weight: 700; }
.note .answer-form .btn { min-height: 46px; }
.note.resolved { animation: resolved .5s forwards; }
@keyframes resolved { to { opacity: 0; transform: scale(.96); } }

/* 도넛 */
.donut-row { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: center; }
.donut-legend { display: grid; gap: 10px; }
.donut-legend .between { font-weight: 800; }
.donut-legend .xp-bar { height: 8px; }

/* ── 마이페이지 · 메뉴 ── */
.profile { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.profile h2 { font-size: 1.25rem; }
.profile .mascot { width: 64px; height: 64px; }
.profile p { font-size: .88rem; color: var(--muted); font-weight: 700; }
.profile p b { color: var(--orange); }
.two-stats { display: grid; grid-template-columns: 1fr 1px 1fr; text-align: center; align-items: center; }
.two-stats .sep { height: 40px; background: var(--line); }
.two-stats .l { font-size: .85rem; color: var(--muted); font-weight: 700; }
.two-stats .v { font-size: 1.5rem; }
.two-stats .v.green { color: var(--green-ink); }
.menu { display: grid; padding: 4px 0; }
.menu a, .menu button {
  appearance: none; border: 0; background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; padding: 14px 18px; font-weight: 700;
}
.menu a + a, .menu a + button, .menu button + a { border-top: 1px solid var(--line); }
.menu svg { width: 22px; height: 22px; color: var(--muted); }
.menu .chev { color: var(--muted); }
.menu .danger { color: var(--red-ink); }
.menu a, .menu button { min-height: 52px; }
@media (hover: hover) { .menu a:hover, .menu button:hover { background: var(--surface-2); } }

/* ── 통계 · 인포그래픽 ── */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border-radius: 18px; padding: 14px; border: 2px solid var(--line); }
.kpi .v { font-size: 1.5rem; font-weight: 900; letter-spacing: -0.02em; font-family: 'Nunito', 'Pretendard Variable', sans-serif; }
.kpi .l { color: var(--muted); font-size: .85rem; font-weight: 700; display: flex; align-items: center; gap: 5px; }
.kpi .l .ico { color: var(--green-ink); }
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); justify-content: start; gap: 3px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.heatmap::-webkit-scrollbar { display: none; }
.heatmap i { width: 14px; height: 14px; border-radius: 4px; background: var(--surface-2); display: block; }
.heatmap i.l1 { background: color-mix(in srgb, var(--green) 30%, var(--surface-2)); }
.heatmap i.l2 { background: color-mix(in srgb, var(--green) 62%, var(--surface-2)); }
.heatmap i.l3 { background: var(--green); }
.heatmap i.pad { visibility: hidden; }
.legend { display: flex; gap: 4px; align-items: center; font-size: .78rem; color: var(--muted); }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend .hm0 { background: var(--surface-2); }
.legend .hm1 { background: color-mix(in srgb, var(--green) 30%, var(--surface-2)); }
.legend .hm2 { background: color-mix(in srgb, var(--green) 62%, var(--surface-2)); }
.legend .hm3 { background: var(--green); }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 7.5em 1fr 3.2em; gap: 8px; align-items: center; font-size: .9rem; font-weight: 600; }
.bar-row .track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-row .track > span { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.bar-row.weak .track > span { background: var(--orange); }
.bar-row .pct { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.chart svg { width: 100%; height: auto; display: block; }
.list { display: grid; gap: 0; }
.list > * { padding: 12px 0; border-top: 1px solid var(--line); }
.list > *:first-child { border-top: 0; }
.list a.item { display: flex; justify-content: space-between; align-items: center; color: var(--text); font-weight: 700; }
.info-hero { background: linear-gradient(150deg, color-mix(in srgb, var(--tc) 12%, var(--surface)), var(--surface) 60%); }
.tier-big { font-size: 1.4rem; font-weight: 900; letter-spacing: -0.02em; }
.journey { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.jgroup { display: grid; gap: 6px; }
.jcells { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; }
.jcells i { height: 14px; border-radius: 4px; background: var(--surface-2); }
.jcells i.on { background: var(--tc); }
.jcells i.reached { background: color-mix(in srgb, var(--tc) 35%, var(--surface-2)); }
.jcells i.now { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--tc); }
.jname { font-size: .72rem; color: var(--muted); font-weight: 800; text-align: center; white-space: nowrap; }
.lg { display: inline-flex; align-items: center; gap: 5px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; background: var(--surface-2); }
.sw.on { background: var(--tc, var(--green)); }
.sw.reached { background: color-mix(in srgb, var(--tc, var(--green)) 35%, var(--surface-2)); }
.sw.blue { background: var(--data-ok); } .sw.orange { background: var(--data-no); }
.hero-number { font-size: 2.6rem; font-weight: 900; letter-spacing: -0.03em; line-height: 1.1; font-family: 'Nunito', 'Pretendard Variable', sans-serif; }
.split { display: flex; gap: 2px; height: 14px; }
.split span { border-radius: 4px; min-width: 6px; }
.s-clean { background: var(--data-ok); }
.s-hint { background: color-mix(in srgb, var(--data-ok) 40%, var(--surface-2)); }
.s-wrong { background: var(--data-no); }
.wdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; }
.wday { display: grid; gap: 4px; justify-items: center; }
.wbar { width: 100%; max-width: 28px; height: 72px; display: flex; align-items: flex-end; }
.wbar span { width: 100%; min-height: 2px; border-radius: 6px 6px 0 0; background: color-mix(in srgb, var(--green) 35%, var(--surface-2)); }
.wday.best .wbar span { background: var(--green); }
.wlabel { font-size: .8rem; color: var(--muted); font-weight: 800; }
.wday.best .wlabel { color: var(--text); }
.duo { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 500px) { .duo { grid-template-columns: 1fr 1fr; } }
.badges { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; text-align: center; }
.badges div { display: grid; gap: 2px; background: var(--surface-2); border-radius: 16px; padding: 10px 4px; }
.badges span { color: var(--green-ink); display: grid; place-items: center; }
.badges span .ico { width: 26px; height: 26px; }
.badges small { color: var(--muted); font-size: .75rem; font-weight: 700; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; display: grid; gap: 12px; border-left: 2px solid var(--line); }
.timeline li { position: relative; display: grid; gap: 1px; }
.timeline li::before { content: ''; position: absolute; left: -25px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--tc); box-shadow: 0 0 0 2px var(--surface); }
.table-view summary { font-size: .85rem; }
.table-view table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: .85rem; font-variant-numeric: tabular-nums; }
.table-view th, .table-view td { text-align: left; padding: 6px 4px; border-top: 1px solid var(--line); }
.tip {
  position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none; opacity: 0; transition: opacity .12s;
  background: var(--text); color: var(--bg); font-size: .8rem; font-weight: 700; padding: 6px 10px; border-radius: 10px; max-width: 240px;
}
.tip.show { opacity: 1; }
.wday:focus-visible, rect[data-tip]:focus-visible { outline: 2px solid var(--blue); }

/* ── 난이도 · 승급 시험 ── */
.tier { border-radius: 18px; border: 2px solid var(--line); overflow: hidden; background: var(--surface); }
.tier-head { display: flex; align-items: center; gap: 12px; padding: 14px; width: 100%; background: none; border: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.tier-head .emoji { font-size: 1.6rem; }
.tier-head .name { font-weight: 900; }
.tier.locked { border-style: dashed; }
.tier-levels { display: grid; gap: 8px; padding: 0 14px 14px; }
.level-btn {
  display: grid; gap: 4px; text-align: left; padding: 12px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer; box-shadow: 0 3px 0 var(--line);
}
.level-btn.current { border-color: var(--green); background: var(--green-soft); box-shadow: 0 3px 0 var(--green-dark); }
.level-btn.pending { border-style: dashed; border-color: var(--green); }
.level-btn.exam { border-style: dashed; background: var(--surface-2); }
.level-btn.exam .between .small { color: var(--gold-ink); font-weight: 900; }
.level-btn .ex { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.t-bronze { color: var(--bronze); } .t-silver { color: var(--silver); } .t-gold { color: var(--tier-text); }
.t-platinum { color: var(--tier-text); } .t-diamond { color: var(--diamond); }
.exam-cta { background: linear-gradient(150deg, var(--yellow-soft), var(--surface) 70%); border-color: color-mix(in srgb, var(--yellow) 60%, var(--line)); }
.exam-intro { text-align: center; justify-items: center; background: linear-gradient(160deg, color-mix(in srgb, var(--tc) 12%, var(--surface)), var(--surface) 60%); }
.rules { text-align: left; margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: .93rem; justify-self: stretch; }
.exam-result.pass { background: linear-gradient(160deg, var(--green-soft), var(--surface) 60%); }
.ask { display: grid; gap: 10px; background: var(--surface-2); border-radius: 16px; padding: 14px; text-align: left; }
.ask > p:first-child { font-weight: 700; }
.ask-actions { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; }
@media (max-width: 380px) { .ask-actions { grid-template-columns: 1fr 1fr; } .ask-actions > :last-child { grid-column: 1 / -1; } }

/* 진단 · 시험 진행 */
.stepper { display: flex; gap: 4px; }
.stepper i { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-2); }
.stepper i.done { background: var(--green); }
.stepper i.now { background: color-mix(in srgb, var(--green) 45%, var(--surface-2)); }
.big-level { font-size: 2.1rem; font-weight: 900; letter-spacing: -0.03em; }
.result-item { display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: start; }
.result-item .mark { font-weight: 900; }

/* 사진 */
.photo-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo-pick label { cursor: pointer; }
.photo-preview { width: 100%; max-height: 320px; object-fit: contain; border-radius: 16px; background: var(--surface-2); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--green-soft); border-top-color: var(--green); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 로그인 */
.login { min-height: 82vh; display: grid; align-content: center; gap: 22px; text-align: center; }
.login .mascot { width: 120px; height: 120px; margin: 0 auto; }
.wordmark { font-size: 2.3rem; font-weight: 900; color: #1e2a5a; letter-spacing: -0.04em; } /* 남색 */
@media (prefers-color-scheme: dark) { .wordmark { color: #9fb0ff; } }
.features { display: grid; gap: 10px; text-align: left; }
.features div { display: flex; gap: 12px; align-items: center; background: var(--surface); padding: 12px 14px; border-radius: 16px; border: 2px solid var(--line); }
.gsi { display: flex; justify-content: center; min-height: 44px; }
.legal { font-size: .8rem; color: var(--muted); }

/* ── 하단 탭 (가운데 카메라 버튼) ── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--surface); border-top: 2px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-inner { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; }
.tabbar a { display: grid; justify-items: center; gap: 2px; padding: 8px 0 9px; min-height: 56px; color: var(--muted); font-size: .75rem; font-weight: 800; position: relative; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.active { color: var(--green-ink); }
.tabbar a.active:not(.fab)::before { content: ''; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--green-btn); }
.tabbar a.fab { position: relative; padding-top: 0; }
.tabbar a.fab span.circle {
  width: 60px; height: 60px; border-radius: 50%; background: var(--green-btn); color: #fff; display: grid; place-items: center;
  margin-top: -26px; box-shadow: 0 4px 0 var(--green-btn-dark), 0 0 0 5px var(--surface); transition: transform .06s;
}
.tabbar a.fab:active span.circle { transform: translateY(3px); }
.tabbar a.fab svg { width: 28px; height: 28px; }

.dialog { border: 0; border-radius: 24px; padding: 22px; max-width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.dialog::backdrop { background: rgba(10, 15, 30, .5); }
.dialog .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

.toast {
  position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: .9rem;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 95; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 500px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 370px) {
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar-row { grid-template-columns: 6.2em 1fr 3em; }
  .donut-row { grid-template-columns: 96px 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .confetti { display: none; }
}
