/* ====================================
   Huojile Premium Design System
   2025 Optimized Edition
   ==================================== */

/* 1. Design Tokens & Variables */
:root {
    /* Palette - Refined Blue & Slate */
    --primary-hue: 215;
    --primary-sat: 95%;
    --primary-light: 55%;

    --primary-color: hsl(var(--primary-hue), var(--primary-sat), var(--primary-light));
    --primary-dark: hsl(var(--primary-hue), var(--primary-sat), 45%);
    --primary-glow: hsla(var(--primary-hue), var(--primary-sat), var(--primary-light), 0.3);

    --success-color: #34C759;
    --danger-color: #FF3B30;
    --warning-color: #FF9500;

    /* Backgrounds */
    --bg-body: #F5F7FA;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-glass: rgba(255, 255, 255, 0.7);

    /* Text */
    --text-main: #1D1D1F;
    --text-secondary: #86868B;
    --text-tertiary: #AEAEB2;

    /* Borders & Shadows */
    --border-light: rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 20px var(--primary-glow);

    /* Radius */
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;

    /* Typography */
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 2. Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(0, 122, 255, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(52, 199, 89, 0.05) 0%, transparent 40%);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 16px;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* 3. Components */

/* Shared Layouts */
.user-avatar,
.leaderboard-rank,
.icon-item {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Buttons */
.button {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 12px var(--primary-glow);
    position: relative;
    overflow: hidden;
}

.button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--primary-glow);
}

.button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px var(--primary-glow);
}

.button.secondary {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
    box-shadow: none;
}

.button.secondary:hover {
    background: rgba(0, 0, 0, 0.1);
}

.switch-btn {
    padding: 10px 20px;
    border: 1px solid transparent;
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    font-weight: 500;
}

.switch-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-main);
}



/* Inputs */
.input-group {
    margin-bottom: 24px;
}

.input-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group textarea {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    background-color: white;
    color: var(--text-main);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    font-family: inherit;
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

.input-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.password-wrapper {
    position: relative;
    width: 100%;
}

.password-toggle {
    position: absolute;
    right: 12px;
    bottom: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.2s;
    z-index: 10;
    box-shadow: none !important;
    /* Override button shadow */
}

.password-toggle:hover {
    color: var(--primary-color);
    transform: none !important;
    /* Override button transform */
}

.masked {
    -webkit-text-security: disc;
    font-family: monospace !important;
    letter-spacing: 2px;
}

/* Cards & Containers */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    margin-bottom: 24px;
    transition: transform 0.3s ease;
}

.login-container {
    max-width: 440px;
    margin: 80px auto;
    text-align: center;
}

.login-container h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.login-container p {
    color: var(--text-secondary);
    margin-bottom: 40px;
}

/* Dashboard Layout */
.dashboard {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 24px;
    animation: fadeIn 0.6s ease-out;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    font-size: 28px;
    font-weight: 700;
    box-shadow: var(--shadow-glow);
}

.user-details h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.user-details p {
    color: var(--text-secondary);
    font-size: 14px;
}

.user-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    margin-top: 8px;
    display: inline-block;
}

.user-links a:hover {
    text-decoration: underline;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.stat-item {
    background: white;
    padding: 24px;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease;
    border: 1px solid var(--border-light);
}

.stat-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-item label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
}

.stat-item span {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: -1px;
}

/* Leaderboard */
.leaderboard-tabs {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.leaderboard-tab {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.leaderboard-tab:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-main);
}

.leaderboard-tab.act {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
}



.leaderboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.leaderboard-item {
    background: white;
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.leaderboard-rank {
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    font-weight: 700;
    margin-right: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.leaderboard-item:nth-child(1) .leaderboard-rank {
    background: #FFD700;
    color: #B45309;
}

.leaderboard-item:nth-child(2) .leaderboard-rank {
    background: #C0C0C0;
    color: #4A5568;
}

.leaderboard-item:nth-child(3) .leaderboard-rank {
    background: #CD7F32;
    color: #78350F;
}

.leaderboard-name {
    flex-grow: 1;
    font-weight: 600;
}

.leaderboard-score {
    font-weight: 700;
    color: var(--primary-color);

    font-size: 16px;
}

/* Icons Grid */
.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 12px;
    margin-top: 24px;
}

.icon-item {
    width: 50px;
    height: 64px;
    background: white;
    border-radius: var(--radius-sm);
    flex-direction: column;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
    border: 2px solid transparent;
    position: relative;
}

.icon-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.icon-item.selected {
    border-color: var(--primary-color);
    background: rgba(0, 122, 255, 0.05);
}

.icon-item img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    margin-bottom: 4px;
}

.icon-number {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-tertiary);
}

/* Utilities */
.divider {
    height: 1px;
    background: var(--border-light);
    margin: 32px 0;
    border: none;
}

.block-center {
    display: block;
    margin: 0 auto;
}

.mt-4 {
    margin-top: 16px;
}



.text-center {
    text-align: center;
}

.hint {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Toast */
#toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    backdrop-filter: blur(10px);
    display: none;
    animation: slideDown 0.3s ease;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Command Info */
.command-info {
    white-space: pre-line;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.03);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-top: 24px;
    border: 1px solid var(--border-light);
}

/* Mobile Adaptation */
@media (max-width: 768px) {
    .dashboard {
        padding: 16px;
        margin: 0;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .button-container {
        width: 100%;
        display: flex;
        gap: 10px;
    }

    .button-container .button {
        flex: 1;
    }

    .card {
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}