:root{color-scheme:dark;font-family:"PingFang SC","Noto Sans CJK SC","Microsoft YaHei",sans-serif;color:#eef2ef;background:#11161a;font-synthesis:none}*{box-sizing:border-box}body{margin:0;height:100vh;height:100dvh;display:flex;flex-direction:column}button,input{font:inherit}button{min-height:52px;min-width:64px;border:1px solid #46514e;border-radius:8px;padding:0 20px;background:transparent;color:inherit;cursor:pointer}button:active{background:#354039}button:disabled{opacity:.5;cursor:wait}button:focus-visible,input:focus-visible,a:focus-visible{outline:3px solid #b4d9b1;outline-offset:4px}header{height:80px;flex-shrink:0;display:flex;align-items:center;gap:24px;padding:0 32px;border-bottom:1px solid #313b3a}.brand{text-decoration:none;color:inherit;font-size:24px;font-weight:650;letter-spacing:-1px}#status{color:#b5beb9;font-size:15px;flex:1}nav{display:flex;gap:12px}main{flex:1;min-height:0;position:relative;overflow:auto}#pairing{max-width:1240px;padding:40px;margin:auto}.eyebrow{color:#b4d9b1;font-size:14px;letter-spacing:2px}h1{font-size:clamp(32px,4vw,54px);line-height:1.2;font-weight:550;letter-spacing:-1.5px;margin:20px 0}p{color:#b5beb9;font-size:17px;line-height:1.7}form{margin-top:32px}label{display:block;margin-bottom:12px;font-size:14px}.form-row{display:flex;gap:12px;max-width:580px}input{min-width:0;flex:1;background:#1c2428;border:1px solid #46514e;border-radius:8px;padding:14px 18px;color:#eef2ef;font-size:22px;letter-spacing:3px}.primary{background:#b4d9b1;color:#17251b;border:0;min-width:170px;font-weight:600}.primary:active{background:#99be98}.primary .material-icon{width:24px;height:24px;fill:currentColor;vertical-align:middle;margin-left:12px}#message{color:#efbe90;min-height:28px;margin:12px 0}footer{border-top:1px solid #313b3a;padding-top:24px;margin-top:28px;color:#98a59f;font-size:14px;line-height:1.8}#display{height:100%;width:100%;position:relative;background:#0b0f12;overflow:hidden}#screen,#video{width:100%;height:100%;object-fit:contain;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}#screen.stale,#video.stale{opacity:.2;pointer-events:none}#waiting{position:absolute;inset:0;display:flex;justify-content:center;align-items:center;flex-direction:column;padding:24px;text-align:center;pointer-events:none}#waiting strong{font-size:28px;font-weight:500}.hint{font-size:14px}[hidden]{display:none!important}@media(max-height:560px){header{height:64px;padding:0 20px}#pairing{padding:24px 32px}h1{font-size:32px;margin:12px 0}h1 br{display:none}form{margin-top:16px}footer{margin-top:16px;padding-top:12px}}@media(max-width:600px){header{padding:0 16px;gap:12px}.brand{font-size:20px}#status{font-size:13px}nav{gap:8px}nav button{padding:0 12px;min-width:52px}.form-row{flex-direction:column}.wide{display:none}h1{letter-spacing:-.5px}}@media(prefers-reduced-motion:no-preference){button{transition:background .15s ease}#screen,#video{transition:opacity .2s ease}}

/* Pairing and browser preferences share a responsive home. */
#pairing h1{font-size:clamp(28px,3vw,38px);letter-spacing:-1px;margin:12px 0 32px}
.pairing-layout{display:grid;grid-template-columns:minmax(0,1fr);gap:36px}
.pairing-panel,.setup-panel{min-width:0}
.pairing-panel{width:100%;max-width:440px;margin:0 auto}
.qr-pairing{display:flex;flex-direction:column;align-items:center;text-align:center;margin:0}
.qr-image{display:grid;place-items:center;width:240px;height:240px;padding:8px;border:1px solid #313b3a;border-radius:16px;background:#1c2428;margin-bottom:24px}
.qr-pairing img{width:224px;height:224px;max-width:100%;object-fit:contain;background:white;border-radius:8px}
.qr-pairing h2{font-size:20px;font-weight:550;margin:0}
#pair-instructions{font-size:14px;line-height:1.7;margin:10px 0 0;max-width:360px}
#qr-status{font-size:13px;margin:12px 0;color:#b4d9b1}
#refresh-qr{min-height:44px;font-size:13px}
#connect-form{margin-top:28px}
#connect{width:100%;min-height:56px}
#code-entry{border:0;padding:24px 0 0;margin:0 0 20px;min-width:0;border-top:1px solid #313b3a}
#code-entry legend{padding:0;font-size:14px;color:#b5beb9}
.pin-inputs{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:8px;direction:ltr}
#code-entry .pin-digit{width:100%;min-width:0;height:58px;padding:0;text-align:center;font-size:28px;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;letter-spacing:0;border-radius:10px;caret-color:#b4d9b1}
#code-entry .pin-digit:focus{border-color:#b4d9b1;outline:2px solid #b4d9b1;outline-offset:2px;background:#24352c}
.pairing-panel footer{font-size:12px;line-height:1.8;margin-top:20px;padding-top:20px}
#message:empty{display:none}
#remembered-device{margin:0 0 24px}
.setup-panel{border-top:1px solid #313b3a;padding-top:28px}
#setup-title{font-size:22px;font-weight:550;margin:0 0 12px}
.settings-list .launch-option{width:100%;margin:0;padding:18px 0;border-bottom:1px solid #313b3a;align-items:center;gap:24px}
.settings-list .launch-option span{flex:1;order:0}
.settings-list .launch-option input{order:1;margin:0;flex:0 0 44px;width:44px;height:26px;border-radius:20px;background:#303b3a;border:1px solid #46514e}
.settings-list .launch-option input::before{content:"";display:block;width:16px;height:16px;margin:4px;border-radius:50%;background:#b5beb9}
.settings-list .launch-option input:checked{background:#b4d9b1;border-color:#b4d9b1}
.settings-list .launch-option input:checked::before{transform:translateX(18px);background:#17251b}
.settings-list .launch-option strong{font-size:14px;font-weight:550}
.settings-list .launch-option small{font-size:12px;line-height:1.6}
.settings-list .renderer-options{margin:24px 0 0}
.settings-list .renderer-options legend{font-size:13px;color:#98a59f;margin-bottom:4px}
.settings-list .renderer-cards{display:flex;flex-direction:column;gap:0}
.settings-list .renderer-card{align-items:center;gap:20px;min-height:0;padding:14px 0;border:0;border-bottom:1px solid #313b3a;border-radius:0;background:transparent;box-shadow:none}
.settings-list .renderer-card input{order:1;margin:0 4px 0 auto;width:20px;height:20px}
.settings-list .renderer-card span{flex:1;order:0}
.settings-list .renderer-card strong{font-size:14px;font-weight:550}
.settings-list .renderer-card.selected strong{color:#b4d9b1}
.settings-list .renderer-card.selected{background:transparent;box-shadow:none;border:0;border-bottom:1px solid #313b3a}
.settings-list .renderer-card small{font-size:12px;margin-top:0}
.settings-list .renderer-card em{font-size:10px}
.settings-list .secure-setup{margin:0;padding:20px 0;border-radius:0;border-bottom:1px solid #313b3a;background:transparent;font-size:13px}
.settings-list .secure-setup p{font-size:12px}
#location-status:empty{display:none}
@media(min-width:960px){.pairing-layout{grid-template-columns:minmax(320px,.9fr) minmax(0,1.1fr);gap:56px}.pairing-panel{max-width:380px}.setup-panel{border-top:0;border-left:1px solid #313b3a;padding:0 0 0 40px}}
@media(max-width:959px){#pairing{max-width:620px;padding:28px 24px}#pairing h1{margin-bottom:24px}.setup-panel{padding-top:28px}.qr-image{width:224px;height:224px;margin-bottom:20px}.qr-pairing img{width:208px;height:208px}#connect-form{margin-top:24px}}
@media(max-width:380px){#pairing{padding:24px 16px}.pin-inputs{gap:6px}#code-entry .pin-digit{height:52px;font-size:24px}}
#touch-surface{position:absolute;inset:0;touch-action:none;user-select:none;-webkit-user-select:none;z-index:1}#touch-surface.stale{pointer-events:none}
#video-canvas{width:100%;height:100%;object-fit:contain;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}#video-canvas.stale{opacity:.2;pointer-events:none}
/* Keep a layout box for decoding without placing a native video surface on screen. */
#video.offscreen-video{position:fixed;left:-10000px;top:0;width:1px;height:1px;pointer-events:none}
.launch-option{display:flex;align-items:flex-start;gap:14px;width:fit-content;margin-top:24px;cursor:pointer}.launch-option input{appearance:none;flex:0 0 auto;width:24px;height:24px;margin:1px 0 0;padding:0;border-radius:6px;background:#1c2428;letter-spacing:0}.launch-option input:checked{border-color:#b4d9b1;background:#b4d9b1 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2317251b' d='m9.2 16.4-4.3-4.3 1.4-1.4 2.9 2.9 8.5-8.5 1.4 1.4z'/%3E%3C/svg%3E") center/20px no-repeat}.launch-option span{display:grid;gap:4px}.launch-option strong{font-size:15px;font-weight:600}.launch-option small{color:#98a59f;font-size:13px;line-height:1.5}
.secure-setup{margin:28px 0;padding:16px 20px;background:#1c2428;border-radius:16px;color:#b5beb9;font-size:14px}.secure-setup summary{cursor:pointer;color:#eef2ef}.secure-setup p{font-size:14px}.secure-setup code{display:block;overflow-wrap:anywhere;font-size:12px;color:#b4d9b1}.secure-links{display:flex;flex-wrap:wrap;gap:20px;margin-top:16px}.secure-links a{color:#b4d9b1}#audio-message{position:absolute;right:16px;bottom:16px;z-index:2;max-width:min(85%,360px);padding:10px 14px;background:#1c2428e8;border:1px solid #46514e;border-radius:14px;font-size:13px;color:#efbe90;line-height:1.4}@media(max-width:600px){#audio-message{left:8px;right:8px;bottom:8px;max-width:none}}

#phone-connect{pointer-events:auto;position:relative;z-index:2}#phone-connect-message{max-width:560px}

#remembered-device{padding:20px 24px;background:#1c2428;border:1px solid #46514e;border-radius:16px}#remembered-device strong{font-size:18px;color:#b4d9b1}#remembered-device p{margin:8px 0 0;font-size:15px}

#display.ignore-browser-zoom{position:fixed;transform-origin:0 0;z-index:3}
#screen-next,#screen-third,#held-frame{width:100%;height:100%;object-fit:contain;touch-action:none;user-select:none;-webkit-user-select:none}#screen-next.stale,#screen-third.stale,#held-frame.stale{opacity:.2;pointer-events:none}

#media-message{position:absolute;left:16px;top:16px;z-index:2;max-width:85%;padding:10px 14px;background:#1c2428e8;border-radius:12px;font-size:13px;color:#efbe90;pointer-events:none}

.renderer-options{border:0;margin:28px 0 0;padding:0;min-width:0}.renderer-options legend{padding:0;margin-bottom:12px;font-size:15px;font-weight:600}.renderer-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.renderer-card{display:flex;align-items:flex-start;gap:12px;margin:0;padding:18px 16px;min-height:130px;border:1px solid #46514e;border-radius:12px;background:#1c2428;cursor:pointer}.renderer-card.selected{border-color:#b4d9b1;background:#24352c;box-shadow:inset 0 0 0 1px #b4d9b1}.renderer-card input{appearance:auto;accent-color:#b4d9b1;flex:0 0 auto;width:20px;height:20px;margin:2px 0 0;padding:0;letter-spacing:0}.renderer-card span{display:flex;flex-wrap:wrap;align-items:center;gap:6px}.renderer-card strong{font-size:15px;line-height:1.5}.renderer-card em{font-style:normal;font-size:11px;color:#b4d9b1;border:1px solid #465e4b;border-radius:4px;padding:1px 5px}.renderer-card small{flex-basis:100%;margin-top:3px;font-size:13px;line-height:1.6;color:#b5beb9}.renderer-hint{font-size:13px;line-height:1.6;color:#efbe90;margin:12px 0 0}@media(max-width:759px){.renderer-cards{grid-template-columns:1fr}.renderer-card{min-height:0;padding:16px}}

#location-message{position:absolute;right:16px;top:16px;z-index:2;max-width:min(85%,360px);padding:10px 14px;background:#1c2428e8;border-radius:12px;font-size:13px;color:#efbe90;pointer-events:none}

/* Remains accessible in immersive display mode; absent for sources without Back. */
#desktop-back{position:absolute;left:12px;bottom:12px;z-index:2;opacity:.85}

#settings-dialog{position:fixed;inset:0;margin:auto;width:min(560px,calc(100% - 32px));max-height:calc(100% - 32px);overflow:auto;padding:24px;border:1px solid #46514e;border-radius:20px;background:#1c2428;color:#eef2ef;box-shadow:0 24px 80px #0008}
#settings-dialog::backdrop{background:#0009}
.settings-heading{display:flex;align-items:center;justify-content:space-between;gap:20px}
.settings-heading h2{margin:0;font-size:24px;font-weight:550}
.settings-actions{display:flex;flex-wrap:wrap;gap:12px;margin-top:24px}
#settings-location-status:empty{display:none}

/* Keep text opaque and readable even over a white video frame. Touches pass through. */
#debug-overlay{position:absolute;top:12px;right:12px;top:max(12px,env(safe-area-inset-top));right:max(12px,env(safe-area-inset-right));z-index:3;width:min(360px,calc(100% - 24px));max-height:calc(100% - 24px);overflow:hidden;padding:14px 16px;border:1px solid #ffffff30;border-radius:12px;background:rgba(8,14,20,.86);color:#f3f7fa;box-shadow:0 4px 20px #0005;pointer-events:none;user-select:none;font-size:12px;line-height:1.5;font-variant-numeric:tabular-nums}
#debug-overlay h2{margin:0 0 10px;font-size:14px;font-weight:600;color:#fff}
#debug-overlay dl{display:grid;gap:6px;margin:0}
#debug-overlay dl div{display:grid;grid-template-columns:minmax(90px,auto) minmax(0,1fr);gap:12px;align-items:baseline}
#debug-overlay dt{color:#cbd5df}
#debug-overlay dd{margin:0;text-align:right;overflow-wrap:anywhere}
#debug-overlay p{margin:10px 0 0;padding-top:8px;border-top:1px solid #ffffff25;color:#cbd5df;font-size:11px;line-height:1.5}
#display.debug-visible #location-message{top:auto;bottom:16px;left:16px;right:auto}
@media(max-width:480px),(max-height:480px){#debug-overlay{padding:10px 12px;font-size:11px;width:min(320px,calc(100% - 24px))}#debug-overlay h2{font-size:12px;margin-bottom:6px}#debug-overlay dl{gap:4px}}

.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
#debug-overlay .debug-summary{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-bottom:10px;padding-bottom:12px;border-bottom:1px solid #ffffff25}
#debug-overlay .debug-summary>div{grid-template-columns:16px minmax(0,1fr);gap:6px;align-items:center}
#debug-overlay .debug-summary svg{display:block;width:16px;height:16px;fill:none;stroke:#b4d9b1;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
#debug-overlay .debug-summary dd{text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:13px;font-weight:600}
@media(max-width:480px),(max-height:480px){#debug-overlay .debug-summary{gap:8px;padding-bottom:10px}#debug-overlay .debug-summary>div{gap:4px}#debug-overlay .debug-summary dd{font-size:12px}}

#code-entry .pin-digit.keypad-active{border-color:#b4d9b1;box-shadow:0 0 0 2px #b4d9b1;background:#24352c}
#pairing-keypad{position:fixed;inset:auto;margin:0;padding:12px;width:304px;max-width:calc(100% - 24px);overflow:auto;overscroll-behavior:contain;z-index:10;border:1px solid #58645e;border-radius:16px;background:#19221f;color:#eef2ef;box-shadow:0 12px 48px #0009;--keypad-key-height:48px}
.keypad-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:40px;margin-bottom:10px}
#keypad-title{font-size:12px;font-weight:500;color:#b5beb9}
#keypad-code{font:18px/1.4 ui-monospace,SFMono-Regular,Consolas,monospace;white-space:nowrap;color:#b4d9b1}
#keypad-done{min-width:44px;min-height:40px;padding:0 8px;border:0;color:#b4d9b1;font-size:13px}
.keypad-keys{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
#pairing-keypad .keypad-keys button{min-width:0;height:var(--keypad-key-height);min-height:var(--keypad-key-height);padding:0 8px;border:1px solid #46514e;border-radius:8px;background:#25312c;font-size:22px;line-height:1;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
#pairing-keypad .keypad-keys button:active{background:#b4d9b1;color:#17251b}
#pairing-keypad #keypad-clear{font-size:13px;background:transparent;color:#cbd5cf}
#keypad-delete svg{display:block;width:24px;height:24px;margin:auto;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
@media(max-height:480px){body.pin-keypad-open #topbar{display:none}}
