:root {
  --bg: #0e1014;
  --surface: #14171c;
  --surface-2: #1a1e25;
  --surface-3: #222731;
  --hover: #262c37;
  --border: #272d37;
  --border-2: #333b47;
  --text: #e7eaf0;
  --text-2: #b7bfcc;
  --muted: #8690a0;
  --faint: #5b6574;
  --accent: #4f8cff;
  --accent-soft: rgba(79, 140, 255, .14);
  --green: #3ccf8e;
  --green-soft: rgba(60, 207, 142, .13);
  --red: #f36b7f;
  --red-soft: rgba(243, 107, 127, .13);
  --amber: #f1b74a;
  --amber-soft: rgba(241, 183, 74, .13);
  --violet: #a68bff;
  --sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --r: 8px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent); text-decoration: none; }
kbd { font: 500 10.5px var(--mono); padding: 1px 5px; border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 4px; color: var(--muted); background: var(--surface-2); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.sm { font-size: 12px; }
.pad { padding: 14px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2b313c; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #3a4250; background-clip: padding-box; border: 2px solid transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ── 레이아웃 ── */
.app { height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 52px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 14px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.brand-mark { display: grid; }
.search-trigger { margin: 0 auto; width: min(460px, 46vw); height: 34px; display: flex; align-items: center; gap: 10px; padding: 0 10px 0 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; color: var(--muted); font-size: 13px; transition: border-color .15s; }
.search-trigger:hover { border-color: var(--border-2); color: var(--text-2); }
.search-trigger span { flex: 1; text-align: left; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.solved-chip { padding: 4px 10px; border-radius: 999px; background: var(--green-soft); color: var(--green); font: 600 12px var(--mono); }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 7px; color: var(--muted); font-weight: 600; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.sm { width: 30px; height: 30px; font-size: 16px; flex: none; border: 1px solid var(--border); }

.body { flex: 1; min-height: 0; display: flex; }
.sidebar { width: 288px; flex: none; display: flex; flex-direction: column; gap: 10px; padding: 12px; background: var(--surface); border-right: 1px solid var(--border); min-height: 0; }
.app.no-sidebar .sidebar { display: none; }
.main { flex: 1; min-width: 0; min-height: 0; display: flex; }

/* ── 공통 컨트롤 ── */
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.seg-btn { height: 28px; border-radius: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
.seg-btn.active { background: var(--surface-3); color: var(--text); }
.select, .input { height: 32px; padding: 0 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; outline: 0; font-size: 13px; min-width: 0; }
.select:focus, .input:focus { border-color: var(--accent); }
.select.xs { height: 26px; font-size: 12px; padding: 0 6px; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.chip.active { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.btn { height: 32px; display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; border-radius: 7px; background: var(--surface-3); border: 1px solid var(--border-2); color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap; transition: filter .12s, background .12s; }
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn kbd { background: transparent; border-color: rgba(255,255,255,.18); color: inherit; opacity: .7; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.submit { background: transparent; border-color: var(--border-2); }
.btn.submit.ready { background: var(--green); border-color: var(--green); color: #07261a; }
.btn.submit.ready kbd { border-color: rgba(0,0,0,.25); }
.btn.lg { height: 38px; padding: 0 16px; font-size: 14px; }
.btn.ghost-btn { background: transparent; }
.tool { height: 26px; padding: 0 8px; border-radius: 6px; color: var(--muted); font-size: 12px; font-weight: 500; }
.tool:hover { background: var(--hover); color: var(--text); }
.link { color: var(--accent); font-size: 12px; }
.link:hover { text-decoration: underline; }
.ghost { height: 28px; display: inline-flex; align-items: center; padding: 0 10px; border-radius: 6px; border: 1px solid var(--border); color: var(--text-2); font-size: 12px; }
.ghost:hover { background: var(--hover); color: var(--text); }
.ghost.on { color: var(--amber); border-color: var(--amber-soft); background: var(--amber-soft); }

/* ── 사이드바: 로드맵 ── */
.side-pane { display: flex; flex-direction: column; gap: 10px; min-height: 0; flex: 1; }
.roadmap-head { display: flex; gap: 6px; }
.roadmap-head .select { flex: 1; }
.progress-block { padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); }
.progress-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.progress-top b { color: var(--text); font: 600 13px var(--mono); }
.bar { height: 5px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--green)); border-radius: 5px; transition: width .4s; }
.roadmap-list, .record-list { flex: 1; overflow-y: auto; margin: 0 -6px; padding: 0 6px; min-height: 0; }
.step { border-radius: 7px; }
.step-head { width: 100%; display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 8px; padding: 8px 6px; border-radius: 7px; text-align: left; }
.step-head:hover { background: var(--hover); }
.step-num { font: 600 11px var(--mono); color: var(--faint); text-align: center; }
.step.current .step-num { color: var(--accent); }
.step.done .step-num { color: var(--green); }
.step-title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step.done .step-title { color: var(--muted); }
.step-count { font: 11px var(--mono); color: var(--faint); }
.step.done .step-count { color: var(--green); }
.step-body { padding: 2px 0 8px 22px; }
.step-desc { font-size: 11.5px; color: var(--faint); padding: 0 6px 6px; line-height: 1.45; }
.prow { width: 100%; display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: center; padding: 5px 6px; border-radius: 6px; text-align: left; position: relative; }
.prow:hover { background: var(--hover); }
.prow.active { background: var(--accent-soft); }
.prow .ptext { display: flex; gap: 7px; align-items: baseline; min-width: 0; }
.prow .pnum { font: 11px var(--mono); color: var(--faint); flex: none; }
.prow .pname { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow.solved .pname { color: var(--muted); }
.prow.next::after { content: '다음'; position: absolute; right: 6px; font-size: 10px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 1px 6px; border-radius: 4px; }
.sdot { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--border-2); display: grid; place-items: center; font-size: 10px; color: transparent; transition: .12s; }
.sdot:hover { border-color: var(--green); color: var(--green); }
.sdot.tried { border-color: var(--amber); }
.sdot.tried::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }
.sdot.solved { background: var(--green); border-color: var(--green); color: #062418; font-weight: 800; }
.sdot.manual { background: transparent; border-color: var(--green); color: var(--green); font-weight: 800; }
.wb-remove { margin-left: auto; }

/* ── 사이드바: 기록 ── */
.record { width: 100%; display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: center; padding: 7px 6px; border-radius: 6px; text-align: left; }
.record:hover { background: var(--hover); }
.record.active { background: var(--accent-soft); }
.record .rt { min-width: 0; }
.record .rt div { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record .rt small { color: var(--faint); font: 11px var(--mono); }
.record .rdate { font-size: 11px; color: var(--faint); }
.lang-mini { font: 600 10px var(--mono); padding: 1px 5px; border-radius: 4px; background: var(--surface-3); color: var(--text-2); }

/* ── 홈 ── */
.home { flex: 1; overflow-y: auto; }
.home-inner { max-width: 1100px; margin: 0 auto; padding: 36px 32px 60px; }
.home-hero h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.02em; }
.home-hero p { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 24px 0; }
.stat { padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.stat span { color: var(--muted); font-size: 12px; }
.stat b { display: block; margin-top: 4px; font: 600 26px var(--mono); letter-spacing: -.02em; }
.stat b small { font-size: 13px; color: var(--muted); margin-left: 3px; font-weight: 500; }
.home-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 14px; }
.card { padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; min-width: 0; }
.card.wide { grid-column: 1 / -1; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head.mt { margin-top: 20px; }
.card h2 { margin: 0; font-size: 14px; font-weight: 700; }
.next-list { display: grid; gap: 8px; }
.next-card { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; text-align: left; transition: border-color .15s, transform .15s; }
.next-card:hover { border-color: var(--accent); }
.next-card.first { border-color: rgba(79,140,255,.45); background: linear-gradient(180deg, rgba(79,140,255,.10), var(--surface-2)); padding: 18px 16px; }
.next-card .nid { font: 600 13px var(--mono); color: var(--accent); }
.next-card .ntitle { font-weight: 600; font-size: 15px; }
.next-card.first .ntitle { font-size: 18px; }
.next-card .nnote { color: var(--muted); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.next-card .go { color: var(--muted); font-size: 13px; }
.next-card.first .go { color: #fff; background: var(--accent); padding: 7px 12px; border-radius: 7px; font-weight: 600; }
.mini-list { display: grid; gap: 2px; }
.mini-list.cols { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-top: 14px; }
.mini { display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 8px; padding: 8px 8px; border-radius: 7px; text-align: left; }
.mini:hover { background: var(--hover); }
.mini .mid { font: 12px var(--mono); color: var(--muted); }
.mini .mt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.mini .mx { font-size: 11px; color: var(--faint); }
.empty { color: var(--faint); font-size: 12.5px; padding: 10px 8px; }
.skeleton { height: 64px; border-radius: 10px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.heatmap { display: grid; grid-template-rows: repeat(7, 12px); grid-auto-flow: column; grid-auto-columns: 12px; gap: 3px; }
.heatmap i { border-radius: 3px; background: var(--surface-3); }
.heatmap i.l1 { background: rgba(60,207,142,.35); }
.heatmap i.l2 { background: rgba(60,207,142,.6); }
.heatmap i.l3 { background: var(--green); }
.heatmap i.today { outline: 1px solid var(--text-2); }

/* ── 작업 공간 ── */
.workspace { flex: 1; min-width: 0; display: flex; }
.statement { width: 42%; min-width: 280px; display: flex; flex-direction: column; background: var(--surface); min-height: 0; }
.statement-head { padding: 16px 20px 12px; border-bottom: 1px solid var(--border); display: grid; gap: 8px; }
.title-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pid { font: 600 14px var(--mono); color: var(--accent); }
.title-row h1 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.solved-badge { font-size: 11px; font-weight: 700; color: var(--green); background: var(--green-soft); padding: 2px 8px; border-radius: 999px; }
.meta-row { display: flex; gap: 6px; flex-wrap: wrap; }
.meta { font-size: 11.5px; padding: 2px 8px; border-radius: 5px; background: var(--surface-3); color: var(--text-2); }
.meta b { font-weight: 600; color: var(--text); }
.meta.warn { background: var(--amber-soft); color: var(--amber); }
.head-actions { display: flex; gap: 6px; }
.statement-body { flex: 1; overflow-y: auto; padding: 4px 20px 40px; }
.sec { padding: 16px 0 6px; }
.sec + .sec { border-top: 1px solid var(--border); }
.sec h2 { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--text-2); letter-spacing: .02em; }
.prose { color: var(--text-2); line-height: 1.75; font-size: 14px; word-break: keep-all; overflow-wrap: anywhere; }
.prose p { margin: 0 0 10px; }
.prose img { max-width: 100%; height: auto; background: #fff; border-radius: 6px; padding: 4px; }
.prose table { border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.prose td, .prose th { border: 1px solid var(--border-2); padding: 4px 8px; }
.prose pre, .prose code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-3); border-radius: 4px; }
.prose code { padding: 1px 4px; }
.prose pre { padding: 8px 10px; overflow-x: auto; }
.prose ul, .prose ol { padding-left: 20px; }
.prose a { color: var(--accent); }
.samples { display: grid; gap: 12px; }
.sample { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sbox { min-width: 0; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); overflow: hidden; }
.sbox-head { display: flex; justify-content: space-between; align-items: center; padding: 5px 10px; border-bottom: 1px solid var(--border); font-size: 11.5px; color: var(--muted); }
.sbox pre { margin: 0; padding: 10px; font: 12.5px/1.55 var(--mono); color: var(--text); overflow-x: auto; max-height: 260px; }
.memo { width: 100%; min-height: 80px; resize: vertical; padding: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 7px; outline: 0; font-size: 13px; line-height: 1.6; color: var(--text-2); }
.memo:focus { border-color: var(--accent); }

.gutter { flex: none; background: var(--border); position: relative; z-index: 2; }
.gutter-x { width: 1px; cursor: col-resize; }
.gutter-x::after { content: ''; position: absolute; inset: 0 -4px; }
.gutter-y { height: 1px; cursor: row-resize; }
.gutter-y::after { content: ''; position: absolute; inset: -4px 0; }
.gutter:hover, .gutter.drag { background: var(--accent); }
body.resizing { user-select: none; }
body.resizing iframe, body.resizing .editor { pointer-events: none; }

.ide { flex: 1; min-width: 360px; display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.ide-head { height: 42px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; border-bottom: 1px solid var(--border); background: var(--surface); }
.lang-tabs { display: flex; gap: 2px; height: 100%; }
.lang-tab { display: flex; align-items: center; gap: 7px; padding: 0 12px; color: var(--muted); font-size: 13px; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.lang-tab:hover { color: var(--text); }
.lang-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.lang-tab .has { width: 5px; height: 5px; border-radius: 50%; background: var(--faint); }
.dot { width: 8px; height: 8px; border-radius: 2px; }
.dot.cpp { background: #659ad2; } .dot.java { background: #f0931c; } .dot.python { background: #f5d547; }
.ide-tools { display: flex; align-items: center; gap: 2px; }
.save-state { font-size: 11.5px; color: var(--faint); margin-right: 6px; }
.editor { flex: 1; min-height: 120px; position: relative; }
.editor textarea.fallback { position: absolute; inset: 0; width: 100%; height: 100%; resize: none; border: 0; outline: 0; padding: 12px 16px; background: var(--bg); color: var(--text); font: 14px/1.6 var(--mono); tab-size: 4; }

.action-bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; background: var(--surface); border-top: 1px solid var(--border); }
.actions { display: flex; gap: 6px; }
.verdict-pill { font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.verdict-pill.idle { color: var(--muted); background: var(--surface-3); font-weight: 500; }
.verdict-pill.run { color: var(--accent); background: var(--accent-soft); }
.verdict-pill.ok { color: var(--green); background: var(--green-soft); }
.verdict-pill.bad { color: var(--red); background: var(--red-soft); }
.verdict-pill.stale { color: var(--amber); background: var(--amber-soft); }

.panel { height: 300px; min-height: 90px; flex: none; display: flex; flex-direction: column; background: var(--surface); }
.panel-tabs { height: 38px; flex: none; display: flex; align-items: center; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--border); }
.ptab { height: 100%; padding: 0 12px; color: var(--muted); font-size: 13px; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.ptab.active { color: var(--text); border-bottom-color: var(--accent); }
.ptab .count { font: 600 11px var(--mono); margin-left: 4px; }
.ptab .count.ok { color: var(--green); } .ptab .count.bad { color: var(--red); }
.panel-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.compare-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.panel-body { flex: 1; overflow-y: auto; padding: 10px; min-height: 0; }
.compile-error { margin-bottom: 10px; border: 1px solid rgba(243,107,127,.35); background: var(--red-soft); border-radius: 8px; }
.compile-error h3 { margin: 0; padding: 8px 12px; font-size: 13px; color: var(--red); }
.compile-error pre { margin: 0; padding: 0 12px 10px; font: 12px/1.5 var(--mono); color: #ffc3cc; white-space: pre-wrap; max-height: 260px; overflow: auto; }

.test-list { display: grid; gap: 6px; }
.test { border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.test.AC { border-color: rgba(60,207,142,.3); }
.test.fail { border-color: rgba(243,107,127,.35); }
.test-head { width: 100%; display: grid; grid-template-columns: 22px 1fr auto auto 16px; gap: 8px; align-items: center; padding: 8px 10px; text-align: left; }
.vicon { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--surface-3); color: var(--faint); }
.AC .vicon { background: var(--green); color: #062418; }
.fail .vicon { background: var(--red); color: #2b0710; }
.running .vicon { background: var(--accent-soft); color: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .4; } }
.test-name { font-size: 13px; font-weight: 600; }
.test-name small { margin-left: 6px; font-weight: 400; color: var(--faint); font-size: 11.5px; }
.vtag { font: 700 11px var(--mono); padding: 2px 7px; border-radius: 4px; }
.vtag.AC { color: var(--green); background: var(--green-soft); }
.vtag.WA, .vtag.RE, .vtag.TLE, .vtag.OLE, .vtag.SE { color: var(--red); background: var(--red-soft); }
.ttime { font: 11.5px var(--mono); color: var(--muted); min-width: 54px; text-align: right; }
.chev { color: var(--faint); transition: transform .15s; }
.test.open .chev { transform: rotate(90deg); }
.test-body { display: none; padding: 0 10px 10px; }
.test.open .test-body { display: block; }
.cols3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cols3.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.iobox { min-width: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); }
.iobox .lbl { display: flex; justify-content: space-between; padding: 4px 8px; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--border); }
.iobox pre, .iobox textarea { margin: 0; padding: 8px; font: 12.5px/1.55 var(--mono); max-height: 220px; overflow: auto; white-space: pre; display: block; width: 100%; }
.iobox textarea { min-height: 90px; resize: vertical; background: transparent; border: 0; outline: 0; color: var(--text); }
.iobox pre .bad { background: var(--red-soft); color: #ffb3bf; display: inline-block; min-width: 100%; }
.iobox pre .ws { color: var(--faint); }
.stderr { margin-top: 8px; padding: 8px; border-radius: 6px; background: var(--red-soft); color: #ffc3cc; font: 12px/1.5 var(--mono); white-space: pre-wrap; max-height: 160px; overflow: auto; }
.test-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12px; color: var(--muted); }
.danger { color: var(--red); font-size: 12px; }
.pass-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; margin-bottom: 8px; border-radius: 9px; background: var(--green-soft); border: 1px solid rgba(60,207,142,.35); }
.pass-banner b { color: var(--green); }
.pass-banner p { margin: 2px 0 0; font-size: 12px; color: var(--text-2); }

.manual { padding: 0; }
.io { height: 100%; display: grid; grid-template-columns: 1fr 1fr; }
.io-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.io-col + .io-col { border-left: 1px solid var(--border); }
.io-head { height: 32px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 10px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); }
.io-head span:first-child { flex: 1; }
.code-area { flex: 1; margin: 0; padding: 10px; background: var(--bg); border: 0; outline: 0; resize: none; font: 13px/1.55 var(--mono); color: var(--text); overflow: auto; white-space: pre; min-height: 0; }
.code-area.out.err { color: #ffc3cc; }

/* ── 팔레트 / 모달 / 토스트 ── */
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; background: rgba(5,7,10,.6); backdrop-filter: blur(3px); animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.palette { width: min(620px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.palette input { width: 100%; height: 52px; padding: 0 18px; background: transparent; border: 0; border-bottom: 1px solid var(--border); outline: 0; font-size: 16px; }
.palette-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.pitem { width: 100%; display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 7px; text-align: left; }
.pitem.sel { background: var(--accent-soft); }
.pitem .pi-id { font: 600 13px var(--mono); color: var(--accent); }
.pitem .pi-x { font-size: 11.5px; color: var(--faint); }
.palette-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--faint); }
.modal { width: min(460px, calc(100vw - 32px)); padding: 24px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.5); margin-top: 4vh; }
.modal h2 { margin: 0 0 8px; font-size: 18px; letter-spacing: -.01em; }
.modal p { margin: 0 0 14px; color: var(--text-2); line-height: 1.6; font-size: 13.5px; }
.modal .big-emoji { font-size: 34px; margin-bottom: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.modal .note { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); line-height: 1.6; }
.modal .note b { color: var(--text); }
.shortcut-list { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; font-size: 13px; color: var(--text-2); }
.toasts { position: fixed; z-index: 60; bottom: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { padding: 9px 14px; border-radius: 8px; background: var(--surface-3); border: 1px solid var(--border-2); font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.35); animation: up .18s; }
.toast.ok { border-color: rgba(60,207,142,.45); }
.toast.err { border-color: rgba(243,107,127,.45); }
@keyframes up { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1100px) {
  .sidebar { width: 250px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .home-grid { grid-template-columns: 1fr; }
}

/* ── 로그인 / 비활성 ── */
.gate { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 50% -10%, rgba(79,140,255,.12), transparent), var(--bg); z-index: 70; }
.gate-card { width: min(340px, 100%); text-align: center; }
.gate-logo { display: grid; place-items: center; margin-bottom: 12px; }
.gate h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.02em; }
.gate p { margin: 0 0 18px; }
.pin-input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.pin-dots { height: 26px; display: flex; justify-content: center; align-items: center; gap: 10px; margin: 6px 0 4px; cursor: text; }
.pin-dots i { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--border-2); transition: .12s; }
.pin-dots i.on { background: var(--accent); border-color: var(--accent); }
.pin-dots i.more { width: 8px; height: 8px; }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.pin-error { min-height: 20px; color: var(--red); font-size: 13px; margin-bottom: 10px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button { height: 58px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); font: 500 22px var(--sans); transition: background .1s, transform .06s; }
.keypad button:active { transform: scale(.96); background: var(--hover); }
.keypad .kp-ok { background: var(--accent); border-color: var(--accent); color: #fff; }
.keypad .kp-ok:disabled { opacity: .4; }
.gate-foot { margin-top: 18px !important; font-size: 12px; color: var(--faint); }
.big-emoji { font-size: 36px; margin-bottom: 8px; }
.modal-actions.center { justify-content: center; }

/* ── 상단 사용자 메뉴 ── */
.topbar { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px 0 4px; border-radius: 999px; border: 1px solid var(--border); }
.user-btn:hover { background: var(--hover); }
.avatar { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.user-name { font-size: 13px; font-weight: 500; }
.admin-link { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 7px; color: var(--text-2); font-size: 13px; font-weight: 600; border: 1px solid var(--border); }
.admin-link:hover { background: var(--hover); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font: 700 11px/18px var(--mono); text-align: center; }
.menu { position: absolute; top: 48px; right: 12px; z-index: 45; width: 220px; padding: 6px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 10px; box-shadow: 0 20px 50px rgba(0,0,0,.45); }
.menu-head { display: grid; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-item { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; font-size: 13px; color: var(--text); }
.menu-item:hover { background: var(--hover); }
.menu-item.danger { color: var(--red); }
.m-title { display: none; }
.notice { margin: 18px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--amber-soft); border: 1px solid rgba(241,183,74,.35); color: var(--amber); font-size: 13px; }

/* ── 실행 중지 / 무제한 ── */
.btn.stop { background: var(--red-soft); border-color: rgba(243,107,127,.45); color: var(--red); }
.unlimited { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.manual { display: flex; flex-direction: column; }
.manual .io { flex: 1; min-height: 0; height: auto; }
.run-notice { margin-bottom: 8px; padding: 10px 12px; border-radius: 8px; font-size: 13px; line-height: 1.55; }
.run-notice.warn { background: var(--amber-soft); color: var(--amber); border: 1px solid rgba(241,183,74,.35); }
.run-notice.bad { background: var(--red-soft); color: #ffb3bf; border: 1px solid rgba(243,107,127,.35); }
.run-notice.info { background: var(--accent-soft); color: var(--text-2); border: 1px solid rgba(79,140,255,.3); }

/* ── 관리자 ── */
.admin { flex: 1; overflow-y: auto; }
.admin-inner { max-width: 1200px; margin: 0 auto; padding: 28px 28px 60px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-head h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.admin-tabs { grid-template-columns: repeat(3, auto); }
.admin-tabs .seg-btn { padding: 0 14px; }
.admin-tabs .count { font: 600 11px var(--mono); color: var(--red); margin-left: 3px; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--hover); }
.tbl .num { font-family: var(--mono); text-align: right; }
.tbl .acts { display: flex; gap: 6px; justify-content: flex-end; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.bad { background: var(--red-soft); color: var(--red); }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.pill.mute { background: var(--surface-3); color: var(--muted); }
.admin-section { margin-top: 22px; }
.admin-section h2 { font-size: 14px; margin: 0 0 10px; }
.section-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 10px; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.danger { color: var(--red); }
.code-view { margin: 0; padding: 12px; max-height: 55vh; overflow: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font: 12.5px/1.55 var(--mono); white-space: pre; }
.modal.wide { width: min(820px, calc(100vw - 32px)); }
.field { display: grid; gap: 6px; margin-bottom: 12px; font-size: 13px; color: var(--text-2); }
.field .input, .field .select { width: 100%; height: 38px; }
.back-link { font-size: 13px; color: var(--muted); margin-bottom: 10px; display: inline-block; }

/* ── 모바일 ── */
.keybar, .mnav { display: none; }
.scrim { display: none; }
@media (max-width: 860px) {
  .sidebar { display: none; }
  .app.show-sidebar .sidebar { display: flex; position: fixed; top: 52px; bottom: 0; left: 0; z-index: 41; width: min(320px, 86vw); box-shadow: 20px 0 50px rgba(0,0,0,.4); }
  .app.show-sidebar .scrim { display: block; position: fixed; inset: 52px 0 0; z-index: 40; background: rgba(0,0,0,.45); }
  .topbar { gap: 8px; padding: 0 8px; padding-top: env(safe-area-inset-top); height: calc(52px + env(safe-area-inset-top)); }
  .search-trigger { width: 36px; height: 36px; margin: 0 0 0 auto; padding: 0; justify-content: center; flex: none; }
  .search-trigger span, .search-trigger kbd, .user-name, .solved-chip { display: none; }
  .brand-text { display: none; }
  .app.in-work .brand { display: none; }
  .app.in-work .m-title { display: block; flex: 1; min-width: 0; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app.in-work .m-title b { font-family: var(--mono); color: var(--accent); margin-right: 6px; }
  .home-inner, .admin-inner { padding: 20px 16px 40px; }
  .home-hero h1 { font-size: 21px; }
  .stats { gap: 8px; }
  .stat { padding: 12px; }
  .stat b { font-size: 22px; }
  .next-card { grid-template-columns: auto 1fr; }
  .next-card .go { display: none; }
  .heatmap-wrap { overflow-x: auto; }
  .admin-tabs { width: 100%; }

  /* 작업 공간: 한 번에 한 화면 + 하단 탭 */
  .app { height: 100dvh; }
  .workspace { position: relative; display: block; }
  .gutter { display: none !important; }
  .statement, .ide { position: absolute; inset: 0 0 calc(58px + env(safe-area-inset-bottom)) 0; width: auto !important; min-width: 0; }
  .workspace[data-mpane="problem"] .ide { display: none; }
  .workspace[data-mpane="code"] .statement, .workspace[data-mpane="result"] .statement { display: none; }
  .workspace[data-mpane="code"] .panel { display: none; }
  .workspace[data-mpane="result"] .ide-head, .workspace[data-mpane="result"] .editor { display: none; }
  .workspace[data-mpane="result"] .panel { flex: 1; height: auto !important; }
  .ide .action-bar { order: -1; border-top: 0; border-bottom: 1px solid var(--border); padding: 8px; flex-wrap: wrap; }
  .ide .ide-head { order: -2; }
  .verdict-pill { flex: 1 1 100%; text-align: center; padding: 4px 10px; font-size: 12px; }
  .actions { flex: 1; }
  .actions .btn { flex: 1; justify-content: center; height: 40px; font-size: 14px; padding: 0 6px; }
  .btn kbd { display: none; }
  .lang-tab { padding: 0 9px; font-size: 13px; }
  .ide-tools .tool:not(#resetBtn), .save-state { display: none; }
  .editor textarea.fallback { font-size: 15px !important; padding: 10px 12px; line-height: 1.55; }
  .statement-head { padding: 14px 16px 10px; }
  .statement-body { padding: 4px 16px 32px; }
  .sample { grid-template-columns: 1fr; }
  .cols3, .cols3.two { grid-template-columns: 1fr; }
  .io { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .io-col + .io-col { border-left: 0; border-top: 1px solid var(--border); }
  .code-area, .iobox textarea, .input, .select, .memo, .palette input { font-size: 16px !important; }
  .panel-tools .compare-label { display: none !important; }
  .mnav { display: grid; grid-template-columns: repeat(3, 1fr); position: absolute; left: 0; right: 0; bottom: 0; height: calc(58px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--border); z-index: 5; }
  .mnav button { display: grid; place-items: center; align-content: center; gap: 2px; font-size: 11.5px; color: var(--muted); position: relative; }
  .mnav button span { font-size: 18px; filter: grayscale(1); opacity: .7; }
  .mnav button.active { color: var(--text); }
  .mnav button.active span { filter: none; opacity: 1; }
  .mnav-badge { position: absolute; top: 8px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
  .mnav-badge.bad { background: var(--red); }
  .workspace.kb-open .mnav { display: none; }
  .workspace.kb-open .statement, .workspace.kb-open .ide { bottom: 44px; }
  .keybar { position: absolute; left: 0; right: 0; bottom: 0; height: 44px; z-index: 6; display: flex; gap: 4px; padding: 5px 6px; overflow-x: auto; background: var(--surface-2); border-top: 1px solid var(--border); scrollbar-width: none; }
  .keybar[hidden] { display: none !important; }
  .keybar::-webkit-scrollbar { display: none; }
  .keybar button { flex: none; min-width: 38px; height: 34px; padding: 0 8px; border-radius: 7px; background: var(--surface-3); border: 1px solid var(--border-2); font: 500 16px var(--mono); }
  .keybar button:active { background: var(--hover); }
  .keybar .kb-done { background: var(--accent); border-color: var(--accent); color: #fff; font: 600 13px var(--sans); }
  .modal { padding: 20px; }
  .modal-actions .btn { flex: 1; justify-content: center; }
  .overlay { padding-top: 8vh; }
  .toasts { bottom: calc(70px + env(safe-area-inset-bottom)); width: calc(100% - 32px); }
  .toast { text-align: center; }
}
.mono{font-family:var(--mono);color:var(--muted);font-size:12px}
.progress-desc{margin-top:8px;font-size:11.5px;line-height:1.45;color:var(--faint)}
.acts{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
