/* Layout: control-room page — the classroom stage on the left, the wall-mounted touch panel on the right; stacks on phones. */
:root {
  color-scheme: dark;
  --bg: #0f1520;
  --bg2: #161e2c;
  --line: #273246;
  --fg: #e7edf6;
  --muted: #8d9bb1;
  --accent: #3fa2ff;
  --amber: #ffb547;
  --rec: #ff4d5e;
  --ok: #3ddc97;
  --f-ui: "IBM Plex Sans KR", "Noto Sans KR", system-ui, sans-serif;
  --f-panel: "Noto Sans KR", "Malgun Gothic", sans-serif;
  --f-mono: "Share Tech Mono", ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 14px/1.5 var(--f-ui); }
button { font: inherit; color: inherit; }

.top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  padding-block: 14px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  border-bottom: 1px solid var(--line); background: var(--bg2);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong { display: block; font-size: 17px; letter-spacing: -0.01em; }
.brand small { color: var(--muted); font-size: 12px; }
.mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; letter-spacing: 0.04em; }
.views { display: flex; gap: 6px; background: var(--bg); padding: 4px; border-radius: 10px; border: 1px solid var(--line); }
.views button { border: 0; background: transparent; padding: 8px 14px; border-radius: 7px; cursor: pointer; font-weight: 700; text-align: left; line-height: 1.2; }
.views button span { display: block; font-weight: 400; font-size: 11.5px; color: var(--muted); }
.views button[aria-selected="true"] { background: var(--accent); color: #fff; }
.views button[aria-selected="true"] span { color: #dcecff; }
.views button:focus-visible { outline: 2px solid var(--amber); }

.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 520px); gap: 20px; align-items: start;
  padding-block: 18px 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  max-width: 1600px; margin: 0 auto;
}
@media (max-width: 980px) { .layout { grid-template-columns: minmax(0, 1fr); } .panel-wrap { order: 2; } }

.stage { position: relative; border-radius: 14px; overflow: hidden; background: radial-gradient(120% 90% at 50% 0%, #1d2840 0%, #0c111b 70%); border: 1px solid var(--line); aspect-ratio: 840 / 660; max-width: 100%; }
.view { position: absolute; inset: 0; }
.view svg { width: 100%; height: 100%; display: block; }
#c3d { width: 100%; height: 100%; display: block; touch-action: none; }
.chips { position: absolute; top: 10px; left: 10px; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 20px); pointer-events: none; }
.chip { font-size: 11.5px; padding: 3px 9px; border-radius: 99px; background: rgba(10, 15, 25, 0.78); border: 1px solid var(--line); color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: #475569; }
.chip.on { color: var(--fg); } .chip.on i { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.chip.rec { color: #fff; border-color: var(--rec); } .chip.rec i { background: var(--rec); box-shadow: 0 0 6px var(--rec); animation: blink 1s steps(2) infinite; }
.chip.warm i { background: var(--amber); animation: blink 0.6s steps(2) infinite; }
.chip b { font-family: var(--f-mono); font-weight: 400; color: var(--fg); }
@keyframes blink { 50% { opacity: 0.2; } }
.hint3d { position: absolute; bottom: 10px; left: 10px; font-size: 11.5px; color: var(--muted); background: rgba(10,15,25,.7); padding: 3px 9px; border-radius: 99px; pointer-events: none; }
.pip { position: absolute; right: 10px; bottom: 10px; width: 28%; aspect-ratio: 16/9; border: 2px solid var(--amber); border-radius: 6px; pointer-events: none; }
.pip span { position: absolute; top: -20px; right: 0; font-size: 11px; color: var(--amber); white-space: nowrap; }

.labels3d { position: absolute; inset: 0; pointer-events: none; }
.lab3 { position: absolute; transform: translate(-50%, -100%); font-size: 11px; padding: 2px 7px; border-radius: 4px; background: rgba(12,18,30,.82); color: #dfe8f5; white-space: nowrap; border: 1px solid #33425c; pointer-events: auto; cursor: pointer; }

.info { position: absolute; right: 10px; top: 10px; width: min(300px, calc(100% - 20px)); background: rgba(14, 20, 32, 0.96); border: 1px solid #36507a; border-radius: 12px; padding: 14px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.info h3 { margin: 0; font-size: 16px; }
.info .model { color: var(--accent); font-family: var(--f-mono); font-size: 13px; margin-top: 2px; }
.info p { margin: 8px 0 0; color: #c4cfdf; font-size: 13px; }
.info .ctl { margin-top: 8px; font-size: 12px; color: var(--muted); }
.info a { display: inline-block; margin-top: 10px; color: #fff; background: var(--accent); padding: 6px 12px; border-radius: 6px; text-decoration: none; font-weight: 600; font-size: 13px; }
.info .x { position: absolute; top: 8px; right: 8px; border: 0; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; }

.below { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 10px; }
.toggle { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.tip { margin: 0; color: var(--muted); font-size: 13px; }
.log-wrap { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg2); padding: 10px 14px; }
.log-wrap h2 { margin: 0 0 6px; font-size: 12px; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.log { list-style: none; margin: 0; padding: 0; max-height: 132px; overflow-y: auto; font-family: var(--f-mono); font-size: 12.5px; }
.log li { display: grid; grid-template-columns: 70px 76px minmax(0, 1fr); gap: 8px; padding: 2px 0; border-bottom: 1px dashed #222c3d; color: #b9c6d8; }
.log li.empty { display: block; font-family: var(--f-ui); color: var(--muted); border: 0; }
.log .t { color: #66758c; } .log .p { color: var(--amber); }

/* ---- Touch panel (STC-207W look: silver bezel, black SMART TOUCH screen) ---- */
.panel-wrap { position: sticky; top: 12px; }
@media (max-width: 980px) { .panel-wrap { position: static; } }
.device { max-width: 560px; margin: 0 auto; }
.bezel { padding: 16px; border-radius: 18px; background: linear-gradient(160deg, #e9edf2, #a9b2bd 55%, #d6dbe1); box-shadow: inset 0 1px 0 #fff, 0 14px 40px rgba(0,0,0,.5); }
.device-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 8px; display: flex; gap: 8px; justify-content: center; align-items: center; }
.device-foot .led { width: 22px; height: 3px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 8px var(--accent); }

.tp { container-type: inline-size; aspect-ratio: 800 / 520; background: #000; border-radius: 4px; overflow: hidden; color: #fff; font-family: var(--f-panel); display: flex; flex-direction: column; user-select: none; }
.tp-top { display: flex; align-items: center; justify-content: space-between; padding: 2.4cqw 3cqw 1.2cqw; gap: 2cqw; }
.logo { font-family: var(--f-ui); font-weight: 700; font-style: italic; font-size: 6.4cqw; letter-spacing: 0.06em; line-height: 1; transform: scaleX(1.25); transform-origin: left; color: #fff; }
.tp-clock { font-family: var(--f-mono); font-size: 3cqw; color: #9aa7b8; margin-left: auto; }
.k { border: 0; cursor: pointer; position: relative; border-radius: 0.6cqw; background: linear-gradient(#f2f9ff, #b9dcf6); color: #111; font-weight: 700; font-size: 2.3cqw; box-shadow: inset 0 0 0 0.25cqw #6f8aa3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4cqw; padding: 0.8cqw 0.4cqw; line-height: 1.1; touch-action: manipulation; }
.k svg { width: 4.6cqw; height: 4.6cqw; }
.k:active { transform: translateY(1px); filter: brightness(0.9); }
.k:focus-visible { outline: 0.5cqw solid var(--amber); outline-offset: 0.2cqw; }
.k.on { background: linear-gradient(#cfe8ff, #5aa8ef); box-shadow: inset 0 0 0 0.25cqw #2e6eaa, 0 0 1.6cqw rgba(90,168,239,.55); }
.k.on::before { content: ""; position: absolute; left: 0.25cqw; top: 0.25cqw; border-style: solid; border-width: 1.6cqw 1.6cqw 0 0; border-color: #000 transparent transparent transparent; }
.k.dim { opacity: 0.45; }
.k.sys { background: linear-gradient(#5b5f66, #2a2d33); color: #fff; box-shadow: inset 0 0 0 0.25cqw #8b9099; font-size: 2.3cqw; padding: 1.2cqw 2.4cqw; flex-direction: row; }
.tp-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5cqw; padding: 0 3cqw; }
.tp-tabs button { border: 0; cursor: pointer; padding: 1.4cqw 0; font-size: 2.3cqw; font-weight: 700; border-radius: 0.8cqw 0.8cqw 0 0; background: linear-gradient(#f8f8f8, #c9ced6); color: #222; }
.tp-tabs button[aria-selected="true"] { background: linear-gradient(#bcdcff, #5f97e6); color: #0b1d3a; }
.tp-body { flex: 1; margin: 0 3cqw; border: 0.3cqw solid #e6e9ee; border-top-width: 0.6cqw; padding: 1.8cqw 2cqw; display: flex; gap: 2.4cqw; min-height: 0; }
.grp h4 { margin: 0 0 0.9cqw; font-size: 2.2cqw; font-weight: 700; padding-bottom: 0.6cqw; border-bottom: 0.45cqw double #fff; white-space: nowrap; }
.row { display: flex; gap: 1cqw; }
.row .k { width: 9.6cqw; height: 9.6cqw; }
.col { display: flex; flex-direction: column; gap: 1cqw; }
.col .k { width: 9.6cqw; height: 7cqw; }
.col .k svg { width: 3.6cqw; height: 3.6cqw; }
.stack { display: flex; flex-direction: column; gap: 2cqw; flex: 1; min-width: 0; }
.pair { display: flex; gap: 2.4cqw; }
.tp-scenes { display: flex; align-items: center; gap: 1.2cqw; padding: 1.4cqw 3cqw 2.2cqw; }
.tp-scenes span { font-size: 2.1cqw; color: #9aa7b8; margin-right: 0.6cqw; white-space: nowrap; }
.tp-scenes .k { flex: 1; flex-direction: row; height: 6cqw; font-size: 2.3cqw; gap: 1cqw; }
.tp-scenes .k svg { width: 3.4cqw; height: 3.4cqw; }
.seg { font-family: var(--f-mono); font-size: 4.4cqw; color: #fff; background: #000; border: 0.3cqw solid #cfd5dd; border-radius: 0.6cqw; padding: 0.4cqw 1.2cqw; text-align: center; min-width: 9cqw; letter-spacing: 0.08em; }
.seg.red { color: #ff5b6b; } .seg.amber { color: var(--amber); }
.vol .k { width: 8.4cqw; height: 6cqw; font-size: 4.6cqw; }
.pad { display: grid; grid-template-columns: repeat(3, 7cqw); grid-template-rows: repeat(3, 6.2cqw); gap: 0.8cqw; }
.pad .k { width: auto; height: auto; }
.wide .k { width: auto; flex: 1; }
.note { font-size: 1.9cqw; color: #9aa7b8; margin: 0.6cqw 0 0; line-height: 1.35; }

.start { flex: 1; display: grid; place-items: center; text-align: center; cursor: pointer; background: radial-gradient(70% 70% at 50% 40%, #13243f, #000); border: 0; color: #fff; font-family: var(--f-panel); width: 100%; }
.start .logo { display: inline-block; font-size: 11cqw; transform: scaleX(1.25); transform-origin: center; }
.start p { margin: 2cqw 0 0; font-size: 2.8cqw; color: #b9c7da; }
.outlets { display: flex; gap: 1.2cqw; justify-content: center; margin-top: 3cqw; }
.outlets i { width: 4.6cqw; height: 1.4cqw; border-radius: 0.4cqw; background: #26303d; }
.outlets i.lit { background: var(--ok); box-shadow: 0 0 1.4cqw var(--ok); }
.outlets + small { display: block; margin-top: 1.2cqw; font-size: 2cqw; color: #7f8da2; }

@media (prefers-reduced-motion: reduce) { .chip.rec i, .chip.warm i { animation: none; } }

/* Phones: stage, then the panel right under it, then the notes and log. */
@media (max-width: 980px) {
  .stage-wrap { display: contents; }
  .stage { order: 1; } .panel-wrap { order: 2; } .below { order: 3; margin-top: 0; } .log-wrap { order: 4; margin-top: 0; }
  .layout { gap: 12px; }
  .lab3 { font-size: 10px; padding: 1px 5px; }
  .views button { padding: 6px 10px; }
}
