:root,
:host {
    color-scheme: dark;
    --primary-color: #309cff;
    --accent-color: #58ddff;
    --accent-strong: #72e6ff;
    --success-color: #41f0a2;
    --warning-color: #ffc644;
    --danger-color: #ff667a;
    --text-main: #f7fbff;
    --text-muted: #a9bad0;
    --text-dim: #7489a4;
    --page-bg: #06111f;
    --glass-surface:
        radial-gradient(circle at 12% 8%, rgba(88, 221, 255, 0.13), transparent 34%),
        linear-gradient(145deg, rgba(16, 39, 62, 0.83), rgba(5, 17, 32, 0.72));
    --glass-surface-strong:
        radial-gradient(circle at 10% 0%, rgba(88, 221, 255, 0.14), transparent 34%),
        linear-gradient(145deg, rgba(12, 32, 52, 0.95), rgba(5, 16, 30, 0.92));
    --glass-tile: rgba(255, 255, 255, 0.065);
    --glass-tile-hover: rgba(88, 221, 255, 0.11);
    --glass-stroke: rgba(255, 255, 255, 0.16);
    --glass-stroke-soft: rgba(255, 255, 255, 0.09);
    --glass-shadow: 0 24px 64px rgba(0, 8, 20, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    --glass-blur: blur(18px) saturate(145%);
    --panel-radius: 24px;
    --card-radius: 18px;
    --control-radius: 14px;
    --header-height: 66px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body,
:host,
.camera-page {
    width: 100%;
    min-width: 320px;
    height: 100%;
    margin: 0;
}

body,
.camera-page {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100dvh;
    padding: max(12px, var(--safe-top)) max(12px, var(--safe-right)) max(12px, var(--safe-bottom)) max(12px, var(--safe-left));
    overflow: hidden;
    color: var(--text-main);
    background:
        radial-gradient(circle at 12% 14%, rgba(18, 127, 175, 0.27), transparent 34%),
        radial-gradient(circle at 84% 84%, rgba(48, 89, 255, 0.19), transparent 38%),
        linear-gradient(145deg, #071b2a 0%, var(--page-bg) 48%, #07142a 100%);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input,
select {
    font: inherit;
}

button,
a,
input,
select {
    -webkit-tap-highlight-color: transparent;
}

button,
a {
    touch-action: manipulation;
}

button {
    color: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

[hidden] {
    display: none !important;
}

::selection {
    color: #04101c;
    background: var(--accent-strong);
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    border-radius: 99px;
    background: rgba(146, 188, 222, 0.34);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(114, 230, 255, 0.55);
}

:focus-visible {
    outline: 2px solid var(--accent-strong);
    outline-offset: 2px;
}

.ambient {
    position: fixed;
    z-index: -1;
    width: 34vw;
    height: 34vw;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.18;
    pointer-events: none;
}

.ambient-one {
    top: -16vw;
    left: 14vw;
    background: #24d7ff;
}

.ambient-two {
    right: -13vw;
    bottom: -16vw;
    background: #365dff;
}

.glass-panel {
    border: 1px solid var(--glass-stroke);
    background: var(--glass-surface);
    box-shadow: var(--glass-shadow);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
}

.app-header {
    position: relative;
    z-index: 50;
    display: flex;
    flex: 0 0 var(--header-height);
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    padding: 9px 11px 9px 14px;
    border-radius: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    gap: 12px;
    border-radius: 14px;
}

.brand-mark {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    place-items: center;
    border: 1px solid rgba(139, 236, 255, 0.38);
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(145deg, rgba(88, 221, 255, 0.9), rgba(48, 156, 255, 0.72));
    box-shadow: 0 10px 28px rgba(48, 156, 255, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.48);
    font-size: 20px;
}

.brand-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.brand-copy strong {
    overflow: hidden;
    font-size: 19px;
    font-weight: 760;
    letter-spacing: 0.03em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-copy small {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
}

.connection-summary,
.current-time,
.header-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--glass-stroke-soft);
    border-radius: 13px;
    color: var(--text-muted);
    background: var(--glass-tile);
}

.connection-summary,
.current-time {
    padding: 0 13px;
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}

.connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-dim);
    box-shadow: 0 0 0 4px rgba(116, 137, 164, 0.12);
    transition: background 180ms ease, box-shadow 180ms ease;
}

.connection-summary.has-online .connection-dot {
    background: var(--success-color);
    box-shadow: 0 0 0 4px rgba(65, 240, 162, 0.12), 0 0 12px rgba(65, 240, 162, 0.62);
}

.current-time {
    color: #d7e9f8;
    font-variant-numeric: tabular-nums;
}

.header-button {
    min-width: 44px;
    padding: 0 13px;
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.header-button:hover {
    border-color: rgba(88, 221, 255, 0.42);
    color: #fff;
    background: rgba(88, 221, 255, 0.12);
    transform: translateY(-1px);
}

.channel-trigger {
    display: none;
}

.app-shell {
    position: relative;
    display: grid;
    min-width: 0;
    min-height: 0;
    flex: 1 1 auto;
    grid-template-columns: clamp(300px, 23vw, 356px) minmax(0, 1fr);
    gap: 12px;
}

.panel-overlay {
    display: none;
}

.channel-panel {
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
    border-radius: var(--panel-radius);
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 15px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--accent-color);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.18em;
}

.panel-heading h1 {
    margin: 0;
    font-size: 21px;
    line-height: 1.2;
}

.icon-button {
    display: inline-grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid var(--glass-stroke-soft);
    border-radius: 13px;
    background: var(--glass-tile);
    cursor: pointer;
}

.panel-close {
    display: none;
}

.channel-filters {
    display: grid;
    gap: 10px;
    padding: 0 16px 14px;
    border-bottom: 1px solid var(--glass-stroke-soft);
}

.search-control,
.select-control {
    display: flex;
    min-height: 46px;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--glass-stroke-soft);
    border-radius: var(--control-radius);
    color: var(--text-dim);
    background: rgba(2, 13, 25, 0.35);
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.search-control {
    padding: 0 12px;
}

.search-control:focus-within,
.select-control:focus-within {
    border-color: rgba(88, 221, 255, 0.68);
    background: rgba(15, 47, 70, 0.5);
    box-shadow: 0 0 0 3px rgba(88, 221, 255, 0.1);
}

.search-control input,
.select-control select {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    color: var(--text-main);
    background: transparent;
}

.search-control input {
    height: 44px;
}

.search-control input::placeholder {
    color: #7388a1;
}

.clear-search {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border: 0;
    border-radius: 10px;
    color: var(--text-dim);
    background: transparent;
    cursor: pointer;
}

.filter-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.select-control {
    position: relative;
    min-width: 0;
    padding: 0 10px 0 12px;
}

.select-control select {
    height: 44px;
    padding-right: 24px;
    appearance: none;
    cursor: pointer;
}

.select-control::after {
    position: absolute;
    right: 12px;
    content: "\f078";
    color: var(--text-dim);
    font-family: "Font Awesome 6 Free";
    font-size: 10px;
    font-weight: 900;
    pointer-events: none;
}

.select-control option {
    color: #102035;
    background: #eef8ff;
}

.favorite-toggle {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    gap: 7px;
    padding: 0 13px;
    border: 1px solid var(--glass-stroke-soft);
    border-radius: var(--control-radius);
    color: var(--text-muted);
    background: var(--glass-tile);
    cursor: pointer;
    white-space: nowrap;
}

.favorite-toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}

.favorite-toggle:has(input:checked) {
    border-color: rgba(255, 198, 68, 0.42);
    color: #ffe6a8;
    background: rgba(255, 198, 68, 0.1);
}

.favorite-toggle:has(input:focus-visible) {
    outline: 2px solid var(--accent-strong);
    outline-offset: 2px;
}

.list-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 11px 18px 7px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 650;
}

.list-guidance {
    display: flex;
    min-width: 0;
    align-items: flex-end;
    flex-direction: column;
    gap: 2px;
    text-align: right;
}

.target-channel {
    color: var(--accent-color);
    font-size: 10px;
    font-weight: 760;
    letter-spacing: 0.04em;
}

.summary-hint {
    color: var(--text-dim);
    font-weight: 500;
}

.stream-list {
    min-height: 0;
    flex: 1 1 auto;
    overflow: auto;
    padding: 5px 10px 14px;
    overscroll-behavior: contain;
}

.stream-card {
    display: grid;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: stretch;
    gap: 5px;
    margin-bottom: 7px;
    border: 1px solid transparent;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.025);
    transition: border-color 160ms ease, transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.stream-card:hover,
.stream-card:focus-within {
    border-color: rgba(88, 221, 255, 0.22);
    background: var(--glass-tile-hover);
    transform: translateY(-1px);
}

.stream-card.is-playing {
    border-color: rgba(88, 221, 255, 0.52);
    background: linear-gradient(120deg, rgba(48, 156, 255, 0.16), rgba(88, 221, 255, 0.07));
    box-shadow: inset 3px 0 0 var(--accent-color), 0 10px 24px rgba(0, 15, 34, 0.2);
}

.stream-card.is-dragging {
    opacity: 0.46;
    transform: scale(0.985);
}

.stream-main,
.favorite-button {
    border: 0;
    color: inherit;
    background: transparent;
    cursor: pointer;
}

.stream-main {
    display: grid;
    min-width: 0;
    grid-template-columns: 12px minmax(0, 1fr) 16px;
    align-items: center;
    gap: 11px;
    padding: 11px 8px 11px 13px;
    text-align: left;
}

.stream-main[draggable="true"] {
    cursor: grab;
}

.stream-main[draggable="true"]:active {
    cursor: grabbing;
}

.drag-grip {
    color: rgba(169, 186, 208, 0.48);
    font-size: 12px;
    pointer-events: none;
}

body.is-channel-dragging .stream-card.is-dragging,
body.is-channel-dragging .stream-card.is-dragging *,
.camera-page.is-channel-dragging .stream-card.is-dragging,
.camera-page.is-channel-dragging .stream-card.is-dragging * {
    cursor: grabbing !important;
}

body.is-channel-dragging .video-box.is-drop-target,
body.is-channel-dragging .video-box.is-drop-target *,
.camera-page.is-channel-dragging .video-box.is-drop-target,
.camera-page.is-channel-dragging .video-box.is-drop-target * {
    cursor: copy !important;
}

.stream-status {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--text-dim);
    box-shadow: 0 0 0 4px rgba(116, 137, 164, 0.11);
}

.stream-status.is-connecting,
.stream-status.is-waiting {
    background: var(--warning-color);
    box-shadow: 0 0 0 4px rgba(255, 198, 68, 0.11);
    animation: status-pulse 1.2s ease-in-out infinite;
}

.stream-status.is-online {
    background: var(--success-color);
    box-shadow: 0 0 0 4px rgba(65, 240, 162, 0.1), 0 0 9px rgba(65, 240, 162, 0.6);
}

.stream-status.is-offline,
.stream-status.is-error {
    background: var(--danger-color);
    box-shadow: 0 0 0 4px rgba(255, 102, 122, 0.1);
}

.stream-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.stream-title,
.stream-meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stream-title {
    color: #edf8ff;
    font-size: 13px;
    font-weight: 680;
}

.stream-meta {
    color: var(--text-dim);
    font-size: 11px;
    line-height: 1.3;
}

.favorite-button {
    display: grid;
    width: 44px;
    min-height: 44px;
    place-items: center;
    border-radius: 13px;
    color: #71859c;
}

.favorite-button:hover {
    color: #ffe29b;
    background: rgba(255, 198, 68, 0.08);
}

.favorite-button.is-favorite {
    color: var(--warning-color);
    text-shadow: 0 0 12px rgba(255, 198, 68, 0.48);
}

.list-empty {
    display: grid;
    min-height: 210px;
    place-items: center;
    padding: 28px;
    color: var(--text-dim);
    text-align: center;
}

.list-empty i {
    display: block;
    margin-bottom: 12px;
    color: rgba(88, 221, 255, 0.58);
    font-size: 30px;
}

.list-empty strong {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 14px;
}

.list-empty p {
    margin: 0;
    font-size: 11px;
    line-height: 1.6;
}

.monitor-workspace {
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    gap: 10px;
}

.monitor-toolbar {
    display: flex;
    min-width: 0;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 18px;
}

.toolbar-scroll {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
}

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

.toolbar-group {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 5px;
}

.group-label {
    padding: 0 5px 0 3px;
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.toolbar-divider {
    width: 1px;
    height: 28px;
    flex: 0 0 1px;
    margin: 0 2px;
    background: var(--glass-stroke-soft);
}

.tool-button {
    display: inline-flex;
    min-width: 44px;
    min-height: 42px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 12px;
    border: 1px solid var(--glass-stroke-soft);
    border-radius: 12px;
    color: var(--text-muted);
    background: var(--glass-tile);
    cursor: pointer;
    white-space: nowrap;
    transition: transform 150ms ease, border-color 150ms ease, color 150ms ease, background 150ms ease;
}

.tool-button:hover {
    border-color: rgba(88, 221, 255, 0.36);
    color: #fff;
    background: var(--glass-tile-hover);
    transform: translateY(-1px);
}

.tool-button.is-active {
    border-color: rgba(133, 234, 255, 0.55);
    color: #fff;
    background: linear-gradient(145deg, #3ebeea, #2b82ee);
    box-shadow: 0 8px 20px rgba(48, 156, 255, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.layout-button {
    padding: 0 10px;
}

.danger-button:hover {
    border-color: rgba(255, 102, 122, 0.5);
    color: #ffd7dd;
    background: rgba(255, 102, 122, 0.13);
}

.volume-control {
    display: inline-flex;
    min-height: 42px;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    padding: 0 10px;
    border: 1px solid var(--glass-stroke-soft);
    border-radius: 12px;
    color: var(--text-muted);
    background: var(--glass-tile);
}

.volume-control input {
    width: 72px;
    accent-color: var(--accent-color);
    cursor: pointer;
}

.volume-control output {
    min-width: 28px;
    color: var(--text-dim);
    font-size: 9px;
    font-variant-numeric: tabular-nums;
}

.current-channel {
    display: inline-flex;
    min-width: 164px;
    min-height: 42px;
    flex: 0 1 260px;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 9px;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 11px;
}

.current-channel span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.current-channel i {
    color: var(--accent-color);
}

.video-grid {
    display: grid;
    min-width: 0;
    min-height: 0;
    flex: 1 1 auto;
    gap: 8px;
    overflow: auto;
    overscroll-behavior: contain;
}

.video-grid.is-drop-mode .video-box {
    border-color: rgba(88, 221, 255, 0.28);
}

.video-grid.is-drop-mode .video-box:not(.is-drop-target) {
    box-shadow: inset 0 0 0 1px rgba(88, 221, 255, 0.06), 0 14px 30px rgba(0, 8, 20, 0.25);
}

.video-grid.grid-1 {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
}

.video-grid.grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
}

.video-grid.grid-9 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
}

.video-box {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: var(--card-radius);
    background:
        radial-gradient(circle at 50% 44%, rgba(44, 99, 137, 0.2), transparent 42%),
        linear-gradient(150deg, rgba(6, 21, 36, 0.94), rgba(2, 10, 20, 0.96));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 14px 30px rgba(0, 8, 20, 0.25);
    cursor: pointer;
    isolation: isolate;
    transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.video-box::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    content: "";
    background: linear-gradient(135deg, rgba(88, 221, 255, 0.035), transparent 42%, rgba(48, 89, 255, 0.04));
    pointer-events: none;
}

.video-box:hover {
    border-color: rgba(88, 221, 255, 0.3);
}

.video-box.is-selected {
    border-color: rgba(88, 221, 255, 0.9);
    box-shadow: 0 0 0 2px rgba(88, 221, 255, 0.14), 0 18px 42px rgba(0, 22, 48, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.video-box.is-selected::after {
    position: absolute;
    z-index: 8;
    top: 8px;
    right: 8px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    content: "";
    background: var(--accent-color);
    box-shadow: 0 0 10px rgba(88, 221, 255, 0.9);
}

.video-box.is-drop-target {
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 3px rgba(88, 221, 255, 0.2), inset 0 0 34px rgba(48, 156, 255, 0.16), 0 18px 42px rgba(0, 22, 48, 0.45);
}

.slot-drop-indicator {
    position: absolute;
    z-index: 9;
    inset: 10px;
    display: grid;
    place-items: center;
    border: 1px dashed rgba(114, 230, 255, 0.74);
    border-radius: 14px;
    color: #f4fcff;
    background: linear-gradient(145deg, rgba(7, 37, 59, 0.88), rgba(8, 25, 45, 0.84));
    opacity: 0;
    pointer-events: none;
    transform: scale(0.985);
    transition: opacity 130ms ease, transform 130ms ease;
}

.video-box.is-drop-target .slot-drop-indicator {
    opacity: 1;
    transform: scale(1);
}

.drop-indicator-copy {
    text-align: center;
}

.drop-indicator-copy i {
    display: block;
    margin-bottom: 8px;
    color: var(--accent-color);
    font-size: 24px;
}

.drop-indicator-copy strong,
.drop-indicator-copy small {
    display: block;
}

.drop-indicator-copy strong {
    font-size: 13px;
}

.drop-indicator-copy small {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 10px;
}

.video-element {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: #02070d;
    object-fit: contain;
}

.video-element:fullscreen {
    border-radius: 0;
    background: #000;
}

.video-empty {
    position: absolute;
    z-index: 2;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    color: var(--text-dim);
    pointer-events: none;
    text-align: center;
}

.empty-visual {
    position: relative;
    display: grid;
    width: 54px;
    height: 54px;
    margin: 0 auto 10px;
    place-items: center;
    border: 1px solid rgba(88, 221, 255, 0.15);
    border-radius: 18px;
    color: rgba(149, 202, 232, 0.5);
    background: rgba(88, 221, 255, 0.05);
    font-size: 20px;
}

.video-empty strong {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
}

.video-empty small {
    display: block;
    margin-top: 4px;
    font-size: 9px;
}

.video-osd {
    position: absolute;
    z-index: 5;
    top: 10px;
    left: 10px;
    display: flex;
    max-width: calc(100% - 52px);
    align-items: center;
    gap: 7px;
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 150ms ease, transform 150ms ease;
}

.video-box.has-stream .video-osd {
    opacity: 1;
    transform: translateY(0);
}

.osd-title,
.status-badge {
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 9px;
    background: rgba(2, 12, 23, 0.7);
    box-shadow: 0 7px 18px rgba(0, 6, 14, 0.26);
    -webkit-backdrop-filter: blur(10px) saturate(135%);
    backdrop-filter: blur(10px) saturate(135%);
    font-size: 10px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.osd-title {
    max-width: min(240px, 55%);
    padding: 6px 8px;
}

.status-badge {
    flex: 0 0 auto;
    padding: 6px 7px;
    color: var(--text-muted);
}

.status-badge.is-connecting,
.status-badge.is-waiting {
    color: #ffe3a1;
}

.status-badge.is-online {
    color: #a9ffd5;
}

.status-badge.is-error,
.status-badge.is-offline {
    color: #ffb2bd;
}

.loading-ring {
    position: absolute;
    z-index: 4;
    top: 50%;
    left: 50%;
    display: none;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 3px solid rgba(88, 221, 255, 0.15);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spinner 0.8s linear infinite;
}

.video-box.is-loading .loading-ring {
    display: block;
}

.overlay-tools {
    position: absolute;
    z-index: 6;
    right: 10px;
    bottom: 10px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 150ms ease, transform 150ms ease;
}

.video-box:hover .overlay-tools,
.video-box:focus-within .overlay-tools,
.video-box.is-selected .overlay-tools {
    opacity: 1;
    transform: translateY(0);
}

.video-action {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 11px;
    color: #e9f8ff;
    background: rgba(3, 16, 29, 0.7);
    box-shadow: 0 8px 20px rgba(0, 6, 15, 0.24);
    -webkit-backdrop-filter: blur(10px) saturate(135%);
    backdrop-filter: blur(10px) saturate(135%);
    cursor: pointer;
}

.video-action:hover {
    border-color: rgba(88, 221, 255, 0.5);
    color: #fff;
    background: rgba(31, 115, 159, 0.72);
}

.mobile-dock {
    display: none;
}

.toast-region {
    position: fixed;
    z-index: 2000;
    right: max(18px, var(--safe-right));
    bottom: max(18px, var(--safe-bottom));
    display: grid;
    width: min(360px, calc(100vw - 36px));
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--glass-stroke);
    border-radius: 14px;
    color: var(--text-main);
    background: var(--glass-surface-strong);
    box-shadow: 0 18px 46px rgba(0, 5, 14, 0.48);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    font-size: 12px;
    line-height: 1.5;
    opacity: 0;
    transform: translateY(10px) scale(0.98);
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast.is-success i {
    color: var(--success-color);
}

.toast.is-warning i {
    color: var(--warning-color);
}

.toast.is-error i {
    color: var(--danger-color);
}

.noscript-message {
    position: fixed;
    z-index: 3000;
    inset: 50% auto auto 50%;
    width: min(420px, calc(100vw - 36px));
    margin: 0;
    padding: 20px;
    border-radius: 18px;
    color: #fff;
    background: #102238;
    text-align: center;
    transform: translate(-50%, -50%);
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}

@keyframes status-pulse {
    50% { opacity: 0.45; }
}

@media (max-width: 1160px) {
    .app-shell {
        grid-template-columns: 292px minmax(0, 1fr);
    }

    .monitor-toolbar {
        position: relative;
    }

    .toolbar-scroll {
        padding-right: 16px;
        -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 22px), transparent 100%);
        mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 22px), transparent 100%);
    }

    .connection-summary {
        display: none;
    }

    .tool-button span:not(.sr-only) {
        display: none;
    }

    .tool-button {
        padding: 0 11px;
    }

    .layout-button span {
        display: inline !important;
    }

    .volume-control output {
        display: none;
    }

    .volume-control input {
        width: 58px;
    }

    .current-channel {
        min-width: 128px;
        flex-basis: 190px;
    }
}

@media (max-width: 900px) {
    body,
    .camera-page {
        gap: 10px;
    }

    .channel-trigger,
    .panel-close {
        display: inline-grid;
    }

    .channel-trigger {
        display: inline-flex;
    }

    .app-shell {
        display: block;
    }

    .monitor-workspace {
        width: 100%;
        height: 100%;
    }

    .channel-panel {
        position: fixed;
        z-index: 1200;
        top: calc(max(12px, var(--safe-top)) + var(--header-height) + 12px);
        bottom: max(12px, var(--safe-bottom));
        left: max(12px, var(--safe-left));
        width: min(360px, calc(100vw - max(24px, var(--safe-left) + var(--safe-right) + 24px)));
        background: var(--glass-surface-strong);
        transform: translateX(calc(-100% - 28px));
        visibility: hidden;
        transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1), visibility 220ms;
    }

    .channel-panel.is-open {
        transform: translateX(0);
        visibility: visible;
    }

    .panel-overlay {
        position: fixed;
        z-index: 1100;
        inset: 0;
        display: block;
        border: 0;
        background: rgba(0, 6, 15, 0.58);
        opacity: 0;
        visibility: hidden;
        -webkit-backdrop-filter: blur(3px);
        backdrop-filter: blur(3px);
        transition: opacity 180ms ease, visibility 180ms;
    }

    .panel-overlay.is-open {
        opacity: 1;
        visibility: visible;
    }
}

@media (max-width: 768px) {
    :root,
    :host {
        --header-height: 58px;
    }

    body,
    .camera-page {
        width: 100%;
        min-width: 0;
        height: 100dvh;
        padding: max(8px, var(--safe-top)) max(8px, var(--safe-right)) calc(72px + max(8px, var(--safe-bottom))) max(8px, var(--safe-left));
    }

    .app-header {
        padding: 7px 8px;
        border-radius: 17px;
    }

    .brand {
        gap: 8px;
    }

    .brand-mark {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
        border-radius: 13px;
    }

    .brand-copy strong {
        font-size: 15px;
    }

    .brand-copy small,
    .current-time,
    .channel-trigger {
        display: none;
    }

    .channel-panel {
        top: auto;
        right: max(8px, var(--safe-right));
        bottom: calc(64px + max(8px, var(--safe-bottom)));
        left: max(8px, var(--safe-left));
        width: auto;
        height: min(76dvh, 680px);
        border-radius: 26px 26px 20px 20px;
        transform: translateY(calc(100% + 90px));
    }

    .channel-panel.is-open {
        transform: translateY(0);
    }

    .panel-heading {
        padding: 16px 17px 12px;
    }

    .panel-heading::before {
        position: absolute;
        top: 7px;
        left: 50%;
        width: 42px;
        height: 4px;
        border-radius: 99px;
        content: "";
        background: rgba(255, 255, 255, 0.28);
        transform: translateX(-50%);
    }

    .panel-heading h1 {
        font-size: 18px;
    }

    .channel-filters {
        padding: 0 12px 11px;
    }

    .monitor-toolbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        padding: 6px 7px;
        border-radius: 16px;
    }

    .toolbar-scroll {
        width: 100%;
        min-width: 0;
    }

    .monitor-toolbar .layout-group,
    .monitor-toolbar .toolbar-divider:first-of-type {
        display: none;
    }

    .search-control input,
    .select-control select {
        font-size: 16px;
    }

    .volume-control {
        display: none;
    }

    .current-channel {
        min-width: 130px;
        flex-basis: 170px;
        padding-right: 6px;
    }

    .video-grid {
        gap: 6px;
        padding-bottom: 2px;
    }

    .video-box {
        border-radius: 14px;
    }

    .mobile-dock {
        position: fixed;
        z-index: 1000;
        right: max(8px, var(--safe-right));
        bottom: max(8px, var(--safe-bottom));
        left: max(8px, var(--safe-left));
        display: grid;
        height: 58px;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        align-items: center;
        padding: 5px;
        border-radius: 19px;
    }

    .dock-button {
        display: grid;
        min-width: 0;
        min-height: 46px;
        place-items: center;
        gap: 2px;
        border: 0;
        border-radius: 13px;
        color: var(--text-muted);
        background: transparent;
        cursor: pointer;
    }

    .dock-button i {
        font-size: 15px;
    }

    .dock-button span {
        font-size: 10px;
        font-weight: 650;
    }

    .dock-button.is-active {
        color: #fff;
        background: linear-gradient(145deg, rgba(63, 190, 234, 0.9), rgba(43, 130, 238, 0.9));
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 7px 16px rgba(48, 156, 255, 0.2);
    }

    .overlay-tools {
        right: 7px;
        bottom: 7px;
    }

    .video-action {
        width: 44px;
        height: 44px;
    }

    .toast-region {
        right: max(10px, var(--safe-right));
        bottom: calc(74px + max(8px, var(--safe-bottom)));
        left: max(10px, var(--safe-left));
        width: auto;
    }
}

@media (max-width: 520px) and (orientation: portrait) {
    .app-header {
        min-height: 50px;
        flex-basis: 50px;
    }

    .brand-mark {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }

    .brand-copy strong {
        font-size: 14px;
    }

    .monitor-toolbar {
        grid-template-columns: minmax(0, 1fr);
    }

    .current-channel {
        display: none;
    }

    .video-grid.grid-4,
    .video-grid.grid-9 {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: none;
        grid-auto-rows: minmax(180px, 32dvh);
        align-content: start;
    }

    .video-grid.grid-1 {
        grid-template-rows: minmax(0, 1fr);
    }

    .toolbar-group .tool-button:nth-of-type(n + 3) span {
        display: none;
    }

    .current-channel {
        min-width: 115px;
        font-size: 10px;
    }

    .mobile-dock {
        height: 54px;
    }

    .dock-button {
        min-height: 42px;
    }
}

@media (max-width: 380px) and (orientation: portrait) {
    .camera-page {
        gap: 6px;
    }

    .dock-button i {
        font-size: 16px;
    }

    .dock-button span {
        font-size: 9px;
    }

    .stream-meta {
        font-size: 10px;
    }
}

@media (orientation: landscape) and (max-height: 600px) and (pointer: coarse) {
    :root,
    :host {
        --header-height: 50px;
    }

    body,
    .camera-page {
        gap: 6px;
        padding: max(6px, var(--safe-top)) max(6px, var(--safe-right)) calc(58px + max(5px, var(--safe-bottom))) max(6px, var(--safe-left));
    }

    .app-header {
        padding: 4px 7px;
        border-radius: 15px;
    }

    .brand-mark {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }

    .brand-copy small {
        display: none;
    }

    .monitor-workspace {
        gap: 5px;
    }

    .monitor-toolbar {
        min-height: 48px;
        padding: 3px 6px;
    }

    .tool-button {
        min-height: 40px;
    }

    .video-grid.grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: repeat(2, minmax(0, 1fr));
    }

    .video-grid.grid-9 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-template-rows: repeat(3, minmax(0, 1fr));
    }

    .mobile-dock {
        position: fixed;
        z-index: 1000;
        right: max(6px, var(--safe-right));
        bottom: max(5px, var(--safe-bottom));
        left: max(6px, var(--safe-left));
        display: grid;
        height: 50px;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        align-items: center;
        padding: 3px;
        border-radius: 16px;
    }

    .dock-button {
        display: grid;
        min-width: 0;
        min-height: 42px;
        grid-template-columns: auto auto;
        align-content: center;
        justify-content: center;
        gap: 6px;
        border: 0;
        border-radius: 12px;
        color: var(--text-muted);
        background: transparent;
    }

    .dock-button.is-active {
        color: #fff;
        background: linear-gradient(145deg, rgba(63, 190, 234, 0.9), rgba(43, 130, 238, 0.9));
    }

    .dock-button i {
        font-size: 14px;
    }

    .dock-button span {
        font-size: 9px;
        font-weight: 650;
    }

    .video-action {
        width: 44px;
        height: 44px;
    }
}

@media (hover: none), (pointer: coarse) {
    .drag-grip {
        display: none;
    }

    .stream-main {
        grid-template-columns: 12px minmax(0, 1fr);
        cursor: pointer !important;
    }

    .video-box.has-stream.is-selected .overlay-tools,
    .video-box.has-stream:focus-within .overlay-tools {
        opacity: 1;
        transform: translateY(0);
    }

    .stream-card:hover,
    .tool-button:hover,
    .header-button:hover {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: more) {
    :root,
    :host {
        --glass-stroke: rgba(255, 255, 255, 0.38);
        --glass-stroke-soft: rgba(255, 255, 255, 0.25);
        --text-muted: #d6e5f3;
        --text-dim: #b4c7d9;
    }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .glass-panel,
    .toast {
        background: #0b2034;
    }

    .channel-panel {
        background: #0a1d30;
    }
}

/* FAN Studio 气象实况系统统一导航与图像综合页面。 */
.camera-page {
    padding-left: max(94px, calc(82px + var(--safe-left)));
    background:
        linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px),
        radial-gradient(circle at 12% 14%, rgba(32, 172, 255, 0.22), transparent 34%),
        radial-gradient(circle at 84% 84%, rgba(67, 80, 235, 0.2), transparent 38%),
        linear-gradient(145deg, #07111f 0%, #0a1d32 48%, #0b182b 100%);
    background-size: 48px 48px, 48px 48px, auto, auto, auto;
}

.platform-rail {
    position: fixed;
    z-index: 2400;
    top: 16px;
    bottom: 16px;
    left: 16px;
    display: flex;
    width: 64px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 9px 7px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 22px;
    color: #fff;
    background: rgba(8, 20, 36, 0.82);
    box-shadow: 0 16px 44px rgba(0, 8, 24, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    -webkit-backdrop-filter: blur(18px) saturate(145%);
    backdrop-filter: blur(18px) saturate(145%);
}

.platform-rail-brand {
    display: grid;
    height: 48px;
    margin-bottom: 7px;
    place-items: center;
    border-radius: 15px;
    background: linear-gradient(145deg, rgba(77, 203, 255, 0.22), rgba(44, 95, 231, 0.18));
}

.platform-rail-brand img {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    object-fit: cover;
}

.platform-view {
    display: flex;
    min-height: 58px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 2px;
    border: 1px solid transparent;
    border-radius: 14px;
    color: #91a8bd;
    transition: color 180ms ease, background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.platform-view i { font-size: 18px; }
.platform-view span { font-size: 9px; line-height: 1.1; white-space: nowrap; }

.platform-view:hover {
    color: #eafaff;
    border-color: rgba(88, 221, 255, 0.18);
    background: rgba(88, 221, 255, 0.08);
    transform: translateY(-1px);
}

.platform-view.is-active {
    color: #fff;
    border-color: rgba(105, 225, 255, 0.32);
    background: linear-gradient(145deg, rgba(48, 156, 255, 0.52), rgba(55, 90, 224, 0.38));
    box-shadow: 0 7px 18px rgba(15, 98, 204, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.platform-rail-spacer { flex: 1 1 auto; }

.brand-logo {
    overflow: hidden;
    padding: 0;
    border-color: rgba(105, 225, 255, 0.3);
    background: #071b35;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (min-width: 769px) and (max-width: 900px) {
    .camera-page .channel-panel { left: 94px; }
}

@media (max-width: 768px),
       (orientation: landscape) and (max-height: 600px) and (pointer: coarse) {
    .camera-page {
        padding:
            max(8px, var(--safe-top))
            max(8px, var(--safe-right))
            calc(144px + var(--safe-bottom))
            max(8px, var(--safe-left));
    }

    .platform-rail {
        top: auto;
        right: calc(10px + var(--safe-right));
        bottom: calc(8px + var(--safe-bottom));
        left: calc(10px + var(--safe-left));
        width: auto;
        height: 66px;
        flex-direction: row;
        justify-content: center;
        gap: 6px;
        padding: 6px 8px;
        border-radius: 20px;
    }

    .platform-rail-brand,
    .platform-rail-spacer { display: none; }

    .platform-view {
        min-width: 0;
        min-height: 52px;
        flex: 1 1 0;
    }

    .platform-view i { font-size: 19px; }
    .platform-view span { font-size: 10px; }

    .camera-page .mobile-dock {
        right: max(8px, var(--safe-right));
        bottom: calc(80px + var(--safe-bottom));
        left: max(8px, var(--safe-left));
    }

    .camera-page .channel-panel {
        right: max(8px, var(--safe-right));
        bottom: calc(142px + var(--safe-bottom));
        left: max(8px, var(--safe-left));
        max-height: calc(100dvh - 158px - var(--safe-top) - var(--safe-bottom));
    }

    .camera-page .toast-region {
        bottom: calc(150px + var(--safe-bottom));
    }
}
