:root {
    --bg: #141414;
    --bg-soft: #1b1b1b;
    --panel: rgba(24, 24, 24, 0.82);
    --panel-strong: rgba(30, 30, 30, 0.95);
    --line: rgba(255, 255, 255, 0.1);
    --text: #f5f5f5;
    --muted: #b0b0b0;
    --accent: #E50914;
    --accent-soft: rgba(229, 9, 20, 0.18);
    --success: #2ecc71;
    --danger: #ff6b6b;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(229, 9, 20, 0.16), transparent 28%),
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.05), transparent 30%),
        linear-gradient(180deg, #121212 0%, #141414 45%, #0f0f0f 100%);
    color: var(--text);
    font-family: var(--font);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.28)),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 160px);
    opacity: 0.7;
}

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

button,
input,
select {
    font: inherit;
}

.page {
    position: relative;
    z-index: 1;
    padding-bottom: 48px;
}

.shell {
    width: min(1320px, calc(100vw - 40px));
    margin: 0 auto;
}

.shell--auth {
    min-height: calc(100vh - 84px);
    display: grid;
    align-items: center;
    padding-top: 36px;
}

.shell--hero {
    padding-top: 34px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(18px);
    background: rgba(15, 15, 15, 0.84);
    border-bottom: 1px solid var(--line);
}

.topbar__inner {
    min-height: 84px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

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

.brand__mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: block;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(229, 9, 20, 0.3);
}

.brand__mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand__copy {
    display: grid;
    gap: 2px;
}

.brand__copy strong {
    font-size: 0.98rem;
    line-height: 1;
}

.brand__copy small,
.meta-chip,
.stream-card small,
.mini-card small,
.hero__copy,
.section-head .eyebrow,
.eyebrow,
.inline-link {
    color: var(--muted);
}

.topnav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.topnav__link {
    padding: 10px 14px;
    border-radius: 999px;
    color: #dbdbdb;
    transition: background-color 160ms ease, color 160ms ease;
}

.topnav__link:hover,
.topnav__link.is-active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.84rem;
}

.meta-chip--ghost {
    background: rgba(255, 255, 255, 0.03);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 420px);
    gap: 22px;
    padding: 42px 0 26px;
}

.hero--auth {
    grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.25fr);
}

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

.hero__copy-block,
.hero-panel,
.auth-panel,
.builder-card,
.panel-card {
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.hero__copy-block,
.hero-panel,
.builder-card {
    border-radius: var(--radius-lg);
}

.hero__copy-block {
    padding: 40px;
}

.hero__title {
    margin: 10px 0 12px;
    font-size: clamp(2.4rem, 5vw, 4.2rem);
    line-height: 0.96;
    max-width: 12ch;
}

.hero__copy {
    max-width: 60ch;
    line-height: 1.65;
    font-size: 1rem;
}

.hero__actions,
.panel-card__actions,
.overlay-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.hero__actions {
    margin-top: 22px;
}

.hero__footer {
    margin-top: 18px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.hero-panel {
    padding: 18px;
    display: grid;
}

.panel-card {
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 55%),
        linear-gradient(160deg, rgba(229, 9, 20, 0.18), rgba(10, 10, 10, 0.2));
    padding: 24px;
}

.panel-card h2 {
    margin: 10px 0 8px;
    font-size: 2rem;
}

.eyebrow {
    font-size: 0.76rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.button {
    appearance: none;
    border: none;
    cursor: pointer;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 999px;
    transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease, opacity 180ms ease;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.56;
}

.button--primary {
    background: linear-gradient(135deg, var(--accent), #7b040b);
    color: #fff;
    box-shadow: 0 16px 36px rgba(229, 9, 20, 0.26);
}

.button--ghost {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.button--text {
    background: transparent;
    color: #fff;
    min-height: 0;
    padding: 0;
}

.button--wide {
    width: 100%;
}

.alert {
    margin: 0 0 18px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid transparent;
}

.alert--error {
    background: rgba(255, 107, 107, 0.12);
    border-color: rgba(255, 107, 107, 0.28);
    color: #ffd6d6;
}

.alert--success {
    background: rgba(46, 204, 113, 0.12);
    border-color: rgba(46, 204, 113, 0.28);
    color: #d9ffe8;
}

.feature-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 30px;
}

.mini-card {
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.mini-card__title {
    display: block;
    margin-bottom: 4px;
    font-weight: 700;
}

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

.auth-switch {
    display: inline-flex;
    gap: 8px;
    padding: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    margin-bottom: 16px;
}

.auth-switch__item {
    border: none;
    background: transparent;
    color: #c9c9c9;
    padding: 10px 14px;
    border-radius: 999px;
    cursor: pointer;
}

.auth-switch__item.is-active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.auth-stage {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.auth-card {
    border-radius: 22px;
    padding: 22px;
    background: var(--panel-strong);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-card--single {
    min-height: 0;
}

.auth-card__head h2 {
    margin: 8px 0 18px;
    font-size: 1.7rem;
}

.stack-form,
.builder-card {
    display: grid;
    gap: 16px;
}

.field {
    display: grid;
    gap: 8px;
}

.field span {
    color: #f1f1f1;
    font-size: 0.9rem;
}

.field input,
.field select,
.join-inline__input {
    width: 100%;
    min-height: 48px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    padding: 0 14px;
    outline: none;
}

.field select,
.field select option,
.field select optgroup {
    background: #181818;
    color: #f5f5f5;
}

.field select {
    color-scheme: dark;
}

.field input:focus,
.field select:focus,
.join-inline__input:focus {
    border-color: rgba(229, 9, 20, 0.7);
    box-shadow: 0 0 0 4px rgba(229, 9, 20, 0.12);
}

.inline-link {
    font-size: 0.92rem;
}

.inline-link:hover {
    color: #fff;
}

.join-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.join-inline__input {
    width: min(240px, 100%);
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.section-block,
.section-grid {
    padding-top: 18px;
}

.section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.section-head h2 {
    margin: 6px 0 0;
    font-size: 1.7rem;
}

.section-head--compact {
    margin-top: 28px;
}

.stream-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(250px, 320px);
    gap: 16px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    padding-bottom: 10px;
}

.stream-row::-webkit-scrollbar {
    height: 10px;
}

.stream-row::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
}

.stream-row--tight {
    grid-auto-columns: minmax(220px, 260px);
}

.stream-card {
    position: relative;
    min-height: 320px;
    border-radius: 24px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.06));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow);
    transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
    scroll-snap-align: start;
}

.stream-card:hover {
    transform: scale(1.035);
    border-color: rgba(229, 9, 20, 0.38);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.4);
}

.stream-card__media {
    min-height: 180px;
    display: grid;
    place-items: end start;
    padding: 18px;
    background:
        linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.35)),
        linear-gradient(135deg, rgba(229, 9, 20, 0.32), rgba(255, 255, 255, 0.04));
}

.stream-card__media--room {
    align-items: end;
}

.stream-card__media--theme {
    position: relative;
    place-items: center;
    font-weight: 700;
    letter-spacing: 0.06em;
    overflow: hidden;
}

.stream-card__media--theme::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.58));
}

.stream-card__media--theme span {
    position: relative;
    z-index: 1;
}

.theme-cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stream-card__body {
    padding: 18px;
    display: grid;
    gap: 8px;
}

.stream-card__body h3 {
    margin: 0;
    font-size: 1.2rem;
}

.stream-card__body p {
    margin: 0;
    color: #e9e9e9;
    line-height: 1.45;
}

.stream-card__overlay {
    position: absolute;
    inset: auto 0 0 0;
    padding: 18px;
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.92) 30%);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 220ms ease, transform 220ms ease;
}

.stream-card:hover .stream-card__overlay {
    opacity: 1;
    transform: translateY(0);
}

.stream-card--empty {
    min-height: 220px;
}

.room-code {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-weight: 700;
    letter-spacing: 0.18em;
}

.section-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 24px;
}

.builder-card {
    padding: 24px;
    min-height: 100%;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.draft-grid {
    display: grid;
    gap: 12px;
}

.draft-seat {
    display: grid;
    grid-template-columns: 90px 1fr 1fr;
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.draft-seat__index {
    display: inline-flex;
    align-items: center;
    color: #fff;
    font-weight: 700;
}

.character-mini {
    min-height: 300px;
}

.character-mini .stream-card__media {
    place-items: center;
    min-height: 220px;
}

.character-avatar {
    width: min(100%, 220px);
    max-height: 200px;
    object-fit: contain;
    filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.35));
}

.theme-card.is-selected {
    border-color: rgba(229, 9, 20, 0.48);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(229, 9, 20, 0.18);
}

.auth-stage.is-register [data-auth-card="register"] {
    border-color: rgba(229, 9, 20, 0.38);
}

.auth-stage.is-register [data-auth-card="login"] {
    opacity: 0.72;
}

.honeypot {
    position: absolute;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 1080px) {
    .hero,
    .hero--auth,
    .section-grid,
    .hero--compact {
        grid-template-columns: 1fr;
    }

    .feature-row {
        grid-template-columns: 1fr;
    }

    .auth-stage {
        grid-template-columns: 1fr;
    }

    .form-grid,
    .draft-seat {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .shell {
        width: min(100vw - 22px, 1320px);
    }

    .topbar__inner {
        min-height: 72px;
        align-items: start;
        padding: 14px 0;
        flex-direction: column;
    }

    .hero__copy-block,
    .auth-panel,
    .builder-card,
    .hero-panel {
        padding: 22px;
    }

    .hero__title {
        max-width: none;
        font-size: clamp(2rem, 11vw, 3rem);
    }

    .stream-row {
        grid-auto-columns: minmax(220px, 84vw);
    }
}
