/* =========================================================
 * 코드 키우기 - 스타일 (테마는 CSS 변수로 전환)
 * ========================================================= */
:root, body.theme-dark {
  --bg: #1e1e1e; --panel: #252526; --panel2: #2d2d2d; --panel3: #232323; --border: #333; --border2: #3c3c3c;
  --text: #d4d4d4; --strong: #fff; --muted: #888; --accent: #007acc; --accent2: #0e639c;
  --kw: #569cd6; --str: #ce9178; --cm: #6a9955; --num: #b5cea8; --fn: #dcdcaa; --dec: #c586c0; --type: #4ec9b0; --tag: #569cd6;
  --good: #4ec9b0; --gold: #d7ba7d; --bad: #f48771; --purple: #c586c0; --goal: #1b2b3a;
}
body.theme-light {
  --bg: #f3f3f3; --panel: #ffffff; --panel2: #f0f0f0; --panel3: #fafafa; --border: #ddd; --border2: #ccc;
  --text: #333; --strong: #111; --muted: #777; --accent: #005fb8; --accent2: #0066bf;
  --kw: #0000ff; --str: #a31515; --cm: #008000; --num: #098658; --fn: #795e26; --dec: #af00db; --type: #267f99; --tag: #800000;
  --good: #16825d; --gold: #a06b00; --bad: #d1242f; --purple: #8250df; --goal: #e6f0fa;
}
body.theme-monokai {
  --bg: #272822; --panel: #2f302a; --panel2: #3a3b35; --panel3: #2b2c26; --border: #44453e; --border2: #4f5048;
  --text: #f8f8f2; --strong: #fff; --muted: #90918b; --accent: #a6e22e; --accent2: #6f9a1f;
  --kw: #f92672; --str: #e6db74; --cm: #75715e; --num: #ae81ff; --fn: #a6e22e; --dec: #fd971f; --type: #66d9ef; --tag: #f92672;
  --good: #a6e22e; --gold: #e6db74; --bad: #f92672; --purple: #ae81ff; --goal: #3e3d32;
}
body.theme-terminal {
  --bg: #0a0f0a; --panel: #0f170f; --panel2: #142014; --panel3: #0c130c; --border: #1f3a1f; --border2: #245024;
  --text: #33ff66; --strong: #66ff99; --muted: #2a9d4a; --accent: #1f8f3f; --accent2: #1a7a35;
  --kw: #66ff99; --str: #b5ffb5; --cm: #2a7a3a; --num: #99ffcc; --fn: #ccffcc; --dec: #66ffcc; --type: #00ff99; --tag: #66ff99;
  --good: #66ff99; --gold: #ccff66; --bad: #ff6666; --purple: #66ffcc; --goal: #102a10;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, "Segoe UI", "Malgun Gothic", sans-serif; min-height: 100vh; }
button, input { font-family: inherit; }
.hidden { display: none !important; }

.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 10px; }
.top h1 { font-size: 18px; color: var(--strong); display: flex; align-items: center; gap: 8px; }
.ver { color: var(--good); font-family: Consolas, monospace; font-size: 14px; }
.title-chip { font-size: 12px; background: var(--panel2); color: var(--gold); padding: 2px 9px; border-radius: 10px; font-weight: 500; }
.stats { display: flex; gap: 22px; flex-wrap: wrap; }
.stat-label { font-size: 11px; color: var(--muted); }
.stat-val { font-size: 18px; font-weight: 600; color: var(--strong); font-family: Consolas, monospace; }
.stat-val.rate { color: var(--num); }
.stat-val.rate.neg { color: var(--bad); }
.stat-val.key { color: var(--gold); }
.stat-val.rep { color: var(--purple); }

.goalbar { position: relative; z-index: 45; display: flex; align-items: center; gap: 12px; padding: 0 20px; height: 46px; box-sizing: border-box; background: var(--goal); border-bottom: 1px solid var(--border); font-size: 13px; flex-wrap: nowrap; }
.goal-label { background: var(--accent); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 3px; font-weight: 600; }
#goal { color: var(--strong); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 아이콘 개수와 상관없이 칸 크기 고정 (아이콘 10개 자리) */
#buffs { display: flex; gap: 6px; margin-left: auto; flex-wrap: nowrap; justify-content: flex-end; flex: 0 0 354px; width: 354px; height: 32px; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: rgba(78, 201, 176, .15); color: var(--good); }
.chip.bad { background: rgba(244, 135, 113, .15); color: var(--bad); }

.main { display: grid; grid-template-columns: 1fr 410px; gap: 14px; padding: 14px 20px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; position: relative; }

/* 에디터 */
.tab { background: var(--panel2); padding: 6px 12px; font-size: 13px; color: var(--text); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.tab .lines { color: var(--muted); margin-left: 8px; font-size: 12px; }
.tab .right { display: flex; align-items: center; gap: 8px; }
.tab .stage-name { color: var(--muted); font-size: 12px; }
.grade-chip { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 3px; background: var(--panel3); border: 1px solid var(--border2); color: var(--muted); }
.grade-chip.drop { animation: gdrop .4s ease-in-out 3; }
@keyframes gdrop { 50% { background: var(--bad); color: #fff; } }
.grade-chip.g0 { color: var(--bad); border-color: var(--bad); }
.grade-chip.g4 { color: #ffd700; border-color: #ffd700; } .grade-chip.g3 { color: var(--good); border-color: var(--good); } .grade-chip.g2 { color: var(--kw); border-color: var(--kw); }
.btn { font-size: 12px; background: var(--accent2); color: #fff; border: none; border-radius: 3px; padding: 4px 10px; cursor: pointer; white-space: nowrap; }
.btn:disabled, .btn.off { background: var(--panel2); color: var(--muted); cursor: default; border: 1px solid var(--border2); }
.btn.warn { background: #8a4b08; }
.btn.gray { background: var(--panel2); color: var(--text); border: 1px solid var(--border2); }
.btn.on { background: var(--accent); }

.status { display: flex; align-items: center; gap: 14px; padding: 0 12px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); background: var(--panel3); height: 34px; white-space: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.status .debt { display: flex; align-items: center; gap: 6px; }
.mini-bar { width: 80px; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; display: inline-block; }
.mini-fill { height: 100%; display: block; }
.bug-count { color: var(--bad); font-weight: 600; }
.alert { color: var(--bad); font-weight: 600; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .45; } }

.combo-bar { height: 30px; padding: 0 14px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.combo-bar .cb-label { width: 72px; font-weight: 700; }
.combo-bar .cb-mult { width: 44px; text-align: right; font-family: Consolas, monospace; font-weight: 700; }
.combo-bar .cb-track { flex: 1; height: 8px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
.combo-bar .cb-fill { height: 100%; width: 0; background: var(--muted); border-radius: 4px; }
.combo-bar[data-lv="1"] .cb-fill { background: var(--accent); }
.combo-bar[data-lv="2"] .cb-fill { background: var(--good); }
.combo-bar[data-lv="3"] .cb-fill, .combo-bar[data-lv="4"] .cb-fill { background: var(--gold); }
.combo-bar[data-lv="1"], .combo-bar[data-lv="2"] { color: var(--text); }
.combo-bar[data-lv="3"], .combo-bar[data-lv="4"] { color: var(--gold); }
.combo-bar[data-lv="4"] .cb-fill { animation: cbshine .6s ease-in-out infinite alternate; }
@keyframes cbshine { to { filter: brightness(1.45); } }
.combo-bar.low .cb-fill { background: var(--bad) !important; animation: bblink .3s steps(2, start) infinite; }
.challenge { height: 42px; padding: 0 14px; border-top: 1px solid var(--border); font-size: 13px; display: flex; align-items: center; gap: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.challenge.on { background: rgba(215, 186, 125, .12); color: var(--text); }
.challenge .word { font-family: Consolas, monospace; font-size: 18px; letter-spacing: 2px; }
.challenge .typed { color: var(--good); }
.challenge .rest { color: var(--muted); }
.challenge .meta { color: var(--gold); margin-left: auto; }

.workspace { display: flex; height: 400px; position: relative; }
.desk { position: absolute; right: 16px; bottom: 6px; pointer-events: none; opacity: .92; text-align: center; background: var(--panel3); border: 1px solid var(--border); border-radius: 6px; padding: 6px 6px 3px; }
.desk .h2 { display: none; }
.desk.pose .h1 { display: none; }
.desk.pose .h2 { display: inline; }
.filetabs { display: flex; background: var(--panel3); border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; height: 34px; scrollbar-width: thin; }
.ftab { display: flex; align-items: center; gap: 6px; padding: 0 14px; font-size: 12px; white-space: nowrap; border-right: 1px solid var(--border); color: var(--muted); border-top: 2px solid transparent; flex-shrink: 0; }
.ftab.done { cursor: pointer; }
.ftab.done:hover { background: var(--panel2); color: var(--text); }
.ftab.cur { background: var(--panel); color: var(--strong); border-top-color: var(--accent); }
.ftab.locked { opacity: .35; }
.ftab .ex-check { color: var(--good); font-size: 11px; }

.code { flex: 1; font-family: Consolas, "D2Coding", monospace; font-size: 14px; line-height: 1.6; padding: 10px 0; overflow: auto; cursor: text; }
.code::-webkit-scrollbar { width: 10px; height: 10px; }
.code::-webkit-scrollbar-thumb { background: var(--border2); }
.code.refactoring { opacity: .45; }
.ln { display: flex; white-space: pre; min-height: 22px; }
.ln:hover { background: rgba(128, 128, 128, .08); }
.ln .no { width: 52px; flex-shrink: 0; text-align: right; padding-right: 16px; color: var(--muted); opacity: .7; user-select: none; }
.ln.bug { background: rgba(244, 71, 71, .18); cursor: pointer; }
.ln.bug .no { color: var(--bad); opacity: 1; }
.ln.bug .tx::after { content: "  클릭해서 수정"; color: var(--bad); font-family: "Malgun Gothic", sans-serif; font-size: 11px; opacity: .8; }
.typo { color: var(--bad); text-decoration: underline wavy var(--bad); text-underline-offset: 3px; }
.cursor { display: inline-block; width: 8px; height: 16px; background: var(--text); vertical-align: text-bottom; animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.kw { color: var(--kw); } .str { color: var(--str); } .cm { color: var(--cm); } .num { color: var(--num); } .fn { color: var(--fn); } .dec { color: var(--dec); } .type { color: var(--type); } .tag { color: var(--tag); }

.infobar { padding: 0 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); height: 36px; display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; background: var(--panel3); }
.infobar b { color: var(--strong); }
.infobar .explain { color: var(--text); }
.gl-chip { font-size: 11px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--accent); color: var(--accent); cursor: pointer; background: none; }
.gl-chip:hover { background: var(--accent); color: #fff; }

.float { position: absolute; right: 24px; top: 90px; color: var(--gold); font-family: Consolas, monospace; font-size: 14px; pointer-events: none; animation: rise .7s ease-out forwards; z-index: 5; }
.float.good { color: var(--good); }
@keyframes rise { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-24px); } }

.progress-wrap { padding: 8px 14px; border-top: 1px solid var(--border); }
.progress-label { font-size: 12px; color: var(--muted); margin-bottom: 5px; display: flex; justify-content: space-between; }
.bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); width: 0; }
.bar-fill.file { background: var(--good); }
.bar-fill.time { background: var(--gold); }
.bar-fill.urgent { background: var(--bad); }

/* 오른쪽 패널 */
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--panel2); border-bottom: 1px solid var(--border); }
.tabs button { background: none; border: none; color: var(--muted); padding: 8px 0; font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--strong); border-bottom-color: var(--accent); }
.tabs .badge { background: var(--purple); color: #1e1e1e; border-radius: 8px; padding: 0 5px; font-size: 10px; margin-left: 3px; font-weight: 700; }
#side { padding: 12px 14px; height: 629px; overflow-y: auto; }
.sec-title { font-size: 13px; color: var(--strong); margin: 4px 0 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sec-title .sub { font-size: 11px; color: var(--muted); font-weight: 400; }
.note { font-size: 12px; color: var(--muted); line-height: 1.6; margin-bottom: 10px; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.q { display: inline-block; width: 15px; height: 15px; line-height: 15px; text-align: center; border-radius: 50%; border: 1px solid var(--muted); color: var(--muted); font-size: 10px; margin-left: 5px; cursor: help; }
.q:hover { border-color: var(--accent); color: var(--accent); }

.upg { display: flex; justify-content: space-between; align-items: center; padding: 9px 10px; margin-bottom: 7px; background: var(--panel2); border: 1px solid var(--border2); border-radius: 4px; cursor: pointer; user-select: none; }
.upg:hover:not(.disabled):not(.locked) { border-color: var(--accent); }
.upg.disabled { opacity: .5; cursor: default; }
.upg.locked { cursor: default; position: relative; }
.upg.locked > :not(.lock-tag), .row.locked > :not(.lock-tag) { opacity: .25; }
.upg-name { font-size: 14px; color: var(--strong); display: flex; align-items: center; }
.upg-lv { color: var(--good); font-size: 12px; margin-left: 6px; }
.upg-tier { color: var(--gold); font-size: 11px; margin-left: 6px; }
.upg-desc { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.upg-desc b { color: var(--text); font-weight: 500; }
.upg-cost { font-family: Consolas, monospace; font-size: 13px; color: var(--gold); text-align: right; white-space: nowrap; margin-left: 8px; }

.card { background: var(--panel2); border: 1px solid var(--border2); border-radius: 4px; padding: 10px; margin-bottom: 8px; }
.card.active { border-color: var(--accent); }
.card-top { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.kind { padding: 1px 6px; border-radius: 3px; font-weight: 600; color: #1e1e1e; }
.k-maint { background: #9cdcfe; } .k-qa { background: #ce9178; } .k-build { background: #4ec9b0; } .k-adv { background: #c586c0; } .k-next { background: #d7ba7d; } .k-boss { background: #f48771; }
.card-top .right { margin-left: auto; font-family: Consolas, monospace; }
.card-title { font-size: 14px; color: var(--strong); margin: 6px 0; }
.req { font-size: 12px; color: var(--muted); margin: 2px 0; }
.req.done { color: var(--good); }
.card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12px; color: var(--gold); gap: 8px; }

.row { display: flex; justify-content: space-between; align-items: center; padding: 9px 10px; margin-bottom: 7px; background: var(--panel2); border: 1px solid var(--border2); border-radius: 4px; gap: 10px; }
.row.locked { position: relative; }
.route { position: relative; }
.route.locked > :not(.lock-tag) { opacity: .25; }
.route .lock-tag { text-align: center; padding: 0 8px; line-height: 1.6; white-space: normal; flex-direction: column; }
#buffs { align-items: center; }
.bicon { position: relative; width: 30px; height: 30px; border-radius: 5px; background: #f2f2f2; border: 1px solid var(--border2); display: flex; align-items: center; justify-content: center; cursor: default; }
.bicon.bad { background: #f6d5d0; }
.bicon .bfill { position: absolute; left: 0; bottom: 0; right: 0; height: 0; background: rgba(60, 60, 60, .6); border-radius: 0 0 5px 5px; pointer-events: none; }
.bicon.blink > svg, .bicon.blink > .bfill { animation: bblink .5s steps(2, start) infinite; }
@keyframes bblink { to { opacity: .25; } }
.bicon .bcount { position: absolute; right: -3px; bottom: -4px; font-size: 10px; font-weight: 700; color: #fff; background: var(--accent); border-radius: 7px; padding: 0 4px; line-height: 14px; }
.bicon .bcount:empty { display: none; }
.bicon .btip { display: none; position: absolute; top: 36px; right: 0; width: 180px; background: var(--panel); color: var(--text); border: 1px solid var(--accent); border-radius: 5px; padding: 7px 9px; font-size: 12px; line-height: 1.5; z-index: 40; text-align: left; white-space: normal; }
.bicon .btip b { color: var(--strong); }
.bicon:hover .btip { display: block; }
.lock-tag { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: var(--strong); letter-spacing: .5px; pointer-events: none; }
.row.owned { border-color: var(--good); }
.row-name { font-size: 14px; color: var(--strong); }
.item-art { width: 44px; height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--panel3); border-radius: 4px; }
.row-name .cnt { color: var(--good); font-size: 12px; margin-left: 6px; }
.row-name .role { color: var(--muted); font-size: 11px; margin-left: 6px; }
.row-desc { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.5; }

.big-btn { width: 100%; padding: 10px; font-size: 14px; font-weight: 600; background: var(--accent2); color: #fff; border: none; border-radius: 4px; cursor: pointer; margin-top: 8px; }
.big-btn:disabled { background: var(--panel2); color: var(--muted); cursor: default; }
.big-btn.gold { background: #8a6d08; }
.big-btn.red { background: #8a2b2b; }
.info { font-size: 13px; color: var(--muted); line-height: 1.7; }
.info b { color: var(--good); }
.route-box { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.route { background: var(--panel2); border: 1px solid var(--border2); border-radius: 4px; padding: 10px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.route h4 { color: var(--strong); font-size: 14px; margin-bottom: 4px; }

.ach { display: flex; gap: 10px; align-items: center; padding: 7px 4px; border-bottom: 1px solid var(--border); font-size: 13px; }
.ach .mark { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--muted); flex-shrink: 0; }
.ach.done .mark { background: var(--good); border-color: var(--good); }
.ach .a-desc { font-size: 11px; color: var(--muted); }
.ach:not(.done) .a-name { color: var(--muted); }

.gloss-search { width: 100%; padding: 7px 10px; background: var(--panel2); border: 1px solid var(--border2); border-radius: 4px; color: var(--text); font-size: 13px; margin-bottom: 10px; }
.gl-cat { font-size: 11px; color: var(--accent); margin: 12px 0 4px; font-weight: 700; letter-spacing: 1px; }
.gl { padding: 8px 10px; border-radius: 4px; margin-bottom: 4px; border: 1px solid transparent; }
.gl .gl-term { font-size: 14px; color: var(--strong); font-weight: 600; }
.gl .gl-desc { font-size: 12px; color: var(--text); line-height: 1.6; margin-top: 3px; }
.gl .gl-ex { font-family: Consolas, monospace; font-size: 12px; color: var(--cm); margin-top: 4px; background: var(--panel3); padding: 3px 6px; border-radius: 3px; display: inline-block; }
.gl.feat { background: var(--panel2); border: 1px solid var(--border2); margin-bottom: 8px; padding: 10px 12px; }
.gl-badge { font-size: 10px; font-weight: 700; color: var(--good); border: 1px solid var(--good); border-radius: 9px; padding: 0 7px; margin-left: 8px; vertical-align: 2px; }
.gl-sec { display: flex; gap: 8px; margin-top: 7px; align-items: flex-start; }
.gl-sec .gl-desc { margin-top: 0; flex: 1; }
.gl-lab { flex: 0 0 auto; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 3px; background: var(--panel3); color: var(--muted); margin-top: 1px; }
.gl-lab.game { background: rgba(78, 201, 176, .15); color: var(--good); }
.gl-cat-sub { font-weight: 400; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.gl.flash { border-color: var(--accent); background: rgba(0, 122, 204, .12); }

.set-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.set-input { flex: 1; padding: 6px 9px; background: var(--panel2); border: 1px solid var(--border2); border-radius: 4px; color: var(--text); font-size: 13px; }

/* 모달 */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: var(--panel); border: 1px solid var(--accent); border-radius: 8px; padding: 22px; width: 440px; max-width: 94vw; max-height: 90vh; overflow-y: auto; }
.modal.wide { width: 820px; }
.modal h3 { color: var(--strong); font-size: 17px; margin-bottom: 10px; }
.modal .m-desc { font-size: 14px; color: var(--text); line-height: 1.7; margin-bottom: 16px; }
.modal .m-btns { display: flex; flex-direction: column; gap: 8px; }
.modal .m-btns button { padding: 10px; font-size: 14px; border-radius: 4px; border: none; cursor: pointer; background: var(--accent2); color: #fff; }
.modal .m-btns button.alt { background: var(--panel2); color: var(--text); border: 1px solid var(--border2); }
.card-img { width: 100%; image-rendering: pixelated; border-radius: 4px; display: block; }
.modal .m-auto { font-size: 11px; color: var(--muted); margin-top: 10px; text-align: right; }
.modal input { width: 100%; padding: 9px 11px; background: var(--panel2); border: 1px solid var(--border2); border-radius: 4px; color: var(--text); font-size: 15px; margin-bottom: 12px; }
.archive { font-family: Consolas, "D2Coding", monospace; font-size: 13px; line-height: 1.55; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 8px 0; max-height: 60vh; overflow: auto; }
.share-box { width: 100%; height: 120px; background: var(--panel2); color: var(--text); border: 1px solid var(--border2); border-radius: 4px; padding: 8px; font-size: 13px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; padding: 10px 20px; border-radius: 4px; font-size: 14px; opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 60; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; pointer-events: auto; cursor: pointer; }

@media (max-width: 1000px) {
  .main { grid-template-columns: 1fr; }
  #side { height: auto; max-height: 640px; }
}

.aug-box.wide { width: 760px; }
.aug-box.tier-g { border-color: #e6b94a; box-shadow: 0 0 24px rgba(230, 185, 74, .25); }
.aug-box.tier-p { border-color: #c792ea; box-shadow: 0 0 28px rgba(199, 146, 234, .35); }
.aug-sub { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.aug-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.aug-card { background: var(--panel2); border: 2px solid var(--tc); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; animation: augIn .35s ease-out both; }
.aug-card:nth-child(2) { animation-delay: .08s; } .aug-card:nth-child(3) { animation-delay: .16s; }
@keyframes augIn { from { transform: translateY(12px) scale(.96); opacity: 0; } }
.aug-card.t-p { background: linear-gradient(160deg, rgba(199, 146, 234, .16), rgba(79, 195, 247, .10) 50%, rgba(255, 213, 79, .12)); }
.aug-tier { font-size: 11px; font-weight: 700; color: var(--tc); letter-spacing: 1px; }
.aug-icon { width: 56px; height: 56px; border-radius: 8px; background: #f2f2f2; display: flex; align-items: center; justify-content: center; }
.aug-name { font-size: 15px; font-weight: 700; color: var(--strong); }
.aug-desc { font-size: 12px; color: var(--text); line-height: 1.5; min-height: 54px; }
.aug-tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.aug-tag { font-size: 10px; padding: 1px 6px; border-radius: 8px; background: var(--panel3); color: var(--good); border: 1px solid var(--border2); }
.aug-btns { width: 100%; display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.aug-tag.hit { background: rgba(78, 201, 176, .18); border-color: var(--good); font-weight: 700; }
.aug-pick { width: 100%; padding: 9px; border: 0; border-radius: 5px; background: var(--accent2); color: #fff; font-size: 13px; font-weight: 700; cursor: pointer; margin-top: 4px; }
.aug-re { width: 100%; padding: 6px; border: 1px solid var(--border2); border-radius: 5px; background: none; color: var(--muted); font-size: 12px; cursor: pointer; }
.aug-re:disabled { opacity: .4; cursor: default; }
.aug-own, .aug-dex { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.aug-chip { font-size: 11px; padding: 2px 8px; border-radius: 10px; border: 1px solid #c0c7cf; color: var(--text); background: var(--panel2); }
.aug-chip.t-g { border-color: #e6b94a; color: #e6b94a; }
.aug-chip.t-p { border-color: #c792ea; color: #c792ea; }
.aug-chip.unseen { color: var(--muted); border-style: dashed; border-color: var(--border2); }
.aug-sets { display: flex; flex-direction: column; gap: 4px; }
.aug-set { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.aug-set b { color: var(--text); white-space: nowrap; }
.aug-set.on b { color: var(--good); }
.aug-set .pixel { background: #f2f2f2; border-radius: 3px; flex: 0 0 auto; }

/* =========================================================
 * 모바일 (하단 탭 방식)
 * ========================================================= */
.mnav { display: none; }
.sw-row { display: flex; gap: 6px; }
.sw { width: 30px; height: 30px; padding: 4px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--border2); fill: none; stroke: var(--muted); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; box-sizing: border-box; }
.sw.now { stroke: var(--strong); border-color: var(--gold); background: rgba(215, 186, 125, .15); animation: swpulse .8s ease-in-out infinite alternate; }
.sw.done { stroke: var(--good); border-color: var(--good); }
@keyframes swpulse { to { transform: scale(1.08); } }
.sw-label { font-size: 12px; color: var(--gold); white-space: nowrap; }
@media (max-width: 700px) {
  body { padding-bottom: 72px; }
  body:not(.m-side) { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; box-sizing: border-box; padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  body:not(.m-side) .top, body:not(.m-side) .goalbar { flex: none; }
  body:not(.m-side) .main { flex: 1; min-height: 0; display: flex; }
  body:not(.m-side) #editorPanel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  body:not(.m-side) #editorPanel > * { flex: none; }
  body:not(.m-side) #editorPanel > .workspace { flex: 1; min-height: 60px; height: auto; }
  body:not(.m-side) .main, body:not(.m-side) .top { touch-action: none; -webkit-user-select: none; user-select: none; }
  .top { padding: 8px 12px; gap: 6px; }
  .top h1 { font-size: 15px; width: 100%; }
  .stats { gap: 0; width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats > div:nth-child(n+4) { display: none; }
  .stat-val { font-size: 15px; }
  .goalbar { padding: 0 12px; gap: 8px; height: 42px; font-size: 12px; }
  #buffs { flex: 0 1 auto; width: auto; max-width: 46%; overflow-x: auto; overflow-y: visible; }
  .bicon .btip { right: auto; left: 50%; transform: translateX(-60%); }
  .main { display: block; padding: 0; }
  .main > .panel { border-radius: 0; border-left: 0; border-right: 0; }
  body.m-side #editorPanel { display: none; }
  body:not(.m-side) .main > .panel:not(#editorPanel) { display: none; }
  .tab .stage-name, .tab .lines { display: none; }
  .filetabs { overflow-x: auto; }
  .status { gap: 8px; padding: 0 10px; }
  .code { font-size: 12px; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
  .desk { right: 8px; bottom: 6px; }
  .desk svg { width: 110px; height: 66px; }
  #infobar { display: none; }
  .progress-wrap { padding: 5px 12px; }
  .progress-label { font-size: 11px; margin-bottom: 3px; gap: 8px; }
  .progress-label > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .progress-label > span:last-child { white-space: nowrap; flex: 0 0 auto; }
  .top h1 .title-chip { font-size: 11px; }
  .challenge { height: 48px; padding: 0 12px; gap: 8px; }
  .challenge .word { font-size: 16px; }
  .challenge.on .meta { margin-left: auto; font-size: 11px; }

  #tabs { display: none; }
  body.m-more #tabs { display: grid; grid-template-columns: repeat(5, 1fr); }
  body.m-more #tabs button:nth-child(-n+3) { display: none; }
  #side { height: auto; max-height: none; padding: 12px; }
  #side .btn { padding: 10px 14px; font-size: 13px; min-height: 40px; }
  .upg, .row { padding: 11px 12px; }
  .route-box { grid-template-columns: 1fr !important; }
  .modal { padding: 18px; }
  .aug-cards { grid-template-columns: 1fr; gap: 8px; }
  .aug-card { padding: 10px; gap: 4px; }
  .aug-icon { width: 44px; height: 44px; }
  .aug-icon .pixel { width: 32px; height: 32px; }
  .aug-desc { min-height: 0; }
  .aug-btns { flex-direction: row; margin-top: 4px; }
  .aug-pick, .aug-re { flex: 1; margin-top: 0; }
  .toast { bottom: 84px; }
  .mnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 46; background: var(--panel); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
  .mnav button { position: relative; flex: 1; height: 60px; border: 0; background: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; }
  .mnav button.on { color: var(--strong); }
  .mnav button.on::before { content: ''; position: absolute; top: 0; left: 22%; right: 22%; height: 2px; background: var(--accent); }
  .mnav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .mbadge { position: absolute; top: 6px; left: 50%; margin-left: 8px; background: var(--bad); color: #1e1e1e; font-size: 10px; font-weight: 700; border-radius: 8px; padding: 0 5px; line-height: 15px; }
  .mbadge:empty { display: none; }
}

/* =========================================================
 * 토스 미니앱 안: 상태 표시줄만큼 내리고, 오른쪽 위 닫기 버튼(... X) 자리를 비움
 * ========================================================= */
html.in-toss .top { padding-top: calc(max(var(--sat, 0px), env(safe-area-inset-top, 0px)) + 6px); }
html.in-toss .top h1 { min-height: 44px; padding-right: 120px; box-sizing: border-box; }
html.in-toss .mnav { padding-bottom: max(var(--sab, 0px), env(safe-area-inset-bottom, 0px)); }
@media (max-width: 700px) {
  html.in-toss body:not(.m-side) { padding-bottom: calc(60px + max(var(--sab, 0px), env(safe-area-inset-bottom, 0px))); }
}
@media (max-width: 700px) {
  html.in-toss .top h1 { white-space: nowrap; overflow: hidden; gap: 6px; }
  html.in-toss .top h1 .title-chip { white-space: nowrap; }
  html.in-toss #companyChip { display: none; }
}

/* 토스 시작 화면 등급 표시 */
.rating-splash { position: fixed; inset: 0; z-index: 9999; background: #0d1117; display: flex; align-items: center; justify-content: center; padding: 24px; transition: opacity .4s; }
.rating-splash.out { opacity: 0; pointer-events: none; }
.rt-box { display: flex; align-items: center; gap: 16px; color: #e6edf3; font-size: 13px; line-height: 1.6; }
.rt-mark { flex: none; width: 76px; height: 76px; border-radius: 50%; background: #2ea043; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 3px solid #fff; }
.rt-mark b { font-size: 24px; line-height: 1; }
.rt-mark span { font-size: 11px; margin-top: 4px; }
.rt-info { word-break: break-all; }
.rt-name { font-size: 16px; font-weight: 700; margin-bottom: 2px; }

/* 첫 시작 안내: 첫 타이핑 전까지 코드 영역 가운데에 표시 */
.workspace { position: relative; }
.tap-hint { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 5; pointer-events: none; text-align: center; padding: 14px 18px; border-radius: 10px; background: rgba(0, 122, 204, .92); color: #fff; box-shadow: 0 6px 24px rgba(0, 0, 0, .35); animation: hintPulse 1.2s ease-in-out infinite; white-space: nowrap; }
.tap-hint b { display: block; font-size: 17px; margin-bottom: 4px; }
.tap-hint span { font-size: 12px; opacity: .9; }
@keyframes hintPulse { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -50%) scale(1.06); } }
/* 첫 업그레이드를 살 수 있을 때 반짝임 */
.upg.nudge, .mnav button.nudge { animation: nudgeGlow 1s ease-in-out infinite; }
.upg.nudge { border-color: var(--accent); }
@keyframes nudgeGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(0, 122, 204, 0); } 50% { box-shadow: 0 0 0 3px rgba(0, 122, 204, .55); } }
/* 오늘의 이슈 의뢰 */
.k-daily { background: #ffd54f; }
