:root {
  --bg: #0b0f14;
  --bg-elevated: #141b24;
  --bg-card: #18212c;
  --border: #2a3a4d;
  --border-focus: #4a7ec7;
  --text: #e7ecf3;
  --text-muted: #9fb0c3;
  --text-dim: #6f8298;
  --primary: #2f7cf6;
  --primary-pressed: #2563c7;
  --danger: #e04f4f;
  --danger-pressed: #c73a3a;
  --success: #5ecf8a;
  --warn: #f0c674;
  --radius: 12px;
  --radius-sm: 10px;
  --touch-min: 44px;
  --header-h: 52px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --shadow-btn: 0 2px 8px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
  overscroll-behavior-y: none;
}

body.app-shell {
  margin: 0;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior-y: none;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  display: flex;
  flex-direction: column;
}

/* ── Header (compact) ── */
.app-header {
  flex: 0 0 auto;
  z-index: 20;
  padding: calc(6px + var(--safe-top)) 12px 6px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 15, 20, 0.95);
  backdrop-filter: blur(8px);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.layout-mode-toggle {
  margin: 0;
  padding: 4px 10px;
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(47, 124, 246, 0.18);
  color: #dce6f2;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}

.layout-mode-toggle[aria-pressed="true"] {
  background: rgba(240, 193, 75, 0.22);
  border-color: rgba(240, 193, 75, 0.45);
  color: #f0c14b;
}

h1 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}

body[data-server-role="demo"] #appBrand {
  color: #f0c14b;
}

body[data-server-role="internal"] #appBrand {
  color: #7ec8ff;
}

.service-version {
  font-size: 0.68rem;
  color: #7ec8ff;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(47, 124, 246, 0.12);
}

.status-line {
  margin: 2px 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Pull to refresh (video / header zone) ── */
.pull-refresh {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  height: var(--ptr-offset, 0px);
  max-height: 72px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  background: linear-gradient(180deg, rgba(11, 15, 20, 0.98) 0%, rgba(11, 15, 20, 0.82) 100%);
  transition: opacity 0.15s ease;
}

.pull-refresh.is-pulling,
.pull-refresh.is-refreshing {
  opacity: 1;
}

.pull-refresh-text {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.pull-refresh.is-ready .pull-refresh-text {
  color: var(--primary);
}

.pull-refresh.is-refreshing .pull-refresh-text {
  color: var(--success);
}

/* ── Cockpit split: video + controls always on screen ── */
.cockpit-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.video-pane {
  flex: 1 1 56vh;
  min-height: 220px;
  max-height: none;
  display: flex;
  flex-direction: column;
  padding: 6px 10px 4px;
  border-bottom: 1px solid var(--border);
  background: #080b10;
}

.video-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

.video-unlock {
  position: absolute;
  inset: 0;
  z-index: 2;
  margin: auto;
  width: fit-content;
  height: fit-content;
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.72);
  color: #f0f4f8;
  font-size: 0.85rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

.black-screen-diag-btn {
  position: absolute;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%);
  z-index: 12;
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(240, 193, 75, 0.55);
  background: rgba(0, 0, 0, 0.72);
  color: #f0c674;
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.black-screen-diag-btn.hidden {
  display: none !important;
}

.black-screen-diag-panel {
  flex: 0 0 auto;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(240, 193, 75, 0.35);
  background: rgba(20, 27, 36, 0.96);
  color: var(--text);
}

.black-screen-diag-panel.hidden {
  display: none !important;
}

.black-screen-diag-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.black-screen-diag-verdict {
  margin: 0 0 6px;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--warn);
  line-height: 1.35;
}

.black-screen-diag-verdict.is-ok {
  color: var(--success);
}

.black-screen-diag-verdict.is-error {
  color: #f07178;
}

.black-screen-diag-list {
  margin: 0;
  padding: 0 0 0 1.1rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.45;
  max-height: 28vh;
  overflow: auto;
}

.black-screen-diag-list li {
  margin: 2px 0;
}

.black-screen-diag-list .ok {
  color: var(--success);
}

.black-screen-diag-list .bad {
  color: #f07178;
}

.black-screen-diag-list .warn {
  color: var(--warn);
}

.black-screen-diag-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

body.layout-landscape .black-screen-diag-panel {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 56px;
  z-index: 14;
  max-width: min(520px, calc(100% - 16px));
  max-height: 55vh;
  overflow: auto;
  pointer-events: auto;
}

.video-unlock.hidden {
  display: none;
}

.video-overlay {
  position: absolute;
  top: 6px;
  right: 6px;
  left: auto;
  bottom: auto;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  max-width: min(92%, 280px);
  pointer-events: none;
}

.video-overlay-toggle {
  pointer-events: auto;
  margin: 0;
  padding: 3px 8px;
  min-height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.55);
  color: #dce6f2;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.video-overlay-badges {
  pointer-events: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  padding: 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(4px);
}

.video-overlay.is-collapsed .video-overlay-badges,
.video-overlay-badges[hidden] {
  display: none !important;
}

.video-badge {
  font-size: 0.62rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  color: #dce6f2;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.video-badge.is-ok { color: var(--success); border-color: rgba(94, 207, 138, 0.35); }
.video-badge.is-warn { color: var(--warn); }
.video-badge-muted { color: #aab4c0; }

.stream-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.stream-bar::-webkit-scrollbar {
  display: none;
}

.stream-res-field {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 0;
  white-space: nowrap;
  flex: 0 0 auto;
}

.stream-res-field .field-label {
  font-size: 0.68rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.stream-res-field.is-disabled {
  opacity: 0.55;
}
.stream-res-field .field-input-compact {
  min-width: 72px;
  min-height: 26px;
  padding: 1px 4px;
  font-size: 0.68rem;
}

.stream-allow-hls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.stream-allow-hls input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent, #3d8bfd);
}

.stream-allow-hls .field-label {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.stream-bar-status {
  flex: 1 1 auto;
  min-width: 64px;
  max-width: 28vw;
  font-size: 0.62rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stream-bar-status.is-ok { color: var(--success); }
.stream-bar-status.is-warn { color: var(--warn); }
.stream-bar-status.is-error { color: #f07178; }

/* ── Control dock (compact; video gets remaining height) ── */
.control-dock {
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 4px 10px calc(4px + var(--safe-bottom));
  gap: 4px;
  /* visible: vehicle list panel is position:absolute and must not be clipped */
  overflow: visible;
}

.dock-toolbar {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  /* Do not use overflow-x:auto here — it creates a scrollport that clips the vehicle list. */
  overflow: visible;
}

.dock-toolbar::-webkit-scrollbar {
  display: none;
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 1 auto;
  min-width: 0;
}

.vehicle-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 42%;
}

.vehicle-select-wrap .vehicle-id-field {
  flex: 1 1 auto;
  min-width: 0;
}

.vehicle-list-toggle {
  flex: 0 0 auto;
}

.vehicle-list-panel {
  position: absolute;
  left: 0;
  /* Open upward over the video so dock height / safe-area never clips it */
  bottom: calc(100% + 6px);
  top: auto;
  width: min(92vw, 360px);
  max-width: calc(100vw - 20px);
  z-index: 80;
  max-height: min(42vh, 280px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated, #141a22);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  padding: 8px;
}

.vehicle-list-panel.hidden {
  display: none;
}

.vehicle-list-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  margin-bottom: 6px;
  padding: 0 2px;
}

.vehicle-list-head-main,
.vehicle-list-head-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.vehicle-list-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}

.vehicle-list-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.vehicle-list-updated {
  font-size: 0.66rem;
  color: var(--text-muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vehicle-list-refresh {
  flex: 0 0 auto;
  padding: 2px 8px;
  min-height: 26px;
  font-size: 0.72rem;
}

.vehicle-list-refresh.is-busy {
  opacity: 0.65;
  pointer-events: none;
}

.vehicle-list-body {
  display: grid;
  gap: 6px;
}

.vehicle-list-empty {
  margin: 0;
  padding: 10px 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.vehicle-list-item {
  display: grid;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card, #0f141b);
  color: inherit;
  cursor: pointer;
}

.vehicle-list-item:hover,
.vehicle-list-item:focus-visible {
  border-color: var(--accent, #3d8bfd);
  outline: none;
}

.vehicle-list-item.is-active {
  border-color: var(--accent, #3d8bfd);
  background: rgba(61, 139, 253, 0.12);
}

.vehicle-list-item.is-stale {
  opacity: 0.72;
}

.vehicle-list-item-title {
  font-size: 0.82rem;
  font-weight: 600;
}

.vehicle-list-item-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.field-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.field-input {
  width: 100%;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.8rem;
}

.field-input-compact {
  min-height: 28px;
  font-size: 0.78rem;
}

.toolbar-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex: 0 0 auto;
}

.pad {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(3, minmax(36px, 1fr));
  gap: 6px;
  align-content: stretch;
  max-height: 148px;
}

.pad-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  align-items: stretch;
}

.field-inline-chassis {
  flex: 0 0 auto;
  min-width: 72px;
}

.field-inline-chassis.hidden {
  display: none;
}

.chassis-accessory-panel.hidden {
  display: none;
}

.accessory-bar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.accessory-status {
  flex: 0 0 auto;
  margin: 0;
  font-size: 0.68rem;
  color: var(--text-dim);
  min-height: 1.1em;
}

.accessory-status.is-ok { color: var(--success); }
.accessory-status.is-warn { color: var(--warn); }
.accessory-status.is-error { color: #f07178; }

.btn-accessory {
  min-height: 28px;
  padding: 0 8px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  box-shadow: none;
}

.btn-accessory[aria-pressed="true"] {
  border-color: rgba(94, 207, 138, 0.55);
  background: rgba(94, 207, 138, 0.16);
  color: #a8e08d;
}

.btn-accessory.btn-unlock {
  border-color: rgba(255, 193, 94, 0.45);
  background: rgba(255, 193, 94, 0.1);
  color: #ffd48a;
}

.btn-accessory:disabled {
  opacity: 0.45;
}

/* ── More / seats (collapsible) ── */
.more-panel {
  flex: 0 0 auto;
  max-height: 28vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.more-panel summary {
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
}

.more-panel summary::-webkit-details-marker { display: none; }

.more-body {
  padding: 0 12px 10px;
}

.seat-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.seat-panel-head-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.seat-claim-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.seat-claim-row.hidden {
  display: none;
}

.seat-claim-hint {
  font-size: 0.72rem;
  color: var(--warn);
}

.seat-title {
  font-size: 0.78rem;
  font-weight: 600;
}

.seat-summary {
  font-size: 0.72rem;
  font-weight: 600;
  color: #7ec8ff;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(126, 200, 255, 0.1);
}

.seat-limit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.seat-limit-row.hidden {
  display: none;
}

.seat-limit-field {
  flex: 1 1 auto;
  margin: 0;
}

select.field-input {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #9fb0c3 50%), linear-gradient(135deg, #9fb0c3 50%, transparent 50%);
  background-position: calc(100% - 14px) calc(50% - 2px), calc(100% - 9px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

.seat-self-status {
  margin: 0 0 6px;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.seat-self-status.is-ok { color: var(--success); }
.seat-self-status.is-warn { color: var(--warn); }
.seat-self-status.is-error { color: #f07178; }

.seat-rename-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
  margin: 8px 0 10px;
}

.seat-rename-row.hidden {
  display: none;
}

.seat-rename-field {
  margin: 0;
  min-width: 0;
}

.seat-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: grid;
  gap: 6px;
}

.seat-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  font-size: 0.74rem;
}

.seat-item.is-self {
  border-color: #3d6ea8;
  background: rgba(47, 124, 246, 0.08);
}

.seat-item-main {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.seat-role {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 600;
  background: #243040;
  color: #b9cadc;
}

.seat-role.operator {
  background: rgba(94, 207, 138, 0.18);
  color: #a8e08d;
}

.seat-meta-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.seat-meta {
  color: var(--text-dim);
  font-size: 0.64rem;
}

.seat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.btn-transfer {
  min-height: 28px;
  padding: 0 8px;
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid rgba(94, 207, 138, 0.45);
  background: rgba(94, 207, 138, 0.12);
  color: #a8e08d;
  box-shadow: none;
}

.btn-transfer:active:not(:disabled) {
  background: rgba(94, 207, 138, 0.22);
}

.btn-kick {
  min-height: 28px;
  padding: 0 8px;
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid rgba(240, 113, 120, 0.45);
  background: rgba(240, 113, 120, 0.12);
  color: #f0a8ad;
  box-shadow: none;
}

.btn-kick:active:not(:disabled) {
  background: rgba(240, 113, 120, 0.22);
}

.control-settings {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
  margin-top: 8px;
}

.setting-item { margin: 0; }

.latency-status,
.port-hint {
  margin: 6px 0 0;
  font-size: 0.68rem;
  color: var(--text-dim);
}

.latency-status.is-ok { color: var(--success); }
.latency-status.is-warn { color: var(--warn); }
.latency-status.is-error { color: #f07178; }

.port-hint code { color: #a8bdd4; }

/* ── Buttons ── */
button {
  font: inherit;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  -webkit-user-select: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: var(--touch-min);
  padding: 0 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  box-shadow: var(--shadow-btn);
  transition: transform 0.08s ease, background 0.12s ease;
}

.btn-sm {
  min-height: 28px;
  padding: 0 8px;
  font-size: 0.72rem;
  border-radius: 8px;
}

.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.btn-primary {
  background: linear-gradient(180deg, #3d8cff 0%, var(--primary) 100%);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  box-shadow: none;
  font-weight: 500;
}

.btn-danger {
  background: linear-gradient(180deg, #ff7070 0%, var(--danger) 100%);
}

.btn-setting {
  min-height: 36px;
  font-size: 0.78rem;
}

.btn-drive {
  width: 100%;
  min-height: 36px;
  height: 100%;
  padding: 0 6px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.btn-drive-forward,
.btn-drive-back {
  background: linear-gradient(180deg, #4a9dff 0%, #2f7cf6 50%, #2563c7 100%);
}

.btn-drive-turn {
  background: linear-gradient(180deg, #3a4654 0%, #2a3440 100%);
  color: #e8eef5;
}

.btn-drive-brake {
  background: linear-gradient(180deg, #ff6b6b 0%, var(--danger) 55%, #b83232 100%);
  font-size: 0.82rem;
  box-shadow: 0 2px 8px rgba(224, 79, 79, 0.28);
}

.drive.is-active {
  filter: brightness(1.12);
  transform: scale(0.96);
}

/* Manual landscape layout: full-bleed video + floating drive pad */
body.layout-landscape .app-header {
  padding-top: calc(4px + var(--safe-top));
  padding-bottom: 4px;
}

body.layout-landscape .status-line {
  display: none;
}

body.layout-landscape .cockpit-main {
  position: relative;
  flex-direction: column;
}

body.layout-landscape .video-pane {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  height: auto;
  padding: 0;
  border-bottom: none;
  border-right: none;
  background: #000;
}

body.layout-landscape .video-wrap {
  border-radius: 0;
  border: none;
}

body.layout-landscape .stream-bar {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 8px;
  z-index: 12;
  margin: 0;
  padding: 4px 6px;
  border-radius: 10px;
  background: rgba(8, 11, 16, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  max-width: calc(100% - 16px);
  pointer-events: auto;
}

body.layout-landscape .black-screen-diag-btn {
  z-index: 13;
  pointer-events: auto;
}

body.layout-landscape .peer-push-banner {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 48px;
  z-index: 5;
  margin: 0;
}

body.layout-landscape .control-dock {
  position: absolute;
  inset: 0;
  z-index: 6;
  margin: 0;
  padding: 0;
  background: transparent;
  pointer-events: none;
  overflow: visible;
}

body.layout-landscape .control-dock > * {
  pointer-events: auto;
}

body.layout-landscape .dock-toolbar {
  position: absolute;
  left: 8px;
  right: auto;
  bottom: calc(10px + var(--safe-bottom));
  z-index: 7;
  padding: 4px 6px;
  border-radius: 10px;
  background: rgba(8, 11, 16, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  max-width: min(420px, calc(100% - 250px));
}

body.layout-landscape .pad {
  position: absolute;
  right: 10px;
  bottom: calc(10px + var(--safe-bottom));
  z-index: 8;
  width: min(236px, 46vw);
  height: 156px;
  max-height: none;
  flex: none;
  padding: 8px;
  gap: 6px;
  border-radius: 14px;
  background: rgba(8, 11, 16, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
}

body.layout-landscape .pad .btn-drive {
  min-height: 40px;
  font-size: 0.88rem;
}

body.layout-landscape .chassis-accessory-panel {
  position: absolute;
  left: 8px;
  bottom: calc(52px + var(--safe-bottom));
  z-index: 7;
  max-width: min(280px, calc(100% - 260px));
  padding: 4px 6px;
  border-radius: 10px;
  background: rgba(8, 11, 16, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
}

body.layout-landscape .more-panel {
  position: absolute;
  left: 8px;
  bottom: calc(52px + var(--safe-bottom));
  z-index: 7;
  width: min(360px, calc(100% - 250px));
  max-height: min(42vh, 280px);
  margin: 0;
  background: rgba(20, 27, 36, 0.92);
  backdrop-filter: blur(8px);
}

body.layout-landscape .chassis-accessory-panel:not(.hidden) ~ .more-panel {
  bottom: calc(96px + var(--safe-bottom));
}

body.layout-landscape .video-overlay {
  top: 8px;
  right: 8px;
  z-index: 9;
}

/* Device landscape fallback (portrait layout mode only): side-by-side */
@media (orientation: landscape) and (max-height: 520px) {
  body:not(.layout-landscape) .cockpit-main {
    flex-direction: row;
  }

  body:not(.layout-landscape) .video-pane {
    flex: 1 1 55%;
    max-height: none;
    height: auto;
    border-bottom: none;
    border-right: 1px solid var(--border);
  }

  body:not(.layout-landscape) .control-dock {
    flex: 1 1 45%;
    overflow: visible;
  }

  body:not(.layout-landscape) .more-panel {
    max-height: 18vh;
  }
}

@media (min-width: 600px) {
  body.app-shell:not(.layout-landscape) {
    max-width: 520px;
    margin: 0 auto;
  }
}

/* Narrow phones in landscape layout: keep pad usable */
@media (max-width: 420px) {
  body.layout-landscape .pad {
    width: min(200px, 52vw);
    height: 140px;
    right: 6px;
    bottom: calc(6px + var(--safe-bottom));
  }

  body.layout-landscape .dock-toolbar,
  body.layout-landscape .more-panel,
  body.layout-landscape .chassis-accessory-panel {
    max-width: calc(100% - 220px);
  }
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(7, 10, 14, 0.94);
}

.login-gate.hidden {
  display: none;
}

.login-card {
  width: min(100%, 320px);
  padding: 24px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.login-title {
  margin: 0 0 8px;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
}

.login-hint {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

.login-input {
  width: 100%;
  min-height: var(--touch-min);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 1.1rem;
  letter-spacing: 0.12em;
  text-align: center;
}

.login-input-secondary {
  margin-top: 10px;
  letter-spacing: 0.06em;
  font-size: 1rem;
  border-color: rgba(47, 124, 246, 0.45);
}

.login-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.login-error {
  min-height: 1.2em;
  margin: 10px 0 0;
  color: #f07178;
  font-size: 0.78rem;
  text-align: center;
}

.login-btn {
  width: 100%;
  margin-top: 14px;
  min-height: var(--touch-min);
}

body.login-locked .app-header,
body.login-locked .cockpit-main {
  pointer-events: none;
  user-select: none;
}

body.login-locked .app-header *,
body.login-locked .cockpit-main * {
  pointer-events: none;
}

.peer-push-banner {
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid rgba(240, 180, 70, 0.45);
  border-radius: 10px;
  background: rgba(60, 42, 12, 0.92);
}

.peer-push-banner.hidden {
  display: none;
}

.peer-push-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.peer-push-text {
  margin: 0;
  flex: 1 1 180px;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #f6d59a;
}

.peer-push-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.vehicle-list-item.is-pushing .vehicle-list-item-title::after {
  content: "推流中";
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 600;
  color: #142016;
  background: #7dcea0;
  vertical-align: middle;
}
