:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-soft: #eef3f4;
    --ink: #121417;
    --muted: #66707a;
    --line: #d9e0e3;
    --teal: #0f766e;
    --teal-strong: #115e59;
    --red: #dc2626;
    --amber: #b45309;
    --violet: #4f46e5;
    --shadow: 0 18px 48px rgba(17, 24, 39, 0.1);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(244, 246, 248, 1)),
        radial-gradient(circle at top right, rgba(15, 118, 110, 0.16), transparent 34%),
        var(--bg);
    font-family: Segoe UI, Arial, sans-serif;
}

a {
    color: inherit;
}

.shell {
    width: min(1440px, calc(100% - 32px));
    margin: 0 auto;
    padding: 18px 0 48px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 72px;
    margin-bottom: 24px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(17, 24, 39, 0.06);
    backdrop-filter: blur(16px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    min-width: 190px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--ink);
    color: white;
    font-weight: 800;
}

.brand strong,
.brand small {
    display: block;
}

.brand small,
.muted,
.small {
    color: var(--muted);
}

.nav {
    display: flex;
    gap: 8px;
    padding: 4px;
    background: var(--surface-soft);
    border-radius: 8px;
}

.nav a {
    padding: 10px 14px;
    border-radius: 6px;
    color: #283039;
    font-size: 14px;
    font-weight: 650;
    text-decoration: none;
}

.nav a:hover {
    background: white;
}

.top-status {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 150px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 650;
}

.top-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.compact-button {
    min-height: 36px;
    padding: 0 12px;
}

.dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    flex: 0 0 10px;
    border-radius: 50%;
    background: var(--muted);
}

.dot-live {
    background: var(--teal);
    box-shadow: 0 0 0 6px rgba(15, 118, 110, 0.12);
}

.dot-ok {
    background: var(--teal);
    box-shadow: 0 0 0 6px rgba(15, 118, 110, 0.12);
}

.dot-muted {
    background: #98a2ad;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(420px, 1.08fr);
    gap: 28px;
    align-items: stretch;
    min-height: 520px;
    margin-bottom: 24px;
}

.hero-copy,
.broadcast-frame,
.panel,
.workspace,
.video-shell,
.metric {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.hero-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(28px, 5vw, 64px);
}

.eyebrow,
.panel-kicker {
    margin: 0 0 10px;
    color: var(--teal-strong);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 18px;
    font-size: clamp(44px, 7vw, 92px);
    line-height: 0.94;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 12px;
    font-size: 24px;
    letter-spacing: 0;
}

.lead {
    max-width: 640px;
    color: #48525c;
    font-size: 20px;
    line-height: 1.55;
}

.hero-actions,
.stream-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 6px;
    font: inherit;
    font-size: 14px;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
}

.button-primary {
    background: var(--teal);
    color: white;
}

.button-primary:hover {
    background: var(--teal-strong);
}

.button-secondary,
.button-ghost {
    background: white;
    color: #27313a;
    border-color: var(--line);
}

.button-danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.icon-button {
    width: 42px;
    padding: 0;
    background: var(--ink);
    color: white;
}

.broadcast-frame {
    display: grid;
    grid-template-rows: auto 1fr auto;
    overflow: hidden;
    background: #101316;
    color: white;
}

.frame-toolbar,
.frame-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    color: #c7d0d8;
    border-color: rgba(255, 255, 255, 0.12);
}

.frame-toolbar {
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.frame-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 13px;
}

.signal-stage {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 360px;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.35), rgba(79, 70, 229, 0.22)),
        #101316;
}

.signal-stage::before {
    content: "";
    position: absolute;
    inset: 12%;
    background:
        linear-gradient(90deg, transparent 49%, rgba(255, 255, 255, 0.2) 50%, transparent 51%),
        linear-gradient(0deg, transparent 49%, rgba(255, 255, 255, 0.12) 50%, transparent 51%);
    background-size: 52px 52px;
    opacity: 0.45;
}

.signal-rings {
    position: absolute;
    width: min(56vw, 520px);
    aspect-ratio: 1;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
}

.signal-rings::before,
.signal-rings::after {
    content: "";
    position: absolute;
    inset: 16%;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
}

.signal-rings::after {
    inset: 32%;
}

.signal-core {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: var(--ink);
    box-shadow: 0 0 80px rgba(15, 118, 110, 0.32);
}

.signal-core span {
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
}

.signal-core strong {
    font-size: 42px;
}

.section-grid,
.control-grid,
.admin-layout,
.player-layout,
.auth-layout,
.tv-layout {
    display: grid;
    gap: 18px;
}

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

.panel,
.workspace {
    padding: 22px;
}

.panel p {
    color: #4d5964;
    line-height: 1.6;
}

.admin-layout {
    gap: 22px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.section-heading.compact h1,
.section-heading.compact h2 {
    margin-bottom: 0;
    font-size: 28px;
}

.control-grid {
    grid-template-columns: minmax(320px, 0.9fr) minmax(280px, 0.65fr) minmax(280px, 0.65fr);
    align-items: start;
}

label {
    display: block;
    margin: 16px 0 7px;
    color: #3a444d;
    font-size: 14px;
    font-weight: 750;
}

input,
select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #cdd6db;
    border-radius: 6px;
    background: white;
    color: var(--ink);
    font: inherit;
}

input:focus,
select:focus {
    outline: 2px solid rgba(15, 118, 110, 0.18);
    border-color: var(--teal);
}

.message-slot {
    min-height: 54px;
    margin-top: 14px;
}

.alert {
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 650;
}

.alert-success {
    background: #dcfce7;
    color: #14532d;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-info {
    background: #e0f2fe;
    color: #075985;
    border: 1px solid #bae6fd;
}

.copy-row,
.health-lines div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.copy-row:last-child,
.health-lines div:last-child {
    border-bottom: 0;
}

code,
.mono {
    font-family: Consolas, Monaco, monospace;
}

code {
    padding: 4px 7px;
    border-radius: 5px;
    background: #eef3f4;
    color: #20272d;
    font-size: 13px;
}

.stream-list {
    display: grid;
    gap: 10px;
}

.stream-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
}

.stream-row strong,
.stream-row span {
    display: block;
}

.stream-row span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 14px;
}

.empty-state {
    display: grid;
    place-items: center;
    min-height: 120px;
    border: 1px dashed #b8c2c8;
    border-radius: 8px;
    color: var(--muted);
    background: #fbfcfd;
}

.log-view {
    min-height: 240px;
    max-height: 420px;
    overflow: auto;
    margin: 0;
    padding: 16px;
    border-radius: 8px;
    background: #101316;
    color: #d7dde2;
    font-size: 12px;
    line-height: 1.55;
    white-space: pre-wrap;
}

.player-layout {
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: start;
}

.player-main {
    min-width: 0;
}

.video-shell {
    position: relative;
    overflow: hidden;
    background: #050607;
}

.video-js {
    width: 100%;
    min-height: min(66vh, 720px);
}

.offline-cover {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    gap: 10px;
    align-content: center;
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.2), rgba(79, 70, 229, 0.16)),
        rgba(5, 6, 7, 0.86);
    color: white;
    text-align: center;
}

.offline-cover strong {
    font-size: 26px;
}

.side-rail {
    display: grid;
    gap: 16px;
}

.status-panel strong,
.status-panel span {
    display: block;
}

.status-panel strong {
    margin-bottom: 8px;
    font-size: 26px;
}

.status-panel span:last-child {
    color: var(--muted);
}

.metric-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.metric {
    padding: 16px;
}

.metric span,
.metric strong {
    display: block;
}

.metric span {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.metric strong {
    font-size: 22px;
}

.auth-layout {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 480px);
    align-items: center;
    min-height: 620px;
}

.auth-copy {
    padding: clamp(24px, 5vw, 72px);
}

.auth-panel {
    box-shadow: var(--shadow);
}

.tv-layout {
    grid-template-columns: minmax(0, 1fr) 380px;
    align-items: start;
}

.tv-main {
    min-width: 0;
}

.tv-heading h1 {
    font-size: 42px;
}

.watch-stage {
    position: relative;
    min-height: min(62vh, 680px);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #050607;
    box-shadow: var(--shadow);
}

.watch-stage .video-js,
.youtube-frame {
    width: 100%;
    height: min(62vh, 680px);
    min-height: 420px;
}

.youtube-frame {
    display: block;
    border: 0;
}

.empty-player {
    display: grid;
    place-items: center;
    align-content: center;
    min-height: min(62vh, 680px);
    color: white;
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.26), rgba(79, 70, 229, 0.18)),
        #101316;
}

.empty-player strong {
    font-size: 44px;
}

.watch-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px 0 18px;
}

.content-rail {
    display: grid;
    gap: 16px;
    position: sticky;
    top: 18px;
}

.content-list {
    display: grid;
    gap: 10px;
}

.content-item {
    display: grid;
    grid-template-columns: 116px minmax(0, 1fr);
    gap: 12px;
    width: 100%;
    min-height: 78px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
    color: var(--ink);
    text-align: left;
}

.content-item.selected,
.content-item:hover {
    border-color: rgba(15, 118, 110, 0.42);
    background: #eef8f6;
}

.content-thumb {
    display: block;
    width: 116px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 6px;
    background: #101316;
}

.content-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.live-thumb {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: white;
    background:
        linear-gradient(135deg, rgba(220, 38, 38, 0.42), rgba(15, 118, 110, 0.46)),
        #101316;
}

.live-thumb span {
    font-weight: 900;
}

.content-copy {
    display: grid;
    align-content: center;
    gap: 6px;
    min-width: 0;
}

.content-copy strong {
    overflow: hidden;
    font-size: 14px;
    line-height: 1.25;
    text-overflow: ellipsis;
}

.content-copy small {
    color: var(--muted);
    font-size: 12px;
}

.comments-workspace {
    box-shadow: none;
}

.inline-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    margin-bottom: 14px;
}

.inline-form input {
    margin: 0;
}

.comment-list {
    display: grid;
    gap: 10px;
}

.comment {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
}

.comment p {
    margin: 6px 0;
    color: #303941;
}

.comment small {
    color: var(--muted);
}

.compact-empty {
    min-height: 72px;
    padding: 14px;
}

.submit-panel form + form {
    margin-top: 16px;
}

.admin-catalog-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
    margin: 16px 0;
}

.flat-panel {
    box-shadow: none;
}

.admin-content-list {
    margin-top: 12px;
}

.admin-content-item {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.studio-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 18px;
    align-items: start;
}

.studio-main,
.studio-side {
    display: grid;
    gap: 16px;
}

.studio-side {
    position: sticky;
    top: 18px;
}

.studio-list {
    margin-top: 14px;
}

.studio-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
}

.studio-item strong,
.studio-item small {
    display: block;
}

.studio-item small {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
}

.studio-item p {
    margin: 8px 0 0;
    color: #4d5964;
    line-height: 1.45;
}

@media (max-width: 980px) {
    .hero,
    .player-layout,
    .auth-layout,
    .tv-layout,
    .studio-layout {
        grid-template-columns: 1fr;
    }

    .control-grid,
    .section-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: auto;
    }

    .content-rail,
    .studio-side {
        position: static;
    }
}

@media (max-width: 720px) {
    .shell {
        width: min(100% - 20px, 1440px);
        padding-top: 10px;
    }

    .topbar,
    .section-heading,
    .stream-row {
        align-items: stretch;
        flex-direction: column;
    }

    .brand,
    .top-status {
        min-width: 0;
    }

    .nav {
        width: 100%;
    }

    .nav a {
        flex: 1;
        text-align: center;
    }

    .hero-copy,
    .panel,
    .workspace {
        padding: 18px;
    }

    h1 {
        font-size: 44px;
    }

    .lead {
        font-size: 17px;
    }

    .stream-actions {
        width: 100%;
    }

    .stream-actions .button {
        flex: 1;
    }

    .top-actions,
    .watch-actions,
    .inline-form {
        align-items: stretch;
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .content-item {
        grid-template-columns: 96px minmax(0, 1fr);
    }

    .content-thumb {
        width: 96px;
    }

    .admin-catalog-grid {
        grid-template-columns: 1fr;
    }

    .watch-stage .video-js,
    .youtube-frame,
    .empty-player {
        min-height: 280px;
        height: 320px;
    }
}
