/* ===== CATPPUCCIN MACCHIATO THEME ===== */
/* https://github.com/catppuccin/catppuccin */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
    /* Catppuccin Macchiato Palette */
    --base:     #24273a;
    --mantle:   #1e2030;
    --crust:    #181926;
    --surface0: #363a4f;
    --surface1: #494d64;
    --surface2: #5b6078;
    --overlay0: #6e738d;
    --overlay1: #8087a2;
    --overlay2: #939ab7;
    --subtext0: #a5adcb;
    --subtext1: #b8c0e0;
    --text:     #cad3f5;

    /* Catppuccin Macchiato Accent Colors */
    --lavender: #b7bdf8;
    --blue:     #8aadf4;
    --sapphire: #7dc4e4;
    --sky:      #91d7e3;
    --teal:     #8bd5ca;
    --green:    #a6da95;
    --yellow:   #eed49f;
    --peach:    #f5a97f;
    --maroon:   #ee99a0;
    --red:      #ed8796;
    --mauve:    #c6a0f6;
    --pink:     #f5bde6;
    --flamingo: #f0c6c6;
    --rosewater:#f4dbd6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--base);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
}

.app-layout {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========== HOVER REVEAL ZONE (header + status bars) ========== */
.hover-reveal-zone {
    position: relative;
    z-index: 50;
    max-height: 4px;
    overflow: hidden;
    transition: max-height 0.35s ease, box-shadow 0.35s ease;
    background: var(--mantle);
    box-shadow: none;
}

.hover-reveal-zone::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--blue), var(--lavender), var(--mauve));
    opacity: 0.5;
    z-index: 51;
    transition: opacity 0.35s ease;
}

.hover-reveal-zone:hover::before {
    opacity: 0;
}

.hover-reveal-zone:hover {
    max-height: 200px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

/* ========== MINIMAL TOP BAR ========== */
.minimal-header {
    background: var(--mantle);
    border-bottom: 1px solid var(--surface0);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 800;
    color: var(--lavender);
    letter-spacing: 0.3px;
}

.header-brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: contain;
    flex-shrink: 0;
    display: block;
    background: var(--surface0);
    border: 1px solid var(--surface1);
}

.brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ========== INLINE STATS ========== */
.inline-stats {
    display: flex;
    gap: 6px;
    font-size: 11px;
}

.inline-stat {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--surface0);
    border-radius: 20px;
    border: 1px solid var(--surface1);
    transition: border-color 0.2s;
}

.inline-stat:hover {
    border-color: var(--overlay0);
}

.inline-stat-label {
    font-size: 12px;
}

.inline-stat-value {
    font-weight: 700;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}

/* ========== HEADER CONTROLS ========== */
.header-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.status-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--surface0);
    border: 1px solid var(--surface1);
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    color: var(--subtext0);
}

.status-chip-dot {
    width: 6px;
    height: 6px;
    background: var(--overlay0);
    border-radius: 50%;
    transition: all 0.3s;
}

.status-chip-dot.connected {
    background: var(--green);
    box-shadow: 0 0 8px rgba(166, 218, 149, 0.6);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 0 rgba(166, 218, 149, 0.6); }
    50%       { box-shadow: 0 0 0 5px rgba(166, 218, 149, 0); }
}

/* ========== BATTLE DISPLAY ========== */
.battle-display {
    padding: 10px 20px;
    background: var(--mantle);
    border-bottom: 1px solid var(--surface0);
    position: relative;
}

.battle-hide-btn {
    position: absolute;
    top: 8px;
    right: 12px;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid var(--surface1);
    background: var(--surface0);
    color: var(--overlay2);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
    line-height: 1;
    padding: 0;
    font-family: 'Nunito', sans-serif;
}

.battle-hide-btn:hover {
    background: var(--surface1);
    color: var(--red);
    border-color: var(--red);
}

.battle-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
    gap: 10px;
}

/* Teams row: host + VS + guest */
.battle-teams-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    background: linear-gradient(135deg, rgba(30, 32, 48, 0.95), rgba(54, 58, 79, 0.8));
    border: 1px solid var(--surface1);
    border-radius: 12px;
    padding: 12px 20px;
}

.battle-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: center;
}

.team-member {
    display: flex;
    align-items: center;
    gap: 6px;
}

.team-member-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.team-separator {
    color: var(--overlay2);
    font-weight: 800;
    font-size: 14px;
    margin: 0 4px;
    flex-shrink: 0;
}

.team-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--surface1);
    background: var(--surface0);
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
}

.battle-vs-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.battle-vs {
    font-size: 11px;
    font-weight: 800;
    color: var(--red);
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(237, 135, 150, 0.15);
    padding: 3px 10px;
    border-radius: 6px;
    border: 1px solid rgba(237, 135, 150, 0.3);
    flex-shrink: 0;
}

.battle-stream-label {
    font-size: 9px;
    font-weight: 800;
    color: var(--overlay2);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Battle mid row: supporters | bar+timer | supporters */
.battle-mid-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}

.battle-mid-row .battle-bar-section {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.battle-mid-row .battle-participants {
    width: 140px;
    flex-shrink: 0;
}

.battle-mid-row .host-participants {
    text-align: right;
}

.battle-mid-row .host-participants .participants-list {
    justify-content: flex-end;
}

.battle-mid-row .guest-participants {
    text-align: left;
}

.battle-mid-row .guest-participants .participants-list {
    justify-content: flex-start;
}

.team-bar {
    width: 100%;
    height: 28px;
    background: var(--surface0);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    border: 1px solid var(--surface1);
}

.team-bar-fill {
    height: 100%;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: var(--crust);
    font-family: 'JetBrains Mono', monospace;
}

.host-bar {
    background: linear-gradient(90deg, var(--red), var(--maroon));
    justify-content: flex-end;
    padding-right: 10px;
}

.guest-bar {
    background: linear-gradient(90deg, var(--blue), var(--sapphire));
    justify-content: flex-start;
    padding-left: 10px;
}

/* Battle timer */
.battle-timer {
    font-size: 13px;
    font-weight: 800;
    color: var(--lavender);
    font-family: 'JetBrains Mono', monospace;
    display: flex;
    align-items: center;
    gap: 4px;
}

.battle-timer-icon {
    color: var(--red);
    font-size: 10px;
}

/* Battle supporters / participants */
.battle-participants {
    min-width: 0;
}

.participants-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--overlay2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.participants-list {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    align-items: center;
}

.participant-chip {
    display: flex;
    align-items: center;
    gap: 3px;
    background: var(--surface0);
    border: 1px solid var(--surface1);
    border-radius: 16px;
    padding: 3px 6px 3px 3px;
    transition: background 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.participant-chip:hover {
    background: var(--surface1);
}

.host-participants .participant-chip {
    border-color: rgba(237, 135, 150, 0.2);
}

.guest-participants .participant-chip {
    border-color: rgba(138, 173, 244, 0.2);
}

.participant-rank {
    font-size: 9px;
    font-weight: 800;
    min-width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--crust);
    font-family: 'JetBrains Mono', monospace;
}

.host-participants .participant-rank {
    background: var(--red);
}

.guest-participants .participant-rank {
    background: var(--blue);
}

.participant-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--surface1);
    flex-shrink: 0;
}

.participant-name {
    font-size: 10px;
    font-weight: 600;
    color: var(--subtext1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60px;
}

/* ========== FLOATING CONTROL PANEL ========== */
.floating-panel {
    position: fixed;
    top: 50px;
    right: -320px;
    width: 300px;
    height: calc(100vh - 50px);
    background: var(--mantle);
    border-left: 1px solid var(--surface0);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.floating-panel:hover,
.floating-panel.open { right: 0; }

/* Panel pull-tab toggle on left edge */
.panel-pull-tab {
    position: absolute;
    left: -36px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 72px;
    background: var(--crust);
    border: 1px solid var(--surface0);
    border-right: none;
    border-radius: 8px 0 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--overlay1);
    font-size: 16px;
    transition: all 0.2s;
    z-index: 101;
}

.panel-pull-tab:hover {
    background: var(--surface0);
    color: var(--lavender);
    width: 40px;
    left: -40px;
}

.panel-pull-tab .tab-icon {
    transition: transform 0.3s;
}

.floating-panel:hover .panel-pull-tab .tab-icon,
.floating-panel.open .panel-pull-tab .tab-icon {
    transform: rotate(180deg);
}

.panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--surface0);
    padding: 0 12px;
    background: var(--crust);
}

.panel-tab {
    flex: 1;
    padding: 12px 8px;
    background: none;
    border: none;
    color: var(--overlay1);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-family: 'Nunito', sans-serif;
    letter-spacing: 0.3px;
}

.panel-tab:hover { color: var(--subtext1); }

.panel-tab.active {
    color: var(--lavender);
    border-bottom-color: var(--lavender);
}

.panel-content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.panel-section { display: none; }
.panel-section.active { display: block; }

/* ========== FORM CONTROLS ========== */
.field { margin-bottom: 12px; }

.field-label {
    display: block;
    font-size: 9px;
    color: var(--overlay1);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
}

.field-input {
    width: 100%;
    background: var(--surface0);
    border: 1px solid var(--surface1);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text);
    font-size: 12px;
    font-family: 'Nunito', sans-serif;
    transition: border-color 0.2s;
}

.field-input::placeholder { color: var(--overlay0); }
.field-input:focus {
    outline: none;
    border-color: var(--lavender);
    box-shadow: 0 0 0 2px rgba(183, 189, 248, 0.15);
}

.action-btn {
    width: 100%;
    padding: 9px;
    border: none;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 6px;
    transition: all 0.2s;
    font-family: 'Nunito', sans-serif;
    letter-spacing: 0.3px;
}

.action-btn-primary {
    background: linear-gradient(135deg, var(--blue), var(--lavender));
    color: var(--crust);
}

.action-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(138, 173, 244, 0.4);
}

.action-btn-secondary {
    background: var(--surface0);
    border: 1px solid var(--surface1);
    color: var(--subtext1);
}

.action-btn-secondary:hover {
    background: var(--surface1);
    color: var(--text);
    border-color: var(--overlay0);
}

.field-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
    font-size: 11px;
    color: var(--subtext0);
    cursor: pointer;
    font-weight: 600;
}

.field-checkbox input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--lavender);
}

.info-btn-mini {
    background: rgba(183, 189, 248, 0.1);
    border: 1px solid rgba(183, 189, 248, 0.25);
    border-radius: 6px;
    padding: 4px 8px;
    color: var(--lavender);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
    transition: all 0.2s;
    font-family: 'Nunito', sans-serif;
}

.info-btn-mini:hover {
    background: rgba(183, 189, 248, 0.2);
}

.info-box-mini {
    background: var(--surface0);
    border: 1px solid var(--surface1);
    border-radius: 8px;
    padding: 10px;
    font-size: 10px;
    line-height: 1.6;
    color: var(--subtext0);
    margin-top: 6px;
}

.stat-row {
    background: var(--surface0);
    border: 1px solid var(--surface1);
    border-radius: 8px;
    padding: 9px 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}

.stat-row-label { color: var(--subtext0); font-weight: 600; }
.stat-row-value {
    font-weight: 800;
    color: var(--lavender);
    font-family: 'JetBrains Mono', monospace;
}

/* ========== MAIN CONTENT GRID ========== */
.content-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1.8fr 1fr;
    gap: 10px;
    padding: 10px;
    background: var(--base);
    overflow: hidden;
}

.content-box {
    background: var(--mantle);
    border: 1px solid var(--surface0);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.box-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--surface0);
    font-size: 10px;
    font-weight: 800;
    color: var(--overlay2);
    letter-spacing: 1px;
    text-transform: uppercase;
    background: var(--crust);
}

.box-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.video-content {
    display: flex;
    flex-direction: column;
    padding: 0;
}

/* ========== TOP GIFTERS LEADERBOARD ========== */
.top-gifters-wrapper {
    position: relative;
    height: 120px;
    flex-shrink: 0;
    background: var(--crust);
    z-index: 5;
}

.top-gifters-wrapper:hover .top-gifters-expand {
    max-height: 400px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.top-gifters-wrapper:hover .top-gifters-fade {
    opacity: 0;
}

.top-gifters-expand {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    max-height: 120px;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--crust);
    border-radius: 0 0 10px 10px;
    transition: max-height 0.4s ease, box-shadow 0.3s ease;
    z-index: 6;
}

.top-gifters-list {
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.top-gifters-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(to bottom, transparent, var(--mantle));
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 7;
}

.top-gifter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 12px;
    transition: background 0.15s;
}

.top-gifter-row:hover {
    background: var(--surface0);
}

.top-gifter-rank {
    font-size: 11px;
    font-weight: 800;
    min-width: 16px;
    color: var(--overlay2);
    font-family: 'JetBrains Mono', monospace;
    text-align: center;
}

.top-gifter-rank.rank-1 { color: var(--yellow); }
.top-gifter-rank.rank-2 { color: var(--subtext1); }
.top-gifter-rank.rank-3 { color: var(--peach); }

.top-gifter-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--surface1);
    flex-shrink: 0;
}

.top-gifter-name {
    flex: 1;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.top-gifter-value {
    font-weight: 800;
    color: var(--overlay2);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    flex-shrink: 0;
}

/* ========== CHAT & NOTIFICATIONS ========== */
.toggleable-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.toggleable-header:hover {
    background: var(--surface0);
}

.toggle-arrow {
    font-size: 9px;
    color: var(--overlay1);
    transition: transform 0.2s;
}

.section-hidden {
    display: none !important;
}

.chatcontainer,
.notificationcontainer {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.notificationcontainer {
    max-height: 320px;
    min-height: 320px;
}

.chatcontainer > div,
.notificationcontainer > div {
    background: var(--surface0);
    border: 1px solid var(--surface1);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    line-height: 1.5;
    transition: background 0.15s;
}

.chatcontainer > div:hover,
.notificationcontainer > div:hover {
    background: var(--surface1);
}

.miniprofilepicture {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid var(--surface1);
    object-fit: cover;
}

.usernamelink {
    color: var(--blue);
    text-decoration: none;
    font-weight: 700;
}

.usernamelink:hover {
    color: var(--lavender);
    text-decoration: underline;
}

/* ========== GIFTS ========== */
.giftcontainer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    overflow-y: auto;
}

.giftcontainer > div {
    background: var(--surface0);
    border: 1px solid var(--surface1);
    border-radius: 8px;
    padding: 10px;
    font-size: 12px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    transition: background 0.15s;
}

.giftcontainer > div:hover {
    background: var(--surface1);
}

.giftcontainer > div table { width: 100%; }
.giftcontainer > div td { vertical-align: middle; padding: 2px; }
.giftcontainer > div td:first-child { width: 76px; }

.gifticon {
    width: 68px;
    height: 68px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--surface1);
}

/* ========== VIDEO PLAYER ========== */
#dplayer.player-hidden {
    display: none !important;
    min-height: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

#dplayer {
    width: 100%;
    height: 100%;
    border-radius: 0;
    overflow: hidden;
    background: var(--crust);
    min-height: 500px;
    position: relative;
}

#dplayer .dplayer-video-wrap {
    position: absolute !important;
    top: 0 !important; left: 0 !important;
    width: 100% !important; height: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

#dplayer video {
    max-width: 100% !important; max-height: 100% !important;
    width: 100% !important; height: 100% !important;
    object-fit: contain !important;
}

/* DPlayer accent color overrides */
#dplayer .dplayer-bar-inner { background: var(--lavender) !important; }
#dplayer .dplayer-played  { background: var(--blue) !important; }
#dplayer .dplayer-thumb   { background: var(--lavender) !important; }

#dplayer.portrait-mode { display: flex !important; justify-content: center !important; align-items: center !important; }
#dplayer.portrait-mode .dplayer-video-wrap { display: flex !important; justify-content: center !important; align-items: center !important; }
#dplayer.portrait-mode video { width: auto !important; height: 100% !important; max-width: 100% !important; object-fit: contain !important; }

#dplayer.landscape-mode video { width: 100% !important; height: auto !important; max-height: 100% !important; object-fit: contain !important; }

#dplayer.square-mode .dplayer-video-wrap { aspect-ratio: 1/1 !important; max-width: 100% !important; max-height: 100% !important; }
#dplayer.square-mode video { width: 100% !important; height: 100% !important; object-fit: cover !important; aspect-ratio: 1/1 !important; }

#dplayer .dplayer-controller { position: absolute !important; bottom: 0 !important; left: 0 !important; right: 0 !important; z-index: 10 !important; }
#dplayer .dplayer-video { width: 100% !important; height: 100% !important; }
#dplayer .dplayer-video-wrap video, #dplayer .dplayer-video video { margin: 0 auto !important; }

.video-box {
    flex: 1;
    background: var(--crust);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--overlay0);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    min-height: 500px;
}

/* ========== ACTIVITY PANEL (right column) ========== */
.activity-panel-header {
    padding: 12px 14px 0;
    background: var(--crust);
    border-bottom: 1px solid var(--surface0);
    flex-shrink: 0;
}

.activity-title {
    display: block;
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 10px;
}

.activity-tabs {
    display: flex;
    gap: 2px;
}

.activity-tab {
    flex: 1;
    padding: 7px 6px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--overlay1);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    transition: all 0.2s;
    border-radius: 6px 6px 0 0;
    white-space: nowrap;
}

.activity-tab:hover {
    color: var(--subtext1);
    background: var(--surface0);
}

.activity-tab.active {
    color: var(--text);
    border-bottom-color: var(--lavender);
    background: var(--surface0);
}

.activity-tab-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.activity-tab-content .box-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.activity-tab-content .notificationcontainer {
    max-height: unset;
    min-height: unset;
    flex: 1;
}

/* ========== TOAST (if used in app.js) ========== */
.toast {
    background: var(--surface0) !important;
    border: 1px solid var(--surface1) !important;
    color: var(--text) !important;
    border-radius: 8px !important;
    font-family: 'Nunito', sans-serif !important;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--surface0); }
::-webkit-scrollbar-thumb { background: var(--surface1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--overlay0); }

/* stream-panel notif/gifts block — mobile only */
.mobile-only { display: none; }

/* ========== RESPONSIVE ========== */
@media (max-width: 1400px) {
    .content-grid { grid-template-columns: 1fr 1.6fr 1fr; }
}

@media (max-width: 1200px) {
    .content-grid { grid-template-columns: 1fr; }
    .inline-stats { gap: 8px; }
    #dplayer, .video-box { min-height: 450px; }
}

@media (max-width: 768px) {
    /* ===== MOBILE: FULLSCREEN STREAM + OVERLAY CHAT ===== */

    body { overflow: hidden; }

    .app-layout {
        position: relative;
        height: 100vh;
        width: 100vw;
    }

    /* Header still hover-reveal */
    .minimal-header { flex-wrap: wrap; gap: 8px; }
    .inline-stats { order: 3; width: 100%; justify-content: space-around; }

    /* Content grid becomes a fullscreen stack */
    .content-grid {
        display: block;
        position: relative;
        width: 100%;
        height: 100%;
        padding: 0;
        gap: 0;
        background: #000;
    }

    /* Hide the chat and notifications side columns */
    .content-grid > .content-box:nth-child(1),
    .content-grid > .content-box:nth-child(3) {
        display: none;
    }

    /* Video box = fullscreen */
    .content-grid > .content-box:nth-child(2) {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        border: none;
        background: #000;
        z-index: 1;
    }

    .video-content {
        width: 100%;
        height: 100%;
        padding: 0;
    }

    #dplayer, .video-box {
        min-height: unset;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    /* Show stream-panel notif/gifts block on mobile only */
    .mobile-only { display: block; }

    /* ===== BATTLE DISPLAY — TikTok style overlay ===== */
    #battleDisplay {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        z-index: 30;
        background: transparent !important;
        border-bottom: none !important;
        padding: 0 !important;
        pointer-events: none;
    }

    .battle-container {
        pointer-events: auto;
        gap: 0;
        max-width: 100%;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    /* Hide teams row, participants — show only bar */
    .battle-teams-row,
    .battle-mid-row .battle-participants {
        display: none !important;
    }

    /* Also hide the VS/timer that's inside battle-teams-row by default */
    .battle-vs-group {
        display: none !important;
    }

    .battle-mid-row {
        gap: 0;
        width: 100%;
        flex-direction: column;
        align-items: center;
    }

    .battle-mid-row .battle-bar-section {
        flex: unset;
        width: 100%;
        gap: 0;
        flex-direction: column;
        align-items: center;
        position: relative;
    }

    /* Full-width bar like reference photo */
    .team-bar {
        width: 100%;
        height: 34px;
        border-radius: 0;
        border: none;
        overflow: hidden;
        position: relative;
    }

    .team-bar-fill {
        font-size: 15px;
        font-weight: 900;
        color: #fff;
        min-width: 44px;
    }

    .host-bar {
        background: linear-gradient(90deg, #ff2d78, #ff6fa3);
        padding-right: 12px;
        justify-content: flex-end;
    }

    .guest-bar {
        background: linear-gradient(90deg, #38d9f5, #7de8ff);
        padding-left: 12px;
        justify-content: flex-start;
    }

    /* Timer pill — injected below bar via JS, centered */
    .mobile-battle-timer-pill {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: rgba(15, 15, 25, 0.9);
        border-radius: 30px;
        padding: 5px 20px;
        font-size: 14px;
        font-weight: 900;
        color: #fff;
        font-family: 'JetBrains Mono', monospace;
        letter-spacing: 1px;
        border: 1.5px solid rgba(255,255,255,0.15);
        box-shadow: 0 2px 12px rgba(0,0,0,0.5);
        margin: 5px auto 0 auto;
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        pointer-events: none;
    }

    /* Hide original timer (it's inside hidden battle-teams-row) */
    .battle-timer { display: none !important; }

    /* Show battle hide button on mobile — positioned top-right of overlay */
    .battle-hide-btn {
        display: flex !important;
        position: fixed;
        top: 44px;
        right: 10px;
        z-index: 50;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        background: rgba(15,15,25,0.85);
        border: 1.5px solid rgba(255,255,255,0.2);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        pointer-events: auto;
        color: #fff;
        font-size: 14px;
    }

    /* ===== OVERLAY CHAT — scrollable ===== */
    .mobile-chat-overlay {
        display: flex !important;
        flex-direction: column;
        justify-content: flex-end;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 110px;
        z-index: 20;
        padding: 0 8px 14px 10px;
        pointer-events: none;
        background: none;
    }

    /* Scrollable chat wrapper — needs its own element so iOS respects it */
    .mobile-chat-scroll-wrapper {
        display: flex;
        flex-direction: column;
        max-height: 160px;
        overflow-y: scroll;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        touch-action: pan-y;
        pointer-events: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 4px;
    }
    .mobile-chat-scroll-wrapper::-webkit-scrollbar { display: none; }

    .mobile-chat-overlay .chatcontainer {
        display: contents;
    }

    /* Chat items — TikTok-style pill with avatar + info button visible */
    .mobile-chat-scroll-wrapper > div,
    .mobile-chat-overlay .chatcontainer > div {
        background: rgba(20, 22, 40, 0.82);
        border: 1px solid rgba(255,255,255,0.10);
        border-radius: 22px;
        padding: 5px 10px 5px 5px;
        font-size: 12px;
        color: #fff;
        line-height: 1.4;
        max-width: calc(100% - 4px);
        align-self: flex-start;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        display: flex;
        gap: 7px;
        align-items: center;
        flex-shrink: 0;
        flex-wrap: nowrap;
    }

    /* Show avatar in mobile chat — circular, tight */
    .mobile-chat-scroll-wrapper > div .miniprofilepicture,
    .mobile-chat-overlay .chatcontainer > div .miniprofilepicture {
        display: block !important;
        width: 26px !important;
        height: 26px !important;
        border-radius: 50% !important;
        flex-shrink: 0 !important;
        border: 1.5px solid rgba(255,255,255,0.25) !important;
        object-fit: cover !important;
    }

    /* Username + message text wrapper */
    .mobile-chat-scroll-wrapper > div .username-with-profile,
    .mobile-chat-overlay .chatcontainer > div .username-with-profile {
        display: inline-flex !important;
        align-items: center !important;
        gap: 3px !important;
        flex-shrink: 0 !important;
    }

    /* Info checker button — always visible on mobile */
    .mobile-chat-scroll-wrapper > div .upm-trigger-btn,
    .mobile-chat-overlay .chatcontainer > div .upm-trigger-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        opacity: 0.75 !important;
        font-size: 0.8rem !important;
        padding: 0 1px !important;
        flex-shrink: 0 !important;
        pointer-events: auto !important;
    }

    /* Username color on mobile */
    .mobile-chat-scroll-wrapper > div .usernamelink,
    .mobile-chat-overlay .chatcontainer > div .usernamelink {
        color: var(--lavender) !important;
        font-size: 11px !important;
        font-weight: 700 !important;
    }

    /* Message text — allow wrap, keep compact */
    .mobile-chat-scroll-wrapper > div span:not(.usernamelink):not(.upm-trigger-btn),
    .mobile-chat-overlay .chatcontainer > div span:not(.usernamelink):not(.upm-trigger-btn) {
        font-size: 12px !important;
        color: rgba(255,255,255,0.92) !important;
        word-break: break-word !important;
        flex: 1 !important;
        min-width: 0 !important;
    }

    /* Top gifters — hidden on mobile */
    .mobile-chat-overlay .top-gifters-wrapper {
        display: none;
    }

    /* ===== FLOATING CONTROL PANEL ===== */

    /* Gift items inside panel — bigger */
    .mobile-drawer-panel .giftcontainer > div {
        padding: 12px;
        font-size: 13px;
    }

    .mobile-drawer-panel .gifticon {
        width: 56px;
        height: 56px;
    }

    .mobile-drawer-panel .notificationcontainer {
        max-height: unset;
        min-height: unset;
    }

    .floating-panel {
        width: 85%;
        max-width: 320px;
        right: -85%;
        top: 0;
        height: 100vh;
    }
    .floating-panel:hover { right: -85%; }
    .floating-panel.open { right: 0 !important; }

    .panel-pull-tab {
        width: 44px;
        height: 80px;
        left: -44px;
        touch-action: manipulation;
    }
}

/* ========== MOBILE: NOTIFICATIONS & GIFTS IN STREAM PANEL ========== */
@media (max-width: 768px) {

    /* ── Outer wrapper spacing ── */
    .stream-panel-notif-block > div {
        margin-top: 12px !important;
        padding-top: 12px !important;
    }

    /* ── Section headers ── */
    .stream-panel-notif-block .box-header.toggleable-header {
        padding: 8px 12px !important;
        font-size: 10px !important;
        letter-spacing: 0.8px;
        border-radius: 8px;
        background: var(--crust);
        border: 1px solid var(--surface0);
        margin-bottom: 6px !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    /* ── Notification container ── */
    #sp-notifications-content,
    .sp-notif-mirror {
        max-height: 220px !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 5px !important;
        padding: 2px 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    /* ── Each notification item ── */
    #sp-notifications-content > div,
    .sp-notif-mirror > div {
        background: var(--surface0) !important;
        border: 1px solid var(--surface1) !important;
        border-radius: 10px !important;
        padding: 7px 10px !important;
        font-size: 12px !important;
        gap: 8px !important;
        align-items: center !important;
        line-height: 1.4 !important;
        min-height: unset !important;
        flex-wrap: nowrap !important;
        white-space: normal !important;
        overflow: hidden !important;
        display: flex !important;
        flex-shrink: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Avatar in notification rows */
    #sp-notifications-content > div .miniprofilepicture,
    .sp-notif-mirror > div .miniprofilepicture {
        width: 22px !important;
        height: 22px !important;
        flex-shrink: 0 !important;
        display: block !important;
    }

    /* Text inside notifications — allow wrapping */
    #sp-notifications-content > div span,
    #sp-notifications-content > div p,
    #sp-notifications-content > div div:not(:has(img)),
    .sp-notif-mirror > div span,
    .sp-notif-mirror > div p {
        font-size: 12px !important;
        line-height: 1.4 !important;
        overflow: hidden !important;
        min-width: 0 !important;
        flex: 1 !important;
        white-space: normal !important;
        word-break: break-word !important;
    }

    /* ── Gift container ── */
    #sp-gifts-content,
    .sp-gift-mirror {
        max-height: 220px !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 5px !important;
        padding: 2px 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    /* ── Each gift item ── */
    #sp-gifts-content > div,
    .sp-gift-mirror > div {
        background: var(--surface0) !important;
        border: 1px solid var(--surface1) !important;
        border-radius: 10px !important;
        padding: 7px 10px !important;
        font-size: 12px !important;
        gap: 8px !important;
        align-items: center !important;
        line-height: 1.4 !important;
        flex-direction: row !important;
        display: flex !important;
        flex-shrink: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
        flex-wrap: nowrap !important;
        overflow: hidden !important;
    }

    /* Gift icon — smaller but still visible */
    #sp-gifts-content .gifticon,
    .sp-gift-mirror .gifticon {
        width: 36px !important;
        height: 36px !important;
        border-radius: 6px !important;
        flex-shrink: 0 !important;
        object-fit: cover !important;
    }

    /* Gift table */
    #sp-gifts-content > div table,
    .sp-gift-mirror > div table {
        width: 100% !important;
        font-size: 12px !important;
        table-layout: fixed !important;
    }

    #sp-gifts-content > div td,
    .sp-gift-mirror > div td {
        padding: 1px 3px !important;
        vertical-align: middle !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        font-size: 12px !important;
    }

    /* Icon cell width */
    #sp-gifts-content > div td:first-child,
    .sp-gift-mirror > div td:first-child {
        width: 42px !important;
    }

    /* Avatar inside gift rows */
    #sp-gifts-content .miniprofilepicture,
    .sp-gift-mirror .miniprofilepicture {
        width: 20px !important;
        height: 20px !important;
        flex-shrink: 0 !important;
    }
}

/* ========== CONNECT BUTTON STATES (all breakpoints) ========== */
#connectButton.connecting {
    background: linear-gradient(135deg, var(--yellow), var(--peach));
    color: var(--crust);
    pointer-events: none;
    position: relative;
    overflow: hidden;
}

#connectButton.connecting::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    animation: btn-shimmer 1.2s infinite;
}

@keyframes btn-shimmer {
    0%   { left: -60%; }
    100% { left: 130%; }
}

#connectButton.disconnecting {
    background: linear-gradient(135deg, var(--red), var(--maroon));
    color: #fff;
    pointer-events: none;
    opacity: 0.85;
}

/* ===== SWIPE-TO-HIDE CHAT OVERLAY (mobile) ===== */
.mobile-chat-overlay {
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.35s ease;
}

.mobile-chat-overlay.chat-swipe-hidden {
    transform: translateX(-110%);
    opacity: 0;
    pointer-events: none;
}

/* Peek tab — visible when chat is hidden, tap or swipe-left to restore */
#chatPeekTab {
    position: fixed;
    bottom: 60px;
    left: 0;
    z-index: 25;
    width: 36px;
    height: 44px;
    background: rgba(20, 22, 40, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-left: none;
    border-radius: 0 12px 12px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
    touch-action: pan-x;
    /* subtle pulse to hint it's tappable */
    animation: peek-pulse 2.5s ease-in-out infinite;
}

@keyframes peek-pulse {
    0%, 100% { box-shadow: 2px 0 12px rgba(0,0,0,0.4); }
    50%       { box-shadow: 2px 0 18px rgba(139, 213, 202, 0.35); }
}
/* ══════════════════════════════════════════
   USER PROFILE MODAL
   ══════════════════════════════════════════ */
body.upm-open { overflow: hidden; }

#userProfileModal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(14,16,26,0.82);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 16px;
}
#userProfileModal.active { display: flex; }

.upm-card {
    background: var(--mantle);
    border: 1px solid var(--surface0);
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0,0,0,0.6);
    overflow: hidden;
    animation: upm-in 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes upm-in {
    from { opacity:0; transform:scale(0.88) translateY(12px); }
    to   { opacity:1; transform:scale(1)    translateY(0); }
}

.upm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--surface0);
    flex-shrink: 0;
}
.upm-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--subtext0);
    letter-spacing: .08em;
    text-transform: uppercase;
}
.upm-close-btn {
    background: var(--surface0);
    border: none;
    color: var(--subtext0);
    width: 28px; height: 28px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.upm-close-btn:hover { background: var(--red); color: #fff; }

.upm-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--surface1) transparent;
}

#upm-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--subtext0);
    font-size: 0.85rem;
    padding: 24px 0;
}
.upm-spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--surface1);
    border-top-color: var(--lavender);
    border-radius: 50%;
    animation: upm-spin 0.75s linear infinite;
}
@keyframes upm-spin { to { transform: rotate(360deg); } }

.upm-avatar {
    width: 80px; height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--lavender);
    box-shadow: 0 0 0 3px var(--surface0);
}
.upm-rows { width:100%; display:flex; flex-direction:column; gap:4px; }
.upm-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--lavender);
    padding: 8px 4px 2px;
    margin-top: 4px;
    border-bottom: 1px solid var(--surface0);
    width: 100%;
}
.upm-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 8px;
    background: var(--base);
    border: 1px solid transparent;
    transition: border-color 0.15s, background 0.15s;
}
.upm-row:hover { border-color: var(--surface1); background: var(--surface0); }
.upm-label {
    font-size: 0.73rem;
    color: var(--subtext0);
    text-transform: capitalize;
    flex-shrink: 0;
    min-width: 90px;
}
.upm-val { font-size:0.82rem; color:var(--text); font-weight:600; text-align:right; word-break:break-all; }
.upm-badge { font-size:0.72rem; font-weight:700; padding:2px 8px; border-radius:6px; }
.upm-green { background:rgba(166,218,149,0.15); color:var(--green); }
.upm-red   { background:rgba(237,135,150,0.15); color:var(--red); }
.upm-no-data { color:var(--subtext0); font-size:0.82rem; padding:16px 0; text-align:center; }

.upm-tiktok-link {
    display: inline-flex;
    align-items: center;
    font-size: 0.78rem;
    color: var(--blue);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid rgba(138,173,244,0.25);
    transition: background 0.15s, border-color 0.15s;
    margin-top: 4px;
}
.upm-tiktok-link:hover { background:rgba(138,173,244,0.1); border-color:var(--blue); }

.username-with-profile { display:inline-flex; align-items:center; gap:3px; }

/* Name itself is now the profile trigger */
.upm-trigger-btn-name {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-weight: 700;
    font-size: inherit;
    font-family: inherit;
    color: var(--blue);
    line-height: inherit;
    vertical-align: baseline;
    transition: color 0.15s, text-decoration 0.15s;
}
.upm-trigger-btn-name:hover {
    color: var(--lavender);
    text-decoration: underline;
}

/* Small arrow link to open TikTok profile in new tab */
.upm-tiktok-icon-link {
    color: var(--blue);
    text-decoration: none;
    font-size: 0.65rem;
    opacity: 0.35;
    line-height: 1;
    vertical-align: middle;
    transition: opacity 0.15s;
}
.upm-tiktok-icon-link:hover { opacity: 1; }

/* Legacy button kept in case referenced elsewhere */
.upm-trigger-btn {
    background: none;
    border: none;
    padding: 0 2px;
    cursor: pointer;
    font-size: 0.75rem;
    opacity: 0.35;
    transition: opacity 0.15s, transform 0.15s;
    line-height: 1;
    vertical-align: middle;
}
.upm-trigger-btn:hover { opacity:1; transform:scale(1.2); }