/* ============================================================
   Custom Theme — 橙白清新风格（面向客户展示）
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
    /* Primary Palette - Warm Orange */
    --c-primary: #7C3AED;
    --c-primary-light: #A78BFA;
    --c-primary-dark: #6D28D9;
    --c-primary-bg: rgba(124, 58, 237, 0.08);
    --c-primary-bg-hover: rgba(124, 58, 237, 0.14);

    /* Accent & Status */
    --c-accent: #A78BFA;
    --c-success: #22C55E;
    --c-success-bg: rgba(34, 197, 94, 0.1);
    --c-danger: #EF4444;
    --c-danger-bg: rgba(239, 68, 68, 0.1);
    --c-info: #3B82F6;
    --c-info-bg: rgba(59, 130, 246, 0.1);
    --c-warning: #F59E0B;

    /* Backgrounds */
    --c-bg-page: #F8F6F3;
    --c-bg-card: #FFFFFF;
    --c-bg-sidebar: #FFFFFF;
    --c-bg-input: #F7F5F2;
    --c-bg-hover: rgba(124, 58, 237, 0.06);

    /* Text */
    --c-text-primary: #1A1A2E;
    --c-text-secondary: #4A4A5A;
    --c-text-muted: #9CA3AF;
    --c-text-on-primary: #FFFFFF;

    /* Borders */
    --c-border: rgba(0, 0, 0, 0.06);
    --c-border-strong: rgba(0, 0, 0, 0.12);
    --c-border-input: rgba(0, 0, 0, 0.1);

    /* Shadows */
    --c-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --c-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --c-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
    --c-shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.1);
    --c-shadow-card: 0 2px 12px rgba(124, 58, 237, 0.08);
    --c-shadow-card-hover: 0 8px 28px rgba(124, 58, 237, 0.16);

    /* Radii */
    --c-radius-sm: 8px;
    --c-radius-md: 12px;
    --c-radius-lg: 16px;
    --c-radius-xl: 20px;
    --c-radius-2xl: 24px;
    --c-radius-full: 999px;

    /* Spacing */
    --c-gap: 20px;
    --c-padding: 24px;

    /* Transitions */
    --c-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --c-transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--c-bg-page);
    color: var(--c-text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Ambient background glow */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 600px 500px at 15% 10%, rgba(124, 58, 237, 0.07), transparent),
        radial-gradient(ellipse 500px 400px at 85% 5%, rgba(167, 139, 250, 0.08), transparent),
        radial-gradient(ellipse 400px 400px at 50% 90%, rgba(34, 197, 94, 0.04), transparent);
    z-index: 0;
    animation: ambientDrift 18s ease-in-out infinite alternate;
}

@keyframes ambientDrift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(18px, 12px) scale(1.04); }
}

img { max-width: 100%; display: block; }
a { color: var(--c-primary); text-decoration: none; transition: color var(--c-transition); }
a:hover { color: var(--c-primary-dark); }
button, input, select, textarea { font-family: inherit; }

/* ---------- Page Shell ---------- */
.page-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

/* 漂浮光斑装饰，让所有 custom 页面都有动态氛围 */
.page-shell::before,
.page-shell::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(80px);
}

.page-shell::before {
    width: 480px;
    height: 480px;
    top: -140px;
    right: -120px;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.18), transparent 70%);
    animation: blobFloat 13s ease-in-out infinite alternate;
}

.page-shell::after {
    width: 380px;
    height: 380px;
    bottom: -100px;
    left: -80px;
    background: radial-gradient(circle, rgba(129, 140, 248, 0.15), transparent 70%);
    animation: blobFloat 11s ease-in-out infinite alternate-reverse;
}

/* 视差偏移合并进 keyframes，避免 animation 的 transform 覆盖 */
@keyframes blobFloat {
    0% { transform: translate(var(--parallax-x, 0px), var(--parallax-y, 0px)) scale(1); }
    100% { transform: translate(calc(var(--parallax-x, 0px) + 30px), calc(var(--parallax-y, 0px) - 24px)) scale(1.1); }
}

.page-shell.page-shell-centered {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(20px, 5vw, 48px);
}

/* ---------- Top Navigation Bar ---------- */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--c-border);
    padding: 0 clamp(20px, 4vw, 48px);
}

.top-nav-inner {
    max-width: 1480px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.nav-brand-logo {
    width: 42px;
    height: 42px;
    border-radius: var(--c-radius-md);
    background: linear-gradient(135deg, #7C3AED, #A78BFA);
    display: grid;
    place-items: center;
    color: white;
    font-weight: 700;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.nav-brand-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--c-text-primary);
    letter-spacing: -0.3px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--c-radius-full);
    color: var(--c-text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--c-transition);
    border: 1px solid transparent;
    text-decoration: none;
    background: none;
    cursor: pointer;
}

.nav-link:hover {
    background: var(--c-primary-bg);
    color: var(--c-primary);
    transform: translateY(-1px);
}

.nav-link.active {
    background: linear-gradient(135deg, #7C3AED, #A78BFA);
    color: white;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
    animation: navGlow 3s ease-in-out infinite;
}

@keyframes navGlow {
    0%, 100% { box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25); }
    50% { box-shadow: 0 4px 20px rgba(124, 58, 237, 0.45); }
}

.nav-link .nav-icon {
    font-size: 16px;
    display: flex;
    align-items: center;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.nav-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--c-text-primary);
}

.nav-user-role {
    font-size: 12px;
    color: var(--c-text-muted);
}

.nav-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--c-radius-md);
    background: linear-gradient(135deg, #7C3AED, #A78BFA);
    display: grid;
    place-items: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.2);
}

.nav-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--c-radius-full);
    background: var(--c-danger-bg);
    color: var(--c-danger);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--c-transition);
    text-decoration: none;
    border: none;
}

.nav-logout:hover {
    background: var(--c-danger);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

/* ---------- Main Content Area ---------- */
.main-content {
    max-width: 1480px;
    margin: 0 auto;
    padding: clamp(20px, 4vw, 36px) clamp(20px, 4vw, 48px);
}

/* ---------- Card Surface ---------- */
.card-surface {
    background: var(--c-bg-card);
    border-radius: var(--c-radius-xl);
    border: 1px solid var(--c-border);
    box-shadow: var(--c-shadow-md);
    transition: box-shadow var(--c-transition), transform var(--c-transition);
}

.card-surface:hover {
    box-shadow: var(--c-shadow-lg);
}

/* ---------- Button Shine ---------- */
.primary-btn,
.game-detail-btn {
    position: relative;
    overflow: hidden;
}

.primary-btn::after,
.game-detail-btn::after {
    content: "";
    position: absolute;
    top: 0;
    left: -120%;
    width: 60%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-20deg);
    transition: left 0.55s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.primary-btn:hover::after,
.game-detail-btn:hover::after {
    left: 140%;
}

/* ---------- Revenue Banner ---------- */
.revenue-banner {
    background: linear-gradient(135deg, #F5F0FF 0%, #EDE9FE 50%, #F3E8FF 100%);
    border: 1px solid rgba(124, 58, 237, 0.12);
    border-radius: var(--c-radius-2xl);
    padding: clamp(20px, 3vw, 32px) clamp(24px, 4vw, 40px);
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: clamp(20px, 3vw, 32px);
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.08);
    position: relative;
    overflow: hidden;
}

.revenue-banner::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.08), transparent 70%);
    pointer-events: none;
}

.revenue-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--c-radius-lg);
    background: linear-gradient(135deg, #7C3AED, #A78BFA);
    display: grid;
    place-items: center;
    color: white;
    font-size: 24px;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
    flex-shrink: 0;
}

.revenue-label {
    font-size: 15px;
    color: var(--c-text-muted);
    font-weight: 500;
}

.revenue-value {
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 800;
    background: linear-gradient(135deg, #7C3AED, #A78BFA);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

/* ---------- Section Header ---------- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--c-text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title .title-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--c-primary);
    animation: dotPulse 2.2s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.45); transform: scale(1); }
    50% { box-shadow: 0 0 0 6px rgba(124, 58, 237, 0); transform: scale(1.2); }
}

.section-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--c-radius-full);
    background: var(--c-primary-bg);
    color: var(--c-primary);
    font-size: 13px;
    font-weight: 600;
}

/* ---------- Game Card Grid ---------- */
.game-card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

@media (max-width: 1200px) {
    .game-card-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .game-card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
    .game-card-grid { grid-template-columns: 1fr; }
}

/* ---------- Game Card ---------- */
.game-card {
    background: var(--c-bg-card);
    border-radius: var(--c-radius-xl);
    border: 1px solid var(--c-border);
    padding: 22px;
    transition: all var(--c-transition-slow);
    position: relative;
    overflow: hidden;
    cursor: default;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 悬浮时浮起的柔和紫光 */
.game-card::after {
    content: "";
    position: absolute;
    top: -40%;
    right: -30%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.10), transparent 70%);
    opacity: 0;
    transition: opacity var(--c-transition-slow), transform var(--c-transition-slow);
    pointer-events: none;
}

.game-card:hover::after {
    opacity: 1;
    transform: translate(-16px, 20px);
}

.game-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--c-primary), var(--c-primary-light));
    opacity: 0;
    transition: opacity var(--c-transition);
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--c-shadow-card-hover);
    border-color: rgba(124, 58, 237, 0.15);
}

.game-card:hover::before {
    opacity: 1;
}

.game-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.game-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--c-radius-md);
    display: grid;
    place-items: center;
    font-size: 18px;
    color: white;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.game-card-icon.color-0 { background: linear-gradient(135deg, #FF6B6B, #EE5A24); }
.game-card-icon.color-1 { background: linear-gradient(135deg, #54A0FF, #2E86DE); }
.game-card-icon.color-2 { background: linear-gradient(135deg, #5F27CD, #341F97); }
.game-card-icon.color-3 { background: linear-gradient(135deg, #1DD1A1, #10AC84); }
.game-card-icon.color-4 { background: linear-gradient(135deg, #FF9F43, #EE5A24); }
.game-card-icon.color-5 { background: linear-gradient(135deg, #F368E0, #C44569); }
.game-card-icon.color-6 { background: linear-gradient(135deg, #00D2D3, #01A3A4); }
.game-card-icon.color-7 { background: linear-gradient(135deg, #48DBFB, #0ABDE3); }
.game-card-icon.color-8 { background: linear-gradient(135deg, #FECA57, #FF9F43); }
.game-card-icon.color-9 { background: linear-gradient(135deg, #A29BFE, #6C5CE7); }

.game-card-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--c-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-card-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.game-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.game-metric-label {
    font-size: 11px;
    color: var(--c-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.game-metric-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--c-text-primary);
}

.game-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid var(--c-border);
}

.game-total-label {
    font-size: 13px;
    color: var(--c-text-muted);
    font-weight: 500;
}

.game-total-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--c-primary);
}

.game-detail-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--c-radius-full);
    background: linear-gradient(135deg, #7C3AED, #A78BFA);
    color: white;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--c-transition);
    text-decoration: none;
    box-shadow: 0 3px 10px rgba(124, 58, 237, 0.25);
}

.game-detail-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 18px rgba(124, 58, 237, 0.35);
    color: white;
}

.game-detail-btn:active {
    transform: translateY(0) scale(0.98);
}

/* ---------- Login Shell ---------- */
.login-shell {
    width: 100%;
    max-width: 420px;
    padding: 0;
}

.login-shell .form-panel {
    padding: clamp(32px, 5vw, 48px);
}

.login-shell .form-header {
    text-align: center;
    margin-bottom: 36px;
}

.login-shell .form-header .login-logo {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: linear-gradient(135deg, #7C3AED, #A78BFA);
    display: inline-grid;
    place-items: center;
    color: white;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 20px;
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.3);
}

.login-shell .form-header h2 {
    font-size: 26px;
    font-weight: 800;
    color: var(--c-text-primary);
    margin-bottom: 8px;
}

.login-shell .form-header p {
    font-size: 14px;
    color: var(--c-text-muted);
}

.login-shell .form-group {
    margin-bottom: 20px;
}

.login-shell .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text-secondary);
    margin-bottom: 8px;
}

.login-shell .input-shell {
    position: relative;
}

.login-shell .input-shell input {
    width: 100%;
    padding: 14px 18px;
    border-radius: var(--c-radius-lg);
    border: 1.5px solid var(--c-border-input);
    background: var(--c-bg-input);
    color: var(--c-text-primary);
    font-size: 15px;
    transition: all var(--c-transition);
    outline: none;
}

.login-shell .input-shell input:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
    background: white;
}

.login-shell .input-shell input::placeholder {
    color: var(--c-text-muted);
}

.login-shell .input-shell .toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--c-text-muted);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all var(--c-transition);
}

.login-shell .input-shell .toggle-password:hover {
    color: var(--c-primary);
    background: var(--c-primary-bg);
}

.login-shell .form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 13px;
}

.login-shell .form-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--c-text-secondary);
    cursor: pointer;
}

.login-shell .form-options a {
    color: var(--c-primary);
    font-weight: 500;
}

.login-shell .btn-primary {
    width: 100%;
    padding: 14px;
    border-radius: var(--c-radius-lg);
    background: linear-gradient(135deg, #7C3AED, #A78BFA);
    color: white;
    font-size: 16px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all var(--c-transition);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.3);
    margin-bottom: 16px;
}

.login-shell .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(124, 58, 237, 0.4);
}

.login-shell .btn-primary:active {
    transform: translateY(0);
}

.login-shell .login-footnote {
    text-align: center;
    font-size: 12px;
    color: var(--c-text-muted);
}

.login-message {
    text-align: center;
    padding: 10px 16px;
    border-radius: var(--c-radius-md);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
    display: none;
}

.login-message.error {
    display: block;
    background: var(--c-danger-bg);
    color: var(--c-danger);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.login-message.success {
    display: block;
    background: var(--c-success-bg);
    color: var(--c-success);
    border: 1px solid rgba(34, 197, 94, 0.15);
}

/* ---------- Dashboard Shell ---------- */
.dashboard-shell {
    max-width: 1480px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: clamp(20px, 3vw, 32px);
}

.brand-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: transparent;
    display: grid;
    place-items: center;
    font-size: 26px;
    color: var(--c-primary);
    animation: iconFloat 4s ease-in-out infinite;
}

@keyframes iconFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-meta h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    background: linear-gradient(120deg, #6D28D9, #A78BFA);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

.brand-meta span {
    color: var(--c-text-muted);
    font-size: 14px;
}

.header-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.ghost-btn {
    border-radius: var(--c-radius-full);
    padding: 12px 20px;
    border: 1.5px solid var(--c-border-strong);
    background: white;
    color: var(--c-text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--c-transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ghost-btn:hover {
    border-color: var(--c-primary);
    color: var(--c-primary);
    background: var(--c-primary-bg);
    transform: translateY(-1px);
}

/* ---------- Filter Panel ---------- */
.filter-panel {
    padding: clamp(20px, 4vw, 32px);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: flex-end;
}

.input-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1 1 200px;
}

.input-field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text-secondary);
}

.input-field input,
.input-field select {
    width: 100%;
    border-radius: var(--c-radius-lg);
    padding: 13px 16px;
    border: 1.5px solid var(--c-border-input);
    background: var(--c-bg-input);
    color: var(--c-text-primary);
    font-size: 14px;
    transition: all var(--c-transition);
    outline: none;
}

.input-field input:focus,
.input-field select:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
    background: white;
}

.fancy-select {
    position: relative;
}

.fancy-select select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 46px;
    cursor: pointer;
}

.fancy-select::after {
    content: "";
    position: absolute;
    right: 18px;
    top: calc(50% + 6px);
    width: 10px;
    height: 10px;
    border-left: 2px solid var(--c-text-muted);
    border-bottom: 2px solid var(--c-text-muted);
    transform: rotate(-45deg);
    pointer-events: none;
}

.date-field { position: relative; }
.date-field input { cursor: pointer; }

.input-with-clear { position: relative; width: 100%; }
.input-with-clear input { padding-right: 42px; }

.clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--c-transition);
    padding: 0;
    font-size: 18px;
    line-height: 1;
    color: var(--c-text-muted);
}

.clear-btn:hover {
    background: var(--c-danger-bg);
    color: var(--c-danger);
    transform: translateY(-50%) scale(1.1);
}

.filter-submit {
    flex: 0 0 auto;
    border: none;
    border-radius: var(--c-radius-full);
    padding: 14px 32px;
    background: linear-gradient(135deg, #7C3AED, #A78BFA);
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--c-transition);
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.filter-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

.filter-submit:active {
    transform: translateY(0);
}

.filter-submit:disabled,
.filter-submit.loading {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Quick Range Buttons */
.quick-range-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-range-btn {
    padding: 8px 16px;
    border-radius: var(--c-radius-full);
    border: 1.5px solid var(--c-border-strong);
    background: white;
    color: var(--c-text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--c-transition);
}

.quick-range-btn:hover,
.quick-range-btn.active {
    border-color: var(--c-primary);
    background: var(--c-primary-bg);
    color: var(--c-primary);
}

/* ---------- Stats Wrapper ---------- */
.stats-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    padding: clamp(16px, 3vw, 28px);
}

.stat-card {
    background: white;
    border-radius: var(--c-radius-xl);
    padding: 20px;
    border: 1px solid var(--c-border);
    position: relative;
    overflow: hidden;
    transition: all var(--c-transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--c-shadow-card);
}

.stat-card::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 0 0 var(--c-radius-xl) var(--c-radius-xl);
}

.stat-card.color-orange::after { background: linear-gradient(90deg, #7C3AED, #A78BFA); }
.stat-card.color-blue::after { background: linear-gradient(90deg, #3B82F6, #60A5FA); }
.stat-card.color-green::after { background: linear-gradient(90deg, #22C55E, #4ADE80); }
.stat-card.color-purple::after { background: linear-gradient(90deg, #8B5CF6, #A78BFA); }

.stat-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text-muted);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--c-text-primary);
    line-height: 1.2;
}

/* ---------- Table Shell ---------- */
.table-shell {
    padding: clamp(16px, 3vw, 28px);
    overflow-x: auto;
}

.table-shell table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

.table-shell thead th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--c-text-secondary);
    border-bottom: 2px solid var(--c-border);
    white-space: nowrap;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.table-shell tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--c-border);
    color: var(--c-text-primary);
    vertical-align: middle;
}

.table-shell tbody tr {
    transition: background var(--c-transition);
}

.table-shell tbody tr:hover {
    background: var(--c-bg-hover);
}

.table-shell tbody tr:nth-child(even) {
    background: rgba(124, 58, 237, 0.02);
}

.table-shell tbody tr:nth-child(even):hover {
    background: var(--c-bg-hover);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    border-radius: var(--c-radius-full);
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all var(--c-transition);
    font-size: 14px;
}

.btn:focus-visible {
    outline: 3px solid rgba(124, 58, 237, 0.35);
    outline-offset: 2px;
}

.btn:disabled,
.btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, #7C3AED, #A78BFA);
    color: white;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

.btn-ghost {
    background: var(--c-primary-bg);
    color: var(--c-primary);
}

.btn-ghost:hover {
    background: var(--c-primary-bg-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--c-bg-input);
    color: var(--c-text-secondary);
    border: 1px solid var(--c-border);
}

.btn-secondary:hover {
    background: white;
    border-color: var(--c-border-strong);
}

/* ---------- Loading Spinner ---------- */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner.dark {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: var(--c-primary);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- Loading Overlay ---------- */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
}

.loading-overlay.active {
    display: flex;
}

.loading-overlay .spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
    border-color: rgba(124, 58, 237, 0.2);
    border-top-color: var(--c-primary);
}

/* ---------- Message Toast ---------- */
.message-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 16px 32px;
    border-radius: var(--c-radius-lg);
    font-size: 15px;
    font-weight: 600;
    z-index: 9999;
    box-shadow: var(--c-shadow-xl);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.message-toast.success {
    background: var(--c-success);
    color: white;
}

.message-toast.error {
    background: var(--c-danger);
    color: white;
}

.message-toast.show {
    opacity: 1;
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: clamp(40px, 6vw, 80px) clamp(20px, 4vw, 40px);
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--c-primary-bg);
    display: inline-grid;
    place-items: center;
    font-size: 36px;
    color: var(--c-primary);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--c-text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--c-text-muted);
    max-width: 360px;
    margin: 0 auto;
}

/* ---------- Badge ---------- */
.badge-soft {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--c-radius-full);
    font-size: 12px;
    font-weight: 600;
    background: var(--c-primary-bg);
    color: var(--c-primary);
}

/* ---------- Visually Hidden ---------- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.2); }

/* ---------- Back to Top ---------- */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7C3AED, #A78BFA);
    color: white;
    border: none;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35);
    transition: all var(--c-transition);
    z-index: 50;
}

.back-to-top.visible {
    display: flex;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 24px rgba(124, 58, 237, 0.45);
}

/* ---------- Responsive: Mobile Nav ---------- */
@media (max-width: 768px) {
    .top-nav-inner { height: 56px; }
    .nav-brand-text { display: none; }
    .nav-links { gap: 4px; }
    .nav-link { padding: 8px 12px; font-size: 13px; }
    .nav-user-info { display: none; }
    .main-content { padding: 16px; }
    .game-card-grid { gap: 14px; }
    .game-card { padding: 16px; }
    .game-card-metrics { gap: 8px; }
    .revenue-banner { padding: 16px 20px; }
    .revenue-icon { width: 44px; height: 44px; font-size: 20px; }
}

/* ---------- Animations ---------- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-in {
    animation: fadeInUp 0.5s ease both;
}

.animate-in-delay-1 { animation-delay: 0.05s; }
.animate-in-delay-2 { animation-delay: 0.1s; }
.animate-in-delay-3 { animation-delay: 0.15s; }
.animate-in-delay-4 { animation-delay: 0.2s; }

/* ---------- Data Update Timestamp ---------- */
.update-timestamp {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--c-text-muted);
}

.update-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--c-success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ---------- Copy Tooltip ---------- */
.copy-tooltip {
    position: absolute;
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--c-text-primary);
    color: white;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.copy-tooltip.show { opacity: 1; }

/* ---------- OpenID Copy ---------- */
.openid-copy {
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background var(--c-transition);
}

.openid-copy:hover {
    background: var(--c-primary-bg);
}
