/* ── FilmTap Styles v2.0 ───────────────────────────────────────────────── */

:root {
    --primary: #E50914;
    --primary-dark: #B20710;
    --background: #0a0a0a;
    --surface: #141414;
    --surface-light: #1f1f1f;
    --surface-2: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --accent: #46D369;
    --warning: #F5C518;
    --blue: #2979FF;
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

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

#app {
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* ── Screens ─────────────────────────────────────────────────────────── */

.screen {
    display: none;
    height: 100vh;
    overflow: hidden;
    flex-direction: column;
}
.screen.active { display: flex; }

/* ── Splash ──────────────────────────────────────────────────────────── */

#splash-screen { background: var(--background); position: relative; justify-content: center; align-items: center; }

.splash-bg {
    position: absolute; inset: 0;
    background: linear-gradient(135deg, var(--primary-dark) 0%, #1a0505 50%, var(--background) 100%);
}
.splash-gradient {
    position: absolute; bottom: 0; left: 0; right: 0; height: 50%;
    background: linear-gradient(to top, var(--background), transparent);
}
.logo-container {
    position: relative; z-index: 2;
    display: flex; flex-direction: column; align-items: center;
}
.logo {
    width: 100px; height: 100px;
    background: var(--primary);
    border-radius: 24px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 24px;
    box-shadow: 0 10px 40px rgba(229,9,20,0.4);
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.05)} }

.logo-container h1 { font-size: 36px; font-weight: 700; margin-bottom: 8px; letter-spacing: -1px; }
.logo-container p { color: var(--text-secondary); font-size: 16px; }

.loading-bar {
    position: absolute; bottom: -80px;
    width: 120px; height: 3px;
    background: rgba(255,255,255,0.15);
    border-radius: 2px; overflow: hidden;
}
.loading-progress {
    height: 100%; background: var(--primary);
    animation: loading 2.2s ease-in-out forwards;
}
@keyframes loading { 0%{width:0%} 100%{width:100%} }

/* ── Auth Screens ────────────────────────────────────────────────────── */

#login-screen, #register-screen {
    background: var(--background);
    justify-content: center; align-items: center;
}

.auth-container {
    width: 100%; max-width: 400px;
    padding: 40px 28px;
    display: flex; flex-direction: column;
}

.logo-small { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.logo-icon {
    width: 48px; height: 48px;
    background: var(--primary);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
}
.logo-small h2 { font-size: 24px; font-weight: 700; }
.auth-container h3 { font-size: 22px; font-weight: 600; margin-bottom: 24px; }

form { display: flex; flex-direction: column; gap: 12px; }

input, textarea {
    background: #1e1e1e;
    border: 1px solid #2e2e2e;
    border-radius: 10px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}
input:focus, textarea:focus { border-color: var(--primary); }
input::placeholder, textarea::placeholder { color: #555; }
input:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--primary);
    color: white;
    border: none; border-radius: 10px;
    padding: 14px; font-size: 15px; font-weight: 600;
    cursor: pointer; transition: all 0.2s; margin-top: 8px;
    font-family: inherit; width: 100%;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-demo {
    background: linear-gradient(135deg, #1a1a1a, #242424);
    color: var(--accent);
    border: 1px solid #2e2e2e;
    border-radius: 10px; padding: 14px;
    font-size: 15px; font-weight: 600;
    cursor: pointer; width: 100%;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: all 0.2s; font-family: inherit;
}
.btn-demo:hover { border-color: var(--accent); }

.divider {
    display: flex; align-items: center;
    margin: 20px 0; color: #444; font-size: 12px;
}
.divider::before, .divider::after { content:''; flex:1; height:1px; background:#2a2a2a; }
.divider span { padding: 0 14px; }

.auth-link { text-align: center; color: var(--text-secondary); margin-top: 20px; font-size: 14px; }
.auth-link a { color: var(--primary); text-decoration: none; font-weight: 500; }

.api-status { text-align: center; color: var(--text-secondary); font-size: 12px; margin-top: 20px; }
.api-status.online { color: var(--accent); }

.demo-badge {
    background: var(--warning); color: #000;
    padding: 8px 16px; border-radius: 8px;
    font-weight: 700; font-size: 12px; text-align: center;
}
.demo-badge-small {
    background: var(--warning); color: #000;
    padding: 4px 8px; border-radius: 4px;
    font-weight: 700; font-size: 10px;
}

/* ── Main App ────────────────────────────────────────────────────────── */

#main-app { flex-direction: column; position: relative; }

.app-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.95), transparent);
    position: fixed; top: 0; left: 0; right: 0; z-index: 50;
}
.header-left { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; }
.logo-icon-small {
    width: 32px; height: 32px;
    background: var(--primary); border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
}
.header-right { display: flex; align-items: center; gap: 10px; }
.wallet-mini {
    display: flex; align-items: center; gap: 4px;
    background: rgba(70,211,105,0.12);
    padding: 6px 12px; border-radius: 20px;
    font-weight: 600; font-size: 13px; color: var(--accent);
}

/* ── App Body ────────────────────────────────────────────────────────── */

.app-body { flex: 1; overflow: hidden; position: relative; }

.tab-content {
    display: none; position: absolute;
    inset: 0; overflow-y: auto;
    padding-bottom: 80px;
    -webkit-overflow-scrolling: touch;
}
.tab-content.active { display: block; }

/* ── Tab Nav ─────────────────────────────────────────────────────────── */

.tab-nav {
    display: flex; justify-content: space-around;
    background: var(--surface);
    padding: 10px 0 22px;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    border-top: 1px solid #1e1e1e;
}
.tab-btn {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: none; border: none;
    color: var(--text-secondary);
    font-size: 10px; font-weight: 500;
    cursor: pointer; padding: 4px 16px;
    transition: color 0.2s;
    font-family: inherit;
}
.tab-btn.active { color: var(--primary); }
.tab-btn svg { transition: transform 0.2s; }
.tab-btn.active svg { transform: scale(1.1); }

/* ── Tab Headers ─────────────────────────────────────────────────────── */

.tab-header-title {
    font-size: 22px; font-weight: 700;
    padding: 16px 16px 8px;
    margin-top: 52px;
}

/* ── Hero Banner ─────────────────────────────────────────────────────── */

.hero-banner {
    height: 58vh; position: relative;
    background: linear-gradient(to bottom, transparent 50%, var(--background)),
                url('https://images.unsplash.com/photo-1485846234645-a62644f84728?w=800') center/cover no-repeat;
    margin-top: 50px;
}
.hero-gradient {
    position: absolute; bottom: 0; left: 0; right: 0; height: 160px;
    background: linear-gradient(to top, var(--background), transparent);
}
.hero-content { position: absolute; bottom: 50px; left: 0; right: 0; padding: 24px; }
.hero-badge {
    background: var(--primary); color: white;
    padding: 3px 8px; border-radius: 4px;
    font-size: 10px; font-weight: 700; letter-spacing: 1px;
}
.hero-content h1 {
    font-size: 28px; font-weight: 700;
    margin: 10px 0 6px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
.hero-content p {
    color: var(--text-secondary); font-size: 13px; line-height: 1.4;
    margin-bottom: 16px;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.hero-buttons { display: flex; gap: 10px; }
.btn-play {
    background: white; color: black;
    border: none; border-radius: 8px; padding: 10px 20px;
    font-size: 14px; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; gap: 6px;
    transition: all 0.2s; font-family: inherit;
}
.btn-play:hover { background: #e0e0e0; }
.btn-info {
    background: rgba(109,109,110,0.6); color: white;
    border: none; border-radius: 8px; padding: 10px 14px;
    font-size: 14px; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; gap: 6px;
    transition: all 0.2s; font-family: inherit;
}
.btn-info:hover { background: rgba(109,109,110,0.4); }

/* ── Category Filters ────────────────────────────────────────────────── */

.category-filters {
    display: flex; gap: 8px;
    padding: 12px 16px; overflow-x: auto;
    scrollbar-width: none; -ms-overflow-style: none;
}
.category-filters::-webkit-scrollbar { display: none; }
.category-chip {
    background: #1e1e1e; color: var(--text-secondary);
    padding: 7px 16px; border-radius: 20px;
    white-space: nowrap; font-size: 13px;
    cursor: pointer; border: 1px solid #2e2e2e;
    transition: all 0.2s; font-family: inherit;
}
.category-chip:hover, .category-chip.active {
    background: var(--primary); color: white; border-color: var(--primary);
}

/* ── Video Sections ──────────────────────────────────────────────────── */

.video-section { margin-bottom: 28px; }
.video-section h3 {
    font-size: 16px; font-weight: 600;
    margin-bottom: 12px; padding: 0 16px;
}
.top50-section h3 {
    font-size: 14px; color: var(--warning);
    background: rgba(245,197,24,0.08);
    padding: 10px 16px; border-left: 3px solid var(--warning);
    margin-bottom: 12px;
}

.video-row {
    display: flex; gap: 10px;
    overflow-x: auto; padding: 0 16px 8px;
    scrollbar-width: none; -ms-overflow-style: none;
}
.video-row::-webkit-scrollbar { display: none; }

.video-card { flex: 0 0 120px; cursor: pointer; transition: transform 0.2s; }
.video-card:hover { transform: scale(1.04); }

.thumbnail {
    width: 100%; aspect-ratio: 2/3;
    background: var(--surface-light);
    border-radius: 8px; position: relative;
    overflow: hidden; margin-bottom: 6px;
}
.thumbnail img { width: 100%; height: 100%; object-fit: cover; display: block; }

.duration-badge {
    position: absolute; bottom: 5px; right: 5px;
    background: rgba(0,0,0,0.85);
    padding: 2px 6px; border-radius: 4px;
    font-size: 10px; font-weight: 500;
}
.video-title {
    font-size: 12px; font-weight: 500;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
    line-height: 1.3;
}

/* ── Studio Tab ──────────────────────────────────────────────────────── */

.search-container {
    display: flex; align-items: center; gap: 12px;
    background: #1e1e1e; margin: 0 16px 4px;
    padding: 12px 16px; border-radius: 10px;
    border: 1px solid #2a2a2a;
}
.search-container input {
    background: none; border: none; padding: 0;
    font-size: 14px;
}

.browse-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 8px; padding: 8px 16px;
}
.browse-card .thumbnail { aspect-ratio: 16/9; }
.browse-card .video-title { font-size: 11px; }
.browse-card { flex: none; }

/* ── Messages Tab ────────────────────────────────────────────────────── */

.messages-container { padding: 0 16px 16px; }
.messages-section-title {
    font-size: 13px; font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.8px;
    margin-bottom: 12px;
}

/* Chatrooms list */
.chatrooms-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.chatroom-item {
    display: flex; align-items: center; gap: 14px;
    background: var(--surface); padding: 14px;
    border-radius: var(--radius); cursor: pointer;
    transition: background 0.2s;
    border: 1px solid transparent;
}
.chatroom-item:hover { background: var(--surface-light); border-color: #2e2e2e; }
.chatroom-icon { font-size: 28px; width: 44px; text-align: center; flex-shrink: 0; }
.chatroom-info { flex: 1; min-width: 0; }
.chatroom-name { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.chatroom-desc { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chatroom-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.chatroom-online { font-size: 11px; color: var(--accent); font-weight: 500; }

.suggest-room-btn {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 12px 16px;
    background: transparent;
    border: 1px dashed #333; border-radius: var(--radius);
    color: var(--text-secondary); font-size: 14px;
    cursor: pointer; font-family: inherit; transition: all 0.2s;
}
.suggest-room-btn:hover { border-color: var(--primary); color: var(--primary); }

/* DM threads */
.dm-list { display: flex; flex-direction: column; gap: 8px; }
.empty-dms {
    text-align: center; padding: 32px 20px;
    color: var(--text-secondary);
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.empty-dms p { font-size: 14px; }
.empty-dms .sub { font-size: 12px; color: #555; }

.dm-thread-item {
    display: flex; align-items: center; gap: 12px;
    background: var(--surface); padding: 12px 14px;
    border-radius: var(--radius); cursor: pointer; transition: background 0.2s;
}
.dm-thread-item:hover { background: var(--surface-light); }
.dm-thread-avatar {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--primary), #8b0000);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700; flex-shrink: 0;
}
.dm-thread-info { flex: 1; min-width: 0; }
.dm-thread-name { font-size: 14px; font-weight: 600; }
.dm-thread-preview { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Profile Tab ─────────────────────────────────────────────────────── */

#profile-tab { padding-bottom: 100px; overflow-y: auto; }

/* Demo badge pinned at top */
.profile-demo-badge {
    position: relative; z-index: 10;
    border-radius: 0; margin: 0;
}

/* Cover Banner */
.profile-cover {
    height: 140px; position: relative; overflow: hidden;
    background: linear-gradient(135deg,
        #2d0505 0%, #4a0a0a 25%, #2a0820 55%, #0d0d2a 100%);
}
.cover-lines {
    position: absolute; inset: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px, transparent 28px,
        rgba(255,255,255,0.025) 28px, rgba(255,255,255,0.025) 30px
    ), repeating-linear-gradient(
        0deg,
        transparent 0px, transparent 28px,
        rgba(255,255,255,0.015) 28px, rgba(255,255,255,0.015) 30px
    );
}
.cover-fade {
    position: absolute; bottom: 0; left: 0; right: 0; height: 90px;
    background: linear-gradient(to top, var(--background), transparent);
}

/* Identity block */
.profile-identity {
    text-align: center;
    margin-top: -52px;
    padding: 0 20px 16px;
    position: relative; z-index: 2;
}

.avatar-ring {
    display: inline-block;
    padding: 3px;
    background: linear-gradient(135deg, var(--primary), #ff6b35);
    border-radius: 50%;
    margin-bottom: 12px;
}
.avatar {
    width: 96px; height: 96px;
    background: linear-gradient(145deg, #1a0505, #2d0808);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 38px; font-weight: 800;
    border: 3px solid var(--background);
    position: relative;
}

.profile-identity h2 {
    font-size: 22px; font-weight: 800;
    margin-bottom: 3px; color: #fff;
}
.profile-handle {
    font-size: 13px; color: var(--primary);
    font-weight: 600; margin-bottom: 4px;
}
.profile-email-txt {
    font-size: 12px; color: #666;
}

/* Stats Row */
.profile-stats-row {
    display: flex; align-items: center;
    background: var(--surface);
    border: 1px solid #1e1e1e;
    border-radius: 16px;
    margin: 0 16px 16px;
    padding: 14px 0;
}
.pstat { flex: 1; text-align: center; }
.pstat-val { font-size: 20px; font-weight: 800; color: #fff; }
.pstat-lbl {
    font-size: 10px; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.6px;
    margin-top: 3px;
}
.pstat-sep { width: 1px; height: 32px; background: #222; }

/* Wallet Cards — 2-column grid */
.wallet-cards {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 10px; margin: 0 16px 20px;
}

.wallet-card-item {
    border-radius: 16px; padding: 14px 14px 12px;
    display: flex; flex-direction: column; gap: 8px;
    position: relative; overflow: hidden;
}
.wallet-card-item::before {
    content: '';
    position: absolute; top: -20px; right: -20px;
    width: 80px; height: 80px; border-radius: 50%;
    opacity: 0.08;
}

.wc-main {
    background: linear-gradient(145deg, #1e0707, #2e0c0c);
    border: 1px solid rgba(229,9,20,0.25);
}
.wc-main::before { background: var(--primary); }

.wc-gift {
    background: linear-gradient(145deg, #0e0e22, #181830);
    border: 1px solid rgba(120,100,255,0.25);
}
.wc-gift::before { background: #8b78ff; }

.wc-label-row {
    display: flex; align-items: center; gap: 5px;
}
.wc-icon-emoji { font-size: 14px; line-height: 1; }
.wc-label {
    font-size: 11px; font-weight: 600;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase; letter-spacing: 0.5px;
}

.wc-amount {
    font-size: 18px; font-weight: 800; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    line-height: 1.2;
}

.wc-btn {
    width: 100%; padding: 8px 4px;
    border-radius: 10px; border: none;
    font-size: 12px; font-weight: 700;
    cursor: pointer; font-family: inherit;
    transition: all 0.2s; letter-spacing: 0.2px;
}
.wc-withdraw {
    background: rgba(229,9,20,0.75); color: #fff;
}
.wc-withdraw:hover { background: var(--primary); transform: scale(1.02); }
.wc-withdraw:active { transform: scale(0.97); }

.wc-topup {
    background: rgba(110,90,255,0.75); color: #fff;
}
.wc-topup:hover { background: #7b68ff; transform: scale(1.02); }
.wc-topup:active { transform: scale(0.97); }

/* Section title above menu */
.profile-section-title {
    font-size: 11px; font-weight: 700;
    color: #555;
    text-transform: uppercase; letter-spacing: 1px;
    padding: 0 20px; margin-bottom: 8px;
}

/* Profile Menu — grouped card */
.profile-menu {
    background: var(--surface);
    border: 1px solid #1e1e1e;
    border-radius: 16px;
    margin: 0 16px 20px;
    overflow: hidden;
}
.menu-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #1a1a1a;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:hover  { background: rgba(255,255,255,0.03); }
.menu-item:active { background: rgba(255,255,255,0.06); }

.menu-icon-wrap {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.menu-item span {
    flex: 1; font-size: 14px; font-weight: 500; color: #eee;
}
.menu-chevron { color: #3a3a3a; flex-shrink: 0; }

/* Sign-out section */
.signout-wrap { padding: 0 16px; margin-bottom: 12px; }
.btn-logout {
    width: 100%;
    background: rgba(229,9,20,0.07);
    border: 1px solid rgba(229,9,20,0.18);
    color: var(--primary);
    padding: 14px; border-radius: 14px;
    font-size: 14px; font-weight: 700;
    cursor: pointer; font-family: inherit;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: all 0.2s;
}
.btn-logout:hover {
    background: rgba(229,9,20,0.14);
    border-color: var(--primary);
}
.btn-logout:active { transform: scale(0.98); }

.app-version {
    text-align: center; color: #3a3a3a;
    font-size: 11px; padding: 4px 0 8px;
}

/* Hide old single-card wallet style */
.profile-wallet { display: none; }

/* ── Video Player ─────────────────────────────────────────────────────── */

.modal {
    display: none; position: fixed; inset: 0;
    background: black; z-index: 200;
}
.modal.active { display: block; }

.player-container { height: 100%; display: flex; flex-direction: column; background: #000; }
.player-header {
    display: flex; align-items: center; gap: 16px;
    padding: 16px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
    position: absolute; top: 0; left: 0; right: 0; z-index: 10;
}
.close-player { background: none; border: none; cursor: pointer; padding: 4px; }
#player-title { font-size: 16px; font-weight: 500; }
.video-area {
    flex: 1; display: flex;
    align-items: center; justify-content: center;
    position: relative; background: #111;
}
.video-placeholder { opacity: 0.3; }
.play-overlay {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.4); cursor: pointer;
}
.play-btn-large {
    width: 80px; height: 80px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
}

.player-controls {
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    padding: 16px;
}
.progress-bar-container { margin-bottom: 12px; }
.progress-bar-bg { height: 3px; background: rgba(255,255,255,0.2); border-radius: 2px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--primary); width: 0%; transition: width 2s linear; }
.controls-row { display: flex; align-items: center; justify-content: space-between; }
.time-display { font-size: 13px; color: rgba(255,255,255,0.7); }
.control-btn { background: none; border: none; cursor: pointer; padding: 4px; }

/* Ad Overlay */
.ad-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.92);
    display: flex; align-items: center; justify-content: center;
    z-index: 20;
}
.ad-content { text-align: center; padding: 32px; width: 100%; max-width: 340px; }
.ad-label { font-size: 11px; color: var(--text-secondary); letter-spacing: 1px; margin-bottom: 16px; }
.ad-placeholder { background: #1a1a1a; border-radius: 12px; padding: 40px 20px; margin-bottom: 20px; }
.ad-placeholder p { font-size: 16px; margin-bottom: 8px; }
.ad-sub { font-size: 13px; color: var(--text-secondary); }
.ad-progress { height: 4px; background: rgba(255,255,255,0.15); border-radius: 2px; overflow: hidden; }
.ad-progress-fill { height: 100%; background: var(--primary); transition: width 1s linear; }

/* ── Overlay Panels (Chatroom, DM, Settings) ─────────────────────────── */

.overlay-panel {
    position: fixed; inset: 0; z-index: 150;
    background: var(--background);
    display: none; flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.overlay-panel.visible { transform: translateX(0); }

.overlay-header {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    background: var(--surface);
    border-bottom: 1px solid #1e1e1e;
    min-height: 60px;
    flex-shrink: 0;
}
.back-btn { background: none; border: none; cursor: pointer; padding: 4px; flex-shrink: 0; }
.overlay-header-info { flex: 1; min-width: 0; }
.overlay-title { font-size: 16px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.overlay-sub { font-size: 12px; color: var(--text-secondary); display: block; }

.room-online-badge {
    background: rgba(70,211,105,0.12); color: var(--accent);
    padding: 4px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
    flex-shrink: 0;
}

/* DM header user info */
.dm-header-user { display: flex; align-items: center; gap: 10px; }
.dm-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), #8b0000);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.gift-icon-btn { background: none; border: none; cursor: pointer; padding: 6px; color: var(--warning); flex-shrink: 0; }

/* ── Chat Messages ────────────────────────────────────────────────────── */

.chat-messages {
    flex: 1; overflow-y: auto;
    padding: 16px; display: flex;
    flex-direction: column; gap: 12px;
    -webkit-overflow-scrolling: touch;
}
.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

.chat-msg {
    display: flex; align-items: flex-end; gap: 8px;
    max-width: 85%;
}
.chat-msg.mine { align-self: flex-end; flex-direction: row-reverse; }

.msg-avatar {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, #2979ff, #1a4aa8);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    flex-shrink: 0;
}
.msg-avatar.clickable { cursor: pointer; }
.msg-avatar.clickable:hover { opacity: 0.85; }

.msg-bubble-wrap { display: flex; flex-direction: column; gap: 2px; max-width: 100%; }
.msg-bubble-wrap.mine { align-items: flex-end; }

.msg-username {
    font-size: 11px; color: var(--text-secondary);
    margin-bottom: 2px; padding: 0 4px;
    cursor: pointer;
}
.msg-username.clickable:hover { color: var(--primary); }

.msg-bubble {
    background: var(--surface-light);
    padding: 10px 14px;
    border-radius: 18px 18px 18px 4px;
    font-size: 14px; line-height: 1.4;
    max-width: 100%;
    word-break: break-word;
}
.msg-bubble.mine {
    background: var(--primary);
    border-radius: 18px 18px 4px 18px;
}
.msg-bubble.gift-bubble {
    background: linear-gradient(135deg, #2a1a00, #3a2500);
    border: 1px solid rgba(245,197,24,0.3);
    color: var(--warning);
}
.gift-in-chat { font-size: 18px; }

.msg-time { font-size: 10px; color: #555; padding: 0 4px; }

/* Chat Input Row */
.chat-input-row {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px;
    background: var(--surface);
    border-top: 1px solid #1e1e1e;
    flex-shrink: 0;
}
.chat-input {
    flex: 1; background: var(--surface-light);
    border: 1px solid #2e2e2e; border-radius: 24px;
    padding: 10px 16px; font-size: 14px;
    color: var(--text-primary);
    outline: none; transition: border-color 0.2s;
}
.chat-input:focus { border-color: #3e3e3e; }
.send-btn {
    width: 40px; height: 40px;
    background: var(--primary); color: white;
    border: none; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: background 0.2s;
}
.send-btn:hover { background: var(--primary-dark); }
.gift-btn {
    width: 40px; height: 40px;
    background: rgba(245,197,24,0.1); color: var(--warning);
    border: none; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: background 0.2s;
}
.gift-btn:hover { background: rgba(245,197,24,0.2); }

/* ── User Profile Popup ───────────────────────────────────────────────── */

.user-popup-backdrop {
    position: fixed; inset: 0; z-index: 300;
    background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
}
.user-popup-card {
    background: var(--surface-light);
    border-radius: 20px; padding: 32px 24px 24px;
    width: calc(100% - 64px); max-width: 300px;
    text-align: center; position: relative;
}
.close-popup-x {
    position: absolute; top: 12px; right: 14px;
    background: none; border: none; color: var(--text-secondary);
    font-size: 18px; cursor: pointer;
}
.popup-avatar {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--primary), #8b0000);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 700;
    margin: 0 auto 12px;
}
.popup-name { font-size: 18px; font-weight: 700; margin-bottom: 20px; }
.popup-actions { display: flex; flex-direction: column; gap: 10px; }
.popup-action-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 12px;
    background: var(--surface-2); color: white;
    border: none; border-radius: 10px;
    font-size: 14px; font-weight: 600; cursor: pointer;
    font-family: inherit; transition: background 0.2s;
}
.popup-action-btn:hover { background: #333; }
.popup-action-btn.gift-action { background: rgba(245,197,24,0.12); color: var(--warning); }
.popup-action-btn.gift-action:hover { background: rgba(245,197,24,0.2); }

/* ── Modals (Gift, Suggest Room) ─────────────────────────────────────── */

.modal-backdrop {
    position: fixed; inset: 0; z-index: 300;
    background: rgba(0,0,0,0.7);
    display: flex; align-items: flex-end; justify-content: center;
    backdrop-filter: blur(4px);
}
.bottom-sheet {
    background: var(--surface-light);
    border-radius: 20px 20px 0 0;
    padding: 8px 24px 36px;
    width: 100%; max-width: 480px;
}
.bottom-sheet-handle {
    width: 40px; height: 4px;
    background: #333; border-radius: 2px;
    margin: 8px auto 20px;
}

.gift-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px;
}
.gift-modal-header h3 { font-size: 18px; font-weight: 700; }
.close-modal-btn {
    background: none; border: none; color: var(--text-secondary);
    font-size: 20px; cursor: pointer;
}

/* Gifts Grid */
.gifts-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.gift-item {
    background: var(--surface-2); border-radius: 12px;
    padding: 16px 8px; text-align: center;
    cursor: pointer; transition: all 0.2s;
    border: 1px solid transparent;
}
.gift-item:hover { background: #333; border-color: var(--warning); transform: scale(1.04); }
.gift-item:active { transform: scale(0.97); }
.gift-emoji { font-size: 32px; margin-bottom: 6px; }
.gift-name { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.gift-price { font-size: 12px; color: var(--warning); font-weight: 700; }

/* Suggest Room Form */
.suggest-form { display: flex; flex-direction: column; gap: 12px; }
.suggest-form textarea { resize: none; }

/* ── Settings ─────────────────────────────────────────────────────────── */

.settings-content {
    flex: 1; overflow-y: auto;
    padding: 20px 16px 40px;
    display: flex; flex-direction: column; gap: 28px;
    -webkit-overflow-scrolling: touch;
}
.settings-section { display: flex; flex-direction: column; gap: 16px; }
.settings-section-label {
    font-size: 11px; font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 1px;
    border-bottom: 1px solid #1e1e1e;
    padding-bottom: 10px;
}
.settings-field { display: flex; flex-direction: column; gap: 6px; }
.settings-field label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.settings-input-row { display: flex; gap: 8px; }
.settings-input-row input { flex: 1; }
.settings-save-btn {
    background: var(--primary); color: white;
    border: none; border-radius: 10px;
    padding: 0 16px; font-size: 13px; font-weight: 600;
    cursor: pointer; font-family: inherit;
    white-space: nowrap; transition: background 0.2s;
}
.settings-save-btn:hover { background: var(--primary-dark); }
.settings-hint { font-size: 11px; color: var(--text-secondary); }

/* ── Toast ────────────────────────────────────────────────────────────── */

.toast {
    position: fixed; bottom: 100px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #222; color: white;
    padding: 10px 20px; border-radius: 24px;
    font-size: 13px; font-weight: 500;
    opacity: 0; pointer-events: none;
    transition: all 0.3s ease;
    z-index: 9999; white-space: nowrap;
    max-width: 90vw;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: #1a3a1a; border: 1px solid rgba(70,211,105,0.3); color: var(--accent); }
.toast.error { background: #2a0a0a; border: 1px solid rgba(229,9,20,0.3); color: #ff6b6b; }
.toast.info { background: #0a1a2a; border: 1px solid rgba(41,121,255,0.3); color: #64b5f6; }

/* ── Scrollbar styling ────────────────────────────────────────────────── */

.tab-content::-webkit-scrollbar { width: 3px; }
.tab-content::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 2px; }

/* ── Responsive Tweaks ────────────────────────────────────────────────── */

@media (max-width: 380px) {
    .hero-content h1 { font-size: 22px; }
    .gifts-grid { grid-template-columns: repeat(3, 1fr); }
    .tab-btn { padding: 4px 10px; font-size: 9px; }
}

@media (min-width: 480px) {
    .bottom-sheet { border-radius: 20px; margin-bottom: 20px; }
}

/* (wallet card styles defined in Profile Tab section above) */

/* ── Gift Wallet Preview in Gift Modal ────────────────────────────────── */

.gift-wallet-preview {
    background: rgba(120,100,255,0.12);
    border: 1px solid rgba(120,100,255,0.25);
    border-radius: 10px; padding: 10px 14px;
    font-size: 13px; font-weight: 600;
    color: #a090ff; margin-bottom: 16px;
    text-align: center;
}

/* ── Withdrawal Modal ─────────────────────────────────────────────────── */

.withdraw-sheet { max-height: 92vh; overflow-y: auto; }

.withdraw-avail-row {
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(70,211,105,0.08);
    border: 1px solid rgba(70,211,105,0.2);
    border-radius: 10px; padding: 12px 14px; margin-bottom: 16px;
    font-size: 13px; color: var(--text-secondary);
}
.withdraw-avail-amt {
    font-size: 15px; font-weight: 700; color: var(--accent);
}

.withdraw-form { display: flex; flex-direction: column; gap: 10px; }

select {
    background: #1e1e1e;
    border: 1px solid #2e2e2e;
    border-radius: 10px; padding: 14px 16px;
    color: var(--text-primary);
    font-size: 15px; font-family: inherit;
    outline: none; width: 100%;
    -webkit-appearance: none; appearance: none;
    cursor: pointer;
}
select:focus { border-color: var(--primary); }

.withdraw-notice {
    display: flex; align-items: center; gap: 8px;
    background: rgba(245,197,24,0.06);
    border: 1px solid rgba(245,197,24,0.15);
    border-radius: 8px; padding: 10px 12px;
    font-size: 12px; color: rgba(245,197,24,0.8);
}

/* ── Gift Top-Up Modal ────────────────────────────────────────────────── */

.topup-subtitle {
    font-size: 13px; color: var(--text-secondary);
    margin-bottom: 16px; text-align: center;
}

.topup-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 10px; margin-bottom: 16px;
}

.topup-option {
    background: var(--surface-2);
    border: 2px solid transparent;
    border-radius: 14px; padding: 18px 8px;
    text-align: center; font-size: 18px; font-weight: 800;
    cursor: pointer; transition: all 0.2s;
    font-family: inherit;
}
.topup-option:hover { border-color: rgba(120,100,255,0.5); background: rgba(120,100,255,0.06); }
.topup-option.selected {
    border-color: #8b78ff; background: rgba(120,100,255,0.15); color: #a090ff;
}
.topup-option:active { transform: scale(0.96); }

.topup-divider {
    text-align: center; font-size: 12px; color: #555;
    margin: 4px 0 12px;
    display: flex; align-items: center; gap: 8px;
}
.topup-divider::before, .topup-divider::after {
    content: ''; flex: 1; height: 1px; background: #2a2a2a;
}

.topup-payment-note {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface); border-radius: 10px;
    padding: 12px 14px; font-size: 12px;
    color: var(--text-secondary); margin: 12px 0;
}

/* ── Utility ──────────────────────────────────────────────────────────── */

.clickable { cursor: pointer; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-secondary); }
.empty-state .sub { font-size: 13px; margin-top: 6px; }
