:root {
    --bg-0: #06101b;
    --bg-1: #081827;
    --bg-2: #0c2233;
    --card: rgba(9, 22, 35, 0.76);
    --card-strong: rgba(12, 30, 45, 0.92);
    --line: rgba(157, 211, 255, 0.18);
    --line-strong: rgba(95, 227, 94, 0.28);
    --text: #f5f8ff;
    --muted: #a9b7c9;
    --blue: #1267a7;
    --blue-soft: #1b9df0;
    --green: #5fe35e;
    --green-2: #1dbb4f;
    --danger: #ff4f67;
    --warning: #ffd166;
    --shadow: 0 28px 90px rgba(0, 0, 0, 0.46);
    --radius-xl: 30px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html {
    min-height: 100%;
    background: var(--bg-0);
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background:
        radial-gradient(circle at 16% 12%, rgba(18, 103, 167, 0.46), transparent 32%),
        radial-gradient(circle at 88% 10%, rgba(95, 227, 94, 0.22), transparent 34%),
        radial-gradient(circle at 55% 100%, rgba(27, 157, 240, 0.14), transparent 38%),
        linear-gradient(135deg, var(--bg-0) 0%, var(--bg-1) 45%, #07111d 100%);
    overflow-x: hidden;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
}

body::before {
    background-image:
        linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: linear-gradient(to bottom, black 0%, black 42%, transparent 90%);
}

body::after {
    background:
        linear-gradient(110deg, transparent 0 18%, rgba(18, 103, 167, 0.13) 18% 19%, transparent 19% 44%, rgba(95, 227, 94, 0.10) 44% 45%, transparent 45% 100%);
    opacity: 0.75;
}

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

.auth-shell {
    min-height: 100vh;
    min-height: 100svh;
    display: grid;
    place-items: center;
    padding: calc(24px + var(--safe-top)) 18px calc(24px + var(--safe-bottom));
}

.auth-card {
    width: min(100%, 520px);
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(13, 31, 48, 0.88), rgba(8, 18, 29, 0.82));
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    padding: clamp(22px, 4vw, 38px);
    backdrop-filter: blur(24px);
}

.auth-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 0%, rgba(95, 227, 94, 0.12), transparent 30%),
        linear-gradient(135deg, rgba(27, 157, 240, 0.14), transparent 36%);
    pointer-events: none;
}

.auth-card > * {
    position: relative;
}

.logo-wrap {
    display: grid;
    place-items: center;
    margin: -8px auto 8px;
}

.auth-logo {
    width: min(250px, 62vw);
    height: auto;
    display: block;
    filter: drop-shadow(0 24px 40px rgba(0,0,0,.34));
}

.install-logo {
    width: 130px;
    margin: 0 auto 10px;
}

.brand-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #dfffe0;
    background: rgba(95, 227, 94, 0.10);
    border: 1px solid rgba(95, 227, 94, 0.25);
}

.brand-eyebrow.compact {
    font-size: 10px;
    padding: 6px 10px;
}

h1 {
    margin: 18px 0 10px;
    font-size: clamp(30px, 6vw, 52px);
    line-height: .98;
    letter-spacing: -0.055em;
    text-wrap: balance;
}

.subtitle {
    margin: 0;
    color: var(--muted);
    font-size: clamp(15px, 2.2vw, 17px);
    line-height: 1.55;
}

.login-form {
    display: grid;
    gap: 12px;
    margin-top: 24px;
}

label {
    color: #e7eef9;
    font-size: 13px;
    font-weight: 800;
}

input {
    width: 100%;
    min-height: 50px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.075);
    color: var(--text);
    padding: 14px 15px;
    font: inherit;
    outline: none;
}

input::placeholder { color: rgba(222, 232, 245, 0.42); }

input:focus {
    border-color: rgba(95, 227, 94, 0.58);
    box-shadow: 0 0 0 4px rgba(95, 227, 94, 0.13);
}

button,
.logout {
    min-height: 50px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    border: 0;
    border-radius: var(--radius-md);
    padding: 14px 18px;
    background: linear-gradient(135deg, var(--blue-soft), var(--blue) 48%, var(--green-2));
    color: white;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 18px 44px rgba(21, 123, 190, 0.28);
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

button:hover,
.logout:hover { transform: translateY(-1px); }

.logout {
    background: rgba(255,255,255,0.085);
    border: 1px solid var(--line);
    box-shadow: none;
    white-space: nowrap;
}

.primary-link {
    background: linear-gradient(135deg, var(--blue-soft), var(--blue) 48%, var(--green-2));
    border: 0;
    box-shadow: 0 18px 44px rgba(21, 123, 190, 0.28);
}

.alert {
    border-radius: var(--radius-md);
    padding: 13px 15px;
    margin: 18px 0 0;
    border: 1px solid var(--line);
    font-size: 14px;
    line-height: 1.45;
}

.alert.error {
    background: rgba(255, 79, 103, 0.12);
    border-color: rgba(255, 79, 103, 0.42);
}

.alert.info {
    background: rgba(95, 227, 94, 0.11);
    border-color: rgba(95, 227, 94, 0.34);
}

.access-rules {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.access-rules span {
    padding: 8px 10px;
    border-radius: 999px;
    color: #dcecff;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.10);
    font-size: 12px;
    font-weight: 800;
}

.microcopy,
.brand-tagline {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.microcopy { margin: 18px 0 0; }
.brand-tagline {
    margin: 18px 0 0;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: rgba(245,248,255,.72);
}

.watch-shell {
    width: min(1240px, calc(100% - 32px));
    margin: 0 auto;
    padding: calc(24px + var(--safe-top)) 0 calc(28px + var(--safe-bottom));
}

.watch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 20px;
}

.watch-brand {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 16px;
}

.watch-logo {
    width: 78px;
    height: 78px;
    flex: 0 0 78px;
    object-fit: contain;
    filter: drop-shadow(0 14px 24px rgba(0,0,0,.38));
}

.watch-header h1 {
    margin: 10px 0 6px;
    font-size: clamp(25px, 4.5vw, 46px);
    letter-spacing: -0.052em;
}

.watch-header p {
    margin: 0;
    color: var(--muted);
    line-height: 1.35;
}

.player-card,
.status-card {
    background: linear-gradient(180deg, rgba(13, 31, 48, 0.84), rgba(8, 18, 29, 0.78));
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(24px);
}

.player-card {
    padding: 12px;
    border-radius: var(--radius-xl);
}

.player-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 240px;
    border-radius: 22px;
    overflow: hidden;
    background: #000;
    border: 1px solid rgba(255,255,255,0.08);
}

.player-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
}

.watermark {
    position: absolute;
    right: 14px;
    bottom: 14px;
    max-width: min(520px, calc(100% - 28px));
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 11px;
    border-radius: 999px;
    color: rgba(255,255,255,0.86);
    background: rgba(0,0,0,0.48);
    border: 1px solid rgba(255,255,255,0.19);
    pointer-events: none;
    backdrop-filter: blur(12px);
    font-size: 12px;
}

.watermark span {
    color: rgba(95, 227, 94, 0.9);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.watermark strong {
    font-weight: 850;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-grid {
    display: grid;
    grid-template-columns: 1.25fr .75fr;
    gap: 14px;
    margin-top: 16px;
}

.status-card {
    min-height: 104px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px;
    border-radius: var(--radius-lg);
}

.status-card.primary { border-color: var(--line-strong); }

.status-card strong {
    display: block;
    margin-top: 2px;
}

.status-card p {
    margin: 6px 0 0;
    color: var(--muted);
    line-height: 1.5;
    font-size: 14px;
}

.dot {
    width: 12px;
    height: 12px;
    margin-top: 6px;
    border-radius: 999px;
    background: var(--green);
    box-shadow: 0 0 0 8px rgba(95, 227, 94, 0.13), 0 0 28px rgba(95, 227, 94, .45);
    flex: 0 0 auto;
}

.mini-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(27,157,240,.22), rgba(95,227,94,.18));
    border: 1px solid rgba(255,255,255,.14);
    color: #effff0;
    font-size: 12px;
    font-weight: 950;
    letter-spacing: -.02em;
}

.install-shell { align-items: start; }
.install-card { width: min(100%, 1020px); }
.install-actions { margin-top: 18px; }

.table-wrap {
    overflow: auto;
    margin-top: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(0,0,0,.16);
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
}

th,
td {
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,.09);
    padding: 12px 14px;
    white-space: nowrap;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #dfffe0;
    background: rgba(12, 30, 45, 0.96);
}

tr:last-child td { border-bottom: 0; }
code {
    color: #f4fff3;
    background: rgba(95,227,94,.12);
    border: 1px solid rgba(95,227,94,.24);
    padding: 4px 7px;
    border-radius: 8px;
}

@media (max-width: 860px) {
    .watch-shell { width: min(100% - 22px, 760px); }

    .watch-header {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
    }

    .logout { width: 100%; }

    .status-grid { grid-template-columns: 1fr; }

    .watch-logo {
        width: 66px;
        height: 66px;
        flex-basis: 66px;
    }
}

@media (max-width: 560px) {
    .auth-shell { padding-left: 12px; padding-right: 12px; }
    .auth-card {
        border-radius: 24px;
        padding: 20px;
    }

    .auth-logo { width: min(210px, 76vw); }
    h1 { font-size: clamp(28px, 10vw, 38px); }

    .access-rules span {
        flex: 1 1 calc(50% - 8px);
        text-align: center;
    }

    .watch-shell {
        width: calc(100% - 14px);
        padding-top: calc(12px + var(--safe-top));
    }

    .watch-brand {
        gap: 11px;
    }

    .watch-logo {
        width: 56px;
        height: 56px;
        flex-basis: 56px;
    }

    .brand-eyebrow.compact { font-size: 9px; }

    .watch-header h1 {
        font-size: 24px;
        line-height: 1.02;
    }

    .watch-header p { font-size: 13px; }

    .player-card {
        padding: 7px;
        border-radius: 22px;
    }

    .player-wrap {
        min-height: 210px;
        border-radius: 17px;
    }

    .watermark {
        left: 8px;
        right: 8px;
        bottom: 8px;
        justify-content: center;
        font-size: 10px;
        border-radius: 14px;
        padding: 7px 8px;
    }

    .watermark span { display: none; }

    .status-card {
        border-radius: 18px;
        padding: 15px;
    }

    .status-card p { font-size: 13px; }

    .brand-tagline { font-size: 11px; }
}

@media (max-width: 390px) {
    .auth-card { padding: 18px; }
    .auth-logo { width: min(188px, 76vw); }
    .player-wrap { min-height: 190px; }
    .watch-header h1 { font-size: 22px; }
}

@media (orientation: landscape) and (max-height: 520px) {
    .auth-shell { place-items: start center; }
    .auth-logo { width: 150px; }
    .auth-card { margin: 8px 0; }
}
