:root{color-scheme:dark;--bg:#07111f;--surface:#101d2d;--surface2:#17283b;--line:#2a4057;--text:#eaf4ff;--muted:#9eb2c7;--accent:#2bd4bf;--warn:#ffba52;--danger:#ff6b7a;--safe-top:env(safe-area-inset-top,0px);--safe-right:env(safe-area-inset-right,0px);--safe-bottom:env(safe-area-inset-bottom,0px);--safe-left:env(safe-area-inset-left,0px)}
*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;background:var(--bg);color:var(--text);font-family:Inter,Segoe UI,Arial,sans-serif}button,input,select{font:inherit;color:inherit}button,select,input{min-height:44px;border:1px solid var(--line);border-radius:10px;background:var(--surface2);padding:8px 12px}button{touch-action:manipulation;cursor:pointer}.primary{background:var(--accent);border-color:var(--accent);color:#031511;font-weight:800}
.pair-card{position:fixed;z-index:50;left:50%;top:50%;transform:translate(-50%,-50%);width:min(440px,calc(100% - 32px));max-height:calc(100dvh - var(--safe-top) - var(--safe-bottom) - 24px);overflow:auto;margin:0;padding:24px;background:var(--surface);border:1px solid var(--line);border-radius:18px;display:grid;gap:18px}.pair-card label{display:grid;gap:7px;color:var(--muted)}.pair-card input{width:100%;font-size:20px}.brand{display:flex;gap:10px;align-items:center;min-width:0}.brand h1,.brand p{margin:0}.brand p,.brand small{color:var(--muted)}.brand-mark{display:grid;place-items:center;width:48px;height:48px;border-radius:14px;background:linear-gradient(135deg,var(--accent),#4c84ff);color:#04141e;font-weight:900}.error{min-height:1.2em;color:var(--danger);margin:0}
#viewer{position:relative;height:100%;padding:var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);display:grid;grid-template-rows:56px minmax(0,1fr)}#viewer[hidden]{display:none}header{display:flex;align-items:center;gap:10px;padding:5px 10px;border-bottom:1px solid var(--line);background:var(--surface);min-width:0}.compact .brand-mark{width:38px;height:38px;border-radius:10px}.compact div{display:grid;gap:1px;min-width:0}.compact strong{max-width:22vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.compact small{font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.top-command{font-weight:700;white-space:nowrap}.top-command.active,.icon-command.active{border-color:var(--accent);background:#123f39;color:#7ff5e4}.icon-command{width:46px;min-width:46px;padding:0;font-size:24px;font-weight:800}#montageButton{min-width:150px;max-width:32vw;overflow:hidden;text-overflow:ellipsis}.status-row{margin-left:auto;display:flex;align-items:center;gap:6px;min-width:0}.pill{padding:7px 9px;border-radius:999px;background:#29415b;color:var(--muted);white-space:nowrap}.pill.ok{background:#123f39;color:#69ebd8}.pill.warn{background:#503b1e;color:#ffd18a}.pill.error{background:#4b222a;color:#ff9ba5}
#workspace{position:relative;min-width:0;min-height:0;padding-right:84px;background:#050d18}#eegPanel{position:relative;width:100%;height:100%;min-width:0;min-height:0;background:#050d18;overflow:hidden}#eegCanvas{display:block;width:100%;height:100%;touch-action:none}#eegEmpty,#videoEmpty{display:none;position:absolute;inset:0;place-items:center;color:var(--muted);background:#07111fe6;text-align:center;padding:20px}.empty.show{display:grid!important}#channelPager{position:absolute;z-index:7;top:7px;right:8px;bottom:48px;width:48px;display:flex;flex-direction:column;align-items:center;gap:4px;padding:4px;border:1px solid var(--line);border-radius:12px;background:#07111ff2;color:var(--muted);font-size:11px;box-shadow:0 3px 16px #0008}#channelPager button{width:38px;min-height:36px;padding:0;border-radius:8px}#channelPager button:disabled{opacity:.35}#channelRange{width:40px;text-align:center;font-weight:700;line-height:1.15;color:var(--text)}#channelScroll{flex:1;width:30px;min-height:48px;padding:0;accent-color:var(--accent);writing-mode:vertical-lr;direction:rtl;touch-action:manipulation}#timelineDock{position:absolute;z-index:5;left:92px;right:62px;bottom:3px;height:40px;display:flex;align-items:center;gap:7px;padding:4px 7px;border:1px solid var(--line);border-radius:10px;background:#07111fe8;color:var(--muted);font:11px ui-monospace,Consolas,monospace}#timelineDock span{min-width:55px;text-align:center}#visibleWindow{min-width:42px;color:var(--accent);white-space:nowrap}.study-timeline{flex:1;width:auto;min-width:60px;min-height:28px;padding:0;accent-color:var(--accent);touch-action:manipulation}
#epochPad{position:absolute;z-index:6;top:0;right:0;bottom:0;width:84px;border-left:1px solid var(--line);background:var(--surface);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:8px}.arrow-button{width:62px;height:62px;min-height:62px;padding:0;border-radius:15px;font-size:32px;font-weight:800;line-height:1;background:#18304a;color:#eaf4ff}.arrow-button:active{transform:scale(.95);background:#1d665d;border-color:var(--accent)}
#workspace.video-open{display:grid;grid-template-columns:minmax(0,1fr) minmax(280px,min(46vw,560px));padding-right:84px}#workspace.video-open #eegPanel{grid-column:1;min-width:0}#videoPanel{position:relative;z-index:5;grid-column:2;width:100%;height:100%;min-width:280px;border-left:2px solid var(--accent);background:#02070c;box-shadow:-12px 0 28px #0008;overflow:hidden}#video{width:100%;height:100%;object-fit:contain;background:#02070c}.video-state{position:absolute;z-index:3;left:8px;top:8px;max-width:calc(100% - 16px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:6px 9px;border-radius:8px;background:#07111fdd;color:var(--muted);font-size:12px}.video-tools{position:absolute;z-index:3;left:8px;right:8px;bottom:8px;display:flex;justify-content:space-between;align-items:center;gap:8px;padding:6px 7px;border-radius:12px;background:#07111fee;color:var(--muted)}.video-transport{display:flex;align-items:center;gap:5px;min-width:0}.video-transport button{border-color:#54708c;background:#10253a}.video-play{width:48px;height:48px;min-height:48px;padding:0;border-radius:50%;font-size:22px;font-weight:900;color:#04141e!important;background:var(--accent)!important;border-color:var(--accent)!important}.video-command{width:40px;height:40px;min-height:40px;padding:0;border-radius:50%;font-size:23px;font-weight:900}.video-transport #playbackRate{min-width:34px;color:#fff;font-weight:800;text-align:center}.video-tools select{min-height:40px;padding:5px 8px}.video-tools label{display:flex;align-items:center;gap:5px;white-space:nowrap;font-size:12px}#channelStrip{display:none}
#controls{position:absolute;z-index:10;left:var(--safe-left);right:calc(84px + var(--safe-right));bottom:var(--safe-bottom);max-height:72vh;overflow:auto;background:#101d2df7;border:1px solid var(--line);border-bottom:0;border-radius:16px 16px 0 0;padding:10px 12px;display:grid;gap:8px;box-shadow:0 -10px 30px #0009}.transport,.settings{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.transport .time-input{display:flex;align-items:center;gap:6px}.time-input input{width:106px}.settings label{display:flex;align-items:center;gap:5px;color:var(--muted);font-size:12px}.settings select,.settings input{min-height:38px;padding:5px 8px}.settings input{width:72px}#diagnostics{font:12px ui-monospace,Consolas,monospace;color:var(--muted)}
#rotateHint{display:none}dialog{width:min(620px,calc(100% - 24px));max-height:82vh;border:1px solid var(--line);border-radius:16px;background:var(--surface);color:var(--text);padding:14px}dialog::backdrop{background:#000b}.dialog-title{display:flex;justify-content:space-between;align-items:center;gap:12px}.dialog-title h2,.dialog-title p{margin:0}.dialog-title p{margin-top:3px;color:var(--muted);font-size:13px}#eventList,#montageList{display:grid;gap:7px;margin-top:12px;overflow:auto;max-height:62vh}#eventList button{display:flex;justify-content:space-between;text-align:left}#montageList button{text-align:left;font-weight:700}#montageList button.active{border-color:var(--accent);background:#123f39;color:#7ff5e4}.channel-settings{display:grid;gap:12px;margin-top:16px}.channel-settings label{display:flex;align-items:center;justify-content:space-between;gap:12px;color:var(--muted)}.channel-settings select{min-width:180px}.channel-settings .check-setting{justify-content:flex-start;color:var(--text)}.check-setting input{width:24px;height:24px;min-height:24px;accent-color:var(--accent)}
@media(max-height:520px) and (orientation:landscape){#viewer{grid-template-rows:50px minmax(0,1fr)}header{padding:3px 7px}.compact .brand-mark{width:34px;height:34px}.status-row button,#montageButton{min-height:40px;padding:5px 9px}.arrow-button{width:54px;height:54px;min-height:54px;font-size:28px}#epochPad{width:74px;gap:5px;padding:5px}#workspace,#workspace.video-open{padding-right:74px}.video-tools{bottom:4px;left:4px;right:4px;padding:4px}.video-play{width:42px;height:42px;min-height:42px}.video-command{width:36px;height:36px;min-height:36px}#timelineDock{height:36px;left:92px}#channelPager{top:4px;right:4px}.pill{display:none}}
@media(max-width:900px) and (orientation:landscape){.brand-mark{display:none}.compact strong{max-width:18vw}.status-row{gap:4px}.status-row button{padding:6px 8px}#refreshButton,#fullscreenButton{padding:0}#logoutButton{display:none}#montageButton{min-width:132px;max-width:29vw}}
@media(display-mode:fullscreen){#fullscreenButton{display:none}}
@media(orientation:portrait){html.pairing,html.pairing body{overflow:auto}.pair-card{top:calc(var(--safe-top) + 12px);transform:translateX(-50%);width:min(440px,calc(100% - var(--safe-left) - var(--safe-right) - 24px));max-height:calc(100dvh - var(--safe-top) - var(--safe-bottom) - 24px);padding:20px;gap:14px}.pair-card .brand-mark{width:44px;height:44px}.pair-card h1{font-size:22px}.pair-card input{font-size:22px}#viewer{grid-template-rows:56px minmax(0,1fr)}header>*:not(.brand){display:none}header{justify-content:center}.compact strong{max-width:70vw}#workspace{padding:0}#eegPanel,#epochPad,#videoPanel{visibility:hidden}#rotateHint{position:absolute;z-index:30;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:28px;text-align:center;background:var(--bg)}#rotateHint strong{font-size:24px}#rotateHint span{color:var(--muted)}}
[hidden]{display:none!important}
