/* ═══════════════════════════════════════════
   lobby.css — AI 狼人杀 Premium Dark Theme
   ═══════════════════════════════════════════ */

/* ── Global ── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #07070a;
    color: #e8e8ef;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

*, *::before, *::after { box-sizing: border-box; }

/* ── Atmospheric Background ── */
.ww-atmosphere {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.ww-fog {
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%; left: -50%;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.12;
}

.ww-fog-1 {
    background: radial-gradient(circle at 30% 40%, #dc2626 0%, transparent 50%);
    animation: fogDrift1 25s ease-in-out infinite;
}

.ww-fog-2 {
    background: radial-gradient(circle at 70% 60%, #7c3aed 0%, transparent 50%);
    animation: fogDrift2 30s ease-in-out infinite;
}

@keyframes fogDrift1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(5%, -3%) scale(1.05); }
    66% { transform: translate(-3%, 5%) scale(0.95); }
}

@keyframes fogDrift2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-5%, 3%) scale(1.08); }
}

/* ── Lobby Layout ── */
.ww-lobby {
    position: relative;
    z-index: 1;
    height: 100vh;
    height: 100dvh;
    padding: env(safe-area-inset-top) 0 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Top Bar ── */
.ww-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: rgba(7,7,10,0.7);
}

.ww-topbar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: #ccc;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(8px);
}

.ww-topbar-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-color: rgba(255,255,255,0.2);
}

.ww-topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #ccc;
}

.ww-user-avatar-mini {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #dc2626, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #fff;
}

.ww-topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ww-lang-switch {
    display: flex;
    gap: 2px;
    padding: 3px;
    background: rgba(255,255,255,0.06);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.06);
}

.ww-lang-switch button {
    padding: 5px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: rgba(255,255,255,0.4);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.ww-lang-switch button.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* ── Hero Section ── */
.ww-hero {
    text-align: center;
    padding: 12px 20px 8px;
    position: relative;
}

.ww-wolf-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 8px;
    position: relative;
    animation: wolfPulse 4s ease-in-out infinite;
}

.ww-wolf-icon::before {
    content: '';
    position: absolute;
    inset: -20px;
    background: radial-gradient(circle, rgba(220,38,38,0.25) 0%, transparent 70%);
    border-radius: 50%;
    animation: glowPulse 3s ease-in-out infinite;
}

.ww-wolf-icon svg {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 0 20px rgba(220,38,38,0.4));
}

@keyframes wolfPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.15); }
}

.ww-title {
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ff4466 0%, #e83e8c 40%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 6px;
    line-height: 1.2;
}

.ww-subtitle {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.45);
    margin: 0;
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* ── CTA Quick Start ── */
.ww-cta-area {
    padding: 16px 20px 8px;
}

.ww-cta-quick {
    width: 100%;
    padding: 16px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(220,38,38,0.12), rgba(124,58,237,0.12));
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.ww-cta-quick::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(220,38,38,0.2), rgba(124,58,237,0.2));
    opacity: 0;
    transition: opacity 0.3s;
}

.ww-cta-quick:hover::before,
.ww-cta-quick:active::before {
    opacity: 1;
}

.ww-cta-quick i {
    font-size: 1.1rem;
    color: #fbbf24;
}

.ww-cta-quick small {
    font-size: 0.7rem;
    font-weight: 400;
    color: rgba(255,255,255,0.4);
    margin-left: 4px;
}

.ww-cta-quick:active {
    transform: scale(0.97);
}

/* ── Section Layout ── */
.ww-section {
    padding: 0 20px;
    margin-bottom: 8px;
}

.ww-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0 10px;
}

.ww-section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 700;
    color: #e8e8ef;
}

.ww-section-icon {
    font-size: 1.1rem;
}

.ww-player-badge {
    display: flex;
    align-items: center;
    padding: 4px 14px;
    border-radius: 20px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    font-size: 0.85rem;
    font-weight: 700;
    color: rgba(255,255,255,0.5);
    transition: all 0.3s;
}

.ww-player-badge.valid {
    background: rgba(34,197,94,0.15);
    border-color: rgba(34,197,94,0.3);
    color: #22c55e;
    box-shadow: 0 0 20px rgba(34,197,94,0.1);
}

.ww-player-badge.over {
    background: rgba(239,68,68,0.15);
    border-color: rgba(239,68,68,0.3);
    color: #ef4444;
}

.ww-player-max {
    color: rgba(255,255,255,0.3);
    font-weight: 400;
}

/* ── Role Preference ── */
.ww-role-chips {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.ww-chip-label {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.35);
    white-space: nowrap;
}

.ww-role-select {
    flex: 1;
    max-width: 200px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.06);
    color: #e8e8ef;
    font-size: 0.85rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

/* ── Character Grid ── */
.ww-char-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    gap: 10px;
    max-height: 55vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 0 12px;
    margin: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: none;
    touch-action: pan-y;
}

.ww-char-grid::-webkit-scrollbar { width: 3px; }
.ww-char-grid::-webkit-scrollbar-track { background: transparent; }
.ww-char-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

.ww-char-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 6px 10px;
    border-radius: 16px;
    background: rgba(255,255,255,0.03);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.ww-char-card:active {
    transform: scale(0.93);
}

.ww-char-card.selected {
    border-color: #dc2626;
    background: rgba(220,38,38,0.08);
    box-shadow: 
        0 0 0 1px rgba(220,38,38,0.3),
        0 0 30px rgba(220,38,38,0.12),
        inset 0 0 20px rgba(220,38,38,0.05);
}

.ww-char-card.selected::after {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #dc2626;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: checkPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes checkPop {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

.ww-char-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 8px;
    border: 2.5px solid rgba(255,255,255,0.1);
    transition: all 0.25s;
    background: rgba(255,255,255,0.05);
}

.ww-char-card.selected .ww-char-avatar {
    border-color: #dc2626;
    box-shadow: 0 0 16px rgba(220,38,38,0.35);
}

.ww-char-avatar img,
.ww-char-avatar picture,
.ww-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ww-char-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    line-height: 1.3;
}

.ww-char-desc {
    display: none; /* Hide desc for cleaner look */
}

/* ── Bottom Sticky Bar ── */
.ww-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, rgba(7,7,10,0.98) 60%, transparent);
    z-index: 200;
    backdrop-filter: blur(12px);
}

.ww-start-btn {
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
    color: #fff;
    background: linear-gradient(135deg, #dc2626 0%, #b91c5c 50%, #7c3aed 100%);
    box-shadow: 0 4px 24px rgba(220,38,38,0.25), 0 0 0 1px rgba(220,38,38,0.2);
}

.ww-start-btn:disabled {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.3);
    box-shadow: none;
    cursor: not-allowed;
}

.ww-start-btn:not(:disabled):active {
    transform: scale(0.97);
}

.ww-start-btn:not(:disabled):hover {
    box-shadow: 0 6px 32px rgba(220,38,38,0.35), 0 0 0 1px rgba(220,38,38,0.3);
}

.ww-start-btn-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(135deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
    pointer-events: none;
}

.ww-start-btn:disabled .ww-start-btn-glow {
    display: none;
}

@keyframes shimmer {
    0% { transform: rotate(0deg) translate(-30%, -30%); }
    100% { transform: rotate(0deg) translate(30%, 30%); }
}

.ww-start-btn-text {
    position: relative;
    z-index: 1;
}

/* ── History Section ── */
.ww-section-history {
    padding-bottom: 20px;
}

.ww-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.ww-history-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.ww-history-card:active {
    transform: scale(0.97);
    background: rgba(255,255,255,0.08);
}

.ww-history-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.ww-history-date {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.35);
}

.ww-history-result {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
}

.ww-history-result.good {
    background: rgba(34,197,94,0.15);
    color: #22c55e;
}

.ww-history-result.wolf {
    background: rgba(239,68,68,0.15);
    color: #ef4444;
}

.ww-history-meta {
    display: flex;
    gap: 10px;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.35);
}

/* ── Empty State ── */
.ww-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
}

.ww-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.ww-empty-text {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.4);
    margin-bottom: 4px;
}

.ww-empty-hint {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.2);
}

/* ── Modals ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.ww-modal-card {
    background: rgba(20,20,28,0.98);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 32px 24px;
    max-width: 380px;
    width: 90%;
    position: relative;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

.ww-modal-lg {
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.ww-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255,255,255,0.06);
    border: none;
    color: rgba(255,255,255,0.5);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.ww-modal-close:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.ww-modal-icon {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.ww-modal-title {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: #e8e8ef;
    margin: 0 0 16px;
}

.ww-modal-msg {
    text-align: center;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.5);
    margin: 0 0 24px;
    line-height: 1.5;
}

.ww-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.ww-btn-ghost {
    padding: 10px 24px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: transparent;
    color: rgba(255,255,255,0.6);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.ww-btn-ghost:hover {
    background: rgba(255,255,255,0.06);
}

.ww-btn-danger {
    padding: 10px 24px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #dc2626, #b91c5c);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.ww-btn-danger:active {
    transform: scale(0.96);
}

.ww-replay-content {
    text-align: left;
    font-size: 0.85rem;
    line-height: 1.6;
    color: rgba(255,255,255,0.7);
}

/* ── Toast ── */
.premium-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 24px;
    border-radius: 14px;
    background: rgba(20,20,28,0.95);
    border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(16px);
    color: #e8e8ef;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.premium-toast.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast-success i { color: #22c55e; }
.toast-warn i { color: #fbbf24; }
.toast-error i { color: #ef4444; }
.toast-info i { color: #60a5fa; }

/* ── Settings Card (legacy compat) ── */
.settings-card {
    background: rgba(20,20,28,0.98);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 24px;
    max-width: 380px;
    width: 90%;
    position: relative;
}

.modal-close-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 1.1rem;
    cursor: pointer;
}

/* ── Ambient Background (for game room) ── */
.ambient-bg {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.ambient-glow {
    width: 100%;
    height: 100%;
    transition: all 1.5s ease;
}

/* ── Login bar (legacy compat) ── */
.btn-login {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    color: #ccc;
    font-size: 0.85rem;
    cursor: pointer;
}

/* ── Desktop Tweaks ── */
@media (min-width: 768px) {
    .ww-lobby {
        max-width: 600px;
        margin: 0 auto;
    }
    
    .ww-bottom-bar {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .ww-hero {
        padding-top: 20px;
    }
    
    .ww-wolf-icon {
        width: 80px;
        height: 80px;
    }
    
    .ww-title {
        font-size: 2.4rem;
    }
}

/* ═══════════════════════════════════════
   CHARACTER BROWSER — In-App Marketplace
   ═══════════════════════════════════════ */

.ww-modal-fullscreen {
    width: 100%;
    max-width: 100vw;
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    padding: env(safe-area-inset-top, 16px) 0 env(safe-area-inset-bottom, 0) 0;
    overflow: hidden;
}

.char-browser-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px 8px;
    flex-shrink: 0;
}

.char-browser-back {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.char-browser-back:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.15);
}

.char-browser-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 8px 12px;
    flex: 1;
    max-width: 240px;
}

.char-browser-search i {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
}

.char-browser-search input {
    background: transparent;
    border: none;
    outline: none;
    color: white;
    font-size: 0.9rem;
    width: 100%;
    -webkit-user-select: auto;
    user-select: auto;
}

.char-browser-search input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.char-browser-tabs {
    display: flex;
    gap: 6px;
    padding: 8px 20px 12px;
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.char-tab {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.25s ease;
}

.char-tab.active {
    background: linear-gradient(135deg, rgba(94, 234, 212, 0.2), rgba(168, 85, 247, 0.15));
    border-color: rgba(94, 234, 212, 0.4);
    color: #5eead4;
}

.char-browser-grid {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    align-content: start;
    -webkit-overflow-scrolling: touch;
}

.char-browser-loading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
}

.char-browser-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: all 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}

.char-browser-item:active {
    transform: scale(0.95);
}

.char-browser-item.in-game {
    border-color: rgba(94, 234, 212, 0.4);
    background: rgba(94, 234, 212, 0.08);
}

.char-browser-item .cb-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.char-browser-item .cb-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.char-browser-item .cb-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.char-browser-item .cb-desc {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.char-browser-item .cb-badge {
    font-size: 0.6rem;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(94, 234, 212, 0.15);
    color: #5eead4;
    font-weight: 600;
}

.char-browser-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
}

/* ── Custom Character Row List (My Souls Tab) ── */
.char-browser-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px;
    width: 100%;
    box-sizing: border-box;
}

.char-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    gap: 14px;
    transition: all 0.25s ease;
    box-sizing: border-box;
    width: 100%;
}

.char-list-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}

.char-list-item.in-game {
    background: rgba(94, 234, 212, 0.03);
    border-color: rgba(94, 234, 212, 0.25);
}

.char-list-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.char-list-left .char-list-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.char-list-left .char-list-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.char-list-left .char-list-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.char-list-left .char-list-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.char-list-left .char-list-role-badge {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 6px;
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    font-weight: 500;
    align-self: flex-start;
}

.char-list-mid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 0 0 auto;
    min-width: 0;
}

.char-list-mid .char-list-stats-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.cosmic-tier-badge {
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    flex-shrink: 0;
}

.char-list-mid .char-list-stats-text {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    flex-shrink: 0;
}

.char-list-mid .char-list-desc {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    width: 100%;
}

.char-list-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Action Buttons inside rows */
.btn-char-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    outline: none;
}

.btn-char-action i {
    font-size: 0.8rem;
}

.btn-char-redeem {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.btn-char-redeem:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.4);
}

.btn-char-redeem.glowing-redeem {
    animation: goldPulse 2s infinite alternate;
}

@keyframes goldPulse {
    0% {
        box-shadow: 0 0 4px rgba(245, 158, 11, 0.3);
    }
    100% {
        box-shadow: 0 0 14px rgba(245, 158, 11, 0.8);
    }
}

.btn-char-edit {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.btn-char-edit:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-char-select {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.4);
}

.btn-char-select:hover {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.7);
}

.char-list-item.in-game .btn-char-select {
    background: rgba(94, 234, 212, 0.15);
    border-color: rgba(94, 234, 212, 0.3);
    color: #5eead4;
}

/* ── Leaderboard UI ── */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 16px 20px;
    width: 100%;
    box-sizing: border-box;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    gap: 14px;
    width: 100%;
    box-sizing: border-box;
}

.leaderboard-item .leaderboard-rank {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    flex-shrink: 0;
    border-radius: 50%;
    font-family: 'JetBrains Mono', monospace;
}

.leaderboard-item .leaderboard-rank-1 {
    background: linear-gradient(135deg, #ffe066, #f59e0b);
    color: #1e1b4b;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.leaderboard-item .leaderboard-rank-2 {
    background: linear-gradient(135deg, #e2e8f0, #94a3b8);
    color: #0f172a;
    box-shadow: 0 0 8px rgba(148, 163, 184, 0.3);
}

.leaderboard-item .leaderboard-rank-3 {
    background: linear-gradient(135deg, #fed7aa, #ea580c);
    color: #451a03;
    box-shadow: 0 0 8px rgba(234, 88, 12, 0.3);
}

.leaderboard-item .leaderboard-rank-other {
    color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.03);
}

.leaderboard-item .leaderboard-creator {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 1px;
}

/* ── Read-only Stats & Experience ── */
.stats-experience-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
    word-break: break-all;
    white-space: pre-wrap;
    min-height: 48px;
}

.role-mastery-grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    width: 100%;
}

.role-mastery-item {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 10px 12px;
    gap: 10px;
}

.role-mastery-medal-wrap {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.role-mastery-medal-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.role-mastery-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.role-mastery-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.role-mastery-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.role-mastery-tier {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 6px;
    font-weight: 700;
}

.role-mastery-stats {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Read-only Profile Card ── */
.readonly-profile-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    animation: fadeIn 0.3s ease;
}

.profile-header-card {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 16px;
    gap: 16px;
}

.profile-avatar-wrap {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(94, 234, 212, 0.3);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.profile-avatar-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-meta-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.profile-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.profile-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.profile-role-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(168, 85, 247, 0.2);
    color: #d8b4fe;
    border: 1px solid rgba(168, 85, 247, 0.3);
    font-weight: 600;
}

.profile-occupation {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
    font-weight: 500;
}

.profile-tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.profile-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
}

.profile-chip i {
    font-size: 0.65rem;
}

/* Sections */
.profile-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.profile-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #5eead4;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-section-title i {
    font-size: 0.8rem;
    opacity: 0.8;
}

.profile-description-text {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid rgba(94, 234, 212, 0.5);
    padding: 8px 12px;
    margin: 0;
    border-radius: 0 10px 10px 0;
    line-height: 1.6;
}

.profile-experience-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    word-break: break-all;
    white-space: pre-wrap;
    min-height: 50px;
}

.profile-play-voice-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(94, 234, 212, 0.1);
    border: 1px solid rgba(94, 234, 212, 0.3);
    border-radius: 20px;
    color: #5eead4;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: auto;
}

.profile-play-voice-btn:hover {
    background: rgba(94, 234, 212, 0.2);
    border-color: #5eead4;
    transform: translateY(-1px);
}

.profile-play-voice-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.profile-play-voice-btn i {
    font-size: 0.8rem;
}

