:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", "Noto Sans TC", system-ui, sans-serif;
  --bg: #080b11;
  --surface: #10151e;
  --surface-raised: #171e29;
  --surface-soft: #202938;
  --line: #2a3443;
  --text: #edf2f7;
  --muted: #8d9aab;
  --accent: #55d6be;
  --accent-deep: #0f766e;
  --blue: #63a8ff;
  --danger: #ff5d68;
  --warning: #ffb648;
  --radius: 16px;
  --shadow: 0 22px 60px rgb(0 0 0 / 30%);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
.rolling-door-only { display: none; }

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
}

.brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid rgb(85 214 190 / 45%);
  border-radius: 15px;
  background: linear-gradient(145deg, rgb(85 214 190 / 20%), rgb(99 168 255 / 8%));
  color: var(--accent);
  font-size: 25px;
  font-weight: 800;
  box-shadow: inset 0 0 28px rgb(85 214 190 / 8%);
}

.brand-mark.small { width: 38px; height: 38px; border-radius: 11px; font-size: 18px; }
.primary-button, .secondary-button, .danger-button, .ghost-button, .text-button, .nav-item {
  border: 0;
  cursor: pointer;
}
.primary-button, .secondary-button, .danger-button {
  min-height: 46px;
  border-radius: 11px;
  padding: 0 18px;
  font-weight: 700;
}
.primary-button { background: var(--accent); color: #07110f; }
.primary-button:hover { background: #78e6d2; }
.secondary-button { border: 1px solid var(--line); background: var(--surface-soft); }
.danger-button { border: 1px solid rgb(255 93 104 / 55%); background: #8f2730; color: #fff; cursor: pointer; }
.danger-button:hover { background: #aa303b; }
.ghost-button, .text-button { background: transparent; color: var(--muted); }
.text-button { color: var(--accent); }

.login-view {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
  background:
    radial-gradient(circle at 18% 12%, rgb(85 214 190 / 13%), transparent 28%),
    radial-gradient(circle at 82% 86%, rgb(99 168 255 / 10%), transparent 30%),
    linear-gradient(135deg, #080b11, #0d1420);
}
.login-panel {
  width: min(100%, 420px);
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgb(16 21 30 / 92%);
  box-shadow: var(--shadow);
}
.login-panel h1 { margin: 14px 0 8px; font-size: 28px; }
.login-copy, .safety-note { color: var(--muted); line-height: 1.6; }
.google-login { display: grid; min-height: 44px; margin-top: 26px; place-items: center; transition: opacity .15s ease; }
.google-login.busy { pointer-events: none; opacity: .5; }
.native-google-button { width: min(100%, 340px); min-height: 48px; border: 1px solid #8ab4f8; border-radius: 12px; background: #f8faff; color: #18202b; font-weight: 700; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted); font-size: 11px; }
.login-divider::before, .login-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.pairing-login-form { display: grid; gap: 9px; }
.pairing-login-form > label { color: var(--muted); font-size: 12px; }
.pairing-input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.pairing-input-row input {
  min-width: 0;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0 13px;
  background: #0b1018;
  color: var(--text);
  letter-spacing: .08em;
}
.pairing-input-row input:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px rgb(85 214 190 / 12%); }
.pairing-help { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.toggle-form select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 13px;
  background: #0b1018;
  color: var(--text);
  outline: none;
}
.toggle-form select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(85 214 190 / 12%); }
.form-error { min-height: 20px; margin: 0; color: var(--danger); font-size: 13px; }
.safety-note { margin: 20px 0 0; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12px; }

.app-shell { min-height: 100vh; }
.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  min-height: 70px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: rgb(8 11 17 / 90%);
  backdrop-filter: blur(16px);
}
.brand-lockup { display: flex; align-items: center; gap: 11px; }
.brand-lockup div:last-child { display: grid; gap: 2px; }
.brand-lockup span { color: var(--muted); font-size: 11px; }
.desktop-nav { display: flex; gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.nav-item { padding: 8px 18px; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px; }
.nav-item.active { background: var(--surface-soft); color: var(--text); }
.header-actions { display: flex; justify-content: flex-end; align-items: center; gap: 14px; }
.operator-summary { display: grid; min-width: 0; text-align: right; }
.operator-summary strong { max-width: 180px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.operator-summary span { color: var(--muted); font-size: 10px; }
.connection-pill, .tag, .source-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}
.connection-pill.live { border-color: rgb(85 214 190 / 45%); color: var(--accent); }
.connection-pill.offline { border-color: rgb(255 93 104 / 45%); color: var(--danger); }

main { width: min(100%, 1680px); margin: 0 auto; padding: 22px; }
.view-panel { animation: panel-in .2s ease-out; }
@keyframes panel-in { from { opacity: 0; transform: translateY(4px); } }
.workspace-grid {
  display: grid;
  grid-template-columns: 250px minmax(420px, 1fr) 280px;
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.status-rail, .control-rail { padding: 24px; background: #0d121a; }
.status-rail { border-right: 1px solid var(--line); }
.control-rail { border-left: 1px solid var(--line); }
.section-heading h2, .timeline-header h2, .panel-card h2 { margin: 0; font-size: 18px; }
.status-list { display: grid; gap: 0; margin: 24px 0; }
.status-list div { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.status-list dt { color: var(--muted); font-size: 12px; }
.status-list dd { margin: 0; text-align: right; font-size: 13px; font-weight: 700; }
.io-card, .safety-summary { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.io-card h3, .safety-summary h3 { margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.io-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 12px; }
.io-row b { color: var(--muted); font-size: 11px; }
.io-row b.active { color: var(--accent); }

.device-stage { display: flex; min-width: 0; flex-direction: column; padding: 24px; background: linear-gradient(180deg, #141b26, #10151e); }
.stage-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.stage-title h1 { margin: 0; font-size: clamp(24px, 3vw, 38px); font-weight: 600; }
.source-badge { border-color: rgb(99 168 255 / 34%); color: var(--blue); }
.camera-frame {
  position: relative;
  width: 100%;
  min-height: 380px;
  overflow: hidden;
  border: 1px solid #354257;
  border-radius: 15px;
  padding: 0;
  background: #06080d;
  cursor: zoom-in;
}
.camera-frame:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.camera-scene { position: absolute; inset: 0; background: linear-gradient(180deg, #1d2531 0 16%, #111720 16% 78%, #0b0e13 78%); }
.scene-ceiling { position: absolute; inset: 10% 10% auto; height: 6px; background: #3c4857; box-shadow: 0 12px 28px #000; }
.shutter-slats {
  position: absolute;
  inset: 16% 12% 22%;
  border: 1px solid #505d6d;
  background: repeating-linear-gradient(180deg, #3c4653 0 9px, #222b36 10px 13px);
  box-shadow: inset 0 0 60px rgb(0 0 0 / 55%), 0 25px 50px rgb(0 0 0 / 30%);
}
.scene-floor { position: absolute; inset: 78% 0 0; background: linear-gradient(160deg, #171c23, #090b0f); }
.camera-scene::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 45%, transparent 25%, rgb(0 0 0 / 55%) 100%); }
.camera-label, .camera-time, .camera-warning { position: absolute; z-index: 2; border-radius: 7px; padding: 6px 9px; background: rgb(6 8 13 / 78%); font-size: 11px; backdrop-filter: blur(8px); }
.camera-label { top: 14px; left: 14px; color: var(--blue); }
.camera-time { right: 14px; bottom: 14px; color: #c7d0dc; }
.camera-warning { inset: 50% auto auto 50%; transform: translate(-50%, -50%); background: rgb(116 38 42 / 92%); color: #fff; font-size: 15px; }
.position-panel { margin-top: 20px; }
.position-copy { display: flex; align-items: baseline; justify-content: space-between; }
.position-copy span { color: var(--muted); font-size: 13px; }
.position-copy strong { font-size: 30px; font-variant-numeric: tabular-nums; }
.progress-track { height: 12px; margin-top: 12px; overflow: hidden; border-radius: 999px; background: #080b10; }
.progress-fill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-deep), var(--accent)); transition: width .15s linear; }
.position-scale { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 10px; }

.control-stack { display: grid; gap: 10px; margin: 22px 0 12px; }
.control-button { display: flex; min-height: 76px; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 12px; padding: 0 18px; background: var(--surface); cursor: pointer; text-align: left; }
.control-button span { color: var(--muted); font-size: 10px; letter-spacing: .15em; }
.control-button strong { font-size: 16px; }
.control-button.open:hover:not(:disabled) { border-color: var(--accent); }
.control-button.close:hover:not(:disabled) { border-color: var(--blue); }
.control-button.stop { border-color: rgb(255 93 104 / 62%); background: linear-gradient(120deg, rgb(255 93 104 / 20%), rgb(255 93 104 / 7%)); }
.control-button.stop strong, .control-button.stop span { color: #ff8b93; }
.control-button:disabled { cursor: not-allowed; opacity: .38; }
.control-reason { min-height: 36px; margin: 0 0 15px; color: var(--warning); font-size: 12px; line-height: 1.5; }
.safety-summary ul { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.safety-summary li { position: relative; padding-left: 19px; color: var(--muted); font-size: 12px; }
.safety-summary li::before { content: ""; position: absolute; left: 0; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: #566273; }
.safety-summary li.pass { color: #dce6ee; }
.safety-summary li.pass::before { background: var(--accent); box-shadow: 0 0 10px rgb(85 214 190 / 50%); }
.safety-summary li.fail::before { background: var(--danger); }
.home-security-card { margin-top: 14px; padding: 14px; border: 1px solid rgb(255 182 72 / 35%); border-radius: 12px; background: rgb(255 182 72 / 5%); }
.home-security-card > div { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.home-security-card strong { color: var(--warning); }
.home-security-card p { margin: 9px 0 12px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.home-security-card button { width: 100%; min-height: 40px; }

.timeline-panel, .panel-card { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.timeline-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.event-list { display: grid; }
.event-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 16px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); font-size: 12px; }
.event-row:last-child { border-bottom: 0; }
.event-row time, .event-row span { color: var(--muted); }
.event-row strong { font-weight: 600; }
.empty-state { margin: 0; padding: 28px 20px; color: var(--muted); font-size: 13px; }

.page-heading { padding: 18px 4px 8px; }
.page-heading h1 { margin: 0; font-size: 30px; }
.page-heading > p:last-child { color: var(--muted); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.panel-card { margin-top: 0; padding: 24px; }
.panel-card > p { color: var(--muted); line-height: 1.6; }
.wide-card { grid-column: 1 / -1; }
.permission-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.permission-heading p { margin-bottom: 0; color: var(--muted); line-height: 1.6; }
.operator-list { display: grid; margin-top: 18px; border-top: 1px solid var(--line); }
.operator-row { display: grid; grid-template-columns: minmax(180px, 1.2fr) repeat(2, minmax(120px, .65fr)) minmax(150px, 1fr) auto; gap: 10px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.operator-identity { display: grid; min-width: 0; }
.operator-identity strong, .operator-identity span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.operator-identity span { color: var(--muted); font-size: 11px; }
.operator-row select, .operator-row input { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; background: #0b1018; color: var(--text); }
.operator-row button { min-height: 42px; }
.detail-list { display: grid; gap: 10px; margin-top: 20px; }
.detail-row, .readout { display: flex; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.toggle-form { display: grid; gap: 14px; margin-top: 20px; }
.toggle-form label { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 16px; color: var(--muted); }
.toggle-form .select-field { display: grid; justify-content: stretch; }
.toggle-form input[type="checkbox"] { width: 42px; height: 22px; accent-color: var(--accent); }
.security-card button { width: 100%; margin-top: 20px; }
.danger-zone { border-color: rgb(255 93 104 / 25%); }
.pairing-code-result { display: grid; gap: 4px; margin-top: 16px; border: 1px solid rgb(85 214 190 / 35%); border-radius: 12px; padding: 15px; background: rgb(85 214 190 / 6%); text-align: center; }
.pairing-code-result strong { color: var(--accent); font-size: 28px; font-variant-numeric: tabular-nums; letter-spacing: .12em; }
.pairing-code-result span { color: var(--muted); font-size: 12px; }
#generate-pairing-code-button { width: 100%; }

dialog { width: min(92vw, 460px); border: 1px solid var(--line); border-radius: 17px; padding: 0; background: var(--surface-raised); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(0 0 0 / 68%); backdrop-filter: blur(4px); }
dialog form { padding: 26px; }
dialog h2 { margin: 0; }
dialog p { color: var(--muted); line-height: 1.6; }
.security-warning-dialog { border-color: rgb(255 93 104 / 65%); }
.security-warning-dialog .eyebrow, .security-warning-dialog h2 { color: var(--danger); }
.dialog-checks { display: grid; gap: 8px; margin: 18px 0; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toast { position: fixed; z-index: 50; right: 22px; bottom: 22px; max-width: 360px; border: 1px solid var(--line); border-radius: 11px; padding: 13px 16px; background: var(--surface-raised); box-shadow: var(--shadow); font-size: 13px; }
.mobile-nav { display: none; }

@media (max-width: 1120px) {
  .workspace-grid { grid-template-columns: 210px minmax(360px, 1fr) 250px; }
  .status-rail, .control-rail, .device-stage { padding: 18px; }
}

@media (max-width: 900px) {
  .app-header { grid-template-columns: 1fr auto; padding: 0 18px; }
  .desktop-nav { display: none; }
  .workspace-grid { display: flex; flex-direction: column; }
  .status-rail, .control-rail { border: 0; }
  .status-rail { order: 1; border-bottom: 1px solid var(--line); }
  .control-rail { order: 2; border-bottom: 1px solid var(--line); }
  .device-stage { order: 3; }
  .status-list { grid-template-columns: repeat(2, 1fr); column-gap: 20px; margin: 16px 0; }
  .control-stack { grid-template-columns: repeat(3, 1fr); }
  .control-button { min-height: 68px; }
  .settings-grid { grid-template-columns: 1fr; }
  .wide-card { grid-column: auto; }
  .operator-row { grid-template-columns: 1fr 1fr; }
  .operator-identity { grid-column: 1 / -1; }
  .operator-row input { grid-column: 1 / -1; }
  .mobile-nav { position: sticky; z-index: 30; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); padding: 8px max(8px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: rgb(8 11 17 / 94%); backdrop-filter: blur(16px); }
  .mobile-nav button { min-height: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
  .mobile-nav button.active { background: var(--surface-soft); color: var(--text); }
}

@media (max-width: 600px) {
  .app-header { min-height: 62px; }
  .brand-lockup span, .connection-pill, .operator-summary { display: none; }
  .ghost-button { padding: 10px; }
  main { padding: 10px; }
  .workspace-grid { min-height: 0; border-radius: 13px; }
  .status-rail, .control-rail, .device-stage { padding: 16px; }
  .status-list { grid-template-columns: 1fr; }
  .control-stack { grid-template-columns: 1fr 1.25fr 1fr; gap: 8px; }
  .control-button { display: grid; min-height: 72px; justify-content: center; padding: 10px 6px; text-align: center; }
  .control-button strong { font-size: 14px; }
  .camera-frame { min-height: 260px; }
  .stage-title h1 { font-size: 25px; }
  .source-badge { display: none; }
  .timeline-panel { border-radius: 13px; }
  .event-row { grid-template-columns: 1fr auto; gap: 6px 12px; padding: 13px 15px; }
  .event-row time { grid-column: 1 / -1; }
  .page-heading h1 { font-size: 25px; }
  .panel-card { padding: 18px; }
  .login-panel { padding: 26px 22px; }
  .pairing-input-row { grid-template-columns: 1fr; }
  .permission-heading { display: grid; }
  .operator-row { grid-template-columns: 1fr; }
  .operator-identity, .operator-row input { grid-column: auto; }
  .dialog-actions { grid-template-columns: 1fr; }
  .toast { right: 10px; bottom: 72px; left: 10px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* v14 cinematic controller skin. Functional controls and engineering pages are unchanged. */
.rolling-door-ui {
  --glass-edge: rgb(168 210 238 / 32%);
  --glass-line: rgb(164 204 230 / 18%);
  --glass-surface: rgb(25 48 65 / 38%);
  --glass-shadow: 0 22px 58px rgb(0 5 11 / 44%);
  --mist-text: #f4f8fb;
  --mist-muted: #91a2b2;
  position: relative;
  min-height: 100dvh;
  isolation: isolate;
  overflow-x: hidden;
  color: var(--mist-text);
  font-family: ui-rounded, "SF Pro Rounded", "PingFang TC", "Microsoft JhengHei UI", "Noto Sans TC", system-ui, sans-serif;
  background:
    radial-gradient(circle at 90% 3%, rgb(104 153 199 / 44%), transparent 30%),
    radial-gradient(circle at 4% 93%, rgb(68 103 133 / 26%), transparent 35%),
    radial-gradient(circle at 55% 45%, rgb(35 73 101 / 18%), transparent 43%),
    linear-gradient(145deg, #050b11 0%, #091521 52%, #04090e 100%);
}
.rolling-door-ui .standard-ui-only { display: none !important; }
.rolling-door-ui .rolling-door-only { display: block; }
.rolling-door-ui .login-view { background: transparent; }
.rolling-door-ui .login-divider,
.rolling-door-ui .pairing-login-form { display: none; }
.rolling-door-ui .login-panel {
  border-color: var(--glass-line);
  border-radius: 28px;
  background: linear-gradient(145deg, rgb(24 47 64 / 68%), rgb(8 20 30 / 72%));
  box-shadow: inset 0 1px rgb(255 255 255 / 10%), var(--glass-shadow);
  backdrop-filter: blur(24px) saturate(118%);
}
.rolling-door-ui .login-copy,
.rolling-door-ui .safety-note,
.rolling-door-ui .page-heading p,
.rolling-door-ui .panel-card p { color: var(--mist-muted); }
.rolling-door-ui::before {
  inset: 0;
  background:
    linear-gradient(90deg, rgb(0 0 0 / 28%), transparent 36% 70%, rgb(10 23 34 / 8%)),
    radial-gradient(ellipse at 50% 50%, transparent 34%, rgb(0 4 8 / 30%) 100%);
  filter: none;
}
.rolling-door-ui .app-header {
  position: relative;
  top: auto;
  width: min(100%, 520px);
  min-height: 132px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin: 0 auto;
  padding: 28px 20px 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
.rolling-door-ui .app-header .brand-mark.small { display: none; }
.rolling-door-ui .desktop-nav,
.rolling-door-ui .operator-summary { display: none; }
.rolling-door-ui .brand-lockup { align-items: flex-start; gap: 0; }
.rolling-door-ui .brand-lockup div:last-child { gap: 4px; }
.rolling-door-ui .brand-lockup .controller-kicker {
  color: #9eafbf;
  font-size: 10px;
  font-weight: 560;
  letter-spacing: .25em;
}
.rolling-door-ui .brand-lockup strong.rolling-door-only {
  color: #f4f8fb;
  font-size: clamp(25px, 7vw, 31px);
  font-weight: 330;
  letter-spacing: .025em;
  line-height: 1.12;
}
.rolling-door-ui .brand-lockup span.rolling-door-only:last-child {
  color: #8192a2;
  font-size: 11px;
  letter-spacing: .12em;
}
.rolling-door-ui .header-actions {
  display: grid;
  justify-items: end;
  gap: 7px;
}
.rolling-door-ui .connection-pill {
  gap: 7px;
  padding: 8px 12px;
  border-color: rgb(181 217 240 / 24%);
  background: linear-gradient(145deg, rgb(185 220 245 / 18%), rgb(96 139 172 / 12%));
  color: #dfeaf2;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .22em;
  box-shadow: inset 0 1px rgb(255 255 255 / 20%), 0 10px 26px rgb(0 8 15 / 28%);
}
.rolling-door-ui .connection-pill::before {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #8d9cab;
  box-shadow: 0 0 12px rgb(141 156 171 / 40%);
  content: "";
}
.rolling-door-ui .connection-pill.live::before { background: #59f3a4; box-shadow: 0 0 14px rgb(89 243 164 / 75%); }
.rolling-door-ui .connection-pill.offline::before { background: #ff7e89; box-shadow: 0 0 14px rgb(255 93 104 / 65%); }
.rolling-door-ui .ghost-button {
  min-height: 28px;
  padding: 2px 5px;
  color: #6f8190;
  font-size: 10px;
}
.rolling-door-ui main {
  width: min(100%, 520px);
  padding: 4px 14px calc(88px + env(safe-area-inset-bottom));
}
.rolling-door-ui .workspace-grid {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  gap: 13px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
.rolling-door-ui .control-rail { display: contents; }
.rolling-door-ui .control-rail > .section-heading,
.rolling-door-ui .safety-summary,
.rolling-door-ui .io-card:not(.standard-ui-only) { display: none; }
.rolling-door-ui .control-stack {
  order: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 2.4vw, 14px);
  margin: 0;
}
.rolling-door-ui .control-button {
  --control-tint: 172 220 252;
  position: relative;
  display: flex;
  width: 100%;
  min-height: 0;
  aspect-ratio: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  overflow: hidden;
  border: 1px solid rgb(var(--control-tint) / 72%);
  border-radius: 50%;
  padding: 8px;
  background:
    radial-gradient(circle at 33% 18%, rgb(255 255 255 / 20%), transparent 31%),
    radial-gradient(circle at 50% 62%, rgb(var(--control-tint) / 10%), transparent 56%),
    linear-gradient(145deg, rgb(104 143 170 / 18%), rgb(9 22 33 / 45%));
  box-shadow:
    inset 0 1px 1px rgb(255 255 255 / 48%),
    inset 8px 9px 20px rgb(183 221 246 / 7%),
    inset -9px -12px 24px rgb(0 7 14 / 38%),
    0 0 0 1px rgb(var(--control-tint) / 12%),
    0 12px 32px rgb(0 7 14 / 42%),
    0 0 22px rgb(var(--control-tint) / 15%);
  backdrop-filter: blur(22px) saturate(126%);
  text-align: center;
  touch-action: manipulation;
}
.rolling-door-ui .control-button::before {
  position: relative;
  inset: auto;
  z-index: 2;
  height: auto;
  margin: 0 0 5px;
  border-radius: 0;
  background: none;
  color: #f6fbff;
  font-family: "Segoe UI Symbol", system-ui, sans-serif;
  font-size: clamp(31px, 9vw, 44px);
  font-weight: 260;
  line-height: .88;
  mix-blend-mode: normal;
  opacity: 1;
  text-shadow: 0 0 10px rgb(var(--control-tint) / 58%);
  pointer-events: none;
}
.rolling-door-ui .control-button.open::before { content: "↑"; }
.rolling-door-ui .control-button.stop::before { content: "□"; }
.rolling-door-ui .control-button.close::before { content: "↓"; }
.rolling-door-ui .control-button::after {
  position: absolute;
  inset: 2px 12% auto;
  height: 44%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 0%, rgb(255 255 255 / 28%), rgb(255 255 255 / 5%) 48%, transparent 74%);
  content: "";
  pointer-events: none;
}
.rolling-door-ui .control-button strong.rolling-door-only {
  position: relative;
  z-index: 2;
  display: block;
  grid-column: auto;
  grid-row: auto;
  font-size: clamp(16px, 4.8vw, 22px);
  font-weight: 420;
  letter-spacing: .08em;
  line-height: 1.1;
}
.rolling-door-ui .control-button > span {
  position: relative;
  z-index: 2;
  display: block;
  grid-column: auto;
  grid-row: auto;
  color: rgb(221 234 243 / 74%);
  font-size: clamp(7px, 2vw, 9px);
  font-weight: 500;
  letter-spacing: .26em;
}
.rolling-door-ui .control-button.open,
.rolling-door-ui .control-button.close { --control-tint: 169 217 250; }
.rolling-door-ui .control-button.stop {
  --control-tint: 255 153 164;
  border-color: rgb(255 153 164 / 78%);
  background:
    radial-gradient(circle at 33% 18%, rgb(255 230 233 / 22%), transparent 31%),
    radial-gradient(circle at 50% 62%, rgb(255 105 120 / 13%), transparent 56%),
    linear-gradient(145deg, rgb(143 69 80 / 24%), rgb(33 15 25 / 48%));
  box-shadow:
    inset 0 1px 1px rgb(255 238 240 / 54%),
    inset 8px 9px 20px rgb(255 188 195 / 8%),
    inset -9px -12px 24px rgb(34 0 9 / 38%),
    0 0 0 1px rgb(255 138 150 / 14%),
    0 12px 32px rgb(22 0 6 / 44%),
    0 0 24px rgb(255 105 120 / 18%);
}
.rolling-door-ui .control-button.stop strong,
.rolling-door-ui .control-button.stop > span { color: #ffd8dc; }
.rolling-door-ui .control-button:active:not(:disabled) {
  transform: translateY(2px) scale(.97);
  filter: brightness(1.13);
  box-shadow: inset 2px 3px 18px rgb(0 5 10 / 44%), 0 5px 15px rgb(0 4 8 / 34%), 0 0 18px rgb(var(--control-tint) / 24%);
}
.rolling-door-ui .control-button:focus-visible { outline: 2px solid rgb(230 246 255 / 82%); outline-offset: 4px; }
.rolling-door-ui .control-reason {
  order: 2;
  min-height: 16px;
  margin: -3px 2px 0;
  color: #e7bd73;
  font-size: 9px;
  letter-spacing: .04em;
  text-align: center;
}
.rolling-door-ui .device-stage,
.rolling-door-ui .home-security-card,
.rolling-door-ui .status-rail {
  border: 1px solid var(--glass-line);
  background:
    linear-gradient(115deg, rgb(255 255 255 / 4%), transparent 38%),
    linear-gradient(145deg, rgb(24 47 64 / 42%), rgb(8 20 30 / 42%));
  box-shadow: inset 0 1px rgb(255 255 255 / 9%), var(--glass-shadow);
  backdrop-filter: blur(20px) saturate(118%);
}
.rolling-door-ui .device-stage {
  order: 3;
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, .8fr);
  align-items: center;
  gap: 13px;
  padding: 18px 19px;
  border-radius: 22px;
}
.rolling-door-ui .device-stage .camera-frame { display: none; }
.rolling-door-ui .position-panel {
  order: 1;
  min-width: 0;
  margin: 0;
}
.rolling-door-ui .position-copy { display: grid; justify-content: start; gap: 2px; }
.rolling-door-ui .position-copy span { color: var(--mist-muted); font-size: 10px; letter-spacing: .1em; }
.rolling-door-ui .position-copy strong { font-size: clamp(29px, 9vw, 41px); font-weight: 350; line-height: 1.08; }
.rolling-door-ui .progress-track {
  position: relative;
  height: 8px;
  margin-top: 12px;
  overflow: visible;
  border: 0;
  background: rgb(116 140 157 / 24%);
  box-shadow: inset 0 1px 4px rgb(0 4 8 / 36%);
}
.rolling-door-ui .progress-fill {
  position: relative;
  background: linear-gradient(90deg, #8cc8f2, #cfeaff);
  box-shadow: 0 0 13px rgb(144 207 250 / 36%);
}
.rolling-door-ui .progress-fill::after {
  position: absolute;
  top: 50%;
  right: -6px;
  width: 12px;
  height: 12px;
  border: 1px solid #e6f6ff;
  border-radius: 50%;
  background: #9bc7e7;
  box-shadow: 0 0 11px rgb(174 222 255 / 60%);
  content: "";
  transform: translateY(-50%);
}
.rolling-door-ui .position-scale { display: none; }
.rolling-door-ui .stage-title {
  order: 2;
  display: grid;
  min-width: 0;
  min-height: 76px;
  align-content: center;
  gap: 5px;
  margin: 0;
  padding-left: 14px;
  border-left: 1px solid rgb(162 197 220 / 12%);
}
.rolling-door-ui .stage-title::before {
  color: var(--mist-muted);
  font-size: 9px;
  letter-spacing: .1em;
  content: "位置狀態";
}
.rolling-door-ui .stage-title > div { min-width: 0; }
.rolling-door-ui .stage-title h1 {
  overflow: hidden;
  color: #eef5fa;
  font-size: clamp(15px, 4.6vw, 21px);
  font-weight: 420;
  line-height: 1.2;
  text-overflow: ellipsis;
}
.rolling-door-ui .home-security-card {
  order: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 16px 18px;
  border-color: rgb(223 178 112 / 18%);
  border-radius: 22px;
}
.rolling-door-ui .home-security-card > div {
  position: relative;
  display: grid;
  justify-content: start;
  gap: 3px;
  min-width: 0;
  padding-left: 28px;
}
.rolling-door-ui .home-security-card > div::before {
  position: absolute;
  left: 0;
  top: 50%;
  color: #f0b86c;
  font-size: 21px;
  content: "◇";
  text-shadow: 0 0 12px rgb(240 184 108 / 28%);
  transform: translateY(-50%);
}
.rolling-door-ui .home-security-card span { color: var(--mist-muted); font-size: 10px; letter-spacing: .08em; }
.rolling-door-ui .home-security-card strong { color: #f0b86c; font-size: 15px; font-weight: 520; }
.rolling-door-ui .home-security-card p { display: none; }
.rolling-door-ui .home-security-card button {
  width: auto;
  min-height: 42px;
  padding: 0 17px;
  border-color: rgb(174 214 240 / 38%);
  border-radius: 999px;
  background: linear-gradient(145deg, rgb(123 166 195 / 25%), rgb(22 45 61 / 26%));
  color: #e8f2f8;
  font-size: 11px;
  font-weight: 520;
  box-shadow: inset 0 1px rgb(255 255 255 / 18%), 0 8px 22px rgb(0 7 13 / 28%);
}
.rolling-door-ui .status-rail {
  order: 5;
  padding: 14px 15px;
  border-radius: 22px;
}
.rolling-door-ui .status-rail .section-heading { display: none; }
.rolling-door-ui .status-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0;
}
.rolling-door-ui .status-list div,
.rolling-door-ui .status-list .rolling-door-only {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 0;
  border-left: 1px solid rgb(164 204 230 / 12%);
  text-align: center;
}
.rolling-door-ui .status-list div:first-child { border-left: 0; }
.rolling-door-ui .status-list dt { color: #778998; font-size: 8px; letter-spacing: .06em; }
.rolling-door-ui .status-list dd {
  max-width: 100%;
  color: #dfe9ef;
  font-size: 10px;
  font-weight: 520;
}
.rolling-door-ui .status-list div:first-child dd::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: #59f3a4;
  box-shadow: 0 0 9px rgb(89 243 164 / 64%);
  content: "";
  vertical-align: 1px;
}
.rolling-door-ui .timeline-panel { display: none; }
.rolling-door-ui .view-panel[data-view-panel="device"]::after {
  display: block;
  margin: 25px 0 4px;
  color: #415362;
  font-size: 6px;
  letter-spacing: .38em;
  text-align: center;
  content: "DESIGNED FOR A SMARTER TOMORROW";
}
.rolling-door-ui .page-heading { padding: 14px 5px 8px; }
.rolling-door-ui .panel-card,
.rolling-door-ui dialog {
  border-color: var(--glass-line);
  background: linear-gradient(145deg, rgb(24 47 64 / 64%), rgb(8 20 30 / 68%));
  box-shadow: inset 0 1px rgb(255 255 255 / 8%), var(--glass-shadow);
}
.rolling-door-ui .mobile-nav {
  position: fixed;
  z-index: 30;
  right: 12px;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 12px;
  width: min(calc(100% - 24px), 496px);
  margin: 0 auto;
  padding: 6px;
  border-color: rgb(166 207 234 / 18%);
  border-radius: 999px;
  background: linear-gradient(145deg, rgb(26 48 64 / 78%), rgb(7 17 26 / 84%));
  box-shadow: inset 0 1px rgb(255 255 255 / 10%), 0 18px 42px rgb(0 5 10 / 48%);
  backdrop-filter: blur(24px) saturate(118%);
}
.rolling-door-ui .mobile-nav button.active {
  background: rgb(132 177 207 / 15%);
  color: #eef7fc;
  box-shadow: inset 0 1px rgb(255 255 255 / 13%);
}

@media (max-width: 380px), (max-height: 760px) {
  .rolling-door-ui .app-header { min-height: 116px; padding: 22px 17px 14px; }
  .rolling-door-ui .brand-lockup strong.rolling-door-only { font-size: 24px; }
  .rolling-door-ui main { padding-inline: 11px; }
  .rolling-door-ui .control-button { min-height: 0; grid-template-columns: none; padding: 6px; }
  .rolling-door-ui .control-button::before { font-size: 30px; }
  .rolling-door-ui .control-button strong.rolling-door-only { font-size: 16px; }
  .rolling-door-ui .device-stage { padding: 15px 16px; }
  .rolling-door-ui .home-security-card { padding: 14px 15px; }
  .rolling-door-ui .status-rail { padding-inline: 10px; }
  .rolling-door-ui .status-list div,
  .rolling-door-ui .status-list .rolling-door-only { padding-inline: 4px; }
}
