:root {
  color-scheme: dark;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #08111d;
  color: #f2f7fb;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; min-height: 100dvh; background: radial-gradient(ellipse 65% 55% at 90% 0%, #0d2b40 0%, transparent 70%), #08111d; }
.topbar { height: 74px; padding: 0 clamp(22px, 3.2vw, 54px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #1c2b3a; }
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 800; font-size: 19px; letter-spacing: -.04em; white-space: nowrap; }
.brand-light { font-weight: 600; color: #d9e5ec; }
.brand-mark { width: 31px; height: 31px; border: 3px solid #54d8ca; border-radius: 10px; display: grid; place-items: center; transform: rotate(-14deg); box-shadow: 0 0 22px #2ac9b13b; }
.brand-mark span { width: 10px; height: 10px; border-radius: 50%; background: #54d8ca; }
.topbar-right { display: flex; align-items: center; gap: 24px; color: #8fa6b7; font-size: 13px; }
.topbar-link { color: #d7e9ed; transition: color .2s; }
.topbar-link:hover { color: #67e4d3; }

.workspace { width: min(100%, 1720px); margin: 0 auto; display: grid; grid-template-columns: minmax(300px, 350px) minmax(0, 1fr); gap: clamp(22px, 3vw, 48px); padding: clamp(26px, 3.2vw, 52px); }
.sidebar { display: flex; flex-direction: column; align-self: start; }
.eyebrow { color: #55d9cb; font-size: 11px; letter-spacing: .17em; font-weight: 800; display: flex; align-items: center; gap: 9px; }
.eyebrow-line { width: 21px; height: 1px; background: currentColor; }
.sidebar-intro h1 { margin: 16px 0 11px; font-size: clamp(25px, 2.5vw, 35px); letter-spacing: -.055em; line-height: 1.2; }
.sidebar-intro p { margin: 0; color: #90a6b5; font-size: 14px; line-height: 1.85; }
.connect-form { margin-top: 30px; display: grid; gap: 11px; }
.connect-form label, .text-bar label { font-size: 12px; font-weight: 700; color: #d7e6ed; }
.code-field { display: flex; align-items: center; border: 1px solid #34495a; border-radius: 11px; background: #101f2d; transition: border-color .2s, box-shadow .2s; }
.code-field:focus-within { border-color: #5bd5c8; box-shadow: 0 0 0 3px #41cdb020; }
.code-icon { padding: 0 11px 0 16px; color: #4cd3c2; font-size: 20px; font-weight: 300; }
.code-field input { min-width: 0; width: 100%; height: 51px; padding: 0 14px 0 0; border: 0; outline: 0; background: transparent; color: #f3fbff; font-size: 17px; letter-spacing: .04em; }
.code-field input::placeholder { color: #60778a; letter-spacing: 0; font-size: 14px; }
.primary-button, .secondary-button { height: 49px; border-radius: 10px; font-weight: 750; font-size: 14px; transition: transform .15s, background .15s, border-color .15s; }
.primary-button { display: flex; align-items: center; justify-content: center; gap: 12px; border: 0; color: #061b1c; background: linear-gradient(110deg, #66ead8, #3fc7ba); box-shadow: 0 10px 26px #1fbfa124; }
.primary-button:not(:disabled):hover { transform: translateY(-1px); background: #81f1e1; }
.primary-button:disabled { opacity: .55; }
.secondary-button { border: 1px solid #34485b; background: transparent; color: #c7d6e0; }
.secondary-button:not(:disabled):hover { border-color: #d4e8e8; }
.secondary-button:disabled { opacity: .45; }

.connection-card { margin-top: 30px; border: 1px solid #26394a; border-radius: 15px; padding: 21px 20px 8px; background: linear-gradient(145deg, #102232, #0d1b29); }
.card-topline { display: flex; align-items: center; justify-content: space-between; }
.card-kicker { font-size: 11px; font-weight: 800; color: #7c95a7; letter-spacing: .12em; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #607889; box-shadow: 0 0 0 4px #6078891b; }
.status-dot[data-state="waiting"], .status-dot[data-state="connecting"] { background: #edba62; box-shadow: 0 0 0 4px #edba6225; }
.status-dot[data-state="connected"] { background: #5de4c6; box-shadow: 0 0 0 4px #5de4c629; }
.status-dot[data-state="error"] { background: #f0757f; box-shadow: 0 0 0 4px #f0757f25; }
.status-main { margin-top: 12px; font-size: 17px; font-weight: 750; }
.status-detail { min-height: 48px; margin: 7px 0 15px; color: #8da5b5; font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.status-rows { border-top: 1px solid #294052; }
.status-rows > div { padding: 13px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; border-bottom: 1px solid #22384a; }
.status-rows > div:last-child { border-bottom: 0; }
.status-rows span { color: #88a0b1; }
.status-rows strong { color: #d6e5ed; font-weight: 650; text-align: right; }
.privacy-note { margin-top: 23px; display: flex; gap: 11px; color: #8aa5af; }
.privacy-icon { width: 23px; height: 23px; flex: none; display: grid; place-items: center; border-radius: 7px; background: #1c4a49; color: #62ddc9; font-size: 14px; }
.privacy-note p { margin: 0; font-size: 12px; line-height: 1.7; }

.viewer-panel { min-width: 0; display: flex; flex-direction: column; }
.viewer-toolbar { min-height: 50px; display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.viewer-heading { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 750; }
.viewer-live-dot { width: 7px; height: 7px; border-radius: 50%; background: #57dec5; box-shadow: 0 0 0 4px #57dec522; }
.resolution-text { margin-left: 5px; color: #778fa1; font-size: 12px; font-weight: 500; }
.viewer-actions { display: flex; gap: 9px; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #2e4353; border-radius: 8px; background: #102030; color: #cedde5; }
.icon-button svg { width: 17px; height: 17px; }
.icon-button:not(:disabled):hover { border-color: #62d8c5; color: #6be6d2; }
.icon-button:disabled { opacity: .45; }
.screen-stage { position: relative; width: 100%; min-height: min(62vw, 600px); height: min(62vw, 600px); max-height: calc(100dvh - 250px); display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid #2c4252; border-radius: 16px; background: radial-gradient(ellipse at center, #122735 0%, #0a1723 68%); box-shadow: 0 18px 60px #02070b40, inset 0 0 0 1px #ffffff08; }
.screen-stage:fullscreen { height: 100vh; max-height: none; border: 0; border-radius: 0; background: #02070b; }
.screen-placeholder { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 25px; pointer-events: none; }
.screen-placeholder[hidden] { display: none; }
.screen-placeholder strong { margin-top: 20px; font-size: 17px; font-weight: 750; }
.screen-placeholder p { max-width: 290px; margin: 7px 0 0; color: #7d95a6; font-size: 12px; line-height: 1.7; }
.placeholder-graphic { position: relative; width: 130px; height: 120px; display: grid; place-items: center; }
.placeholder-screen { position: relative; z-index: 1; display: block; width: 89px; height: 59px; border: 2px solid #538c98; border-radius: 9px; background: linear-gradient(145deg, #163748, #11313a); box-shadow: 0 14px 40px #39c5b51a; }
.placeholder-screen::after { content: ""; position: absolute; width: 31px; height: 9px; left: 27px; bottom: -13px; border-bottom: 2px solid #538c98; border-left: 2px solid #538c98; border-right: 2px solid #538c98; border-radius: 0 0 5px 5px; }
.placeholder-screen span { display: block; width: 35px; height: 21px; margin: 16px auto; border-radius: 3px; background: linear-gradient(125deg, #37b9b5, #70e8ce); opacity: .9; }
.placeholder-orbit { position: absolute; border: 1px solid #2c647080; border-radius: 50%; }
.orbit-one { width: 115px; height: 115px; }
.orbit-two { width: 80px; height: 80px; }
.remote-canvas { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; outline: none; cursor: crosshair; touch-action: none; }
.remote-canvas[hidden] { display: none; }
.remote-canvas:focus-visible { box-shadow: 0 0 0 2px #62ddca; }
.stage-hint { position: absolute; left: 50%; bottom: 15px; transform: translateX(-50%); padding: 8px 11px; border-radius: 7px; background: #07121bc9; color: #c8dae4; font-size: 11px; white-space: nowrap; pointer-events: none; }
.stage-hint[hidden] { display: none; }
.control-bar { margin-top: 16px; padding: 17px 20px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid #263a4b; border-radius: 12px; background: #0f1e2d; }
.control-bar-copy { display: flex; flex-direction: column; gap: 5px; }
.control-bar-copy strong { font-size: 13px; }
.control-bar-copy span { color: #839cad; font-size: 12px; line-height: 1.5; }
.quick-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.quick-actions button { min-height: 34px; padding: 6px 11px; border: 1px solid #365062; border-radius: 7px; background: #172d3d; color: #d7e5ea; font-size: 12px; white-space: nowrap; }
.quick-actions button:not(:disabled):hover { border-color: #5edfc9; color: #7ee8d2; }
.quick-actions button:disabled { opacity: .45; }
.text-bar { margin-top: 11px; display: flex; align-items: center; gap: 11px; padding: 10px 12px 10px 19px; border: 1px solid #263a4b; border-radius: 12px; background: #0f1e2d; }
.text-bar label { white-space: nowrap; }
.text-bar input { flex: 1; min-width: 0; height: 32px; padding: 0 11px; border: 0; border-radius: 6px; outline: 0; background: #172d3c; color: #eff7fa; font-size: 12px; }
.text-bar input::placeholder { color: #718b9b; }
.text-bar input:focus { box-shadow: 0 0 0 1px #5bd9c4; }
.text-bar input:disabled { opacity: .5; }
.text-bar button { height: 32px; padding: 0 17px; border: 0; border-radius: 6px; background: #3cd0bc; color: #082125; font-size: 12px; font-weight: 800; }
.text-bar button:disabled { opacity: .45; }
.viewer-footnote { margin: 12px 2px 0; color: #708b9b; font-size: 11px; line-height: 1.6; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 290px minmax(0, 1fr); gap: 20px; padding: 26px; }
  .screen-stage { height: min(60vw, 540px); max-height: none; }
  .control-bar { align-items: flex-start; flex-direction: column; }
  .quick-actions { justify-content: flex-start; }
}

@media (max-width: 760px) {
  .topbar { height: 62px; padding: 0 20px; }
  .topbar-label { display: none; }
  .workspace { display: flex; flex-direction: column; gap: 20px; padding: 25px 16px 35px; }
  .sidebar { width: 100%; }
  .sidebar-intro h1 { margin-top: 12px; font-size: 26px; }
  .sidebar-intro p { font-size: 13px; }
  .connect-form { margin-top: 20px; grid-template-columns: 1fr 1fr; }
  .connect-form label, .code-field { grid-column: 1 / -1; }
  .connection-card { margin-top: 18px; }
  .privacy-note { margin-top: 13px; }
  .viewer-toolbar { min-height: 40px; }
  .screen-stage { height: min(72vw, 450px); min-height: 250px; }
  .control-bar { margin-top: 11px; padding: 14px; gap: 13px; }
  .text-bar { padding-left: 12px; }
  .viewer-footnote { margin-top: 10px; }
}

@media (max-width: 430px) {
  .topbar-link { font-size: 12px; }
  .resolution-text { display: none; }
  .screen-stage { min-height: 220px; height: 65vw; }
  .connect-form { gap: 9px; }
  .primary-button, .secondary-button { font-size: 12px; }
  .text-bar { gap: 7px; }
  .text-bar label { display: none; }
  .quick-actions { width: 100%; }
  .quick-actions button { flex: 1; }
}
