/* =====================================================================
   PBLRC Educational Arcade — Robot Arena (VEX) styles
   Competition-pit look inside the arcade: dark field mat, metal-gray
   panels, colored block categories. Uses shared tokens from styles.css.
   ===================================================================== */
.cabinet.c-vex { --c: var(--neon); }
.vx-hero .lobby-head svg { width: 72px; height: 72px; }
.vx-profile { margin: .8rem 0 .4rem; }
.vx-profile .seg button { font-size: .8rem; }
.gold { color: var(--gold); }
.better { color: var(--green-lit); } .worse { color: var(--red-lit); }

/* ---------- player layout ---------- */
.vx-play { display: grid; grid-template-columns: minmax(260px, 330px) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .vx-play { grid-template-columns: 1fr; } }
.vx-task { position: sticky; top: calc(70px + env(safe-area-inset-top, 0px)); max-height: calc(100vh - 90px); overflow: auto; }
@media (max-width: 1100px) { .vx-task { position: static; max-height: none; } }
.vx-task .prompt { font-size: .95rem; font-weight: 400; }
.vx-widget { min-width: 0; }

/* ---------- arena ---------- */
.vx-arena { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: .8rem; align-items: start; min-width: 0; }
@media (max-width: 980px) { .vx-arena { grid-template-columns: 1fr; } }
.vx-left, .vx-right { min-width: 0; display: grid; gap: .6rem; align-content: start; }
.vx-stage { position: relative; aspect-ratio: 1 / 1; max-height: 62vh; width: 100%; border-radius: 10px; overflow: hidden; border: 2px solid #2B3356; background: #070912; outline: none; }
.vx-stage:focus-visible { box-shadow: 0 0 0 3px var(--gold); }
.vx-stage.small { aspect-ratio: 16 / 10; max-height: 320px; }
.vx-field { display: block; width: 100%; height: 100%; touch-action: none; }
.vx-banner { position: absolute; left: 8px; right: 8px; bottom: 8px; padding: .45rem .6rem; border-radius: 8px; font-size: .82rem; font-weight: 600; line-height: 1.35; }
.vx-banner.bad { background: rgba(80, 8, 8, .92); border: 2px solid var(--red); color: #FFD7D5; }
.vx-banner.info { background: rgba(8, 40, 70, .92); border: 2px solid var(--neon); color: #D6F5FF; }
.vx-banner.good { background: rgba(14, 54, 22, .92); border: 2px solid var(--green-lit); color: #DDFBE0; }
.vx-status { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .8rem; color: var(--muted); }
.vx-status b { color: var(--gold); font-family: var(--mono); }
.vx-controls { gap: .35rem; }
.vx-arena.running .mbtn.go { box-shadow: 0 0 14px rgba(95, 208, 104, .5); }
.vx-telem { background: #0B0F1E; border: 1px solid var(--line); border-radius: 10px; padding: .5rem; display: grid; gap: .4rem; min-width: 0; }
.vx-tlbody { min-height: 160px; max-height: 340px; overflow: auto; }
.vx-tl { font-size: .8rem; }
.vx-tl th { white-space: nowrap; }
.vx-tl td { white-space: normal; }
.vx-tl tr.bad td { color: var(--red-lit); }
.vx-chart { display: block; width: 100%; height: 170px; border-radius: 8px; border: 1px solid var(--line); }
.vx-trace { height: auto; max-height: 300px; }
.vx-trace .tr { grid-template-columns: 50px minmax(70px, auto) minmax(0, 1fr); }
.vx-trace .tr.warn { background: rgba(255, 193, 7, .1); }
.vx-screen { background: #0B1A2B; border: 3px solid #1E2A44; border-radius: 6px; padding: .5rem .6rem; font-family: var(--mono); font-size: .85rem; color: #E9F3FF; min-height: 110px; max-width: 360px; line-height: 1.35; }
.vx-screen.iq { background: #F4F6FA; color: #111; border-color: #2F7BFF; }
.vx-brain { display: grid; gap: .4rem; }
.vx-edactions { gap: .4rem; }

/* controller pad */
.vx-pad { background: #0B0F1E; border: 1px solid var(--line); border-radius: 10px; padding: .4rem .6rem; }
.vx-pad summary { cursor: pointer; font-weight: 700; font-size: .8rem; color: var(--muted); }
.vx-padrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .6rem; align-items: center; margin: .5rem 0; }
@media (max-width: 560px) { .vx-padrow { grid-template-columns: 1fr 1fr; } .vx-pbtns { grid-column: 1 / -1; order: 3; } }
.vx-stickw { display: grid; justify-items: center; gap: .2rem; }
.vx-stick { width: 96px; height: 96px; border-radius: 50%; background: radial-gradient(circle, #1D2340, #0D1022); border: 2px solid #3A4366; display: grid; place-items: center; touch-action: none; cursor: grab; }
.vx-knob { width: 40px; height: 40px; border-radius: 50%; background: #3A4366; border: 2px solid var(--neon); transition: transform .05s; pointer-events: none; }
.vx-pbtns { display: flex; flex-wrap: wrap; gap: .3rem; justify-content: center; }
.vx-pbtn { min-width: 46px; min-height: 40px; border-radius: 8px; border: 2px solid #3A4366; background: #161B2E; font-size: .72rem; font-weight: 700; cursor: pointer; touch-action: none; user-select: none; }
.vx-pbtn.on { background: var(--purple); border-color: var(--purple); color: #fff; }

/* ---------- editor ---------- */
.vx-editor { display: grid; gap: .45rem; min-width: 0; }
.vx-editor .code-tabs .btn { margin-left: .2rem; }
.vx-cfg { font-size: .78rem; }
.vx-cfg summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.vx-cfgcode { max-height: 220px; overflow: auto; font-size: .75rem; white-space: pre; }
.vx-codewrap { height: clamp(260px, 46vh, 520px); }
.vx-codewrap.editing { border-color: var(--gold); }
.code-gutter .gl { cursor: pointer; }
.code-gutter .gl.bpl { color: #FF6B66; font-weight: 700; }
.vx-probs .msg-list { margin: 0; }
.vx-probs li { list-style: none; }
.vx-link { background: none; border: 0; color: inherit; text-align: left; cursor: pointer; padding: .1rem 0; font-size: .8rem; }
.vx-link:hover { text-decoration: underline; }
.vx-ok { color: var(--green-lit); margin: 0; }
.vx-blocks { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: .5rem; min-width: 0; height: clamp(300px, 52vh, 560px); }
@media (max-width: 640px) { .vx-blocks { grid-template-columns: 1fr; height: auto; } .vx-palette { max-height: 220px; } .vx-ws { max-height: 60vh; } }
.vx-palette { overflow: auto; background: #0B0F1E; border: 1px solid var(--line); border-radius: 10px; padding: .35rem; display: grid; gap: .3rem; align-content: start; }
.vx-pgrp summary { cursor: pointer; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--c); padding: .2rem .1rem; }
.vx-pitem { display: block; width: 100%; text-align: left; margin: .18rem 0; padding: .3rem .45rem; border-radius: 6px; border: 0; border-left: 5px solid var(--c); background: #161B2E; font-size: .75rem; cursor: grab; line-height: 1.25; }
.vx-pitem:hover, .vx-pitem:focus-visible { background: #1D2340; }
.vx-wscol { min-width: 0; display: grid; grid-template-rows: auto 1fr; gap: .3rem; min-height: 0; }
.vx-blktools { display: flex; flex-wrap: wrap; gap: .25rem; }
.vx-ws { overflow: auto; background: #04070B; border: 2px solid #23305A; border-radius: 10px; padding: .4rem .5rem; min-height: 0; outline: none; }
.vx-empty { margin: .4rem; }
.vx-list { display: grid; gap: 0; }
.vx-slot { display: block; width: 100%; height: 12px; margin: 1px 0; border: 0; border-radius: 4px; background: transparent; color: transparent; font-size: .7rem; line-height: 12px; cursor: pointer; }
.vx-slot:hover, .vx-slot:focus-visible { background: rgba(255, 193, 7, .18); color: var(--gold); }
.vx-slot.on, .vx-slot.drop { background: rgba(255, 193, 7, .35); color: #fff; height: 18px; }
.vx-blk { border-left: 6px solid var(--c); background: #121730; border-radius: 6px; padding: .12rem .3rem .12rem .2rem; position: relative; outline: none; }
.vx-blk.sel { box-shadow: 0 0 0 2px var(--gold); }
.vx-blk.cur { background: #1E3A24; }
.vx-blk.err { box-shadow: 0 0 0 2px var(--red); }
.vx-row { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .3rem; min-height: 34px; font-size: .82rem; }
.vx-sub { color: var(--muted); font-weight: 700; padding-left: .2rem; }
.vx-addrow { min-height: 26px; }
.vx-body { margin-left: .9rem; padding-left: .3rem; border-left: 2px dashed rgba(255, 255, 255, .12); min-height: 16px; }
.vx-tx { white-space: nowrap; }
.vx-tx.vx-dev { color: #D6F5FF; }
.vx-in, .vx-sel { min-height: 30px; background: #070912; border: 1px solid var(--line); border-radius: 6px; padding: .1rem .35rem; font-family: var(--mono); font-size: .8rem; color: #C8F7CF; max-width: 100%; }
.vx-sel { font-family: var(--body); color: var(--text); }
.vx-in.bad { border-color: var(--red); background: rgba(229, 57, 53, .15); }
.vx-in.vx-var { color: #FFD7A8; }
.vx-in.vx-note { color: var(--muted); font-family: var(--body); }
.vx-exprw { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; }
.vx-mini { min-width: 28px; min-height: 28px; border-radius: 6px; border: 1px solid var(--line); background: #161B2E; cursor: pointer; font-size: .78rem; padding: 0 .35rem; }
.vx-mini:hover { border-color: var(--neon); }
.vx-mini[aria-pressed="true"] { border-color: var(--red); color: var(--red-lit); }
.vx-bpdot { width: 16px; height: 16px; min-width: 16px; border-radius: 50%; border: 2px solid #3A4366; background: transparent; cursor: pointer; padding: 0; }
.vx-bpdot[aria-pressed="true"] { background: #E53935; border-color: #FF6B66; }
.vx-blk.bp > .vx-row .vx-bpdot { background: #E53935; }
.vx-generic .vx-code { color: #C8F7CF; }
.vx-repmenu { display: grid; gap: .3rem; }
.vx-repmenu button { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(0, 1.4fr); gap: .5rem; text-align: left; padding: .4rem .5rem; border-radius: 6px; border: 1px solid var(--line); background: #0D1022; cursor: pointer; font-size: .8rem; }
.vx-repmenu button:hover { border-color: var(--neon); }
.vx-repmenu code { overflow-wrap: anywhere; }

/* ---------- widgets ---------- */
.vx-ask { min-height: 2.2em; }
.vx-diagram svg { width: 100%; height: auto; display: block; }
.vx-clicklog { margin: .4rem 0 0 1rem; color: var(--muted); }
.vx-calc { display: grid; gap: .5rem; }
.vx-calcrow { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 1fr); gap: .5rem; align-items: center; font-size: .9rem; }
@media (max-width: 560px) { .vx-calcrow { grid-template-columns: 1fr; } }
.vx-q { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; margin: 0 0 .7rem; }
.vx-q legend { font-weight: 700; padding: 0 .3rem; }
.vx-radio { display: flex; gap: .5rem; align-items: center; padding: .35rem .5rem; border-radius: 8px; border: 1px solid var(--line); background: #0D1022; cursor: pointer; min-height: 40px; }
.vx-radio input { accent-color: var(--gold); width: 18px; height: 18px; }
.vx-designer { display: grid; gap: .7rem; margin-bottom: .6rem; }
.vx-dgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .4rem .8rem; }
.vx-mechpanel summary { cursor: pointer; }
.vx-readings { max-height: 90px; overflow: auto; background: #04070B; border: 1px solid var(--line); border-radius: 8px; padding: .4rem; margin: .4rem 0; white-space: normal; }
.vx-dots { display: block; width: 100%; height: 90px; border-radius: 8px; border: 1px solid var(--line); margin-bottom: .6rem; }
.vx-bugpanel { display: grid; gap: .5rem; margin-bottom: .6rem; }
.vx-steps button { font-size: .52rem; }
.vx-stepbody { margin-top: .6rem; display: grid; gap: .6rem; }

/* ---------- devices editor ---------- */
.vx-devgrid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1rem; }
@media (max-width: 860px) { .vx-devgrid { grid-template-columns: 1fr; } }
.vx-devs h4 { margin: .6rem 0 .3rem; font-size: .7rem; letter-spacing: .12em; color: var(--muted); }
.vx-devrow { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; padding: .3rem .4rem; border-bottom: 1px solid rgba(255, 255, 255, .05); font-size: .85rem; }
.vx-devrow > span:first-child { min-width: 80px; font-weight: 600; }
.vx-devrow.off { opacity: .6; }
.vx-chk { display: inline-flex; align-items: center; gap: .35rem; min-height: 32px; cursor: pointer; }
.vx-chk input { accent-color: var(--gold); width: 18px; height: 18px; }
.vx-brainports { margin-top: .6rem; }
.vx-brainports summary { cursor: pointer; font-weight: 600; font-size: .85rem; }
.vx-ports { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .25rem; margin: .4rem 0; }
.vx-port { display: grid; padding: .25rem .35rem; border-radius: 6px; background: #0D1022; border: 1px solid var(--line); font-size: .72rem; }
.vx-port.used { border-color: var(--green-lit); }
.vx-port b { font-family: var(--mono); color: var(--gold); }

/* ---------- notebook ---------- */
.vx-nbgrid { display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); gap: 1rem; align-items: start; margin-top: 1rem; }
@media (max-width: 980px) { .vx-nbgrid { grid-template-columns: 1fr; } }
.vx-nblist { display: grid; gap: .4rem; max-height: 70vh; overflow: auto; }
.vx-nbcard { display: grid; gap: .15rem; text-align: left; padding: .5rem .6rem; border-radius: 8px; border: 1px solid var(--line); background: #0D1022; cursor: pointer; }
.vx-nbcard.on { border-color: var(--gold); box-shadow: var(--glow-gold); }
.vx-entry { display: grid; gap: .8rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; min-width: 0; }
.vx-entryhead { display: grid; gap: .4rem; }
.vx-title { font-family: var(--body); font-size: 1.1rem; font-weight: 700; color: var(--text); width: 100%; }
.vx-entrygrid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .vx-entrygrid { grid-template-columns: 1fr; } }
.vx-entryside { position: sticky; top: calc(70px + env(safe-area-inset-top, 0px)); display: grid; gap: .5rem; }
.vx-nbsec { display: grid; gap: .25rem; margin-bottom: .9rem; }
.vx-nbsec p { margin: 0; }
.vx-ta { width: 100%; min-height: 60px; background: #070912; border: 1px solid var(--line); border-radius: 8px; padding: .45rem .55rem; color: var(--text); font-family: var(--body); font-size: .9rem; line-height: 1.45; resize: vertical; }
.vx-sketch { width: 100%; max-width: 600px; height: auto; aspect-ratio: 600 / 360; border-radius: 8px; border: 2px solid var(--line); background: #fff; touch-action: none; cursor: crosshair; display: block; margin: .3rem 0; }
.vx-sktools { gap: .3rem; }
.vx-swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #3A4366; cursor: pointer; color: #111; font-weight: 700; }
.vx-swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--gold); }
.vx-vpre { max-height: 200px; overflow: auto; font-size: .72rem; }
.vx-testpick { display: grid; gap: .2rem; max-height: 220px; overflow: auto; background: #070912; border: 1px solid var(--line); border-radius: 8px; padding: .4rem; font-size: .8rem; }
.vx-nbstatus .checks li { font-size: .8rem; }
.vx-cycle { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin: .4rem 0; }
.vx-cstage { font-size: .72rem; font-weight: 700; letter-spacing: .06em; padding: .25rem .6rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.vx-cstage.on { background: #1E5E25; border-color: var(--green-lit); color: #E6FFE6; }
.vx-board tr.top1 td { color: var(--gold); font-weight: 700; }
.vx-board tr.top2 td { color: #D9DEE8; }
.vx-board tr.top3 td { color: #E0A36A; }
