:root {
    color-scheme: dark;
    --bg: #0d1118;
    --bg-accent: #111b29;
    --panel: rgba(18, 25, 38, 0.78);
    --panel-strong: rgba(24, 33, 49, 0.92);
    --text: #ecf1f8;
    --muted: #a3b0c2;
    --line: rgba(255, 255, 255, 0.08);
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
}

body[data-theme="light"] {
    color-scheme: light;
    --bg: #eef3f8;
    --bg-accent: #d7e1ec;
    --panel: rgba(255, 255, 255, 0.8);
    --panel-strong: rgba(255, 255, 255, 0.96);
    --text: #152033;
    --muted: #5f6d82;
    --line: rgba(21, 32, 51, 0.1);
    --shadow: 0 22px 48px rgba(29, 46, 72, 0.12);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: "Manrope", sans-serif;
    background:
        radial-gradient(circle at top, rgba(96, 143, 214, 0.14), transparent 38%),
        radial-gradient(circle at bottom, rgba(84, 188, 171, 0.1), transparent 30%),
        linear-gradient(180deg, var(--bg-accent), var(--bg));
    color: var(--text);
    display: grid;
    place-items: center;
    padding: 32px 20px;
    transition: background 220ms ease, color 220ms ease;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 120px 120px;
    mask-image: radial-gradient(circle at center, black, transparent 75%);
    opacity: 0.32;
}

.shell {
    width: min(100%, 760px);
    position: relative;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 32px;
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 500ms ease, transform 500ms ease, background 220ms ease, border-color 220ms ease;
}

body.is-ready .shell {
    opacity: 1;
    transform: translateY(0);
}

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-strong);
    color: var(--text);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    transform: translateY(-2px);
    outline: none;
    border-color: rgba(130, 180, 255, 0.45);
}

.theme-toggle__icon {
    font-size: 1rem;
}

.hero {
    text-align: center;
    padding: 36px 12px 28px;
}

.hub-brand {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 88px;
}

.hub-brand__logo {
    display: none;
    width: min(100%, 540px);
    height: auto;
    object-fit: contain;
}

body:not([data-theme="light"]) .hub-brand__logo--dark {
    display: block;
}

body[data-theme="light"] .hub-brand__logo--light {
    display: block;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.subtitle {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: clamp(1rem, 2.5vw, 1.125rem);
}

.auth-panel {
    display: grid;
    gap: 18px;
    margin-bottom: 22px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02));
}

.auth-panel__intro {
    display: grid;
    gap: 8px;
}

.auth-panel__eyebrow {
    margin: 0;
    font-size: 0.78rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: #80c7ff;
}

.auth-panel__title {
    margin: 0;
    font-size: clamp(1.35rem, 3vw, 1.8rem);
}

.auth-panel__text {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.auth-panel__card {
    display: grid;
    gap: 14px;
}

.auth-switch {
    display: inline-grid;
    grid-auto-flow: column;
    gap: 6px;
    width: fit-content;
    padding: 6px;
    border: 1px solid rgba(128, 199, 255, 0.14);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.auth-switch--hidden {
    display: none;
}

.tab {
    min-width: 110px;
    padding: 10px 18px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    cursor: pointer;
    transition: background 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.tab:hover,
.tab:focus-visible {
    color: var(--text);
    outline: none;
}

.tab.active {
    background: linear-gradient(135deg, #74c5ff, #408cff);
    color: #091019;
    box-shadow: 0 10px 22px rgba(64, 140, 255, 0.28);
}

.tab.active:hover,
.tab.active:focus-visible {
    transform: translateY(-1px);
}

.hub-auth-form {
    display: grid;
    gap: 10px;
}

.hub-auth-form--hidden {
    display: none;
}

.hub-auth-form input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
    color: var(--text);
    font: inherit;
}

.hub-auth-form button,
.hub-auth-user__logout {
    padding: 12px 14px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #74c5ff, #408cff);
    color: #091019;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.hub-auth-feedback {
    min-height: 1.4em;
    margin: 0;
    color: var(--muted);
}

.hub-auth-feedback[data-state="error"] {
    color: #ff8f9f;
}

.hub-auth-feedback[data-state="success"] {
    color: #88efc3;
}

.hub-auth-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel-strong);
}

.hub-auth-user--hidden {
    display: none;
}

.hub-auth-user__identity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hub-auth-user__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.hub-auth-user__avatar-wrap {
    position: relative;
    display: inline-flex;
    width: 52px;
    height: 52px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(116, 197, 255, 0.18);
}

.hub-auth-user__avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hub-auth-user__avatar--hidden,
.hub-auth-user__avatar-fallback--hidden {
    display: none;
}

.hub-auth-user__avatar-fallback {
    font-size: 1rem;
    font-weight: 700;
}

.hub-auth-user__label,
.hub-auth-user__name {
    margin: 0;
}

.hub-auth-user__label {
    font-size: 0.76rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
}

.hub-auth-user__file-input {
    display: none;
}

.hub-auth-user__secondary-action,
.hub-auth-user__logout {
    padding: 12px 14px;
    border-radius: 14px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.hub-auth-user__secondary-action {
    border: 1px solid rgba(128, 199, 255, 0.18);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
}

.hub-auth-user__secondary-action:hover,
.hub-auth-user__secondary-action:focus-visible,
.hub-auth-user__logout:hover,
.hub-auth-user__logout:focus-visible {
    transform: translateY(-1px);
    outline: none;
}

.hub-auth-user__secondary-action:hover,
.hub-auth-user__secondary-action:focus-visible {
    border-color: rgba(128, 199, 255, 0.34);
    background: rgba(255, 255, 255, 0.06);
}

.hub-auth-user__name {
    margin-top: 4px;
    font-size: 1rem;
    font-weight: 700;
}

.hub-links {
    display: grid;
    gap: 16px;
    padding: 8px 0 4px;
}

.hub-card {
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    padding: 22px 24px;
    min-height: 106px;
    border-radius: 24px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    column-gap: 16px;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.hub-card::after {
    content: "";
    position: absolute;
    inset: auto -30% -65% auto;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    filter: blur(18px);
    transition: transform 220ms ease;
}

.hub-card:hover,
.hub-card:focus-visible {
    transform: translateY(-3px) scale(1.01);
    border-color: rgba(166, 197, 255, 0.28);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.14);
    outline: none;
}

.hub-card:hover::after,
.hub-card:focus-visible::after {
    transform: scale(1.08);
}

.hub-card__marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.hub-card__logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    object-position: center;
    flex: 0 0 auto;
}

.hub-card__logo--tv {
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.12));
}

.hub-card__logo--music {
    width: 48px;
    height: 48px;
}

.hub-card__logo--drive {
    width: 46px;
    height: 46px;
}

.hub-card__title {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.hub-card__arrow {
    color: var(--muted);
    font-size: 1.1rem;
}

.hub-card--tv .hub-card__marker {
    background: linear-gradient(135deg, #74c5ff, #408cff);
}

.hub-card--music .hub-card__marker {
    background: linear-gradient(135deg, #93f0c9, #3cb888);
}

.hub-card--drive .hub-card__marker {
    background: linear-gradient(135deg, #ffd36c, #e89f2d);
}

@media (max-width: 640px) {
    body {
        padding: 18px;
    }

    .shell {
        padding: 22px 18px 18px;
        border-radius: 28px;
    }

    .hero {
        padding-top: 54px;
    }

    .auth-panel {
        padding: 18px;
        border-radius: 22px;
    }

    .hub-auth-user {
        align-items: flex-start;
        flex-direction: column;
    }

    .hub-auth-user__actions {
        width: 100%;
        justify-content: stretch;
    }

    .hub-auth-user__secondary-action,
    .hub-auth-user__logout {
        width: 100%;
    }

    .auth-switch {
        width: 100%;
        grid-auto-columns: minmax(0, 1fr);
    }

    .tab {
        min-width: 0;
        width: 100%;
    }

    .hub-brand {
        min-height: 56px;
    }

    .hub-brand__logo {
        width: min(100%, 320px);
    }

    .hub-card {
        min-height: 98px;
        padding: 20px;
        grid-template-columns: auto 1fr auto;
    }

    .hub-card__logo {
        width: 38px;
        height: 38px;
    }

    .hub-card__logo--music {
        width: 44px;
        height: 44px;
    }

    .hub-card__logo--drive {
        width: 42px;
        height: 42px;
    }
}

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