:root {
  --bg: #0b1020;
  --bg2: #0f1629;
  --panel: #131b31;
  --panel2: #18223d;
  --line: #24304f;
  --text: #e7eaf3;
  --muted: #8b95b2;
  --accent: #7c5cff;
  --accent2: #4cc9f0;
  --ok: #3ddc97;
  --bad: #ff5c7a;
  --warn: #ffd166;
  --mono: 'D2Coding', 'JetBrains Mono', 'Cascadia Code', Consolas, 'Courier New', monospace;
  --sans: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --r: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: radial-gradient(1200px 600px at 80% -10%, #1d1846 0%, transparent 60%), var(--bg); color: var(--text); font-family: var(--sans); line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
code { font-family: var(--mono); background: #ffffff12; padding: 1px 6px; border-radius: 5px; font-size: .92em; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h2 { font-size: 1.3rem; margin-top: 2rem; }
.muted { color: var(--muted); }
main { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 24px 40px; }

/* ---------- 상단바 ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 28px; padding: 12px 24px; background: #0b1020d9; backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.logo { font-weight: 800; font-size: 1.15rem; display: flex; align-items: center; gap: 8px; letter-spacing: -.02em; }
.logo-mark { font-family: var(--mono); background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; padding: 2px 8px; border-radius: 8px; font-size: .9rem; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: .95rem; }
.nav a:hover { color: var(--text); background: #ffffff0d; }
.nav a.on { color: var(--text); background: #ffffff14; }
.lvpill { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); padding: 6px 14px; border-radius: 999px; font-size: .85rem; }
.lvpill .lv { font-weight: 800; color: var(--warn); }
.lvpill .lvbar { width: 90px; height: 6px; background: #ffffff14; border-radius: 9px; overflow: hidden; }
.lvpill .lvbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .6s; }
.lvpill .xp { color: var(--muted); font-variant-numeric: tabular-nums; }
.lvpill.max { border-color: var(--warn); box-shadow: 0 0 20px #ffd16644; }

/* ---------- 버튼 ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font: 600 .92rem var(--sans); cursor: pointer; transition: transform .1s, background .2s; white-space: nowrap; }
.btn:hover { background: #22305a; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #5b6cff); border-color: transparent; color: #fff; box-shadow: 0 6px 20px #7c5cff55; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: #ff5c7a66; color: var(--bad); background: transparent; }
.btn kbd { font: 600 .7rem var(--mono); background: #ffffff26; padding: 1px 6px; border-radius: 4px; }
.mini { font: 600 .75rem var(--sans); padding: 3px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; }

/* ---------- 홈 ---------- */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: center; padding: 56px 0 32px; }
.eyebrow { display: inline-block; font-size: .82rem; font-weight: 700; color: var(--accent2); background: #4cc9f01a; padding: 4px 12px; border-radius: 99px; margin-bottom: 18px; }
.hero h1 { font-size: clamp(2.2rem, 4.5vw, 3.6rem); letter-spacing: -.03em; font-weight: 900; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--accent), var(--accent2), var(--ok)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 1.05rem; max-width: 560px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.player { display: flex; gap: 22px; align-items: center; background: linear-gradient(160deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: 20px; padding: 26px; box-shadow: 0 20px 50px #0006; transition: transform .2s; }
a.player:hover { transform: translateY(-3px); }
.player-lv { flex: none; width: 104px; height: 104px; border-radius: 50%; display: grid; place-content: center; text-align: center; font-size: 2.4rem; font-weight: 900; background: radial-gradient(circle, var(--panel) 60%, transparent 61%), conic-gradient(var(--accent), var(--accent2), var(--ok), var(--accent)); color: #fff; line-height: 1; }
.player-lv small { display: block; font-size: .62rem; letter-spacing: .2em; color: var(--muted); margin-top: 4px; }
.player-info { flex: 1; min-width: 0; }
.player-info > b { font-size: 1.2rem; }
.player-info > span { color: var(--muted); font-size: .85rem; }
.player-stats { display: flex; gap: 18px; margin-top: 14px; }
.player-stats div { display: flex; flex-direction: column; }
.player-stats b { font-size: 1.15rem; }
.player-stats small { color: var(--muted); font-size: .75rem; }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 8px 0 12px; }
.how div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; }
.how span { display: inline-grid; place-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; margin-right: 8px; }
.how p { color: var(--muted); margin: 6px 0 0; font-size: .9rem; }

.pbar { height: 6px; background: #ffffff12; border-radius: 9px; overflow: hidden; margin: 8px 0; }
.pbar.big { height: 10px; }
.pbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 9px; transition: width .4s; }

.sec { padding-top: 24px; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; }
.sec-head a { color: var(--muted); font-size: .9rem; }
.sec-head a:hover { color: var(--text); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.ccard { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; transition: transform .15s, border-color .15s, box-shadow .15s; position: relative; overflow: hidden; }
.ccard::after { content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: var(--c); }
.ccard:hover { transform: translateY(-4px); border-color: var(--c); box-shadow: 0 12px 30px #0005; }
.ccard h3 { margin: 12px 0 4px; font-size: 1.12rem; }
.ccard p { color: var(--muted); font-size: .88rem; margin: 0 0 12px; flex: 1; }
.ccard-top { display: flex; justify-content: space-between; align-items: center; }
.ccard-foot { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); }
.ccat { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.cicon { display: inline-grid; place-content: center; min-width: 40px; height: 40px; padding: 0 6px; border-radius: 10px; background: color-mix(in srgb, var(--c) 22%, transparent); color: color-mix(in srgb, var(--c) 70%, white); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); font: 800 .9rem var(--mono); }

/* ---------- 목록 페이지 ---------- */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; margin-top: 16px; }
.search { flex: 0 1 380px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: 1rem var(--sans); }
.search:focus { outline: 2px solid var(--accent); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 20px; }
.chip { padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); font-size: .88rem; font-weight: 600; }
.chip.on, .chip:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.course-hero { margin-top: 24px; padding: 28px; border-radius: 20px; background: linear-gradient(135deg, color-mix(in srgb, var(--c) 18%, var(--panel)), var(--panel)); border: 1px solid var(--line); }
.course-hero .back { color: var(--muted); font-size: .9rem; }
.course-hero-row { display: flex; gap: 18px; align-items: center; margin: 14px 0; }
.course-hero-row .cicon { min-width: 64px; height: 64px; font-size: 1.3rem; border-radius: 16px; }
.course-hero h1 { margin: 2px 0; font-size: 2rem; }
.course-hero p { margin: 0; color: var(--muted); }
.course-hero-foot { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.llist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.llist a { display: flex; align-items: center; gap: 16px; padding: 14px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; transition: border-color .15s, transform .15s; }
.llist a:hover { border-color: var(--accent); transform: translateX(4px); }
.lnum { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-content: center; background: var(--panel2); font-weight: 800; color: var(--muted); }
.llist .done .lnum { background: var(--ok); color: #05301f; }
.ltitle { flex: 1; font-weight: 600; display: flex; flex-direction: column; }
.ltitle small { color: var(--muted); font-weight: 400; font-size: .78rem; }
.lmeta { color: var(--muted); font-size: .85rem; }
.llist .done .lmeta { color: var(--ok); }

/* ---------- 레슨 ---------- */
main:has(.lesson) { max-width: none; padding: 0 16px 24px; }
.lesson-top { display: flex; align-items: center; gap: 16px; padding: 12px 4px; }
.lesson-top .back { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.lesson-top .back .cicon { min-width: 30px; height: 30px; font-size: .72rem; border-radius: 8px; }
.dots { flex: 1; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.dots a { width: 26px; height: 8px; border-radius: 9px; background: #ffffff1a; transition: background .2s; }
.dots a.ok { background: var(--ok); }
.dots a.cur { background: var(--accent); box-shadow: 0 0 0 2px #7c5cff55; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.pane { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; min-width: 0; }
.pane.left { position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow: auto; }
.pane h1 { font-size: 1.5rem; }
.desc { color: #c9cfe0; font-size: .97rem; }
.desc p { margin: 0 0 .6em; }
.desc ul { margin: 0 0 .6em; padding-left: 1.2em; }
.codehead { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 16px 0 6px; font-size: .82rem; color: var(--muted); font-weight: 600; }
.codehead-r { display: flex; align-items: center; gap: 6px; flex: none; }
.wip { margin-left: 8px; padding: 2px 10px; border-radius: 999px; background: #ffd16626; border: 1px solid #ffd16666; color: var(--warn); font-size: .75rem; font-weight: 800; white-space: nowrap; }
.tag-lang { background: var(--panel2); padding: 2px 10px; border-radius: 6px; }
.code { display: flex; background: #0a0f1f; border: 1px solid var(--line); border-radius: 12px; overflow: auto; font: 14.5px/1.65 var(--mono); }
.code pre, .typeinner pre { margin: 0; padding: 14px 16px; font: inherit; white-space: pre; tab-size: 4; }
.gut { color: #4a5578; text-align: right; user-select: none; padding-right: 10px !important; border-right: 1px solid var(--line); min-width: 44px; background: #ffffff05; }
.code .kw { color: #c792ea; }
.code .str { color: #c3e88d; }
.code .num { color: #f78c6c; }
.code .com { color: #637199; font-style: italic; }
.code .fn { color: #82aaff; }
.code .tag { color: #ff7a93; }
.code .ty { color: #ffcb6b; }
.answer { max-height: 52vh; }
.prevcode { margin-top: 14px; }
.prevcode summary { cursor: pointer; color: var(--muted); font-size: .88rem; }
.prevcode .code { margin-top: 8px; max-height: 240px; font-size: 13px; opacity: .8; }
.outbox { position: relative; margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; transition: border-color .3s; }
/* 통과하면: 두꺼운 금색 테두리가 반짝반짝 */
.outbox.glow { overflow: visible; border: 5px solid #ffd166; animation: gold-glow 1.1s ease-in-out infinite; }
.outbox.glow::before { content: ''; position: absolute; inset: -5px; border-radius: 13px; padding: 5px; pointer-events: none; z-index: 2;
  background: linear-gradient(110deg, #b8860b 0%, #ffd700 20%, #fff8dc 30%, #ffd700 40%, #daa520 60%, #fff8dc 70%, #ffd700 80%, #b8860b 100%);
  background-size: 250% 100%; animation: gold-shine 1.6s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.outbox.glow::after { content: '✨'; position: absolute; top: -18px; right: -14px; font-size: 1.6rem; z-index: 3; animation: sparkle 1.2s ease-in-out infinite; pointer-events: none; }
@keyframes gold-glow {
  0%, 100% { box-shadow: 0 0 10px 2px #ffd16699, 0 0 26px 6px #ffb70355; }
  50%      { box-shadow: 0 0 18px 6px #ffd166dd, 0 0 44px 14px #ffb70399; }
}
@keyframes gold-shine { from { background-position: 100% 0; } to { background-position: -150% 0; } }
@keyframes sparkle { 0%, 100% { transform: scale(.8) rotate(0deg); opacity: .6; } 50% { transform: scale(1.25) rotate(20deg); opacity: 1; } }
/* 하얀 박스 위에 뜨는 "결과값도 확인해봐!" */
.outcall { position: fixed; z-index: 58; white-space: nowrap; pointer-events: none; transition: opacity .2s;
  padding: 8px 18px; border-radius: 999px; background: linear-gradient(135deg, #ffe08a, #ffb703); color: #3a2400;
  font: 900 1.05rem var(--sans); box-shadow: 0 8px 24px #0007, 0 0 0 3px #fff6; animation: outcall-bob 1.4s ease-in-out infinite; }
.outcall.bye { opacity: 0 !important; transition: opacity .5s; }
@keyframes outcall-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.outhead { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: var(--panel2); font-size: .82rem; font-weight: 700; color: var(--muted); }
#preview { display: block; width: 100%; height: 340px; border: 0; background: #fff; }
.console { margin: 0; background: #070b16; padding: 12px 14px; min-height: 90px; max-height: 260px; overflow: auto; font: 13.5px/1.6 var(--mono); white-space: pre-wrap; color: #d6f5e3; }
.cl { border-bottom: 1px dashed #ffffff0d; padding: 1px 0; }
.cl.error { color: var(--bad); }
.cl.warn { color: var(--warn); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stats div { background: var(--panel2); border-radius: 10px; padding: 8px 12px; }
.stats small { display: block; color: var(--muted); font-size: .72rem; font-weight: 700; }
.stats b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.stats em { font-style: normal; font-size: .7rem; color: var(--muted); margin-left: 3px; }

.typebox { position: relative; background: #0a0f1f; border: 2px solid var(--line); border-radius: 12px; height: 56vh; min-height: 300px; overflow: auto; font: 15.5px/1.7 var(--mono); cursor: text; transition: border-color .2s, box-shadow .2s; }
.typebox.focused { border-color: var(--accent); box-shadow: 0 0 0 4px #7c5cff22; }
.typebox.passed { border-color: var(--ok); box-shadow: 0 0 0 4px #3ddc9722; }
.typeinner { display: flex; min-width: max-content; min-height: 100%; }
.typearea { position: relative; flex: 1; }
.overlay { min-height: 100%; padding-bottom: 60px !important; }
#ta { position: absolute; inset: 0; width: 100%; height: 100%; padding: 14px 16px; margin: 0; border: 0; outline: 0; resize: none; overflow: hidden; background: transparent; color: transparent; caret-color: transparent; font: inherit; white-space: pre; tab-size: 4; }
#ta::selection { background: transparent; }
.overlay .ok { color: #e9edf7; }
.overlay .ghost { color: #46506f; }
.overlay .hide { color: transparent; }
.overlay .bad { color: #fff; background: #ff5c7acc; border-radius: 3px; }
.overlay .bad.sp { color: #ffd0d8; }
.overlay .pend { color: var(--warn); text-decoration: underline; }
.overlay .extra { color: #fff; background: #ff5c7a88; text-decoration: line-through; }
.overlay .nl { color: transparent; }
.overlay .sel { background: #7c5cff73; border-radius: 0; }
.overlay .bad.sel { background: #c0417acc; }
.overlay .cur { display: inline-block; width: 2px; height: 1.25em; margin-right: -2px; vertical-align: text-bottom; background: var(--warn); animation: blink 1s steps(1) infinite; box-shadow: 0 0 8px var(--warn); }
.typebox:not(.focused) .cur { animation: none; opacity: .5; }
.typebox.passed .cur { display: none; }
@keyframes blink { 50% { opacity: 0; } }
.focus-hint { position: sticky; bottom: 10px; left: 0; margin: 0 auto; width: max-content; background: var(--accent); color: #fff; font: 700 .85rem var(--sans); padding: 6px 14px; border-radius: 99px; pointer-events: none; transition: opacity .2s; }
.typebox.focused .focus-hint, .typebox.passed .focus-hint { opacity: 0; }
.nowline { display: flex; gap: 10px; align-items: center; margin-top: 8px; font-size: .8rem; color: var(--muted); }
.nowline code { flex: 1; overflow: hidden; white-space: pre; text-overflow: ellipsis; color: var(--text); }
.controls { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.controls .sp { flex: 1; }
.controls .navpair { display: flex; gap: 8px; margin-left: auto; }
.hint { color: var(--muted); font-size: .78rem; margin: 10px 0 0; }

.result { margin-top: 14px; padding: 20px; border-radius: 14px; background: linear-gradient(135deg, #3ddc9722, #7c5cff22); border: 1px solid #3ddc9766; animation: pop .4s cubic-bezier(.2, 1.6, .4, 1); }
.result-big { font-size: 1.6rem; font-weight: 900; }
.result-big b { color: var(--warn); }
.result-row { display: flex; gap: 18px; flex-wrap: wrap; margin: 6px 0; color: #cfd6ea; font-weight: 600; }
.result-bonus { color: var(--ok); font-size: .85rem; }
.levelup { margin-top: 10px; padding: 10px 14px; border-radius: 10px; background: #ffd16622; color: var(--warn); font-weight: 700; }
.result-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }

/* ---------- 내 기록 ---------- */
.me-top { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.me-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.me-stats div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 18px; }
.me-stats b { font-size: 1.6rem; display: block; }
.me-stats small { color: var(--muted); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.badge { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; text-align: center; opacity: .4; filter: grayscale(1); }
.badge.on { opacity: 1; filter: none; border-color: var(--warn); box-shadow: 0 0 18px #ffd16622; }
.badge span { font-size: 2rem; display: block; }
.badge small { color: var(--muted); font-size: .75rem; display: block; }
.road { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.road div { flex: 1 0 120px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; opacity: .5; }
.road div.on { opacity: 1; border-color: var(--accent); }
.road b { display: block; color: var(--accent2); }
.road span { display: block; font-size: .85rem; font-weight: 600; }
.road small { color: var(--muted); font-size: .72rem; }
.progress-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.progress-list a { display: grid; grid-template-columns: auto 90px 1fr auto; align-items: center; gap: 12px; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; font-size: .9rem; }
.progress-list .cicon { min-width: 32px; height: 32px; font-size: .72rem; }
.progress-list .pbar { margin: 0; }
.progress-list small { color: var(--muted); }
.settings { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.settings input { accent-color: var(--accent); width: 16px; height: 16px; vertical-align: -2px; margin-right: 6px; }

/* ---------- 소리 버튼 ---------- */
.soundbtn { background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 999px; width: 38px; height: 38px; font-size: 1.05rem; cursor: pointer; }
.soundbtn:hover { background: var(--panel2); }

/* ---------- 핵심 줄만 치기 편집기 ---------- */
.modebar { margin: 10px 0 8px; font-size: .85rem; color: #c9cfe0; background: #7c5cff14; border: 1px solid #7c5cff33; padding: 6px 12px; border-radius: 9px; }
.lbox { background: #0a0f1f; border: 2px solid var(--line); border-radius: 12px; padding: 12px 0; font: 15.5px/1.7 var(--mono); max-height: 58vh; overflow: auto; transition: border-color .2s; }
.lbox.passed { border-color: var(--ok); box-shadow: 0 0 0 4px #3ddc9722; }
.lrow { display: flex; align-items: center; min-height: 1.75em; padding-right: 10px; border-left: 3px solid transparent; }
.lrow .ln { flex: none; width: 44px; text-align: right; padding-right: 10px; color: #4a5578; user-select: none; }
.lrow .lc { white-space: pre; background: none; padding: 0 0 0 14px; border-radius: 0; font: inherit; color: #b8c0d8; }
.lrow.pre .lc { opacity: .75; }
.lrow.key { background: #7c5cff14; border-left-color: var(--accent); margin: 3px 0; }
.lrow.key.focused { background: #7c5cff2b; }
.lrow.key.done { border-left-color: var(--ok); background: #3ddc9714; }
.lrow.key .ktag { flex: none; margin-left: 6px; font-size: .85rem; opacity: .8; }
.lrow.key.done .ktag::after { content: '✅'; margin-left: 2px; }
.kwrap { position: relative; flex: 1; min-width: 0; }
.kghost, .kin { font: inherit; margin: 0; padding: 3px 0; white-space: pre; letter-spacing: 0; tab-size: 4; }
.kghost { position: absolute; inset: 0; overflow: hidden; color: transparent; pointer-events: none; }
.kin { position: relative; display: block; width: 100%; background: transparent; border: 0; outline: 0; color: #f1f4fb; caret-color: var(--warn); }
.kin::selection { background: #7c5cff73; }
.kghost .gh { color: #59648a; }
.kghost .hide, .kghost .hit { color: transparent; }
.kghost .miss { color: transparent; background: #ff5c7acc; border-radius: 3px; }
.lbox.passed .kin { color: var(--ok); }
.lbox .kw, .code .kw { color: #c792ea; }
.lbox .str { color: #c3e88d; } .lbox .num { color: #f78c6c; } .lbox .com { color: #637199; font-style: italic; }
.lbox .fn { color: #82aaff; } .lbox .tag { color: #ff7a93; } .lbox .ty { color: #ffcb6b; }
.code .keyline { background: #7c5cff38; border-radius: 4px; box-shadow: 0 0 0 3px #7c5cff38; }

/* ---------- 단계 선택 ---------- */
.stepsel { display: flex; align-items: center; gap: 8px; font-size: .82rem; }
.stepsel select { max-width: 280px; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font: 600 .88rem var(--sans); cursor: pointer; }
.stepsel select:focus { outline: 2px solid var(--accent); }
.small { font-size: .8rem; }
.settings p { margin: 0; }

.updbar { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 55; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 18px; background: var(--panel2); border: 1px solid var(--accent); border-radius: 14px; box-shadow: 0 12px 30px #000a; font-weight: 700; }

/* ---------- 기타 ---------- */
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 20px; border-top: 1px solid var(--line); }
.toast { position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 30px); background: var(--panel2); border: 1px solid var(--accent); color: var(--text); padding: 10px 20px; border-radius: 99px; font-weight: 600; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; box-shadow: 0 10px 30px #0008; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { top: 105vh; transform: rotate(720deg) translateX(60px); } }

/* 큰 격려 문구 — 화면을 가로질러 왔다 갔다 */
.cheer { position: fixed; left: 0; z-index: 62; pointer-events: none; white-space: nowrap; padding: 0 .2em;
  font: 900 clamp(2rem, 5.2vw, 4.6rem)/1.2 var(--sans); letter-spacing: -.02em;
  filter: drop-shadow(0 4px 0 #0b1020) drop-shadow(0 10px 24px #000c); }
.cheer .g { background: linear-gradient(90deg, #ffd166, #ff7a93, #b69cff, #4cc9f0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cheer .emo { margin-left: .15em; }
.cheer.long { font-size: clamp(1.4rem, 3.3vw, 3rem); }
/* 날아와서(1초) → 가운데서 흔들흔들 머물고(다 읽을 때까지) → .out이 붙으면 0.5초 만에 휙 빠져나가요 */
.cheer.ltr { animation-name: cheer-in-ltr; animation-duration: 1s; animation-timing-function: cubic-bezier(.2, .9, .3, 1.15); animation-fill-mode: both; }
.cheer.rtl { animation-name: cheer-in-rtl; animation-duration: 1s; animation-timing-function: cubic-bezier(.2, .9, .3, 1.15); animation-fill-mode: both; }
.cheer.ltr.out { animation: cheer-out-ltr .5s cubic-bezier(.6, 0, .9, .4) both; }
.cheer.rtl.out { animation: cheer-out-rtl .5s cubic-bezier(.6, 0, .9, .4) both; }
.cheer .wig { display: inline-block; animation: cheer-wiggle 1.4s ease-in-out .9s infinite; }
@keyframes cheer-in-ltr {
  0%   { transform: translateX(-110%) rotate(-6deg) scale(.8); opacity: 0; }
  30%  { opacity: 1; }
  100% { transform: translateX(calc(50vw - 50%)) rotate(0deg) scale(1); opacity: 1; }
}
@keyframes cheer-in-rtl {
  0%   { transform: translateX(105vw) rotate(6deg) scale(.8); opacity: 0; }
  30%  { opacity: 1; }
  100% { transform: translateX(calc(50vw - 50%)) rotate(0deg) scale(1); opacity: 1; }
}
@keyframes cheer-out-ltr {
  0%   { transform: translateX(calc(50vw - 50%)) scale(1); opacity: 1; }
  100% { transform: translateX(110vw) rotate(-5deg) scale(.85); opacity: 0; }
}
@keyframes cheer-out-rtl {
  0%   { transform: translateX(calc(50vw - 50%)) scale(1); opacity: 1; }
  100% { transform: translateX(-115%) rotate(5deg) scale(.85); opacity: 0; }
}
@keyframes cheer-wiggle {
  0%, 100% { transform: rotate(-2deg) scale(1); }
  25%      { transform: translateX(-1.5vw) rotate(1.5deg) scale(1.06); }
  50%      { transform: rotate(2deg) scale(1); }
  75%      { transform: translateX(1.5vw) rotate(-1.5deg) scale(1.05); }
}
@media (prefers-reduced-motion: reduce) {
  .cheer.ltr, .cheer.rtl { left: 50%; animation: cheer-fade-in .4s both; transform: translateX(-50%); }
  .cheer.ltr.out, .cheer.rtl.out { animation: cheer-fade-out .3s both; }
  .cheer .wig { animation: none; }
  @keyframes cheer-fade-in { from { opacity: 0; } to { opacity: 1; } }
  @keyframes cheer-fade-out { from { opacity: 1; } to { opacity: 0; } }
}

/* ---------- 📚 바로가기 ---------- */
.jumpbtn { background: linear-gradient(135deg, var(--accent), #5b6cff); color: #fff; border: 0; border-radius: 999px; padding: 8px 16px; font: 800 .92rem var(--sans); cursor: pointer; box-shadow: 0 4px 14px #7c5cff55; white-space: nowrap; }
.jumpbtn:hover { filter: brightness(1.1); }
body.noscroll { overflow: hidden; }
.jump { position: fixed; inset: 0; z-index: 70; background: #050814b3; backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; animation: pop .2s ease-out; }
.jump-panel { width: min(1100px, 100%); height: min(760px, 100%); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 30px 80px #000c; overflow: hidden; }
.jump-head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.jump-head b { font-size: 1.15rem; }
.jump-head b small { display: block; font-size: .78rem; color: var(--muted); font-weight: 600; }
.jump-head .search { flex: 1; min-width: 200px; }
.jump-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 300px 1fr; }
.jump-courses { overflow: auto; padding: 10px; border-right: 1px solid var(--line); }
.jg-title { font-size: .78rem; font-weight: 800; color: var(--muted); margin: 10px 6px 6px; }
.jc { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; margin: 2px 0; background: none; border: 1px solid transparent; border-radius: 10px; color: var(--text); font: 600 .92rem var(--sans); cursor: pointer; text-align: left; }
.jc .cicon { flex: none; min-width: 30px; height: 30px; font-size: .7rem; border-radius: 8px; }
.jc span { flex: 1; }
.jc small { color: var(--muted); }
.jc:hover { background: #ffffff0d; }
.jc.on { background: color-mix(in srgb, var(--c) 18%, transparent); border-color: color-mix(in srgb, var(--c) 50%, transparent); }
.jump-lessons { overflow: auto; padding: 14px 18px; }
.jl-title { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; margin-bottom: 10px; flex-wrap: wrap; }
.jl-title small { font-size: .8rem; color: var(--muted); font-weight: 600; }
.jl-title .cicon { min-width: 32px; height: 32px; font-size: .72rem; }
.jl { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 4px 0; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); font-weight: 600; transition: transform .12s, border-color .12s; }
.jl:hover { border-color: var(--accent); transform: translateX(4px); }
.jl .cicon { min-width: 30px; height: 30px; font-size: .7rem; border-radius: 8px; }
.jl small { display: block; font-size: .72rem; color: var(--muted); }
.jl-n { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-content: center; background: var(--accent); color: #fff; font-size: .8rem; font-weight: 800; }
.jump-foot { display: flex; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: .88rem; color: var(--muted); }
.jump-foot a:hover { color: var(--text); }

/* ---------- ↩ 하던 곳으로 돌아가기 ---------- */
.returnbar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 24px);
  padding: 10px 18px 10px 16px; border-radius: 999px; background: linear-gradient(135deg, #3ddc97, #20b37a); color: #04261a; font: 800 .95rem var(--sans);
  box-shadow: 0 10px 30px #0009, 0 0 0 3px #3ddc9744; animation: pop .35s cubic-bezier(.2, 1.6, .4, 1); }
.returnbar:hover { filter: brightness(1.08); transform: translateX(-50%) translateY(-2px); }
.returnbar span { white-space: nowrap; }
.returnbar b { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 6px; border-radius: 999px; background: #ffffffcc; color: #0b1020; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.returnbar .cicon { flex: none; min-width: 26px; height: 26px; font-size: .62rem; border-radius: 7px; }
main { padding-bottom: 90px; }
.jump-return { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 18px 0; padding: 10px 14px; border-radius: 12px; background: #3ddc971f; border: 1px solid #3ddc9766; color: #c8f7e4; font-weight: 800; }
.jump-return:hover { background: #3ddc9733; }
.jump-return b { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; }
.jump-return .cicon { min-width: 26px; height: 26px; font-size: .62rem; border-radius: 7px; }

/* ---------- 💡 복사 안내 말풍선 (3초) ---------- */
.tipb { position: absolute; z-index: 66; max-width: 420px; padding: 12px 16px; border-radius: 16px; pointer-events: none;
  background: linear-gradient(135deg, #e0f2fe, #bae6fd); color: #0c2a3d; font: 800 1rem/1.45 var(--sans); box-shadow: 0 12px 34px #000a, 0 0 0 3px #4cc9f066;
  animation: tip-in .35s cubic-bezier(.2, 1.6, .4, 1) both; transition: opacity .45s, transform .45s; }
.tipb b { color: #0369a1; }
.tipb small { display: block; margin-top: 3px; font-size: .78rem; font-weight: 700; color: #155e75; }
.tipb::after { content: ''; position: absolute; bottom: -9px; left: var(--tail, 50%); width: 18px; height: 18px; background: #bae6fd; transform: translateX(-50%) rotate(45deg); border-radius: 3px; }
.tipb.out { opacity: 0; transform: translateY(-8px) scale(.96); }
@keyframes tip-in { from { opacity: 0; transform: translateY(10px) scale(.85); } }

/* ---------- 💬 말풍선 ---------- */
.bubble { position: fixed; z-index: 65; width: 300px; padding: 14px 18px; border: 0; border-radius: 18px; cursor: pointer; text-align: left;
  background: linear-gradient(135deg, #ffd166, #ff9f43); color: #2b1600; font: 900 1.15rem/1.35 var(--sans); box-shadow: 0 14px 40px #0009;
  animation: bubble-in .45s cubic-bezier(.2, 1.6, .4, 1) both, bubble-bob 1.6s ease-in-out .45s infinite; }
.bubble small { display: block; margin-top: 4px; font-size: .78rem; font-weight: 700; opacity: .75; }
.bubble::before { content: ''; position: absolute; top: -10px; left: var(--tail, 150px); width: 20px; height: 20px; background: #ffc35c; transform: translateX(-50%) rotate(45deg); border-radius: 4px; }
@keyframes bubble-in { from { transform: translateY(-14px) scale(.6); opacity: 0; } }
@keyframes bubble-bob { 50% { transform: translateY(-6px); } }
.nudge { position: relative; color: var(--text) !important; background: #ffd16633 !important; box-shadow: 0 0 0 2px #ffd166aa, 0 0 18px #ffd16688; animation: nudge 1s ease-in-out infinite; }
@keyframes nudge { 50% { box-shadow: 0 0 0 4px #ffd166, 0 0 26px #ffd166aa; } }

/* ---------- 통과 화면: 문장 설명 + 다른 것 추천 ---------- */
.more { margin-top: 14px; }
.more-head { font-weight: 800; margin-bottom: 8px; }
.more-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.more-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: transform .12s, border-color .12s; }
.more-card:hover { transform: translateY(-2px); border-color: var(--c, var(--accent)); }
.more-card b { display: block; font-size: .92rem; }
.more-card small { color: var(--muted); font-size: .75rem; }
.more-ic { flex: none; min-width: 34px; height: 34px; display: grid; place-content: center; border-radius: 9px; background: color-mix(in srgb, var(--c, #7c5cff) 25%, transparent); font: 800 .8rem var(--mono); }
.more-card.all { border-color: #7c5cff66; }

/* ---------- 📱 휴대폰 ---------- */
.mdesc { display: none; }
.symbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; display: none; gap: 4px; overflow-x: auto; padding: 6px; background: #121a2ef2; border-top: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
.symbar.on { display: flex; }
.symbar button { flex: none; min-width: 40px; height: 40px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font: 700 1.05rem var(--mono); }
.symbar button:active { background: var(--accent); }

@media (max-width: 960px) {
  .hero, .me-top { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .pane.left { position: static; max-height: none; }
  .nav { display: none; }
  .how { grid-template-columns: 1fr; }
  .typebox { height: 50vh; }
  /* 레슨: 타이핑 칸을 맨 위로, 설명은 접어서 (긴 코드 줄은 칸 안에서 옆으로 밀어 보기) */
  .split { grid-template-columns: minmax(0, 1fr); }
  .pane.right { order: -1; }
  .stepsel > span { display: none; }
  .stats { gap: 6px; }
  .stats div { padding: 6px 8px; }
  .pane.left > h1, .pane.left > .desc { display: none; }
  .mdesc { display: block; margin-bottom: 10px; background: var(--panel2); border-radius: 10px; padding: 8px 12px; }
  .mdesc summary { cursor: pointer; font-weight: 800; }
  .mdesc summary small { color: var(--muted); font-weight: 600; }
  .mdesc .desc { margin-top: 8px; font-size: .92rem; }
  .lesson-top { flex-wrap: wrap; gap: 8px; }
  .dots { display: none; }
  .stepsel { flex: 1; }
  .stepsel select { max-width: none; width: 100%; }
  .stats b { font-size: 1.05rem; }
  .stats small { font-size: .65rem; }
  .lbox { font-size: 14px; }
  .lrow .ln { width: 30px; padding-right: 6px; }
  .lrow .lc { padding-left: 8px; }
  .controls .btn { padding: 8px 12px; font-size: .85rem; }
  .pane { padding: 14px; }
  main:has(.lesson) { padding: 0 8px 80px; }
  .topbar { gap: 10px; padding: 10px 12px; }
  .lvpill .xp, .lvpill .lvbar { display: none; }
  .jumpbtn span { display: none; }
  /* 바로가기: 과목 목록을 위에 가로로, 단계 목록을 아래에 */
  .jump { padding: 0; }
  .jump-panel { height: 100%; border-radius: 0; }
  .jump-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .jump-courses { border-right: 0; border-bottom: 1px solid var(--line); max-height: 38vh; }
  .jg { display: flex; flex-wrap: wrap; gap: 4px; }
  .jg-title { width: 100%; }
  .jc { width: auto; }
  .bubble { width: min(300px, calc(100vw - 20px)); font-size: 1rem; }
  .returnbar { bottom: 10px; gap: 8px; padding: 8px 10px; font-size: .85rem; }
  .returnbar span { font-size: 0; }
  .returnbar span::before { content: '↩ 돌아가기'; font-size: .85rem; }
}

/* 장(챕터) 제목 — 레슨이 100개쯤 되는 코스에서 묶어서 보여줘요 */
.llist .lch { margin: 18px 0 2px; padding: 0 4px; font-weight: 900; font-size: 1.1rem; color: var(--accent2, #4cc9f0); }
.llist .lch:first-child { margin-top: 0; }
.llist .lch small, .jl-ch small { font-size: .78rem; color: var(--muted); font-weight: 600; margin-left: 6px; }
.jl-ch { margin: 14px 2px 4px; font-weight: 900; color: var(--accent2, #4cc9f0); }
.dots-ch { font-size: .78rem; font-weight: 800; color: var(--muted); margin-right: 6px; align-self: center; white-space: nowrap; }

/* SQL 레슨 설명 안의 작은 연습용 표 */
table.mini { border-collapse: collapse; font-size: .8rem; margin: 2px 0 10px; display: block; overflow-x: auto; max-width: 100%; }
table.mini th, table.mini td { border: 1px solid var(--line); padding: 2px 8px; white-space: nowrap; text-align: left; }
table.mini th { background: #ffffff12; color: var(--accent2, #4cc9f0); font-weight: 700; }
table.mini i { color: var(--muted); }

/* 정답 코드 칸: 눌러서 고르면 테두리로 알려 주고, 줄 번호는 선택되지 않게 */
.code.answer { cursor: text; }
.code.answer:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px #7c5cff55; }
.code .gut { user-select: none; }

/* ---------- 바닥글 연락처 (문의 · 비즈니스) ---------- */
.contact { display: flex; width: fit-content; max-width: calc(100% - 16px); box-sizing: border-box; align-items: center; gap: 10px; margin: 12px auto 0; padding: 6px 8px 6px 14px; border-radius: 999px;
  background: linear-gradient(#0f1630, #0f1630) padding-box, linear-gradient(90deg, var(--accent), var(--accent2)) border-box;
  border: 1px solid transparent; box-shadow: 0 0 18px #7c5cff22; font-size: .78rem; }
.contact-label { color: var(--muted); letter-spacing: .02em; }
.contact-mail { font-weight: 600; text-decoration: none; background: linear-gradient(90deg, #b9a6ff, var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.contact-mail:hover { text-decoration: underline; text-decoration-color: var(--accent2); }
.contact-copy { font: 600 .72rem var(--sans); color: var(--text); background: #ffffff10; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; cursor: pointer; transition: background .2s, border-color .2s; }
.contact-copy:hover { background: #7c5cff33; border-color: var(--accent); }
@media (max-width: 600px) { .contact { flex-wrap: wrap; justify-content: center; border-radius: 16px; padding: 8px 12px; } }
