:root {
    --bg: #07070a;
    --ink: #10090b;
    --glass: rgba(19, 16, 22, 0.74);
    --glass-strong: rgba(30, 20, 24, 0.9);
    --gold: #d9ad4f;
    --gold-bright: #ffe09a;
    --red: #d22935;
    --red-deep: #85111b;
    --text: #fff4dc;
    --muted: #b9a98d;
    --line: rgba(217, 173, 79, 0.34);
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.46);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body.activity-page {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, "Microsoft JhengHei", sans-serif;
    color: var(--text);
    background:
        linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
        radial-gradient(circle at 14% 8%, rgba(210, 41, 53, .24), transparent 28%),
        radial-gradient(circle at 86% 2%, rgba(217, 173, 79, .18), transparent 30%),
        linear-gradient(135deg, #050508, #170b10 52%, #060609);
    background-size: 42px 42px, 42px 42px, auto, auto, auto;
}

body.activity-page::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255,255,255,.04), transparent 120px), radial-gradient(circle at center, transparent 35%, rgba(0,0,0,.52));
    z-index: -1;
}

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

.site-brandbar {
    min-height: 52px;
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    padding: 0 8px;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
}

.site-brand img {
    width: 58px;
    height: 46px;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 5px 12px rgba(0, 0, 0, .48));
    mix-blend-mode: screen;
}

.site-brand strong {
    display: block;
}

.site-brand strong {
    color: var(--gold-bright);
    font-size: 16px;
}

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

.error-page { display: grid; place-items: center; padding: 20px; }
.error-card { width: min(560px, 100%); padding: 42px; text-align: center; border: 1px solid var(--line); background: var(--glass-strong); box-shadow: var(--shadow); }
.error-card img { width: 110px; height: 92px; object-fit: contain; mix-blend-mode: screen; }
.error-card > strong { display: block; color: var(--gold-bright); font-size: clamp(64px, 14vw, 120px); line-height: 1; }
.error-card h1 { margin: 14px 0 8px; }
.error-card > p:not(.section-kicker) { color: var(--muted); }

.eyebrow,
.section-kicker {
    margin: 0 0 8px;
    color: var(--gold-bright);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
}

.hero-banner {
    position: relative;
    min-height: clamp(360px, 48vw, 560px);
    overflow: hidden;
    padding: 0;
    border: 1px solid rgba(217, 173, 79, .5);
    background: linear-gradient(135deg, #21161b, #5e111c 50%, #10090c);
    box-shadow: var(--shadow);
}

.hero-banner::after {
    content: "";
    position: absolute;
    inset: 14px;
    border: 1px solid rgba(255, 224, 154, .2);
    pointer-events: none;
    z-index: 4;
}

.banner-stage {
    position: absolute;
    inset: 0;
}

.banner-slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: end;
    padding: clamp(24px, 5vw, 56px);
    background:
        linear-gradient(110deg, rgba(8, 7, 10, .94), rgba(92, 11, 20, .58) 54%, rgba(217, 173, 79, .12)),
        var(--slide-image, linear-gradient(135deg, #21161b, #5e111c 50%, #10090c));
    background-size: cover;
    background-position: center;
    opacity: 0;
    visibility: hidden;
    transform: scale(1.025);
    pointer-events: none;
    transition: opacity .55s ease, transform 1.2s ease, visibility .55s ease;
}

.banner-slide.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    pointer-events: auto;
    z-index: 1;
}

.banner-content {
    position: relative;
    max-width: 760px;
    z-index: 2;
}

.banner-arrow {
    position: absolute;
    top: 50%;
    z-index: 6;
    width: 46px;
    height: 54px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255,224,154,.38);
    background: rgba(5,5,8,.58);
    color: var(--gold-bright);
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
    transform: translateY(-50%);
    backdrop-filter: blur(8px);
    transition: background .18s ease, border-color .18s ease;
}

.banner-arrow:hover {
    border-color: var(--gold-bright);
    background: rgba(108,18,27,.78);
}

.banner-arrow.previous { left: 18px; }
.banner-arrow.next { right: 18px; }

.banner-dots {
    position: absolute;
    left: 50%;
    bottom: 24px;
    z-index: 6;
    display: flex;
    gap: 8px;
    transform: translateX(-50%);
}

.banner-dots button {
    width: 28px;
    height: 4px;
    padding: 0;
    border: 0;
    background: rgba(255,255,255,.34);
    cursor: pointer;
    transition: width .18s ease, background .18s ease;
}

.banner-dots button.active {
    width: 46px;
    background: var(--gold-bright);
    box-shadow: 0 0 12px rgba(217,173,79,.6);
}

.hero-banner h1 {
    margin-bottom: 12px;
    font-size: clamp(38px, 6vw, 76px);
    line-height: 1.02;
    text-shadow: 0 10px 34px rgba(0, 0, 0, .6);
}

.hero-banner p:not(.eyebrow) {
    max-width: 620px;
    color: var(--muted);
    font-size: clamp(16px, 2vw, 22px);
    line-height: 1.65;
}

.gold-button,
.red-button,
.back-link {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    border-radius: 0;
    font-weight: 900;
    text-decoration: none;
}

.gold-button {
    border: 1px solid var(--gold-bright);
    background: linear-gradient(180deg, #ffe7a8, #bf8422);
    color: #1c0c07;
    box-shadow: 0 10px 28px rgba(217, 173, 79, .24);
}

.red-button {
    width: 100%;
    border: 1px solid #ff6770;
    background: linear-gradient(180deg, var(--red), var(--red-deep));
    color: #fff;
    box-shadow: 0 12px 30px rgba(210, 41, 53, .3);
}

.back-link {
    width: max-content;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, .28);
    color: var(--gold-bright);
}

.category-dock {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0 30px;
}

.category-dock a,
.category-dock button {
    min-height: 88px;
    display: grid;
    align-content: center;
    gap: 6px;
    padding: 16px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(0,0,0,.28));
    color: var(--text);
    text-decoration: none;
    box-shadow: 0 14px 36px rgba(0,0,0,.24);
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.category-dock a:hover,
.category-dock button:hover,
.category-dock button.active {
    transform: translateY(-3px);
    border-color: var(--gold-bright);
    background: linear-gradient(180deg, rgba(217,173,79,.18), rgba(0,0,0,.36));
}

.category-dock span {
    color: var(--gold);
    font-size: 11px;
    font-weight: 900;
}

.category-dock strong {
    font-size: 20px;
}

.activity-section {
    margin-top: 34px;
}

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

.section-head h2 {
    margin-bottom: 0;
    font-size: clamp(24px, 3vw, 34px);
}

.section-head > span,
.room-meta,
.card-meta {
    color: var(--muted);
}

.activity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.activity-grid-featured {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.activity-card {
    position: relative;
    min-height: 292px;
    overflow: hidden;
    display: flex;
    align-items: end;
    padding: 18px;
    border: 1px solid var(--line);
    color: var(--text);
    text-decoration: none;
    background:
        linear-gradient(180deg, rgba(255,255,255,.02), rgba(0,0,0,.82)),
        var(--cover, linear-gradient(135deg, #22161d, #68131e 58%, #12090d));
    background-size: cover;
    background-position: center;
    box-shadow: 0 18px 44px rgba(0,0,0,.32);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.activity-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(217,173,79,.12));
    opacity: 0;
    transition: opacity .2s ease;
}

.activity-card:hover {
    transform: translateY(-6px) scale(1.018);
    border-color: var(--gold-bright);
    box-shadow: 0 0 0 1px rgba(217,173,79,.24), 0 22px 60px rgba(0,0,0,.48), 0 0 30px rgba(217,173,79,.2);
}

.activity-card:hover::before {
    opacity: 1;
}

.activity-card > div {
    position: relative;
    z-index: 1;
}

.activity-card h3 {
    margin-bottom: 8px;
    font-size: 22px;
}

.card-badge {
    position: absolute;
    z-index: 2;
    top: 12px;
    left: 12px;
    padding: 6px 10px;
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(210, 41, 53, .94);
    color: #fff;
    font-size: 12px;
    font-weight: 900;
}

.activity-grid-featured .card-badge {
    box-shadow: 0 0 0 0 rgba(210, 41, 53, .55);
    animation: livePulse 1.8s infinite;
}

@keyframes livePulse {
    70% { box-shadow: 0 0 0 9px rgba(210, 41, 53, 0); }
    100% { box-shadow: 0 0 0 0 rgba(210, 41, 53, 0); }
}

.card-enter {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    margin-top: 14px;
    padding: 0 12px;
    border: 1px solid var(--line);
    color: var(--gold-bright);
    font-weight: 900;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .18s ease, transform .18s ease;
}

.activity-card:hover .card-enter {
    opacity: 1;
    transform: translateY(0);
}

.empty-card {
    padding: 24px;
    border: 1px dashed var(--line);
    background: rgba(0,0,0,.2);
    color: var(--muted);
}

.room-header {
    position: relative;
    min-height: 190px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
    padding: 28px;
    margin-bottom: 18px;
    border: 1px solid rgba(217, 173, 79, .48);
    background:
        linear-gradient(110deg, rgba(8,7,10,.92), rgba(83,10,17,.56), rgba(217,173,79,.1)),
        var(--room-banner, linear-gradient(135deg, #21161b, #4a1018));
    background-size: cover;
    background-position: center;
    box-shadow: var(--shadow);
}

.room-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.room-type {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    padding: 0 13px;
    border: 1px solid rgba(217, 173, 79, .22);
    background: rgba(0, 0, 0, .2);
    color: var(--gold-bright);
    font-size: 12px;
    font-weight: 900;
}

.room-heading {
    min-width: 0;
}

.room-header h1 {
    margin-bottom: 12px;
    font-size: clamp(32px, 5vw, 64px);
    line-height: 1.05;
}

.room-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.room-meta span {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border: 1px solid var(--line);
    background: rgba(0,0,0,.3);
}

#roomStatus[data-status="live"] {
    border-color: rgba(255, 103, 112, .42);
    background: rgba(210, 41, 53, .2);
    color: #ffd8da;
}

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

.room-main,
.room-side {
    display: grid;
    gap: 14px;
}

.module {
    border: 1px solid var(--line);
    background: linear-gradient(180deg, var(--glass), rgba(8,8,12,.95));
    box-shadow: 0 18px 46px rgba(0,0,0,.34);
    backdrop-filter: blur(10px);
    padding: 16px;
}

.module.hidden {
    display: none;
}

.module-title h2,
.chat-head h2 {
    margin-bottom: 0;
    font-size: 20px;
}

.player-module {
    padding: 12px;
}

.video-frame {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    border: 1px solid rgba(217,173,79,.64);
    background: #000;
}

video {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
}

.standby {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
    background:
        linear-gradient(135deg, rgba(10,8,12,.9), rgba(95,12,20,.76)),
        repeating-linear-gradient(90deg, rgba(217,173,79,.05) 0 1px, transparent 1px 18px);
}

.standby.hidden {
    display: none;
}

.standby h2 {
    margin-bottom: 0;
    font-size: clamp(24px, 3vw, 40px);
}

.standby p,
.text-module p {
    color: var(--muted);
    line-height: 1.7;
    white-space: pre-wrap;
    margin-bottom: 0;
}

.pulse-ring {
    width: 76px;
    height: 76px;
    border: 2px solid var(--gold-bright);
    border-radius: 50%;
    box-shadow: 0 0 0 12px rgba(217,173,79,.12), 0 0 34px rgba(217,173,79,.3);
}

.score-title {
    color: var(--gold-bright);
    font-size: 12px;
    font-weight: 900;
    margin-bottom: 14px;
}

.teams {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 54px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
}

.teams div:not(.versus) {
    min-height: 116px;
    display: grid;
    align-content: center;
    justify-items: center;
    border: 1px solid rgba(217,173,79,.22);
    background: rgba(0,0,0,.24);
}

.teams span {
    max-width: 100%;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.teams strong {
    font-size: 48px;
    line-height: 1;
}

.versus,
.match-clock {
    color: var(--gold-bright);
    font-weight: 900;
    text-align: center;
}

.match-clock {
    margin-top: 10px;
    border: 1px solid var(--line);
    padding: 10px;
    background: rgba(0,0,0,.22);
}

.bet-module {
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
}

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

.chat-head span {
    color: var(--muted);
    font-size: 13px;
}

.chat-card.player-aligned {
    height: var(--player-height);
    min-height: 0;
    display: flex;
    flex-direction: column;
    order: -1;
}

.chat-card.player-aligned .chat-list {
    height: auto;
    min-height: 0;
    flex: 1;
}

.chat-list {
    height: 320px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--line);
    background: rgba(0,0,0,.26);
}

.chat-message {
    padding: 9px 0;
    border-bottom: 1px solid rgba(217,173,79,.13);
}

.chat-message strong {
    color: var(--gold-bright);
}

.chat-message time {
    color: var(--muted);
    margin-left: 8px;
    font-size: 12px;
}

.chat-message p {
    margin: 5px 0 0;
    line-height: 1.5;
}

.chat-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 74px;
    gap: 8px;
    margin-top: 10px;
}

.chat-form input {
    min-height: 44px;
    min-width: 0;
    border: 1px solid var(--line);
    background: #0b0a0e;
    color: var(--text);
    padding: 0 12px;
    font: inherit;
}

.chat-form button {
    border: 1px solid #ff6770;
    background: var(--red);
    color: white;
    font-weight: 900;
    cursor: pointer;
}

@media (max-width: 1080px) {
    .room-layout {
        grid-template-columns: 1fr;
    }

    .chat-card.player-aligned {
        height: auto;
        order: initial;
    }
}

@media (max-width: 820px) {
    .category-dock {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .room-header {
        grid-template-columns: 1fr;
        align-items: start;
    }
}

@media (max-width: 680px) {
    body.activity-page {
        background-size: 30px 30px, 30px 30px, auto, auto, auto;
    }

    .activity-shell {
        width: 100%;
        padding: 8px 10px 34px;
    }

    .site-brandbar {
        min-height: 54px;
        margin-bottom: 8px;
        padding: 0 8px;
    }

    .site-brand img {
        width: 54px;
        height: 46px;
    }

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

    .hero-banner {
        min-height: 286px;
        box-shadow: 0 16px 42px rgba(0, 0, 0, .42);
    }

    .hero-banner::after {
        inset: 9px;
    }

    .banner-slide {
        padding: 18px 20px 52px;
        background-position: center;
    }

    .hero-banner h1 {
        max-width: 92%;
        margin-bottom: 8px;
        font-size: clamp(30px, 9vw, 38px);
        line-height: 1.08;
    }

    .hero-banner p:not(.eyebrow) {
        margin-bottom: 14px;
        font-size: 15px;
        line-height: 1.45;
    }

    .hero-banner .gold-button {
        min-height: 42px;
        padding: 0 18px;
    }

    .banner-arrow {
        top: auto;
        bottom: 12px;
        width: 38px;
        height: 38px;
        font-size: 25px;
        transform: none;
    }

    .banner-arrow.previous { left: auto; right: 56px; }
    .banner-arrow.next { right: 12px; }

    .banner-dots {
        left: 20px;
        bottom: 16px;
        transform: none;
    }

    .banner-dots button { width: 18px; }
    .banner-dots button.active { width: 30px; }

    .category-dock {
        display: flex;
        gap: 8px;
        margin: 12px -10px 24px;
        padding: 0 10px 4px;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
    }

    .category-dock::-webkit-scrollbar {
        display: none;
    }

    .category-dock a,
    .category-dock button {
        flex: 0 0 112px;
        min-height: 66px;
        padding: 11px 13px;
        scroll-snap-align: start;
        box-shadow: 0 10px 24px rgba(0, 0, 0, .22);
    }

    .category-dock strong {
        font-size: 17px;
    }

    .activity-section {
        margin-top: 26px;
    }

    .section-head {
        align-items: start;
        flex-direction: column;
        gap: 4px;
        margin-bottom: 12px;
    }

    .section-head h2 {
        font-size: 25px;
    }

    .section-head > span {
        font-size: 14px;
    }

    .activity-grid,
    .activity-grid-featured {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .activity-card {
        min-height: 220px;
        padding: 15px;
    }

    .activity-card h3 {
        font-size: 20px;
    }

    .card-enter {
        opacity: 1;
        transform: none;
    }

    .room-header {
        min-height: 0;
        padding: 12px 14px 14px;
        margin-bottom: 10px;
        background-position: center;
    }

    .room-toolbar {
        width: 100%;
        gap: 7px;
        margin-bottom: 7px;
    }

    .room-header h1 {
        margin: 0 0 9px;
        font-size: 29px;
    }

    .back-link {
        min-height: 32px;
        padding: 0 10px;
        border-color: rgba(217, 173, 79, .24);
        font-size: 13px;
    }

    .room-type {
        min-height: 32px;
        padding: 0 10px;
        font-size: 11px;
    }

    .room-meta {
        gap: 6px;
    }

    .room-meta span {
        min-height: 30px;
        padding: 0 9px;
        font-size: 13px;
    }

    #roomViewer::before {
        content: "•";
        margin-right: 6px;
        color: var(--gold);
    }

    .room-layout,
    .room-main,
    .room-side {
        gap: 10px;
    }

    .module {
        padding: 12px;
        box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
    }

    .player-module {
        padding: 8px;
    }

    .standby {
        gap: 7px;
        padding: 14px;
    }

    .standby h2 {
        font-size: 23px;
    }

    .standby p {
        font-size: 14px;
        line-height: 1.45;
    }

    .pulse-ring {
        width: 52px;
        height: 52px;
        box-shadow: 0 0 0 8px rgba(217,173,79,.12), 0 0 24px rgba(217,173,79,.3);
    }

    .chat-list {
        height: 240px;
    }

    .chat-form {
        grid-template-columns: minmax(0, 1fr) 68px;
    }

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

    .versus {
        min-height: 30px;
        display: grid;
        place-items: center;
    }
}
