/* =====================================================================
   APEC 2027 LED Facade Show Simulator – control UI
   dark glass "show control" look: icon rail + flyout panel + timeline
   ===================================================================== */
:root {
  --bg: rgba(12, 16, 24, .78); --bg2: rgba(255,255,255,.04); --line: rgba(255,255,255,.09);
  --fg: #e9eef5; --mut: #8a97a8; --acc: #f3c34a; --acc2: #34e0c4; --red: #ff4d5e;
  --r: 12px; --fs: 12.5px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--fg);
  font: var(--fs)/1.45 "Segoe UI", "Inter", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
#app canvas { display: block; }
.hidden { display: none !important; }
.muted { color: var(--mut); } .small { font-size: 11.5px; } .mono { font-variant-numeric: tabular-nums; }
p.small { margin: 10px 0 0; }

/* ---------- buttons ---------- */
button, .btn { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 8px; background: var(--bg2); border: 1px solid var(--line);
  color: var(--fg); cursor: pointer; white-space: nowrap; font-size: var(--fs); transition: background .15s, border-color .15s, transform .1s; }
button:hover, .btn:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); }
button:active, .btn:active { transform: translateY(1px); }
button.primary { background: linear-gradient(180deg, #ffd56a, #e9b12d); color: #1d1503; border-color: transparent; font-weight: 700; }
button.primary:hover { filter: brightness(1.06); }
button.on { background: rgba(52,224,196,.16); border-color: rgba(52,224,196,.6); color: #d8fff7; }
button.sq { width: 32px; padding: 0; }
button.big { height: 38px; padding: 0 18px; letter-spacing: .05em; font-size: 13px; }
button.rec { background: var(--red); border-color: var(--red); color: #fff; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .6; } }

/* ---------- brand ---------- */
#brand { position: fixed; left: 14px; top: 12px; display: flex; gap: 10px; align-items: center; pointer-events: none; z-index: 5; }
#brand .brand-logo { display: block; width: 86px; height: auto; padding: 4px; flex: none; background: #fdfdfd; border-radius: 7px; }
#brand b { display: block; font-size: 13px; letter-spacing: .08em; }
#brand span { display: block; color: var(--mut); font-size: 11px; }
.logo { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-weight: 900; color: #1d1503;
  background: conic-gradient(from 200deg, #ffd56a, #ff7a45, #e9b12d, #ffd56a); box-shadow: 0 4px 18px rgba(243,195,74,.35); }
.logo.big { width: 54px; height: 54px; font-size: 24px; margin: 0 auto 14px; border-radius: 14px; }

/* ---------- top transport bar ---------- */
#topbar { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); display: flex; gap: 6px; align-items: center;
  padding: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(14px) saturate(1.2); z-index: 6;
  box-shadow: 0 10px 30px rgba(0,0,0,.35); }
#topbar .ic span { font-size: 12px; }
.sep { width: 1px; height: 22px; background: var(--line); margin: 0 2px; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; background: rgba(255,255,255,.07);
  color: var(--mut); font-size: 11px; font-variant-numeric: tabular-nums; letter-spacing: 0; text-transform: none; }

/* ---------- left rail ---------- */
#rail { position: fixed; left: 12px; top: 64px; display: flex; flex-direction: column; gap: 4px; padding: 6px; z-index: 6;
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(14px); }
#rail button { flex-direction: column; width: 58px; height: 54px; padding: 0; gap: 2px; border-color: transparent; background: transparent; }
#rail button i { font-style: normal; font-size: 18px; line-height: 1; }
#rail button span { font-size: 10px; color: var(--mut); }
#rail button.on { background: rgba(243,195,74,.12); border-color: rgba(243,195,74,.45); }
#rail button.on span { color: var(--acc); }

/* ---------- flyout panel ---------- */
#panel { position: fixed; left: 88px; top: 64px; width: 320px; max-height: calc(100vh - 150px); overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain; padding: 14px 16px 16px; z-index: 6; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r); backdrop-filter: blur(14px) saturate(1.2); box-shadow: 0 16px 40px rgba(0,0,0,.4);
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; transition: opacity .18s, transform .18s; }
#panel.closed { opacity: 0; transform: translateX(-8px); pointer-events: none; }
#panel section { display: none; }
#panel section.on { display: block; animation: fadein .18s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }
h3 { margin: 0 0 12px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--fg);
  display: flex; align-items: center; justify-content: space-between; gap: 8px; }
h4 { margin: 16px 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--mut); }
.row { display: flex; gap: 6px; margin: 8px 0; }
.row > * { flex: 1; }
.row > .sq { flex: 0 0 32px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.grid button { justify-content: flex-start; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.seg { display: flex; gap: 2px; padding: 3px; background: rgba(0,0,0,.25); border-radius: 9px; margin-bottom: 10px; }
.seg button { flex: 1; height: 28px; padding: 0 6px; border: 0; background: transparent; font-size: 12px; }
.seg button.on { background: rgba(243,195,74,.18); color: var(--acc); }

/* ---------- sliders: label / value / track on a fixed grid (no layout jumps) ---------- */
.sl { display: grid; grid-template-columns: 1fr auto; align-items: center; row-gap: 4px; margin: 10px 0; }
.sl label { color: #c6d0dc; font-size: 12px; }
.sl output { color: var(--acc); font-size: 11px; font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; }
.sl input[type=range], .sl input[type=text] { grid-column: 1 / -1; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; margin: 0; background: transparent;
  cursor: pointer; touch-action: none; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--acc) var(--p, 50%), rgba(255,255,255,.12) var(--p, 50%)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%;
  background: #fff; border: 0; box-shadow: 0 0 0 4px rgba(243,195,74,.25), 0 2px 6px rgba(0,0,0,.5); transition: box-shadow .15s; }
input[type=range]:active::-webkit-slider-thumb { box-shadow: 0 0 0 6px rgba(243,195,74,.35), 0 2px 6px rgba(0,0,0,.5); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255,255,255,.12); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--acc); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }
input[type=text], select { width: 100%; height: 32px; padding: 0 10px; background: rgba(0,0,0,.3); border: 1px solid var(--line);
  color: var(--fg); border-radius: 8px; font: inherit; outline: none; }
select { margin-bottom: 8px; cursor: pointer; }
select option { background: #121822; }
input[type=text]:focus, select:focus { border-color: rgba(243,195,74,.6); }

.chk { display: flex; align-items: center; gap: 9px; padding: 5px 0; cursor: pointer; color: #c6d0dc; }
.chk input { accent-color: var(--acc); width: 15px; height: 15px; margin: 0; }
.chk i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: 0 0 9px; }

.switch { position: relative; width: 36px; height: 20px; flex: 0 0 36px; }
.switch input { display: none; }
.switch span { position: absolute; inset: 0; background: #3a3f48; border-radius: 20px; cursor: pointer; transition: .2s; }
.switch span::after { content: ''; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + span { background: var(--acc2); }
.switch input:checked + span::after { left: 18px; }

/* ---------- scene list ---------- */
#scenes { list-style: none; margin: 8px 0; padding: 0; max-height: 330px; overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid var(--line); border-radius: 9px; background: rgba(0,0,0,.18); scrollbar-width: thin; }
#scenes li { display: flex; gap: 8px; align-items: baseline; padding: 6px 10px; cursor: pointer; color: #b9c4d1; font-size: 12px;
  border-bottom: 1px solid rgba(255,255,255,.04); }
#scenes li:hover { background: rgba(255,255,255,.05); }
#scenes li.cur { background: rgba(52,224,196,.12); color: #fff; box-shadow: inset 3px 0 0 var(--acc2); }
#scenes li small { margin-left: auto; color: var(--mut); font-variant-numeric: tabular-nums; }

.meter { display: flex; gap: 4px; align-items: flex-end; height: 28px; margin-top: 8px; }
.meter i { flex: 1; background: linear-gradient(0deg, var(--acc2), var(--acc)); height: 2px; border-radius: 3px 3px 0 0; transition: height .05s; }
.meter b { width: 28px; height: 28px; border-radius: 50%; background: #222; transition: background .08s; }
.meter b.hit { background: var(--acc); box-shadow: 0 0 14px var(--acc); }

/* ---------- bottom timeline ---------- */
#timeline { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); width: min(980px, calc(100vw - 300px));
  display: flex; align-items: center; gap: 12px; padding: 8px 12px; z-index: 6; background: var(--bg); border: 1px solid var(--line);
  border-radius: 14px; backdrop-filter: blur(14px) saturate(1.2); box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.tlInfo { display: flex; flex-direction: column; width: 220px; min-width: 0; }
.tlInfo b { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tlInfo span { font-size: 11px; color: var(--acc2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tlTrack { position: relative; flex: 1; height: 26px; cursor: pointer; }
#tlTrack::before { content: ''; position: absolute; left: 0; right: 0; top: 11px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.1); }
#showBar { position: absolute; left: 0; top: 11px; height: 4px; width: 0; border-radius: 2px; background: linear-gradient(90deg, var(--acc2), var(--acc)); }
#tlMarks i { position: absolute; top: 8px; width: 1px; height: 10px; background: rgba(255,255,255,.22); }
#tlMarks i.sec { height: 14px; top: 6px; background: rgba(243,195,74,.55); }
#tlHead { position: absolute; top: 6px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px rgba(243,195,74,.7); }
#tlTime { color: var(--mut); font-size: 11px; min-width: 84px; text-align: right; }

/* ---------- minimap / info / labels ---------- */
#minimap { position: fixed; right: 12px; top: 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(10,14,22,.85);
  cursor: crosshair; z-index: 5; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
#info { position: fixed; right: 12px; top: 224px; bottom: 80px; width: 340px; overflow-y: auto; overscroll-behavior: contain; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r); padding: 16px; backdrop-filter: blur(14px); z-index: 6; }
#info h2 { margin: 0 34px 8px 0; font-size: 15px; }
#info .led { border-left: 3px solid var(--acc2); padding-left: 8px; color: #d8fff7; }
#infoClose { position: absolute; right: 10px; top: 10px; }
#infoImgs img { width: 100%; border-radius: 8px; margin-top: 8px; cursor: zoom-in; display: block; }
#lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; z-index: 40; cursor: zoom-out; }
#lightbox img { max-width: 95vw; max-height: 95vh; border-radius: 6px; }
#labels { position: fixed; inset: 0; pointer-events: none; }
.lbl { position: absolute; transform: translate(-50%, -100%); background: rgba(0,0,0,.55); border: 1px solid; border-radius: 6px; padding: 1px 7px; font-size: 11px; font-weight: 700; white-space: nowrap; }

/* ---------- misc overlays ---------- */
#crosshair { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 22px; color: rgba(255,255,255,.7); pointer-events: none; display: none; }
body.walk #crosshair { display: block; }
#hint { position: fixed; left: 50%; bottom: 74px; transform: translateX(-50%); background: var(--bg); border: 1px solid var(--line); border-radius: 20px;
  padding: 5px 14px; color: #c3cdd8; font-size: 12px; white-space: nowrap; display: none; z-index: 5; }
body.walk #hint { display: block; }
#paused { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 8; }
#paused div { pointer-events: auto; cursor: pointer; background: var(--bg); padding: 14px 22px; border-radius: 12px; border: 1px solid var(--acc); font-size: 15px; }
#toast { position: fixed; left: 50%; top: 66px; transform: translateX(-50%); background: var(--acc); color: #1d1503; padding: 6px 14px; border-radius: 8px; font-weight: 600;
  opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 20; }
#toast.show { opacity: 1; }
#loading { position: fixed; inset: 0; background: radial-gradient(circle at 50% 60%, #1b2433, #05070b); display: flex; align-items: center;
  justify-content: center; text-align: center; z-index: 30; transition: opacity .6s; }
#loading b { font-size: 18px; color: var(--acc); }
#loading.done { opacity: 0; pointer-events: none; }

/* ---------- cinema / presentation ---------- */
#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 3; }
.bar { position: fixed; left: 0; right: 0; height: 0; background: #000; z-index: 4; transition: height .8s ease; pointer-events: none; }
.bar.top { top: 0; } .bar.bottom { bottom: 0; }
body.cinema .bar { height: 7vh; }
#caption { position: fixed; left: 4vw; bottom: calc(7vh + 24px); z-index: 6; display: none; flex-direction: column; text-shadow: 0 2px 10px #000; pointer-events: none; }
#caption small { color: var(--acc); letter-spacing: .2em; font-weight: 700; font-size: 12px; }
#caption b { font-size: 26px; font-weight: 300; }
#caption span { color: #a9f3e8; font-size: 15px; }
body.cinema #caption { display: flex; }
#exitPresent { position: fixed; right: 16px; top: 16px; z-index: 7; display: none; opacity: .5; }
#exitPresent:hover { opacity: 1; }
body.presenting #panel, body.presenting #rail, body.presenting #minimap, body.presenting #info, body.presenting #topbar,
body.presenting #labels, body.presenting #timeline, body.presenting #brand, body.presenting #paused, body.cinema #paused { display: none !important; }
body.presenting #exitPresent { display: inline-flex; }
body.hide-ui #panel, body.hide-ui #rail, body.hide-ui #minimap, body.hide-ui #info, body.hide-ui #topbar, body.hide-ui #labels,
body.hide-ui #timeline, body.hide-ui #brand { display: none !important; }
@media (max-width: 1100px) { #topbar .ic span { display: none; } .tlInfo { width: 150px; } #timeline { width: calc(100vw - 120px); } }

/* ---------- studio: options, quantities, views, export ---------- */
.planHead, .planRow { display: grid; grid-template-columns: 34px 1fr 1fr; gap: 6px; align-items: center; }
.planHead { margin-bottom: 4px; }
.planRow select { margin: 0 0 6px; height: 28px; padding: 0 6px; font-size: 11.5px; }
table.qty { width: 100%; border-collapse: collapse; font-size: 11.5px; font-variant-numeric: tabular-nums; }
table.qty th { color: var(--mut); font-weight: 600; text-align: right; padding: 4px 3px; border-bottom: 1px solid var(--line); }
table.qty td { text-align: right; padding: 4px 3px; border-bottom: 1px solid rgba(255,255,255,.04); }
table.qty th:first-child, table.qty td:first-child { text-align: left; }
table.qty tr.tot td { color: var(--acc); font-weight: 700; border-bottom: 0; }
.prices { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; margin-top: 8px; }
.prices label, label.num { display: flex; flex-direction: column; gap: 3px; color: #c6d0dc; font-size: 11px; }
input[type=number] { width: 100%; height: 30px; padding: 0 8px; background: rgba(0,0,0,.3); border: 1px solid var(--line); color: var(--fg);
  border-radius: 8px; font: inherit; outline: none; }
input[type=number]:focus { border-color: rgba(243,195,74,.6); }
.viewRow { display: flex; gap: 6px; margin: 4px 0; }
.viewRow button:first-child { flex: 1; justify-content: flex-start; overflow: hidden; text-overflow: ellipsis; }
button.wide { width: 100%; margin-top: 4px; }
#caption span { max-width: 62vw; }
#exitTour { position: fixed; right: 16px; top: 16px; z-index: 7; display: none; opacity: .6; }
#exitTour:hover { opacity: 1; }
body.touring #exitTour { display: inline-flex; }
body.touring #panel, body.touring #rail, body.touring #minimap, body.touring #info, body.touring #topbar, body.touring #labels,
body.touring #timeline, body.touring #brand { display: none !important; }
#exportBox { position: fixed; inset: 0; z-index: 35; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.55); }
#exportBox > div { width: 420px; padding: 20px; border-radius: 14px; background: #0e131c; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.exTrack { height: 6px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; }
.exTrack i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--acc2), var(--acc)); }
