/* 청개구리 코더 — 어두운 초록 코딩 공방 */
:root {
  --bg: #0f1a14;
  --bg2: #13221a;
  --panel: #16261d;
  --panel2: #1c3025;
  --line: #2a4434;
  --text: #e4f0e6;
  --dim: #8fa999;
  --accent: #7ed957;
  --accent2: #4fb83a;
  --amber: #ffd166;
  --danger: #ff6b6b;
  --info: #6cc4ff;
  --mono: ui-monospace, 'D2Coding', 'Cascadia Mono', Consolas, 'Courier New', monospace;
  --lh: 21px;
  --pad: 10px;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 20% -10%, #1d3a28 0%, transparent 60%), var(--bg);
  color: var(--text);
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
code { font-family: var(--mono); background: #0b140f; border: 1px solid var(--line); border-radius: 5px; padding: 0 4px; font-size: .9em; color: var(--amber); }
small { color: var(--dim); }

/* ───── 상단 ───── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
  background: rgba(15, 26, 20, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; font-size: 13px; white-space: nowrap;
}
.back-btn:hover { border-color: var(--accent); }
.hud { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.hud::-webkit-scrollbar { display: none; }
.hud-item { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; white-space: nowrap; }
.hud-item small { font-size: 11px; }
.hud-item.combo { color: var(--dim); }
.hud-item.combo.hot { color: var(--amber); border-color: #6a5320; }
.hud-item.lang { background: #0b140f; }
.tools { display: flex; gap: 6px; margin-left: auto; }
.mini { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-size: 15px; display: inline-grid; place-items: center; padding: 0; }
.mini:hover { border-color: var(--accent); }

/* ───── 공용 ───── */
.screen { padding: 16px; max-width: 1280px; margin: 0 auto; }
.screen.center { min-height: calc(100vh - 60px); display: grid; place-items: center; }
.btn {
  border: 1px solid var(--line); background: var(--panel2); border-radius: 10px;
  padding: 10px 16px; font-weight: 600; transition: transform .08s, border-color .15s, background .15s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, var(--accent), var(--accent2)); color: #0b1a0e; border-color: transparent; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.big { font-size: 18px; padding: 14px 26px; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.danger { border-color: #6b2c2c; color: #ffb3b3; }
.chip { border: 1px solid var(--line); background: #0f1c15; border-radius: 8px; padding: 3px 9px; font-size: 13px; }
.chip:hover { border-color: var(--accent); }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.ok { color: var(--accent); }
.bad { color: var(--danger); }
.dim { color: var(--dim); }

/* ───── 타이틀 ───── */
.title-wrap { text-align: center; max-width: 560px; }
.title-frog { position: relative; display: inline-block; font-size: 96px; line-height: 1; animation: hop 2.4s ease-in-out infinite; }
.title-frog i { position: absolute; right: -36px; top: -6px; font-style: normal; font-family: var(--mono); font-size: 28px; color: var(--amber); transform: rotate(12deg); }
@keyframes hop { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-18px) scaleY(1.05); } 90% { transform: translateY(0) scaleY(.92); } }
.logo { font-size: clamp(36px, 8vw, 56px); margin: 10px 0 6px; letter-spacing: -1px; background: linear-gradient(180deg, #b6f59a, var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { color: var(--dim); margin: 0 0 22px; }
.tagline b { color: var(--amber); }
.title-note { color: var(--dim); font-size: 13px; margin-top: 18px; min-height: 1em; }

/* ───── 언어 고르기 ───── */
.lang-wrap { max-width: 860px; text-align: center; }
.lang-wrap h2 { margin: 0 0 6px; }
.sub { color: var(--dim); margin: 0 0 20px; }
.lang-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.lang-card { text-align: left; background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; transition: border-color .15s, transform .15s; }
.lang-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.lc-head { display: flex; align-items: center; gap: 8px; font-size: 20px; margin-bottom: 10px; }
.lc-code { font-family: var(--mono); font-size: 13px; background: #0b140f; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 0 0 10px; overflow-x: auto; line-height: 1.5; }
.lang-card p { margin: 0; color: var(--dim); font-size: 13px; }

/* 구문 강조 (언어 카드·편집기 공용) */
.k { color: #ff8fb1; }
.t { color: #6cc4ff; }
.n { color: #ffb86b; }
.s { color: #c3e88d; }
.c { color: #6b8a77; font-style: italic; }
.o { color: #ffd166; }
.f { color: #8ef0c9; }
.i { color: var(--text); }

/* ───── 공방 ───── */
.shop-wrap { max-width: 720px; margin: 0 auto; display: grid; gap: 14px; }
.shop-sign { text-align: center; font-weight: 800; font-size: 20px; padding: 10px; border-radius: var(--radius); background: linear-gradient(90deg, #22402c, #1a3122, #22402c); border: 1px solid var(--line); }
.shop-sign small { display: block; font-weight: 400; font-size: 12px; }
.counter { display: flex; gap: 14px; align-items: flex-end; }
.client { text-align: center; flex: none; width: 96px; }
.client-face { font-size: 64px; line-height: 1.1; }
.client.enter .client-face { animation: enter .45s ease-out; }
@keyframes enter { from { transform: translateX(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
.client-name { font-size: 13px; color: var(--dim); }
.bubble { position: relative; flex: 1; background: #f4f8ef; color: #1b2a20; border-radius: 16px; padding: 14px 16px; margin-bottom: 16px; font-size: 15px; }
.bubble::before { content: ''; position: absolute; left: -10px; bottom: 18px; border: 10px solid transparent; border-right-color: #f4f8ef; border-left: 0; }
.bubble .hello { color: #4a6a54; }
.req-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; }
.req-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.req-machine { font-weight: 700; font-size: 17px; }
.rm-ico { font-size: 22px; }
.req-badge { padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.req-badge.break { background: #3a1f2a; color: #ffb3c8; border: 1px solid #6b2c45; }
.req-badge.fix { background: #1d2f3d; color: #a8dcff; border: 1px solid #2c5470; }
.req-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--dim); font-size: 13px; }
.frog-think { display: flex; gap: 10px; align-items: flex-start; background: #0f1c15; border: 1px dashed #3d6b4b; border-radius: 10px; padding: 10px 12px; }
.frog-think .frog { font-size: 26px; line-height: 1; }
.frog-think p { margin: 0; color: #c6f0b4; font-weight: 600; }
.req-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.req-actions .btn { flex: 1; min-width: 160px; }
.shop-foot { color: var(--dim); font-size: 13px; text-align: center; line-height: 1.7; }
.shop-foot b { color: var(--text); }

/* ───── 작업대 ───── */
#bench { padding-bottom: 90px; }
.bench-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.bench-req { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; }
.bench-face { font-size: 26px; }
.bench-mission { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px; }
.bm-say { margin: 0 0 4px; color: var(--dim); font-size: 14px; }
.bm-frog { margin: 0; color: #c6f0b4; font-weight: 700; }
.tut-tip { background: #2c2611; border: 1px solid #6a5320; color: #ffe7a6; border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; font-size: 14px; }
.tut-tip b { color: var(--amber); }
.bench-grid {
  display: grid; gap: 10px;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  grid-template-areas: 'code machine' 'code tests' 'spec tests';
  align-items: start;
}
.code-pane { grid-area: code; }
.machine-pane { grid-area: machine; }
.test-pane { grid-area: tests; }
.spec-pane { grid-area: spec; }
.pane { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-width: 0; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; margin-bottom: 8px; font-size: 14px; }
.pane-head small { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-tools { display: flex; gap: 4px; }
.frame-line { font-family: var(--mono); font-size: 13px; color: var(--dim); padding: 2px 10px 2px 46px; }
.ed-status { margin-top: 8px; font-size: 13px; line-height: 1.6; min-height: 1.6em; }
.ed-status small { font-size: 12px; }
.bench-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: flex; gap: 10px; justify-content: center;
  padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: rgba(15, 26, 20, .94); backdrop-filter: blur(8px); border-top: 1px solid var(--line);
}
.bench-bar .btn { flex: 1; max-width: 220px; }

/* ───── 편집기 ───── */
.ed { position: relative; --err-line: -10; --hint-line: -10; }
.ed-scroll { overflow: auto; max-height: 62vh; background: #0b140f; border: 1px solid var(--line); border-radius: 8px; }
.ed-row { display: flex; min-width: max-content; min-height: 100%; }
.ed-gutter { flex: none; width: 36px; padding: var(--pad) 6px var(--pad) 0; text-align: right; color: #4f6b59; font-family: var(--mono); font-size: 12px; line-height: var(--lh); user-select: none; border-right: 1px solid #1d3326; background: #0d1811; position: sticky; left: 0; z-index: 2; }
.ed-gutter div { height: var(--lh); }
.ed-gutter .chg { color: var(--amber); box-shadow: inset 3px 0 0 var(--amber); }
.ed-gutter .err { color: #fff; background: #7a2626; }
.ed-gutter .hint { color: #0b1a0e; background: var(--amber); }
.ed-inner { position: relative; flex: 1; }
.ed-inner::before, .ed-inner::after { content: ''; position: absolute; left: 0; right: 0; height: var(--lh); pointer-events: none; }
.ed-inner::before { top: calc(var(--pad) + (var(--err-line) - 1) * var(--lh)); background: rgba(255, 80, 80, .16); }
.ed-inner::after { top: calc(var(--pad) + (var(--hint-line) - 1) * var(--lh)); background: rgba(255, 209, 102, .14); }
.ed-hl, .ed-ta {
  font-family: var(--mono); font-size: 14px; line-height: var(--lh); tab-size: 4;
  font-variant-ligatures: none; letter-spacing: 0;
  margin: 0; padding: var(--pad) 14px var(--pad) 10px; border: 0;
  white-space: pre; overflow-wrap: normal; word-break: normal;
}
.ed-hl { position: relative; color: var(--text); min-height: 100%; }
.ed-ta {
  position: absolute; inset: 0; width: 100%; height: 100%;
  background: transparent; color: transparent; caret-color: var(--accent);
  resize: none; outline: none; overflow: hidden; z-index: 1;
}
.ed-ta::selection { background: rgba(126, 217, 87, .28); color: transparent; }
.ed.tokmode .ed-ta { pointer-events: none; caret-color: transparent; }
.ed.tokmode .tok { cursor: pointer; border-radius: 3px; }
.ed.tokmode .tok:not(.c):hover { background: rgba(126, 217, 87, .16); }
.ed.tokmode .tok.o, .ed.tokmode .tok.n { background: rgba(255, 209, 102, .07); box-shadow: inset 0 -1px 0 rgba(255, 209, 102, .35); }
.ed .tok.sel { background: rgba(126, 217, 87, .35) !important; outline: 1px solid var(--accent); }
.ed-pop { position: absolute; z-index: 10; background: #10211a; border: 1px solid var(--accent2); border-radius: 10px; padding: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.pop-title { font-size: 12px; color: var(--dim); margin-bottom: 6px; font-family: var(--mono); }
.pop-opts, .pop-line { display: flex; flex-wrap: wrap; gap: 5px; }
.pop-opts button { font-family: var(--mono); min-width: 40px; padding: 6px 10px; border-radius: 7px; border: 1px solid var(--line); background: #183024; font-size: 14px; }
.pop-opts button:hover { border-color: var(--accent); }
.pop-line { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.pop-line button { padding: 4px 8px; border-radius: 7px; border: 1px solid var(--line); background: transparent; font-size: 12px; color: var(--dim); }
.pop-line button:hover { color: var(--text); border-color: var(--accent); }
.pop-none { color: var(--dim); font-size: 12px; }

/* ───── 점검·설명서 ───── */
.tests, .spec { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tests { max-height: 46vh; overflow-y: auto; }
.tests li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; background: #112019; border: 1px solid transparent; cursor: pointer; font-size: 13px; }
.tests li:hover { border-color: var(--line); }
.tests li.sel { border-color: var(--accent2); background: #15291e; }
.tests li.bad { background: #2a1717; }
.tests li.bad.sel { border-color: var(--danger); }
.tests .t-empty { cursor: default; color: var(--dim); background: transparent; }
.t-lab { flex: 1; min-width: 0; }
.t-det { width: 100%; padding-left: 24px; font-size: 12px; color: var(--dim); font-family: var(--mono); word-break: break-all; }
.spec li { font-size: 13px; padding: 5px 8px; border-radius: 8px; background: #112019; display: flex; gap: 6px; }
.spec li.broken { background: #2a1717; color: #ffc9c9; }
.sp-st { flex: none; width: 18px; text-align: center; }

/* ───── 기계 그림 ───── */
.viz { min-height: 220px; display: grid; place-items: center; background: #0b140f; border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow: hidden; }
.viz.res-viz { min-height: 170px; margin-top: 10px; }
.viz-empty { color: var(--dim); }
.viz-cap { text-align: center; font-size: 13px; color: #c6f0b4; min-height: 1.5em; margin-top: 6px; }
.viz-ctrl { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 6px; }
.viz-step { font-size: 12px; color: var(--dim); min-width: 40px; }
.v-dim { color: var(--dim); font-size: 13px; }
.v-bad { color: var(--danger); font-weight: 700; font-family: var(--mono); }
.v-pop { font-size: 26px; animation: drop .4s ease-out; }
@keyframes drop { from { transform: translateY(-12px); opacity: 0; } }
.v-err { display: grid; justify-items: center; gap: 4px; text-align: center; color: #ffc9c9; }
.v-err-ico { font-size: 48px; animation: shake .4s; }
.v-err span { font-size: 13px; color: var(--dim); max-width: 300px; }
@keyframes shake { 25% { transform: translateX(-6px) rotate(-4deg); } 75% { transform: translateX(6px) rotate(4deg); } }

/* 자판기 */
.vm { width: 220px; background: linear-gradient(180deg, #c0392b, #922b21); border-radius: 14px; padding: 10px; display: grid; grid-template-columns: 1fr 70px; grid-template-rows: auto auto; gap: 8px; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .15); }
.vm-glass { background: linear-gradient(135deg, #cfeaf5, #9fc9dd); border-radius: 8px; min-height: 96px; padding: 8px; display: flex; flex-wrap: wrap; gap: 4px; align-content: center; justify-content: center; color: #12303f; font-size: 22px; }
.vm-panel { display: grid; gap: 6px; align-content: start; }
.vm-led { background: #081208; color: #7dff6a; font-family: var(--mono); font-size: 12px; border-radius: 5px; padding: 5px; text-align: center; min-height: 28px; word-break: break-all; }
.vm-tag { background: #fff3; color: #fff; font-size: 11px; border-radius: 5px; padding: 3px; text-align: center; }
.vm-slot { grid-column: 1 / -1; background: #1a0f0d; border-radius: 6px; min-height: 40px; display: grid; place-items: center; color: #fff; font-size: 13px; }
.v-coin { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff1b8, #d4a017); color: #5a3f00; font-size: 11px; font-weight: 800; font-family: var(--mono); }
.v-coin.fake { background: radial-gradient(circle at 35% 30%, #ddd, #777); color: #222; outline: 2px dashed var(--danger); }

/* 엘리베이터 */
.el { display: grid; gap: 2px; width: 200px; }
.el-row { display: grid; grid-template-columns: 52px 1fr 26px; align-items: center; height: 26px; }
.el-lab { font-family: var(--mono); font-size: 12px; color: var(--dim); text-align: right; padding-right: 8px; }
.el-shaft { height: 100%; background: #1a2b22; border-left: 2px solid #34503f; border-right: 2px solid #34503f; display: grid; place-items: center; }
.el-row.sky .el-shaft { background: #17304a; border-color: #2a5a85; }
.el-row.sky .el-lab, .el-row.under .el-lab { color: var(--danger); }
.el-row.under .el-shaft { background: #2a1a12; border-color: #5a3a22; }
.el-car { font-size: 18px; line-height: 1; }
.el-call { text-align: center; font-size: 14px; }

/* 오락실 */
.crt { width: 240px; background: #05070a; border: 6px solid #2b2b38; border-radius: 16px; padding: 12px; text-align: center; font-family: var(--mono); color: #7dff6a; box-shadow: inset 0 0 30px rgba(125, 255, 106, .12); }
.crt-score { font-size: 30px; font-weight: 800; letter-spacing: 2px; }
.crt-score.big { font-size: 42px; }
.crt-score.bad { color: var(--danger); }
.crt-row { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; margin: 8px 0; min-height: 26px; }
.crt-row i { font-style: normal; width: 24px; height: 24px; display: grid; place-items: center; background: #11161d; border-radius: 5px; font-size: 14px; color: #556; }
.crt-row i.hit { background: #163a1a; }
.crt-row i.miss { background: #3a1616; color: #f88; }
.crt-row i.now { outline: 2px solid var(--amber); }
.crt-combo { color: var(--amber); font-size: 13px; }
.crt-title { color: var(--amber); margin-bottom: 8px; }
.crt-list { text-align: left; margin: 0; padding-left: 26px; font-size: 13px; }
.crt-list li span { display: inline-block; width: 70px; color: #9ab; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 6px; height: 120px; }
.pod { width: 62px; display: grid; justify-items: center; align-content: start; gap: 2px; border-radius: 6px 6px 0 0; padding-top: 4px; background: #1c2430; }
.pod b { font-size: 14px; word-break: break-all; }
.pod.p1 { height: 110px; order: 2; background: #3a3214; }
.pod.p2 { height: 84px; order: 1; }
.pod.p3 { height: 64px; order: 3; background: #2c1f17; }

/* 주차장 */
.pk { width: 240px; display: grid; grid-template-columns: 50px 1fr; grid-template-rows: auto auto; gap: 8px; align-items: center; background: #1b2026; border-radius: 12px; padding: 14px; }
.pk-gate { font-size: 30px; transition: transform .3s; transform-origin: left center; }
.pk-gate.up { transform: rotate(-60deg); }
.pk-car { font-size: 40px; transition: transform .4s; }
.pk-car.parked { transform: translateX(60px); }
.pk-clock { grid-column: 1 / -1; text-align: center; font-family: var(--mono); color: var(--amber); }
.receipt { width: 230px; background: #fbfaf5; color: #222; font-family: var(--mono); font-size: 13px; padding: 12px 14px; border-radius: 4px; box-shadow: 0 4px 0 #ddd8c6; }
.r-title { text-align: center; font-weight: 800; padding-bottom: 6px; border-bottom: 1px dashed #999; margin-bottom: 6px; }
.r-line { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.r-line b { word-break: break-all; text-align: right; }
.r-line.total { border-top: 1px dashed #999; margin-top: 6px; padding-top: 6px; font-size: 15px; }
.r-line.total.bad b { color: #d22; }
.r-foot { text-align: center; font-size: 11px; color: #888; margin-top: 8px; }
.viz .split .r-foot { color: var(--dim); }

/* 도어락 */
.dl { display: flex; gap: 14px; align-items: center; }
.dl-door { width: 90px; height: 150px; background: linear-gradient(90deg, #6b4a2e, #8a6240); border-radius: 6px; display: grid; place-items: center; font-size: 36px; transition: transform .35s; transform-origin: left center; box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .25); }
.dl-door.open { transform: perspective(300px) rotateY(-35deg); background: linear-gradient(90deg, #4a3320, #6b4a2e); }
.dl-pad { width: 130px; background: #1c1f24; border-radius: 12px; padding: 10px; display: grid; gap: 6px; text-align: center; }
.dl-pad.wide { width: 220px; }
.dl-screen { background: #08131c; color: #6cc4ff; font-family: var(--mono); border-radius: 6px; padding: 6px; min-height: 30px; word-break: break-all; letter-spacing: 2px; }
.dl-title { color: var(--dim); font-size: 12px; }
.dl-fails { font-size: 11px; color: var(--dim); }
.dl .ok, .dl .no { font-size: 13px; }
.dl .no { color: var(--danger); }

/* 키오스크·더치페이 */
.receipt.kiosk { background: #fff8ee; }
.split { width: 250px; text-align: center; }
.split-top { font-weight: 700; margin-bottom: 10px; font-family: var(--mono); }
.split-ppl { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.pp { display: grid; justify-items: center; background: #142219; border-radius: 10px; padding: 6px 8px; min-width: 54px; }
.pp span { font-size: 24px; }
.pp b { font-family: var(--mono); font-size: 12px; }

/* 신호등 */
.cross { display: flex; align-items: center; gap: 12px; }
.tl { display: grid; gap: 6px; background: #15171a; padding: 8px; border-radius: 12px; justify-items: center; }
.tl i { width: 30px; height: 30px; border-radius: 50%; background: #2a2d31; display: block; }
.tl i.red.on { background: #ff4b4b; box-shadow: 0 0 16px #ff4b4b; }
.tl i.yellow.on { background: #ffcf3a; box-shadow: 0 0 16px #ffcf3a; }
.tl i.green.on { background: #45e06b; box-shadow: 0 0 16px #45e06b; }
.road { width: 130px; height: 56px; background: repeating-linear-gradient(90deg, #333 0 14px, #eee 14px 22px); border-radius: 6px; display: grid; place-items: center; font-size: 26px; }
.road.danger { outline: 3px solid var(--danger); animation: shake .4s; }
.ped { font-size: 30px; opacity: .55; }
.ped.go { opacity: 1; }
.blinky { animation: blink .5s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* 세탁기 */
.wm { display: grid; justify-items: center; gap: 10px; }
.wm-drum { width: 110px; height: 110px; border-radius: 50%; border: 10px solid #c9d2d8; background: radial-gradient(circle, #9fd3f0, #4b8db5); display: grid; place-items: center; font-size: 34px; }
.wm-drum.spin { animation: spin .5s linear infinite; }
.wm-drum.wash { animation: wobble .8s ease-in-out infinite; }
.wm-drum.idle { filter: grayscale(.4); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes wobble { 50% { transform: rotate(14deg); } }
.wm-list { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; max-width: 280px; }
.wm-step { display: grid; justify-items: center; padding: 4px 6px; border-radius: 8px; background: #142219; font-size: 16px; min-width: 44px; }
.wm-step small { font-size: 10px; }
.wm-step.done { opacity: .5; }
.wm-step.now { outline: 2px solid var(--accent); background: #1d3a26; }
.wm-step.bad { background: #3a1616; }

/* 로봇 청소기 */
.rb { display: grid; gap: 2px; }
.rb-row { display: flex; gap: 2px; }
.rb i { width: 24px; height: 24px; border-radius: 4px; display: grid; place-items: center; font-style: normal; }
.rb i.dust { background: #4a3b2a; }
.rb i.clean { background: #d8eef5; }
.rb i.wall { background: #222; }
.rb i b { font-size: 16px; line-height: 1; }

/* 택배 분류기 */
.sort { display: grid; gap: 8px; justify-items: center; width: 260px; }
.sort-box { background: #8a6240; color: #fff; border-radius: 6px; padding: 6px 12px; font-weight: 700; font-family: var(--mono); font-size: 13px; }
.sort-belt { letter-spacing: 4px; opacity: .7; }
.sort-lanes { display: grid; gap: 4px; width: 100%; }
.sl { padding: 6px 10px; border-radius: 8px; background: #142219; font-size: 13px; border: 1px solid transparent; }
.sl.want { border-color: var(--accent2); border-style: dashed; }
.sl.on { background: #1d3a26; border-style: solid; border-color: var(--accent); }
.sl.on:not(.want) { background: #3a1616; border-color: var(--danger); }
.sl.bad { background: #3a1616; border-color: var(--danger); }

/* ───── 모달 ───── */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(4, 10, 6, .72); display: grid; place-items: center; padding: 16px; }
.modal-card { width: min(640px, 100%); max-height: 88vh; overflow-y: auto; background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 18px; animation: pop .2s ease-out; }
@keyframes pop { from { transform: scale(.95); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.modal-head h2 { margin: 0; font-size: 20px; }
.help-body h3 { margin: 16px 0 6px; font-size: 16px; color: var(--amber); }
.help-body ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.help-body p { margin: 0 0 8px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.set-note { color: var(--dim); font-size: 12px; margin: 6px 0 0; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 7px 12px; font-size: 13px; }
.seg button.on { background: var(--accent2); color: #0b1a0e; font-weight: 700; }

/* 결과 */
.result { text-align: center; }
.res-head .res-ico { font-size: 52px; line-height: 1.1; }
.res-head h2 { margin: 4px 0 10px; }
.res-head.fail h2 { color: var(--danger); }
.res-reason { font-weight: 700; font-size: 17px; margin: 0 0 6px; }
.res-detail { color: var(--dim); margin: 0 0 10px; font-size: 14px; }
.res-client { margin: 8px 0; }
.res-client.big { font-size: 17px; }
.res-note { color: var(--dim); font-size: 12px; }
.res-stage { border-top: 1px solid var(--line); padding: 12px 0; opacity: 0; transform: translateY(8px); transition: opacity .35s, transform .35s; }
.res-stage.in { opacity: 1; transform: none; }
.res-step { font-size: 12px; color: var(--amber); font-weight: 700; letter-spacing: 1px; }
.res-pub { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 3px; font-size: 13px; }
.res-pub li.ok { color: #c6f0b4; }
.res-pub li.bad { color: #ffb3b3; }
.sp-card { position: relative; display: inline-block; width: min(320px, 100%); margin: 8px auto; padding: 14px; border-radius: 14px; background: #142219; border: 2px solid var(--line); }
.sp-card.r1 { border-color: #7aa58a; }
.sp-card.r2 { border-color: var(--info); box-shadow: 0 0 20px rgba(108, 196, 255, .25); }
.sp-card.r3 { border-color: var(--amber); box-shadow: 0 0 26px rgba(255, 209, 102, .4); background: linear-gradient(160deg, #2c2611, #142219); }
.sp-card.gone { opacity: .75; }
.sp-card p { margin: 6px 0 0; font-size: 13px; color: var(--dim); }
.sp-ico { font-size: 44px; line-height: 1.2; }
.sp-name { font-size: 18px; font-weight: 800; }
.sp-rar { font-size: 12px; color: var(--amber); }
.sp-new { position: absolute; top: -10px; right: -8px; background: var(--danger); color: #fff; font-weight: 800; font-size: 12px; padding: 2px 8px; border-radius: 999px; transform: rotate(8deg); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: rotate(8deg) scale(1.12); } }
.res-lines { width: 100%; max-width: 360px; margin: 6px auto; border-collapse: collapse; font-size: 14px; }
.res-lines td { padding: 3px 4px; text-align: left; }
.res-lines td:last-child { text-align: right; font-family: var(--mono); }
.res-lines tr.tot td { border-top: 1px solid var(--line); font-weight: 800; color: var(--amber); padding-top: 6px; }
.res-grade { display: inline-grid; place-items: center; width: 64px; height: 64px; margin: 8px auto 4px; border-radius: 50%; font-size: 34px; font-weight: 900; border: 3px solid currentColor; }
.res-grade.gS { color: var(--amber); text-shadow: 0 0 12px rgba(255, 209, 102, .7); }
.res-grade.gA { color: var(--accent); }
.res-grade.gB { color: var(--info); }
.res-grade.gC { color: var(--dim); }
.res-gain { font-weight: 700; margin: 4px 0; }
.res-unlock { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: #1d3a26; border: 1px solid var(--accent2); font-size: 14px; }
.res-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; position: sticky; bottom: -18px; padding: 10px 0; background: var(--bg2); }

/* 도감 */
.dex-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.dex-tabs button { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.dex-tabs button.on { background: var(--accent2); color: #0b1a0e; font-weight: 700; }
.dex-sum { font-size: 14px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dex-sum .bar { flex: 1; min-width: 120px; height: 8px; background: #0b140f; border-radius: 999px; overflow: hidden; }
.dex-sum .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent2), var(--amber)); }
.dex-m { margin-bottom: 14px; }
.dex-m h3 { font-size: 15px; margin: 0 0 6px; }
.dex-m.locked { opacity: .55; }
.lock { font-size: 12px; color: var(--dim); font-weight: 400; }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.dx { background: #142219; border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; }
.dx.r2 { border-color: #2c5470; }
.dx.r3 { border-color: #6a5320; }
.dx.off { opacity: .55; }
.dx.unk { border-style: dashed; border-color: #7a5ab8; }
.dx-ico { font-size: 26px; }
.dx-name { font-weight: 700; font-size: 13px; }
.dx-sub { font-size: 11px; color: var(--dim); }
.dx p { margin: 4px 0 0; font-size: 11px; color: var(--dim); text-align: left; }

/* 알림·오류 */
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 60; max-width: min(520px, calc(100vw - 24px)); background: #10211a; border: 1px solid var(--accent2); border-radius: 12px; padding: 10px 14px; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.toast.show { animation: toastIn .25s ease-out; }
@keyframes toastIn { from { transform: translate(-50%, 12px); opacity: 0; } }
.fatal { position: fixed; inset: 0; z-index: 100; background: rgba(4, 10, 6, .9); display: grid; place-items: center; padding: 16px; }
.fatal-card { background: var(--bg2); border: 1px solid var(--danger); border-radius: 16px; padding: 22px; text-align: center; max-width: 420px; }
.fatal-ico { font-size: 48px; }

/* ───── 휴대폰·세로 ───── */
@media (max-width: 860px) {
  .bench-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'code' 'machine' 'tests' 'spec'; }
  .ed-scroll { max-height: 52vh; }
  .tests { max-height: none; }
}
@media (max-width: 560px) {
  body { font-size: 14px; }
  .screen { padding: 12px 10px; }
  .back-txt { display: none; }
  .back-btn { padding: 6px 9px; }
  .hud-item { padding: 3px 8px; font-size: 12px; }
  .hud-item small { display: none; }
  .mini { width: 30px; height: 30px; font-size: 13px; }
  .tools { gap: 4px; }
  .client { width: 70px; }
  .client-face { font-size: 48px; }
  .bubble { font-size: 14px; padding: 12px; }
  .ed-hl, .ed-ta { font-size: 13px; }
  :root { --lh: 20px; }
  .frame-line { padding-left: 46px; font-size: 12px; }
  .bench-bar .btn { padding: 10px 8px; font-size: 14px; }
  .vm, .crt, .pk, .receipt, .sort, .split { transform-origin: center; }
  .dl { flex-direction: column; }
  .dl-door { width: 120px; height: 100px; }
}
