:root {
  color-scheme: light;
  --canvas: #f4f5f7;
  --surface: #fff;
  --ink: #18232f;
  --muted: #526173;
  --quiet: #687585;
  --line: #dce2e9;
  --action: #2455aa;
  --action-hover: #1a458f;
  --accent-wash: #edf2fb;
  --green: #248258;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { display: flex; flex-direction: column; min-height: 100vh; margin: 0; background: var(--canvas); color: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:where(button, input, a, .surface):focus-visible { outline: 2px solid #3e70ce; outline-offset: 3px; }
a { color: inherit; text-decoration: none; }
svg { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; gap: 18px; max-width: 1080px; min-height: 66px; margin: auto; padding: 0 40px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 19px; font-weight: 730; letter-spacing: -.035em; }
.brand img { width: 30px; height: 30px; }
.header-label { border-left: 1px solid var(--line); padding-left: 18px; color: var(--quiet); font-size: 12px; }
.status { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 590; }
.status i, .live-mark { width: 8px; height: 8px; flex: none; border-radius: 50%; background: #a57025; }
.status[data-state="online"] i { background: var(--green); }
.status[data-state="offline"] i { background: #a74646; }

.shell { display: flex; flex: 1; flex-direction: column; width: 100%; max-width: 1080px; margin: 0 auto; padding: 52px 40px 0; }
.page-heading { margin-bottom: 26px; }
.page-heading h1 { margin: 0; font-size: clamp(31px, 4vw, 43px); line-height: 1.1; letter-spacing: -.05em; font-weight: 730; }
.page-heading p { margin: 9px 0 0; color: var(--muted); line-height: 1.5; }
.workbench { display: grid; grid-template-columns: 1fr 1.08fr; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 2px 5px #1d344809; }
.workbench-panel { display: flex; flex-direction: column; justify-content: space-between; min-width: 0; min-height: 291px; padding: 29px 30px 25px; }
.share { background: #fafbfd; border-right: 1px solid var(--line); }
.tile { display: grid; width: 39px; height: 39px; flex: none; place-items: center; border: 1px solid #dfe7f5; border-radius: 9px; background: var(--accent-wash); color: var(--action); }
.connect .tile { border-color: #e1e6ed; background: #f3f5f8; color: #455870; }
.panel-heading h2 { margin: 16px 0 6px; font-size: 22px; font-weight: 690; line-height: 1.2; letter-spacing: -.032em; }
.panel-heading p, dialog p { margin: 0; color: var(--muted); line-height: 1.52; font-size: 13px; }
.panel-heading p { max-width: 275px; }
.panel-body { padding-top: 24px; }
.field-label { display: block; margin-bottom: 7px; color: var(--ink); font-size: 12px; font-weight: 650; }
.join-row, .code-box { display: flex; gap: 8px; align-items: stretch; }

.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 13px; border: 1px solid transparent; border-radius: 7px; color: var(--ink); font-size: 13px; font-weight: 640; white-space: nowrap; }
.button svg, .icon-button svg { width: 16px; height: 16px; }
.button-primary { background: var(--action); color: #fff; }
.button-primary:hover:not(:disabled) { background: var(--action-hover); }
.button-primary:disabled { border-color: #e0e5eb; background: #e9edf2; color: #657386; }
.button-secondary, .icon-button { border-color: #d2dae4; background: #fff; }
.button-secondary:hover:not(:disabled), .icon-button:hover:not(:disabled) { border-color: #b8c5d5; background: #f4f7fb; }
.button-secondary:disabled { color: #778496; background: #f5f7f9; }
.button-danger { border-color: #efd2d2; background: #fff4f3; color: #a03037; }
.button-danger:hover:not(:disabled) { background: #fbe7e7; }
.icon-button { width: 42px; flex: none; padding: 0; }
input, .code-box output { min-width: 0; min-height: 42px; padding: 0 11px; border: 1px solid #cbd5e1; border-radius: 7px; background: #fff; color: var(--ink); font: 600 16px ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace; letter-spacing: .05em; }
input { width: 100%; }
input::placeholder { color: #7d8997; opacity: 1; }
input:disabled { background: #f6f7f9; }
.code-box output { display: flex; align-items: center; flex: 1; color: var(--action); letter-spacing: .09em; }
.hint { margin: 8px 0 0; color: var(--quiet); font-size: 12px; line-height: 1.45; }
.inline-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 18px; margin-top: 7px; color: var(--quiet); font-size: 12px; font-variant-numeric: tabular-nums; }
.text-button { padding: 1px 0; border: 0; background: transparent; color: var(--action); font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
.inline-actions { display: flex; gap: 12px; }
.downloads { display: flex; flex-wrap: wrap; gap: 8px; }
.downloads a { text-decoration: none; }
.security { display: flex; align-items: center; gap: 8px; margin: 17px 0 0; color: var(--quiet); font-size: 12px; }
.security svg { width: 15px; height: 15px; color: #536682; }
.notice { margin: 16px 0 0; padding: 11px 13px; border: 1px solid #d2ddee; border-radius: 8px; background: #edf3fc; color: #294568; font-size: 13px; line-height: 1.45; }
.app-footer { display: flex; justify-content: space-between; align-items: baseline; gap: 15px; margin-top: auto; padding: 36px 0 16px; color: var(--quiet); font-size: 11px; }
.app-footer > span:first-child { min-width: 0; overflow-wrap: anywhere; }
#server-host { margin-left: 5px; color: var(--muted); font: 11px ui-monospace, monospace; }
#version { flex: none; }

dialog { width: min(495px, calc(100vw - 30px)); max-height: calc(100vh - 36px); padding: 23px; border: 1px solid #d1dae5; border-radius: 13px; background: var(--surface); color: var(--ink); box-shadow: 0 14px 60px #18283b38; }
dialog::backdrop { background: #13233775; }
.dialog-heading { display: flex; gap: 12px; align-items: flex-start; }
.dialog-heading h2 { margin: 0 0 5px; font-size: 19px; font-weight: 700; letter-spacing: -.024em; }
.dialog-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 17px; }
.dialog-actions .hint { margin: 0 auto 0 0; font-variant-numeric: tabular-nums; }
.update-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; padding: 12px 14px; border: 1px solid #d2ddee; border-radius: 8px; background: #edf3fc; }
.update-actions { display: flex; flex: none; gap: 8px; }
.perf-canvas { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; }
.perf-report { width: 100%; margin-top: 14px; padding: 10px; border: 1px solid #d8e0e9; border-radius: 8px; font: 12px/1.5 ui-monospace, monospace; resize: vertical; }
.update-banner strong { color: #294568; font-size: 13px; }
.update-banner p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.permission-note { display: grid; justify-items: start; gap: 7px; margin-top: 13px; padding: 12px; border: 1px solid #eddaba; border-radius: 8px; background: #fdf7ec; }
.permission-note strong { color: #69471c; font-size: 13px; }
.permission-note button { min-height: 35px; }
.screen-list, .consent-list { display: grid; gap: 8px; margin-top: 17px; }
.screen-list:empty { display: none; }
#screen-error:empty { display: none; }
.choice { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 9px 11px; border: 1px solid #d8e0e9; border-radius: 8px; background: #fff; color: var(--ink); text-align: left; }
.choice:hover:not(:disabled), .choice[aria-pressed="true"] { border-color: #7394c7; background: #f0f5fc; }
.choice:disabled { opacity: .56; }
.choice > svg { color: var(--action); }
.choice span { display: grid; flex: 1; gap: 3px; min-width: 0; }
.choice strong { font-size: 13px; }
.choice small { color: var(--muted); font-size: 12px; }
.choice img { width: 76px; height: 44px; object-fit: contain; border-radius: 4px; background: #e9edf2; }

.shell:has(.stage:not([hidden])) { max-width: 1500px; padding: 20px 24px 0; }
.stage {
  --stage-ink: #f4f6f9;
  --stage-muted: #b8c3d1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  max-height: calc(100dvh - 138px);
  border: 1px solid #293641;
  border-radius: 10px;
  background: #111923;
  color: var(--stage-ink);
}
.stage:fullscreen { width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; }
.stage-bar, .stage-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 13px; background: #17212d; }
.stage-info, .stage-actions { display: flex; align-items: center; gap: 10px; }
.stage-info { min-width: 0; }
.stage-info h2 { margin: 0; font-size: 14px; font-weight: 670; }
.stage-info p { margin: 3px 0 0; color: var(--stage-muted); font-size: 11px; }
.live-mark { background: #7ac09c; }
.stage:not([data-connected="true"]) .live-mark { background: #d0a163; }
.quality { color: var(--stage-muted); font: 11px ui-monospace, monospace; white-space: nowrap; }
.stage .icon-button { min-height: 34px; width: 36px; border-color: #425065; background: #212e3d; color: var(--stage-ink); }
.stage .icon-button:hover { background: #304055; }
.stage .button-danger, .indicator .button-danger { min-height: 34px; border-color: #784747; background: #412d34; color: #ffd9d8; }
.stage .button-danger:hover, .indicator .button-danger:hover { background: #53343d; }
.surface { position: relative; flex: 1; min-height: 0; overflow: hidden; aspect-ratio: 16 / 9; background: #0a1017; outline-offset: -2px !important; touch-action: none; }
/* A host that cannot hide its pointer already shows one in the video. */
.surface[data-host-cursor="shown"] { cursor: none; }
.stream-quality { min-height: 34px; padding: 0 6px; border: 1px solid #49576a; border-radius: 7px; background: #17212d; color: #f4f6f9; font-size: 12px; }
.audio-choice { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; }
.surface video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.stage:fullscreen .surface { aspect-ratio: auto; }
.stage-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 18px; background: #101923; text-align: center; }
.stage-tile { display: grid; width: 45px; height: 45px; place-items: center; border: 1px solid #40516a; border-radius: 8px; background: #202d3e; color: #c8d8ed; }
.stage-placeholder h3 { margin: 13px 0 5px; font-size: 18px; font-weight: 650; }
.stage-placeholder p { margin: 0; color: var(--stage-muted); font-size: 13px; }
.stage-footer { min-height: 36px; padding-block: 7px; color: var(--stage-muted); font-size: 11px; }

.indicator { min-height: 100vh; flex-direction: row; justify-content: space-between; align-items: center; gap: 6px; padding: 3px 3px 3px 9px; border: 1px solid #49576a; background: #17212d; color: #f4f6f9; user-select: none; -webkit-app-region: drag; }
.indicator strong { display: flex; align-items: center; gap: 5px; font-size: 11px; white-space: nowrap; }
.indicator strong span { width: 7px; height: 7px; flex: none; border-radius: 50%; background: #eb8189; }
.indicator .button { min-height: 24px; padding: 0 7px; font-size: 11px; -webkit-app-region: no-drag; }

@media (max-width: 740px) {
  .top-inner { min-height: 58px; padding-inline: 23px; }
  .shell { padding: 32px 23px 0; }
  .page-heading { margin-bottom: 19px; }
  .workbench { grid-template-columns: 1fr; }
  .workbench-panel { min-height: 0; padding: 22px; }
  .share { border-right: 0; border-bottom: 1px solid var(--line); }
  .panel-heading h2 { margin-top: 11px; font-size: 20px; }
  .panel-heading p { max-width: none; }
  .panel-body { padding-top: 18px; }
  .quality, #fullscreen-hint { display: none; }
  .shell:has(.stage:not([hidden])) { padding: 12px 12px 0; }
  .stage { max-height: calc(100dvh - 122px); }
}
@media (max-width: 390px) {
  .top-inner { padding-inline: 15px; }
  .header-label { display: none; }
  .shell { padding-inline: 15px; }
  .workbench-panel { padding: 17px; }
  .stage-bar, .stage-footer { padding-inline: 8px; }
  .stage-info, .stage-actions { gap: 6px; }
  .stage .button-danger { padding-inline: 8px; }
}
