:root {
    --bg-gradient-start: #1a1a2e;
    --bg-gradient-end: #16213e;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --accent-yellow: #ffd700;
    --accent-green: #4ade80;
    --accent-red: #f87171;
    --accent-blue: #60a5fa;
    --deposit-bg: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    --withdraw-bg: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    --crown-gold: #ffd700;
    --crown-silver: #c0c0c0;
    --crown-bronze: #cd7f32;
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(255, 215, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* 首页样式 */
.home-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.logo {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-yellow), #ff8c00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2rem;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

.home-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.input-group input {
    width: 100%;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-yellow);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.1);
}

.input-group input::placeholder {
    color: var(--text-muted);
}

.btn {
    width: 100%;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--deposit-bg);
    color: #000;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 193, 7, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    margin-top: 1rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--card-border);
}

.divider span {
    padding: 0 1rem;
}

/* 头像上传区域 */
.avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.5rem;
}

.avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid var(--accent-yellow);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-preview:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-preview .placeholder {
    font-size: 2rem;
}

.avatar-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* 房间页面样式 */
.room-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部工具栏 */
.room-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.room-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.back-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--accent-yellow);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.room-tools {
    display: flex;
    gap: 0.5rem;
}

.tool-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.tool-btn.active {
    background: var(--accent-yellow);
    color: #000;
    border-color: var(--accent-yellow);
}

.history-btn {
    background: var(--accent-yellow);
    color: #000;
    font-weight: 600;
    border-color: var(--accent-yellow);
}

/* 筹码池显示 */
.pool-section {
    text-align: center;
    padding: 2rem 1rem;
}

.pool-amount {
    font-size: 4rem;
    font-weight: 800;
    color: var(--accent-yellow);
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}

/* 用户网格 */
.users-section {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
    justify-items: center;
}

.user-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    width: 100%;
    max-width: 120px;
}

.user-avatar-wrapper {
    position: relative;
}

.user-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid var(--card-border);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.crown {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
}

.crown.gold {
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.8));
}

.crown.silver {
    filter: drop-shadow(0 0 5px rgba(192, 192, 192, 0.8));
}

.crown.bronze {
    filter: drop-shadow(0 0 5px rgba(205, 127, 50, 0.8));
}

.user-name {
    font-size: 0.875rem;
    color: var(--text-primary);
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chips {
    font-size: 1.25rem;
    font-weight: 700;
}

.user-chips.positive {
    color: var(--accent-green);
}

.user-chips.negative {
    color: var(--accent-red);
}

.user-chips.zero {
    color: var(--text-muted);
}

/* 底部操作栏 */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 1.5rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent);
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.action-btn .icon {
    font-size: 2rem;
}

.action-btn .label {
    font-size: 1rem;
    font-weight: 600;
}

.withdraw-btn {
    background: var(--withdraw-bg);
    color: #fff;
}

.withdraw-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(34, 197, 94, 0.4);
}

.deposit-btn {
    background: var(--deposit-bg);
    color: #000;
}

.deposit-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 193, 7, 0.4);
}

.room-info {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* 历史记录侧边栏 */
.history-sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: var(--bg-gradient-start);
    border-left: 1px solid var(--card-border);
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.history-sidebar.open {
    right: 0;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--card-border);
}

.history-header h2 {
    font-size: 1.25rem;
}

.close-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.history-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
}

.history-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.history-content {
    flex: 1;
}

.history-user {
    font-weight: 600;
    color: var(--accent-yellow);
}

.history-action {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* 遮罩层 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* 弹窗 */
.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: var(--bg-gradient-start);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2rem;
    z-index: 1001;
    width: 90%;
    max-width: 400px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.open {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* 二维码弹窗 */
.qrcode-modal .qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.qrcode-modal #qrcode {
    background: #fff;
    padding: 1rem;
    border-radius: 12px;
}

.room-id-display {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent-yellow);
    letter-spacing: 0.2em;
}

.copy-btn {
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* 头像编辑弹窗 */
.avatar-modal .avatar-editor {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.avatar-preview-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--accent-yellow);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-glow);
}

.avatar-preview-large canvas,
.avatar-preview-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-actions {
    display: flex;
    gap: 1rem;
}

.avatar-actions .btn {
    width: auto;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    margin-top: 0;
}

/* 可点击的用户头像 */
.user-card.current-user .user-avatar {
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-card.current-user .user-avatar:hover {
    border-color: var(--accent-yellow);
    box-shadow: var(--shadow-glow);
}

/* Toast 提示 */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 1rem 2rem;
    border-radius: 12px;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-muted);
    border-top-color: var(--accent-yellow);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 响应式调整 */
@media (max-width: 480px) {
    .home-card {
        padding: 1.5rem;
        border-radius: 16px;
    }

    .logo {
        font-size: 2.5rem;
    }

    .pool-amount {
        font-size: 3rem;
    }

    .users-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .action-btn {
        padding: 0.75rem 1.5rem;
    }

    .action-btn .icon {
        font-size: 1.5rem;
    }
}