/* =====================================================================
   PBLRC Educational Arcade — CNC Machinist styles
   Machine-tool panel aesthetic inside the arcade: dark control pendant,
   amber/blue DRO, red E-stop. Uses the shared tokens from styles.css.
   ===================================================================== */

/* ---------- Dashboard categories ---------- */
.wings { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0 0; }
.wings span { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; padding: .2rem .6rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.cat { margin-top: 1.4rem; }
.cat-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1rem; margin-bottom: .7rem; }
.cat-head h2 { margin: 0; color: var(--gray); }
.cabinets.solo { grid-template-columns: repeat(auto-fill, minmax(240px, 300px)); }
.cabinet.c-cnc { --c: var(--red); }

/* ---------- CNC lobby ---------- */
.cnc-hero .lobby-head svg { width: 72px; height: 72px; }
.eyebrow-sm { font-size: .7rem; font-weight: 700; letter-spacing: .14em; color: var(--red-lit); }
.rank-name { color: var(--gold); }
.ladder { list-style: none; margin: 1rem 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .4rem; counter-reset: rk; }
.ladder li { position: relative; padding: .55rem .6rem; border-radius: 8px; background: #0D1022; border: 1px solid var(--line); min-width: 0; }
.ladder li b { display: block; font-size: .8rem; line-height: 1.25; }
.ladder li span { display: block; font-size: .7rem; color: var(--muted); line-height: 1.3; }
.ladder li.done { border-color: var(--green-lit); }
.ladder li.done b::before { content: '✔ '; color: var(--green-lit); }
.ladder li.cur { border-color: var(--gold); box-shadow: var(--glow-gold); }
.ladder li.cur b { color: var(--gold); }
@media (max-width: 760px) { .ladder { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stage { margin-top: 1.3rem; }
.stage h2 { color: var(--gray); }
.lathe-track { background: rgba(176, 92, 255, .05); border: 1px dashed rgba(176, 92, 255, .4); border-radius: var(--r); padding: 1rem; }
.mbar { display: block; height: 6px; border-radius: 999px; background: #0D1022; border: 1px solid var(--line); overflow: hidden; margin-top: .3rem; }
.mbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--green-lit)); }
.mastery { display: grid; gap: .45rem; }
.mrow { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr) 110px; gap: .7rem; align-items: center; font-size: .88rem; }
@media (max-width: 560px) { .mrow { grid-template-columns: 1fr; gap: .2rem; } }
.notice.small { font-size: .78rem; }

/* ---------- Mission player ---------- */
.practice-pick { margin-bottom: .8rem; }
.cnc-grid { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 980px) { .cnc-grid { grid-template-columns: 1fr; } }
.cnc-task { position: sticky; top: calc(70px + env(safe-area-inset-top, 0px)); max-height: calc(100vh - 90px); overflow: auto; }
@media (max-width: 980px) { .cnc-task { position: static; max-height: none; } }
.task-title { font-family: var(--body); font-weight: 700; font-size: 1.05rem; letter-spacing: 0; margin: 0 0 .5rem; }
.cnc-task .prompt { font-size: .95rem; font-weight: 400; }
.cnc-widget { min-width: 0; }
.hints .tip { margin: .6rem 0 0; }
.checks { list-style: none; padding: 0; margin: .4rem 0 .6rem; display: grid; gap: .35rem; }
.checks li { display: grid; grid-template-columns: 22px 1fr; gap: .4rem; align-items: start; font-size: .88rem; }
.checks li .ck { font-weight: 700; }
.checks li.ok .ck { color: var(--green-lit); }
.checks li.no .ck { color: var(--red-lit); }
.checks li .small { color: var(--muted); }
.cnc-fb .feedback pre, .gcode { font-family: var(--mono); font-size: .8rem; line-height: 1.45; background: #070912; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .7rem; overflow-x: auto; white-space: pre; margin: .4rem 0; color: #C8F7CF; }
.with-unit { display: flex; align-items: center; gap: .4rem; }
.with-unit .unit { color: var(--muted); font-size: .85rem; }
.calc-t { width: auto; margin: .4rem 0 .8rem; }
.calc-t td { font-family: var(--mono); }
.num-visual { margin-bottom: .8rem; overflow-x: auto; }
.code-top { display: grid; gap: .8rem; margin-bottom: .8rem; }
.bp-wrap { border: 2px solid #1E3A66; border-radius: 10px; overflow: hidden; background: #0B1E3A; }
.blueprint { display: block; width: 100%; height: auto; font-family: var(--body); }
.jog-extra { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-start; margin-top: .8rem; }
.offset-table { background: #070912; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .7rem; }
.offset-table .ot-h { font-size: .68rem; font-weight: 700; letter-spacing: .1em; color: var(--muted); margin-bottom: .3rem; }
.offset-table td { font-family: var(--mono); color: var(--gold); }
.ev-list { display: grid; gap: .5rem; }
.ev-row { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: #0D1022; }

/* ---------- Simulator ---------- */
.sim { background: #0E1224; border: 2px solid #2B3356; border-radius: 14px; padding: .7rem; display: grid; gap: .7rem; min-width: 0; }
.sim-head { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: center; }
.sim-title { font-family: var(--pixel); font-size: .58rem; color: var(--red-lit); letter-spacing: .06em; margin-right: auto; }
.sim-seg button { flex: 0 0 auto; min-height: 36px; font-size: .75rem; padding: .25rem .6rem; }
.sim-body { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: .7rem; min-width: 0; }
@media (max-width: 760px) { .sim-body { grid-template-columns: 1fr; } }
.sim-main { min-width: 0; display: grid; gap: .5rem; }
.sim-stage { position: relative; height: clamp(260px, 46vh, 430px); border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #070912; }
.sim.compact .sim-stage { height: clamp(220px, 34vh, 320px); }
.sim-canvas { display: block; width: 100%; height: 100%; touch-action: manipulation; cursor: crosshair; }
.sim-rot { position: absolute; right: 8px; bottom: 8px; min-width: 40px; min-height: 40px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); cursor: pointer; font-size: 1.1rem; }
.sim-alarm { position: absolute; left: 8px; right: 8px; top: 26px; padding: .45rem .6rem; border-radius: 8px; font-size: .82rem; font-weight: 600; line-height: 1.35; }
.sim-alarm.bad { background: rgba(80, 8, 8, .92); border: 2px solid var(--red); color: #FFD7D5; }
.sim-alarm.info { background: rgba(8, 40, 70, .92); border: 2px solid var(--neon); color: #D6F5FF; }
.sim-legend { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .72rem; color: var(--muted); }
.sim-legend i { display: inline-block; width: 18px; height: 0; vertical-align: middle; margin-right: .3rem; border-top: 3px solid; }
.lg-rapid { border-top-style: dashed !important; border-color: #FFC107; }
.lg-feed { border-color: #29D3FF; }
.lg-drill { border-color: #5FD068; }
.lg-hover { border-color: #FFFFFF; }
.sim-scrub input { width: 100%; accent-color: var(--gold); }
.sim-controls { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.mbtn { min-height: 42px; padding: .3rem .7rem; border-radius: 8px; border: 2px solid #3A4366; background: #161B2E; color: var(--text); font-family: var(--pixel); font-size: .52rem; cursor: pointer; }
.mbtn:hover { border-color: var(--neon); }
.mbtn.go { background: #123A1A; border-color: var(--green-lit); color: #CFF7D3; }
.mbtn.hold { background: #3A2E08; border-color: var(--gold); color: #FFE8A3; }
.sim.running .mbtn.go { box-shadow: 0 0 14px rgba(95, 208, 104, .5); }
.speed-lbl { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; color: var(--muted); }
.speed { min-height: 38px; background: #070912; border: 1px solid var(--line); border-radius: 8px; padding: 0 .4rem; }
.optstop { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; color: var(--muted); min-height: 38px; }
.optstop input { accent-color: var(--gold); width: 18px; height: 18px; }
.estop { margin-left: auto; width: 70px; height: 70px; border-radius: 50%; border: 4px solid #FFC107; background: radial-gradient(circle at 40% 35%, #FF6B66, #B71C1C 70%); color: #FFF; cursor: pointer; display: grid; place-items: center; align-content: center; gap: 0; box-shadow: 0 4px 0 #6d0f0f, 0 0 16px rgba(229, 57, 53, .45); font-family: var(--body); line-height: 1; }
.estop span { font-size: .45rem; font-weight: 700; letter-spacing: .04em; }
.estop b { font-size: .8rem; }
.estop:active { transform: translateY(2px); box-shadow: 0 2px 0 #6d0f0f; }
.sim-side { display: grid; gap: .6rem; align-content: start; min-width: 0; }
.sim-dro { background: #04070B; border: 2px solid #1F3A2A; border-radius: 10px; padding: .5rem .6rem; font-family: var(--mono); }
.dro-head { font-family: var(--body); font-size: .66rem; font-weight: 700; letter-spacing: .12em; color: #7FE08A; margin-bottom: .2rem; }
.dro-row { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.dro-ax { font-family: var(--pixel); font-size: .8rem; }
.dro-x .dro-ax { color: #FF5A52; } .dro-y .dro-ax { color: #5FD068; } .dro-z .dro-ax { color: #4DA3FF; }
.dro-v { font-size: 1.35rem; color: #B9FFB4; text-shadow: 0 0 8px rgba(95, 208, 104, .4); letter-spacing: .03em; }
.dro-info { display: flex; flex-wrap: wrap; gap: .15rem .7rem; margin-top: .35rem; font-family: var(--body); font-size: .72rem; color: var(--muted); }
.dro-info b { color: var(--text); }
.sim-modal .modal-h { font-size: .66rem; font-weight: 700; letter-spacing: .12em; color: var(--muted); margin-bottom: .25rem; }
.chips { display: flex; flex-wrap: wrap; gap: .25rem; }
.chip { font-family: var(--mono); font-size: .75rem; padding: .1rem .4rem; border-radius: 6px; background: rgba(41, 211, 255, .1); border: 1px solid rgba(41, 211, 255, .35); color: #D6F5FF; }
.sim-lights { display: flex; flex-wrap: wrap; gap: .3rem; }
.lamp { font-size: .66rem; font-weight: 700; letter-spacing: .06em; padding: .2rem .45rem; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); background: #0D1022; }
.lamp.on { background: #1E5E25; border-color: var(--green-lit); color: #E6FFE6; box-shadow: 0 0 10px rgba(95, 208, 104, .5); }
.sim-jog { background: #0B0F1E; border: 1px solid var(--line); border-radius: 10px; padding: .5rem; display: grid; gap: .35rem; }
.jog-h { font-size: .66rem; font-weight: 700; letter-spacing: .1em; color: var(--muted); }
.jog-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .3rem; }
.jog-btn { min-height: 46px; border-radius: 8px; border: 2px solid #3A4366; background: #161B2E; font-family: var(--pixel); font-size: .62rem; cursor: pointer; touch-action: none; user-select: none; }
.jog-btn:active { background: #23305A; }
.jog-x { color: #FF8A84; } .jog-y { color: #8DE596; } .jog-z { color: #8CC4FF; }
.jog-c { display: grid; place-items: center; color: var(--muted); }
.sim-jog .seg button { min-height: 36px; font-size: .75rem; padding: .2rem .35rem; font-family: var(--mono); }

/* ---------- Editor ---------- */
.sim-editor { display: grid; gap: .4rem; min-width: 0; }
.code-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.code-tabs button { min-height: 34px; padding: 0 .7rem; border-radius: 6px; background: #0D1022; border: 1px solid var(--line); font-family: var(--pixel); font-size: .55rem; cursor: pointer; }
.code-tabs button[aria-pressed="true"] { background: var(--purple); border-color: var(--purple); color: #FFF; }
.code-hint { margin-left: auto; }
.code-wrap { display: grid; grid-template-columns: 44px minmax(0, 1fr); border: 2px solid #23305A; border-radius: 10px; overflow: hidden; background: #04070B; height: clamp(220px, 34vh, 360px); }
.code-gutter { overflow: hidden; padding: 8px 0; background: #0A0E1A; border-right: 1px solid var(--line); font-family: var(--mono); font-size: 14px; line-height: 21px; color: #5B6488; text-align: right; }
.code-gutter .gl { padding-right: 6px; height: 21px; }
.code-gutter .gl.err { background: rgba(229, 57, 53, .35); color: #FFD7D5; }
.code-gutter .gl.warn { background: rgba(255, 193, 7, .2); color: #FFE8A3; }
.code-gutter .gl.cur { background: rgba(95, 208, 104, .35); color: #FFF; }
.code-gutter .gl.hl { outline: 1px solid #FFF; outline-offset: -1px; color: #FFF; }
.code-ta { width: 100%; height: 100%; resize: none; border: 0; outline: none; background: transparent; color: #C8F7CF; font-family: var(--mono); font-size: 14px; line-height: 21px; padding: 8px 10px; white-space: pre; overflow: auto; tab-size: 4; caret-color: var(--gold); }
.code-ta:focus-visible { box-shadow: inset 0 0 0 2px var(--gold); }
.code-ta[readonly] { color: #A9D9B0; }
.code-trace { height: clamp(220px, 34vh, 360px); overflow: auto; border: 2px solid #23305A; border-radius: 10px; background: #04070B; font-size: .8rem; }
.tr { display: grid; grid-template-columns: 34px minmax(120px, auto) minmax(0, 1fr); gap: .5rem; padding: .15rem .4rem; border-bottom: 1px solid rgba(255, 255, 255, .03); cursor: pointer; }
.tr code { background: none; padding: 0; white-space: pre; color: #C8F7CF; font-size: .8rem; }
.tr-n { color: #5B6488; text-align: right; font-family: var(--mono); }
.tr-x { color: var(--muted); font-size: .74rem; overflow-wrap: anywhere; }
.tr:hover, .tr:focus, .tr.hl { background: rgba(255, 255, 255, .08); outline: none; }
.tr.cur { background: rgba(95, 208, 104, .22); }
.tr.err { background: rgba(229, 57, 53, .22); }
.code-btns { gap: .4rem; }
.sim-msgs .msg-list { margin: 0; padding: .5rem .6rem .5rem 1.6rem; border-radius: 8px; font-size: .82rem; }
.msg-list.bad { background: rgba(229, 57, 53, .12); border: 1px solid var(--red); }
.msg-list.warn { background: rgba(255, 193, 7, .08); border: 1px solid rgba(255, 193, 7, .45); margin-top: .4rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .4rem; }
.stat-mini { background: #0D1022; border: 1px solid var(--line); border-radius: 8px; padding: .35rem .5rem; display: grid; }
.stat-mini span { font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat-mini b { font-family: var(--mono); color: var(--gold); }

/* ---------- Safety scene & drills (Level 1) ---------- */
.scene { width: 100%; height: auto; display: block; background: #0B0F1E; border: 2px solid #2B3356; border-radius: 12px; }
.scene .hot { cursor: pointer; }
.scene .hot:focus { outline: none; }
.scene .hot:focus .ring, .scene .hot:hover .ring { stroke: #FFC107; stroke-width: 3; }
.scene .found .ring { stroke: #5FD068; stroke-width: 3; }
.scene .wrong .ring { stroke: #E53935; stroke-width: 3; }
.ppe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.ppe { display: grid; gap: .25rem; justify-items: center; text-align: center; padding: .6rem; border-radius: 10px; border: 2px solid var(--line); background: #0D1022; cursor: pointer; min-height: 96px; }
.ppe[aria-pressed="true"] { border-color: var(--gold); box-shadow: var(--glow-gold); }
.ppe .em { font-size: 1.6rem; }
.order-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; counter-reset: ord; }
.order-list li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: .5rem; align-items: center; padding: .45rem .55rem; border-radius: 8px; background: #0D1022; border: 1px solid var(--line); counter-increment: ord; }
.order-list li::before { content: counter(ord); font-family: var(--pixel); font-size: .65rem; color: var(--neon); }
.order-list .mv { display: flex; gap: .25rem; }
.order-list .mv button { min-width: 36px; min-height: 36px; border-radius: 6px; background: #161B2E; border: 1px solid var(--line); cursor: pointer; }
.estop-drill { display: grid; gap: .6rem; justify-items: center; text-align: center; padding: 1rem; border: 2px dashed var(--line); border-radius: 12px; }
.estop-drill .estop { margin: 0; width: 110px; height: 110px; }
.estop-drill .estop b { font-size: 1.1rem; }
.estop-drill .estop span { font-size: .6rem; }
.drill-status { font-family: var(--pixel); font-size: .7rem; min-height: 1.2em; }
.state-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .6rem; }
.state-grid select, .plan-table select, .plan-table input { width: 100%; min-height: 40px; background: #070912; border: 1px solid var(--line); border-radius: 6px; padding: .2rem .4rem; }
.sort-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .4rem; }
.sort-item { display: grid; gap: .3rem; padding: .45rem; border-radius: 8px; border: 1px solid var(--line); background: #0D1022; }
.sort-item code { font-size: .95rem; }
.sort-item .seg button { min-height: 32px; font-size: .72rem; }
.plan-table td { white-space: normal; min-width: 110px; }
.tool-crib { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .5rem; }
.tool-card { text-align: left; padding: .55rem; border-radius: 10px; border: 2px solid var(--line); background: #0D1022; cursor: pointer; display: grid; gap: .2rem; }
.tool-card[aria-pressed="true"] { border-color: var(--gold); box-shadow: var(--glow-gold); }
.tool-card b { font-size: .85rem; }
.tool-card span { font-size: .75rem; color: var(--muted); }
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .6rem; }
.compare .col { background: #0D1022; border: 1px solid var(--line); border-radius: 10px; padding: .6rem; }
.compare .col h4 { margin: 0 0 .3rem; font-size: .8rem; letter-spacing: .08em; color: var(--muted); }
.better { color: var(--green-lit); } .worse { color: var(--red-lit); }

/* ---------- Teacher desk ---------- */
.teacher-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.cm-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; }
.cm-form label { display: grid; gap: .2rem; font-size: .8rem; font-weight: 700; color: var(--muted); }
.cm-form input, .cm-form select, .cm-form textarea { min-height: 40px; background: #070912; border: 1px solid var(--line); border-radius: 6px; padding: .3rem .5rem; color: var(--text); font-weight: 400; }
.cm-list { display: grid; gap: .5rem; }
.cm-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: #0D1022; }
.rubric-t td, .rubric-t th { white-space: normal; vertical-align: top; }
