/* Modern CSS with enhanced features and W3C compliance */

/* CSS Cascade Layers for better organization */
@layer reset, base, components, utilities;

/* Modern CSS features for 2024+ */
@supports (color: oklch(0 0 0)) {
    :root {
        /* Use OKLCH color space for better color consistency */
        --primary-color: oklch(0.6 0.2 250);
        --primary-hover: oklch(0.5 0.2 250);
        --secondary-color: oklch(0.5 0.02 0);
        --success-color: oklch(0.6 0.15 140);
        --danger-color: oklch(0.6 0.2 20);
        --warning-color: oklch(0.7 0.15 80);
        --info-color: oklch(0.6 0.15 200);
    }
}

/* CSS Container Queries for responsive components */
@container (min-width: 400px) {
    .game-card, .user-card {
        grid-template-columns: 1fr 1fr;
        align-items: center;
    }
}

/* Modern CSS Scroll Snap */
.scroll-container {
    scroll-snap-type: y mandatory;
    overflow-y: auto;
}

.scroll-item {
    scroll-snap-align: start;
}

/* CSS Subgrid support */
@supports (grid-template-rows: subgrid) {
    .card-grid {
        display: grid;
        grid-template-rows: subgrid;
        grid-row: span 3;
    }
}

@layer reset {
:root {
    /* Color palette using modern color spaces */
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    
    /* Softer light palette to avoid blinding brightness */
    --bg-primary: #f8fafc;   /* slate-50 */
    --bg-secondary: #f1f5f9; /* slate-100 */
    --bg-tertiary: #e2e8f0;  /* slate-200 */
    --text-primary: #0f172a;   /* slate-900 */
    --text-secondary: #475569; /* slate-600 */
    --text-muted: #94a3b8;     /* slate-400 */
    --border-color: #cbd5e1;   /* slate-300 */
    --accent-color: #3b82f6;
    
    /* Modern shadow system using color-mix() fallback */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.06);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.08), 0 8px 10px -6px rgb(0 0 0 / 0.06);
    
    /* Enhanced transition system */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Modern border radius system */
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
    --border-radius-full: 9999px;
    
    /* Typography scale */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    
    /* Spacing system */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-12: 3rem;
    --space-16: 4rem;
    
    /* Container sizes for modern layouts */
    --container-xs: 20rem;
    --container-sm: 24rem;
    --container-md: 28rem;
    --container-lg: 32rem;
    --container-xl: 36rem;
    --container-2xl: 42rem;
    --container-full: 100%;
}

[data-theme="dark"] {
    --primary-color: #60a5fa;
    --primary-hover: #3b82f6;
    --secondary-color: #9ca3af;
    --success-color: #34d399;
    --danger-color: #f87171;
    --warning-color: #fbbf24;
    --info-color: #22d3ee;
    --bg-primary: #1f2937;
    --bg-secondary: #374151;
    --bg-tertiary: #4b5563;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --border-color: #6b7280;
    --accent-color: #60a5fa;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.4), 0 8px 10px -6px rgb(0 0 0 / 0.4);
}

/* Dark mode alert contrast tweaks */
[data-theme="dark"] .alert-success {
    background: #064e3b; /* deep green */
    color: #d1fae5;      /* mint text */
    border: 1px solid #10b981;
}

/* High contrast theme for accessibility - user-friendly colors */
[data-theme="high-contrast"] {
    --primary-color: #0066cc;
    --secondary-color: #333333;
    --success-color: #006600;
    --danger-color: #cc0000;
    --warning-color: #cc6600;
    --info-color: #0066cc;
    --bg-primary: #ffffff;
    --bg-secondary: #f0f0f0;
    --bg-tertiary: #e0e0e0;
    --text-primary: #000000;
    --text-secondary: #333333;
    --border-color: #000000;
    --accent-color: #0066cc;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Auto dark mode based on system preference */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --primary-color: #60a5fa;
        --primary-hover: #3b82f6;
        --secondary-color: #9ca3af;
        --success-color: #34d399;
        --danger-color: #f87171;
        --warning-color: #fbbf24;
        --info-color: #22d3ee;
        --bg-primary: #1f2937;
        --bg-secondary: #374151;
        --bg-tertiary: #4b5563;
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --text-muted: #9ca3af;
        --border-color: #6b7280;
        --accent-color: #60a5fa;
        --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
        --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
        --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
        --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.4), 0 8px 10px -6px rgb(0 0 0 / 0.4);
    }
}

/* High contrast mode based on system preference - user-friendly */
@media (prefers-contrast: high) {
    :root:not([data-theme]) {
        --primary-color: #0066cc;
        --secondary-color: #333333;
        --success-color: #006600;
        --danger-color: #cc0000;
        --warning-color: #cc6600;
        --info-color: #0066cc;
        --bg-primary: #ffffff;
        --bg-secondary: #f0f0f0;
        --bg-tertiary: #e0e0e0;
        --text-primary: #000000;
        --text-secondary: #333333;
        --border-color: #000000;
        --accent-color: #0066cc;
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.3);
        --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.3);
    }
}

    /* Modern CSS Reset with enhanced defaults */
    *,
    *::before,
    *::after {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        font-family: inherit;
    }

    /* Modern focus management */
    :focus-visible {
        outline: 2px solid var(--accent-color);
        outline-offset: 2px;
    }

    :focus:not(:focus-visible) {
        outline: none;
    }
}

@layer base {
    /* Enhanced base styles for modern browsers */
    html {
        line-height: 1.5;
        -webkit-text-size-adjust: 100%;
        -moz-tab-size: 4;
        tab-size: 4;
        font-feature-settings: normal;
        font-variation-settings: normal;
        scroll-behavior: smooth;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
    }

/* Container query support */
@supports (container-type: inline-size) {
    .container-query {
        container-type: inline-size;
        container-name: main-content;
    }
    
    @container main-content (min-width: 768px) {
        .responsive-grid {
            grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        }
    }
    
    @container main-content (min-width: 1024px) {
        .responsive-grid {
            grid-template-columns: repeat(3, 1fr);
        }
    }
}

/* Code/preformatted blocks */
pre, code {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    display: block;
    overflow-x: auto;
}



    body {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
        background: var(--bg-primary);
        color: var(--text-primary);
        line-height: 1.6;
        transition: background-color var(--transition-normal), color var(--transition-normal);
        overflow-x: hidden;
        /* Modern logical properties */
        margin-block: 0;
        margin-inline: 0;
        /* Use flexbox to eliminate white space between body and footer */
        display: flex;
        flex-direction: column;
        min-height: 100vh;
        padding-block: 0;
        padding-inline: 0;
        /* Enhanced typography */
        font-synthesis: none;
        text-rendering: optimizeLegibility;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Smooth page transitions */
.page-transition {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Container with smooth animations */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    animation: slideInFromTop 1s ease-out;
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typography with smooth transitions */
h1 {
    color: var(--text-primary);
    margin-bottom: 2rem;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleGlow 3s ease-in-out infinite alternate;
    text-align: center;
}

@keyframes titleGlow {
    from {
        filter: drop-shadow(0 0 5px rgba(59, 130, 246, 0.3));
    }
    to {
        filter: drop-shadow(0 0 15px rgba(59, 130, 246, 0.6));
    }
}

h2 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    font-weight: 600;
    animation: slideInFromLeft 0.6s ease-out 0.3s both;
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.3rem;
    font-weight: 600;
}

/* Enhanced search forms with smooth interactions */
.search-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: center;
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    animation: slideInFromLeft 0.6s ease-out 0.2s both;
}

.search-form:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.search-form input {
    flex: 1;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.search-form input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: scale(1.02);
}

.search-form input::placeholder {
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.search-form input:focus::placeholder {
    color: transparent;
}

/* Enhanced button styles with smooth animations */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding-block: var(--space-3);
    padding-inline: var(--space-6);
    border: none;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    /* Modern button enhancements */
    user-select: none;
    touch-action: manipulation;
    white-space: nowrap;
    font-synthesis: none;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left var(--transition-normal);
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-color), var(--primary-color));
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color), #9ca3af);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #34d399);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #f87171);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color), #fbbf24);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, var(--info-color), #22d3ee);
    color: white;
}

/* Enhanced grid layouts with staggered animations - REMOVED DUPLICATE */

@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered card animations */
.game-card, .user-card {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    animation: cardSlideIn 0.6s ease-out both;
}

.game-card:nth-child(1) { animation-delay: 0.1s; }
.game-card:nth-child(2) { animation-delay: 0.2s; }
.game-card:nth-child(3) { animation-delay: 0.3s; }
.game-card:nth-child(4) { animation-delay: 0.4s; }
.game-card:nth-child(5) { animation-delay: 0.5s; }
.game-card:nth-child(6) { animation-delay: 0.6s; }
.game-card:nth-child(7) { animation-delay: 0.7s; }
.game-card:nth-child(8) { animation-delay: 0.8s; }

@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.game-card::before, .user-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transform: scaleX(0);
    transition: transform var(--transition-normal);
}

.game-card:hover::before, .user-card:hover::before {
    transform: scaleX(1);
}

.game-card:hover, .user-card:hover {
    border-color: var(--accent-color);
    box-shadow: var(--shadow-xl);
    transform: translateY(-5px) scale(1.02);
}

.game-card.game-disabled {
    opacity: 0.6;
    background: var(--bg-secondary);
    filter: grayscale(0.3);
}

.game-card.game-disabled:hover {
    transform: translateY(-2px) scale(1.01);
}

/* Enhanced game info with smooth transitions */
.game-info h4, .user-info h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.game-info p, .user-info p {
    margin: 0.25rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: color var(--transition-fast);
}

/* Enhanced status indicators with animations */
.game-status {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    animation: statusPulse 2s ease-in-out infinite;
    box-shadow: var(--shadow-sm);
}

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

.status-active {
    background: linear-gradient(135deg, var(--success-color), #34d399);
    color: white;
}

.status-inactive {
    background: linear-gradient(135deg, var(--danger-color), #f87171);
    color: white;
}

/* Enhanced action buttons with smooth interactions */
.game-actions, .user-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-start;
    margin-top: auto;
}

.game-actions .btn, .user-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.game-actions .btn:hover, .user-actions .btn:hover {
    transform: translateY(-1px) scale(1.05);
}

/* Disabled user styling */
.disabled-user {
    opacity: 0.7;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    border: 1px solid #d1d5db;
}

.disabled-user .user-info h4 {
    color: #6b7280;
    text-decoration: line-through;
}

.disabled-user .user-info p {
    color: #6b7280;
}

/* Disabled game styling */
.disabled-game {
    opacity: 0.7;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    border: 1px solid #d1d5db;
}

.disabled-game .game-info h4 {
    color: #6b7280;
    text-decoration: line-through;
}

.disabled-game .game-info p {
    color: #6b7280;
}

/* Disabled section header spacing */
.disabled-section-header {
    margin-top: 3rem;
}

/* Registration control styling */
.registration-control {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin: 2rem 0;
    text-align: center;
}

.registration-control h3 {
    margin: 0 0 1.5rem 0;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.switch-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.switch-status {
    margin: 0;
    color: var(--text-secondary);
    font-size: 1rem;
}

.switch-status strong {
    color: var(--text-primary);
}

/* Enhanced forms with smooth animations */
.add-form, .edit-form {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    margin-top: 3rem;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
    animation: slideInFromRight 0.8s ease-out 0.6s both;
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.add-form:hover, .edit-form:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-2px);
}

.add-form h3, .edit-form h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    position: relative;
}

.add-form h3::after, .edit-form h3::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 2px;
}

.add-form input,
.add-form textarea,
.edit-form input,
.edit-form textarea {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1rem;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.add-form input:focus,
.add-form textarea:focus,
.edit-form input:focus,
.edit-form textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: scale(1.02);
}

.add-form textarea,
.edit-form textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

/* Enhanced form groups */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    margin-top: 2rem;
}

/* Enhanced alert system with smooth animations */
.alert {
    padding: 1.25rem 1.5rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    animation: alertSlideIn 0.5s ease-out;
    box-shadow: var(--shadow-md);
}

@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.alert::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: currentColor;
    opacity: 0.8;
}

.alert-success {
    /* Improved contrast: light success background with dark text */
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #34d399;
}

.alert-error {
    background: linear-gradient(135deg, var(--danger-color), #f87171);
    color: white;
}

.alert-info {
    /* Improved readability: light info background with dark text */
    background: #dbeafe; /* light blue */
    color: #1e3a8a;      /* dark blue text */
    border: 1px solid #93c5fd; /* subtle blue border */
}

.alert-warning {
    background: linear-gradient(135deg, var(--warning-color), #fbbf24);
    color: white;
}

/* Enhanced empty state with animations */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-lg);
    grid-column: 1 / -1;
    animation: emptyStateFadeIn 0.8s ease-out;
    position: relative;
    overflow: hidden;
}

@keyframes emptyStateFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.empty-state::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(59, 130, 246, 0.1), transparent);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.empty-state h4 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

/* Statistics cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
    animation: slideInFromTop 0.8s ease-out 0.1s both;
}

.stat-card {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.stat-card h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-card p {
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Loading states and micro-interactions */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Responsive design with smooth breakpoints */
@media (max-width: 768px) {
    /* Wrap code blocks on mobile to avoid horizontal scrolling */
    pre, code { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; overflow-x: hidden; }
    /* Increase base font size and line height on mobile for readability */
    html { font-size: 17px; }
    body { line-height: 1.7; }

    .admin-container {
        padding: 1rem;
    }
    
    .games-grid, .users-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .search-form {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .game-actions, .user-actions {
        flex-direction: column;
    }
    
    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    h1 {
        font-size: 2rem;
    }

    /* Slightly larger default text sizes for key UI elements */
    .btn { font-size: 1rem; }
    .search-form input,
    .login-form .form-group input,
    .add-form input,
    .add-form textarea,
    .edit-form input,
    .edit-form textarea { font-size: 1.05rem; }

    .score-info p, .game-info p, .user-info p { font-size: 1rem; }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Leaderboard responsive column visibility */
    /* Daily compare: show only Game and Winner */
    table.daily-compare-table th:nth-child(2),
    table.daily-compare-table th:nth-child(3),
    table.daily-compare-table td:nth-child(2),
    table.daily-compare-table td:nth-child(3) { display: none; }

    /* All-time overall: show only User and Win Rate */
    table.alltime-overall-table th:nth-child(2),
    table.alltime-overall-table th:nth-child(4),
    table.alltime-overall-table th:nth-child(5),
    table.alltime-overall-table td:nth-child(2),
    table.alltime-overall-table td:nth-child(4),
    table.alltime-overall-table td:nth-child(5) { display: none; }

    /* All-time per-friend: show only Game and Winner */
    table.alltime-perfriend-table th:nth-child(2),
    table.alltime-perfriend-table th:nth-child(3),
    table.alltime-perfriend-table th:nth-child(4),
    table.alltime-perfriend-table td:nth-child(2),
    table.alltime-perfriend-table td:nth-child(3),
    table.alltime-perfriend-table td:nth-child(4) { display: none; }
    
    /* Compare page: show only Game and Winner */
    table.compare-table th:nth-child(2),
    table.compare-table th:nth-child(3),
    table.compare-table td:nth-child(2),
    table.compare-table td:nth-child(3) { display: none; }
}

@media (max-width: 480px) {
    /* Further bump typography for very small screens */
    html { font-size: 18px; }
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Focus styles for accessibility */
*:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 6px;
}

/* High contrast mode improvements */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .game-card, .user-card {
        border: 3px solid var(--text-primary);
    }
}

/* Sticky Header Styles */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 0.5rem 0; /* Reduced header padding */
}

/* Compact Header Layout */
.header-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
}

.header-brand .app-emoji {
    font-size: 1.5rem;
    color: #FFD700;
}

.header-brand .app-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* CSS-Only Hamburger Menu */
.hamburger-menu {
    position: relative;
    display: inline-block;
}

.hamburger-toggle {
    display: none;
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    width: 24px;
    height: 18px;
    cursor: pointer;
    gap: 3px;
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-menu-content {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.hamburger-menu-content .btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--text-primary);
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.hamburger-menu-content .btn:hover {
    background: var(--bg-secondary);
    transform: none;
    box-shadow: none;
}

.hamburger-menu-content .btn:first-child {
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.hamburger-menu-content .btn:last-child {
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* Show menu when checkbox is checked */
.hamburger-toggle:checked ~ .hamburger-menu-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Animate hamburger lines when menu is open */
.hamburger-toggle:checked ~ .hamburger-icon .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-toggle:checked ~ .hamburger-icon .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-toggle:checked ~ .hamburger-icon .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Header Override */
@media (max-width: 768px) {
    .header-mobile {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 1rem;
    }
    
    .header-mobile .trophy-icon {
        position: static;
    }
    
    .header-mobile .page-title-mobile {
        display: none; /* Hide page title on mobile */
    }
    
    .header-mobile .header-actions-mobile {
        position: static;
        display: flex;
        gap: 0.5rem;
    }
}

/* App Title Styles */
.app-title {
    transition: all var(--transition-fast);
}

.app-title:hover {
    transform: translateY(-2px);
}

/* Login Page Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: flex-start; /* Changed from center to flex-start */
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    padding-top: 4rem; /* Reduced from center positioning */
}

.login-form {
    background: var(--bg-primary);
    padding: 2rem; /* Reduced padding */
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 400px;
    animation: slideInFromTop 0.8s ease-out;
    margin-top: 0; /* Removed negative margin */
}

.login-form h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.login-form .login-subtitle {
    text-align: center;
    margin-block-end: var(--space-8);
    color: var(--text-secondary);
    font-weight: 400;
    font-size: var(--font-size-lg);
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-form .form-group input {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.login-form .form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: scale(1.02);
}

.login-form .form-group input::placeholder {
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.login-form .form-group input:focus::placeholder {
    color: transparent;
}

.login-form .form-actions {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.login-form .form-actions .btn {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.login-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.login-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}



/* Admin Header Styles */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.admin-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.management-links {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
    justify-content: center;
}

.management-links .btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Admin Welcome */
.admin-welcome {
    margin: 2rem 0;
    text-align: center;
    padding: 2rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.admin-welcome h2 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.admin-welcome p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.5;
}

/* Modern Grid Layouts with CSS Grid Level 2 features */
.games-grid, 
.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: var(--space-6);
    margin-block-start: var(--space-6);
    container-type: inline-size;
}

/* Subgrid support for nested grids */
@supports (grid-template-rows: subgrid) {
    .game-card,
    .user-card {
        display: grid;
        grid-template-rows: subgrid;
        grid-row: span 3;
    }
}

/* Enhanced responsive grid for scores */
.scores-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: var(--space-2);
    margin-block-start: var(--space-2);
    container-type: inline-size;
}

/* Container queries for responsive layout */
@container (min-width: 600px) {
    .scores-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@container (min-width: 900px) {
    .scores-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

.game-card, .user-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.game-card:hover, .user-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-color);
}



.game-info, .user-info {
    margin-bottom: 0.75rem;
}

.game-info h4, .user-info h4 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.game-info p, .user-info p {
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

/* Removed old game status styles - now using simple indicator dot */

.game-actions, .user-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.game-actions .btn, .user-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    flex: 1;
    min-width: 80px;
}

/* Search Forms */
.search-form {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
    align-items: center;
    flex-wrap: wrap;
}

.search-form input {
    flex: 1;
    min-width: 250px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.search-form input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-form .btn {
    padding: 0.75rem 1.5rem;
    white-space: nowrap;
}

/* Add Forms */
.add-form {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-sm);
}

.add-form h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.form-row input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-row input::placeholder {
    color: var(--text-muted);
}

/* Form Groups (used in main admin panel) */
.form-group {
    margin-bottom: 1rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
    padding-right: 3rem;
}

.form-group select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: scale(1.02);
}

.form-group select:hover {
    border-color: var(--accent-color);
}

/* Enhanced Native App-Style Dropdowns */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.875rem 1rem;
    padding-right: 3rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.25rem;
    min-height: 3rem;
}

select:hover {
    border-color: var(--primary-color);
    background-color: var(--bg-secondary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-color-alpha), 0 2px 8px rgba(0, 0, 0, 0.15);
    background-color: var(--bg-primary);
    transform: translateY(-1px);
}

select:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

select option {
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: none;
    font-weight: 500;
    transition: all var(--transition-fast);
}

select option:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

select option:checked,
select option:selected {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

select option:focus {
    background: var(--primary-color);
    color: white;
}

/* Disabled state */
select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
}

select:disabled:hover {
    transform: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Admin-specific dropdown styling */
.admin-dropdown {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.admin-dropdown:hover {
    border-color: var(--primary-hover);
    background: var(--bg-secondary);
}

.admin-dropdown:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-color-alpha);
}

/* Enhanced form row styling for admin forms */
.form-row {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.form-row label {
    margin-bottom: 0;
    white-space: nowrap;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-row select {
    flex: 1;
    min-width: 180px;
    margin: 0;
}

.form-row input {
    flex: 1;
    min-width: 150px;
    margin: 0;
}

/* Admin form enhancements */
.add-form, .edit-form {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.add-form h3, .edit-form h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 700;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

/* Game card disable cross button */
.disable-form {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
}

.disable-cross {
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    opacity: 0.8;
}

.disable-cross:hover {
    background: var(--danger-color);
    transform: scale(1.1);
    opacity: 1;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.disable-cross:active {
    transform: scale(0.95);
}

/* Game card positioning for disable button */
.game-card {
    position: relative;
}

/* Clickable game card styling */
.clickable-game-card {
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}

.clickable-game-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.clickable-game-card:active {
    transform: translateY(0);
    box-shadow: var(--shadow-md);
}

/* Game card content - flexible layout */
.game-details {
    margin-top: 0.125rem;
}

.game-description,
.game-levels,
.game-metrics {
    margin-bottom: 0.0625rem;
}

.game-description strong,
.game-levels strong,
.metric-item strong {
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: inline-block;
    margin-right: 0.5rem;
}

.game-description span,
.game-levels span,
.metric-item span {
    color: var(--text-primary);
}

.game-metrics {
    margin-top: 0.125rem;
}

.metric-item {
    margin-bottom: 0.0625rem;
}

.metric-item strong {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: inline-block;
    margin-right: 0.5rem;
}

.metric-item span {
    color: var(--text-primary);
}

/* Desktop - full width description with proper wrapping */
@media (min-width: 769px) {
    .game-description,
    .game-levels {
        display: block;
        width: 100%;
        margin-bottom: 0.125rem;
    }
    
    .game-description strong,
    .game-levels strong {
        display: block;
        margin-bottom: 0.25rem;
        font-size: 0.9rem;
        color: var(--text-secondary);
        font-weight: 600;
    }
    
    .game-description span,
    .game-levels span {
        display: block;
        width: 100%;
        word-wrap: break-word;
        overflow-wrap: break-word;
        line-height: 1.4;
        color: var(--text-primary);
    }
}

/* Mobile - full wrapping */
@media (max-width: 768px) {
    .game-details {
        margin-top: 0.125rem;
    }
    
    .game-description,
    .game-levels,
    .game-metrics {
        margin-bottom: 0.125rem;
    }
    
    .game-description strong,
    .game-levels strong,
    .metric-item strong {
        display: block;
        margin-bottom: 0.125rem;
        margin-right: 0;
        font-size: 0.85rem;
    }
}

/* Hidden edit form that covers the entire card */
.card-edit-form {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    margin: 0;
    padding: 0;
}

.card-edit-button {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1;
    opacity: 0;
}

/* Disable button positioning - above the edit button */
.disable-form {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
    pointer-events: auto;
}

.disable-cross {
    pointer-events: auto;
}

/* Disabled game status styling */
.game-status {
    margin-top: 0.125rem;
}

.game-status strong {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: inline-block;
    margin-right: 0.5rem;
}

.game-status span {
    color: var(--danger-color);
    font-weight: 600;
}

/* Inline form styling */
.inline-form {
    display: inline;
}

/* Enable button styling (green check for disabled games) */
.enable-form {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
    pointer-events: auto;
}

.enable-check {
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    opacity: 0.8;
    pointer-events: auto;
}

.enable-check:hover {
    background: var(--success-color);
    transform: scale(1.1);
    opacity: 1;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.enable-check:active {
    transform: scale(0.95);
}

/* Hide the cross on disabled games */
.disabled-game .disable-form {
    display: none;
}

/* Hide disable button for admin users */
.admin-user .disable-form {
    display: none;
}

/* Responsive admin dropdowns */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 1.5rem;
    }
    
    .form-row label {
        margin-bottom: 0.5rem;
        font-size: 0.85rem;
    }
    
    .form-row select,
    .form-row input {
        min-width: auto;
        width: 100%;
    }
    
    .add-form, .edit-form {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
}

.form-actions {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.form-actions .btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-color);
}

.stat-card h3 {
    font-size: 2rem;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.stat-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state h4 {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.empty-state p {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Dashboard Styles */
.dashboard-container {
    flex: 1;
    background: var(--bg-primary);
}

.dashboard-header {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.dashboard-header.sticky-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    padding: 1rem 0;
}

.header-content {
    inline-size: 100%;
    padding-inline: var(--space-8);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    /* Enhanced flexbox with modern properties */
    flex-wrap: wrap;
    container-type: inline-size;
}

.header-content .app-title {
    flex: 1;
}

.header-content h1 {
    flex: 1;
    text-align: center;
    margin: 0;
    font-size: 1.8rem;
}

.header-actions {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
}

.user-info {
    color: var(--text-secondary);
    font-weight: 500;
}

.dashboard-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.dashboard-section {
    margin-bottom: 3rem;
}

.dashboard-section h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 1.5rem;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 0.5rem;
}

/* Scores List */
.scores-list {
    display: grid;
    gap: 1rem;
}

.score-card {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.score-card:hover {
    border-color: var(--accent-color);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.score-info h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.score-info p {
    margin: 0.25rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.score-actions {
    display: flex;
    gap: 0.5rem;
}

/* Friends Grid */
.friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.friend-card {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.friend-card:hover {
    border-color: var(--accent-color);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.friend-info h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.friend-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Leaderboard Styles */
.leaderboard-container {
    min-height: 100vh;
    background: var(--bg-primary);
}

.leaderboard-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.period-selector {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.game-filter {
    margin-bottom: 2rem;
    text-align: center;
}

.game-filter select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    min-width: 200px;
}

.leaderboard-table {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.leaderboard-table table {
    width: 100%;
    border-collapse: collapse;
}

 .leaderboard-table th,
.leaderboard-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
/* Add vertical column separators between table columns */
.leaderboard-table th + th,
.leaderboard-table td + td {
    border-left: 1px solid var(--border-color);
}

.leaderboard-table th {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

.leaderboard-table td {
    color: var(--text-primary);
}

.leaderboard-table tr.current-user {
    background: rgba(59, 130, 246, 0.1);
    border-left: 4px solid var(--accent-color);
}

.leaderboard-table .rank {
    font-weight: 700;
    color: var(--accent-color);
    text-align: center;
    width: 60px;
}

.leaderboard-table .player {
    min-width: 150px;
}

.leaderboard-table .player strong {
    display: block;
    color: var(--text-primary);
}

.leaderboard-table .player small {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.leaderboard-table .score {
    font-weight: 600;
    color: var(--accent-color);
    text-align: center;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    background: rgba(0, 0, 0, 0.5);
}

.modal {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: scale(0.8) translateY(-20px);
    transition: all var(--transition-fast);
    position: relative;
    z-index: 1001;
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.modal-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--danger-color);
    background: var(--bg-secondary);
}

.modal-body {
    margin-bottom: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 2px solid var(--border-color);
}

/* Search Form Button Styles */
.search-form .btn-primary,
.search-form .btn-secondary {
    min-width: 120px;
    text-align: center;
}



/* Modal Form Styles */
.modal .form-group {
    margin-bottom: 1.5rem;
}

.modal .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal .form-group input,
.modal .form-group textarea,
.modal .form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
    box-sizing: border-box;
}

.modal .form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
    padding-right: 3rem;
}

.modal .form-group select:hover {
    border-color: var(--primary-color);
}

.modal .form-group input:focus,
.modal .form-group textarea:focus,
.modal .form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-help {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Profile Page Styles */
.profile-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.profile-header h1 {
    margin: 0;
    color: var(--primary-color);
}

.profile-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.profile-content {
    display: grid;
    gap: 2rem;
}

.profile-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.profile-section h2 {
    margin: 0 0 1.5rem 0;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.profile-form {
    display: grid;
    gap: 1.5rem;
}

.profile-form .form-group {
    display: grid;
    gap: 0.5rem;
}

.profile-form label {
    font-weight: 600;
    color: var(--text-primary);
}

.profile-form input {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.profile-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.profile-form .form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
    margin-top: 1rem;
}

.profile-form .btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 600;
}

.profile-form .btn-primary {
    background: var(--primary-color);
    color: white;
}

.profile-form .btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: var(--border-radius);
    color: white;
    box-shadow: var(--shadow-md);
}

.welcome-message h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
    font-weight: 700;
}

.welcome-message p {
    margin: 0;
    font-size: 1.1rem;
    opacity: 0.9;
}

.welcome-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

/* Empty State Actions */
.empty-state-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Bulk Upload Form */
.bulk-upload-form {
    max-width: 800px;
    margin: 0 auto;
}

.bulk-upload-form .form-group {
    margin-bottom: 1.5rem;
}

.bulk-upload-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.bulk-upload-form textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
    line-height: 1.4;
    transition: all var(--transition-fast);
    resize: vertical;
    min-height: 300px;
}

.bulk-upload-form textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(var(--accent-color-rgb), 0.2);
}

.bulk-upload-form small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Score dump single-column layout */
.score-dump-container {
}

.score-dump-container textarea {
    width: 100%;
    min-width: 0;
    height: 500px;
    resize: vertical;
}

/* Plain example block (below form now) */
.example-plain { margin-top: 0.75rem; }
.example-plain .example-title { margin: 0 0 0.25rem; font-size: 0.9rem; color: var(--text-secondary); }
.example-plain .example-pre {
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
    filter: grayscale(1);
    -webkit-filter: grayscale(1);
    opacity: 0.9;
}

/* Scores List */
.scores-list {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

/* 3x3 grid for Today's Scores */
.scores-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Equal-size tiles */
.score-tile {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.5rem 0.75rem;
    height: 90px;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: relative;
}


/* Compact row layout inside tiles */
.score-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    width: 100%;
    gap: 0.5rem;
}

.score-row .score-name {
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.score-row .score-value-compact {
    text-align: right;
    font-weight: 700;
    color: var(--accent-color);
    min-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .scores-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .scores-grid-3 { grid-template-columns: 1fr; }
}


.score-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    transition: all var(--transition-fast);
}

.score-item:hover {
    background: var(--bg-tertiary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.score-info h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.score-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent-color);
    margin: 0.5rem 0;
}

.score-date,
.score-time,
.score-notes {
    margin: 0.25rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.score-notes {
    font-style: italic;
}

/* Preview Mode Styles */
.preview-notice {
    margin-bottom: 1.5rem;
}

.preview-item {
    border: 2px solid var(--accent-color);
    background: rgba(var(--accent-color-rgb), 0.05);
}

.preview-item:hover {
    background: rgba(var(--accent-color-rgb), 0.1);
}


.preview-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.preview-actions .btn {
    min-width: 180px;
}

.empty-state-actions .btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.empty-state-actions .btn-primary {
    background: var(--primary-color);
    color: white;
}

.empty-state-actions .btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}



/* Section Actions */
.section-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Search Results */
.search-results {
    margin-top: 1rem;
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
}

.search-loading,
.search-empty,
.search-error {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

.search-error {
    color: var(--error-color);
}

.search-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
    background: var(--bg-secondary);
}

.search-result-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.search-result-item:hover {
    background: var(--bg-tertiary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.user-info strong {
    color: var(--text-primary);
    font-weight: 600;
}

.display-name {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: normal;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    min-width: auto;
}

.btn:disabled {
    background: var(--text-muted);
    color: var(--bg-primary);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn:disabled:hover {
    background: var(--text-muted);
    transform: none;
    box-shadow: none;
}

/* CSS Modal for Add Friend */
#addFriendModal.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#addFriendModal.modal-overlay:target {
    opacity: 1;
    visibility: visible;
}

#addFriendModal .modal {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 640px;
    width: 95%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    position: relative;
    z-index: 1001;
}

#addFriendModal.modal-overlay:target .modal {
    transform: scale(1);
}

/* CSS Modal for Admin Edit Modals */
#editModal.modal-overlay,
#editUserModal.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#editModal.modal-overlay:target,
#editUserModal.modal-overlay:target {
    opacity: 1;
    visibility: visible;
}

#editModal .modal,
#editUserModal .modal {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    position: relative;
    z-index: 1001;
}

#editModal.modal-overlay:target .modal,
#editUserModal.modal-overlay:target .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    margin: 0;
    color: var(--text-color);
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    font-size: 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text-color);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.section-actions .btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.section-actions .btn-primary {
    background: var(--primary-color);
    color: white;
}

.section-actions .btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Friend Stats */
.friend-stats {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0.25rem 0 0 0;
    font-weight: 500;
}

/* Friend Requests */
.friend-requests {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.friend-request-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.friend-request-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.request-info h4 {
    margin: 0 0 0.25rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

/* I Win Today! Branding - Single Puzzle Piece Background */
.app-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 8px 16px;
}

.app-title a {
    font-weight: 700;
    font-size: 1.5rem;
    text-decoration: none;
    position: relative;
}

/* Style only the text part with branding color */
.app-title a .app-text {
    color: var(--primary-color);
}

/* Icon symbol with gold color */
.app-emoji {
    font-size: 1.5rem;
    color: #FFD700;
    font-weight: bold;
}

/* Page title container to keep emoji and H1 together */
.page-title-container {
    flex: 1;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
}

/* Page title emojis outside H1 - preserve natural colors */
.page-title-emoji {
    font-size: 1.5rem;
    color: revert;
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}

.page-title-container h1 {
    margin: 0;
    font-size: 1.8rem;
}

.app-title a:hover .app-text {
    color: var(--primary-hover);
}

/* Emoji now renders naturally outside of any link styling */

/* Site Footer */
.site-footer {
    padding: 2rem 0 1rem;
    margin-top: 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.footer-content a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1.125rem;
    transition: color 0.2s ease;
}

.footer-content a:hover {
    color: var(--primary-color);
}

/* Add top margin to horizontal rules for better spacing */
hr {
    margin-top: 2rem;
}


/* Profile Share Instructions - Fix URL wrapping in pre blocks */
.profile-section pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.875rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin: 0.5rem 0;
    color: var(--text-primary);
    max-width: 100%;
    overflow-x: auto;
}

.request-info p {
    margin: 0.25rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.request-date {
    font-size: 0.8rem !important;
    color: var(--text-muted) !important;
    font-style: italic;
}

.request-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.request-actions .btn {
    min-width: auto;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.request-actions .btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* Responsive Profile */
@media (max-width: 768px) {
    .profile-container {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }
    
    .profile-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .profile-actions {
        justify-content: center;
    }
    
    .profile-section {
        padding: 1.5rem;
    }
    
    .profile-form .form-actions {
        flex-direction: column;
    }
    
    .welcome-message {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .welcome-message h2 {
        font-size: 1.5rem;
    }
    
    .welcome-message p {
        font-size: 1rem;
    }
    
    .empty-state-actions {
        margin-top: 1rem;
    }
    
    .empty-state-actions .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.9rem;
    }
    
    .section-actions {
        margin-top: 1rem;
    }
    
    .section-actions .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.9rem;
    }
}

.modal .form-group textarea {
    min-height: 100px;
    resize: vertical;
}

/* Legacy modal styles for compatibility */
.modal-content {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 90%;
    position: relative;
    animation: slideInFromTop 0.3s ease-out;
}

.close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.close:hover {
    color: var(--text-primary);
}

/* Mobile Header Layout */
.header-mobile {
    display: none;
}

.header-desktop {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    width: 100%;
}

/* Mobile Header Styles */
.trophy-icon {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 10;
}

.trophy-emoji {
    font-size: 1.5rem;
    color: #FFD700;
    font-weight: bold;
    text-decoration: none;
    display: block;
    padding: 0.25rem;
    border-radius: 50%;
    background: var(--bg-primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all var(--transition-fast);
    width: 2rem;
    height: 2rem;
    text-align: center;
    line-height: 1.5rem;
}

.trophy-emoji:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.page-title-mobile {
    text-align: center;
    margin: 0;
    font-size: 1.1rem;
    padding: 0.5rem 0;
    width: 100%;
    margin-left: 2.5rem;
    margin-right: 2.5rem;
}

.header-actions-mobile {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    z-index: 10;
}

.header-actions-mobile .btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
    min-width: auto;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1rem;
    }
    
    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .header-actions .btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
}

@media (max-width: 768px) {
    /* Show mobile layout, hide desktop layout */
    .header-mobile {
        display: block;
        position: relative;
        padding: 0.5rem;
        min-height: 3rem;
    }
    
    .header-desktop {
        display: none;
    }
    
    .header-content {
        padding: 0;
        position: relative;
    }
    
    /* Remove extra padding from containers */
    .dashboard-main,
    .login-container,
    .leaderboard-main {
        padding-top: 0;
    }
    
    .header-actions {
        gap: 0.25rem;
    }
    
    .header-actions .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
    
    .dashboard-main,
    .leaderboard-main {
        padding: 1rem;
    }
    /* Period selector: allow wrapping and centered content on mobile */
    .period-selector { flex-wrap: wrap; gap: 0.5rem; }
    .period-selector .btn { display: inline-flex; align-items: center; justify-content: center; text-align: center; }
}

/* Brag Modal Styles */
#bragModal.modal-overlay {
    display: none;
}

#bragModal.modal-overlay:target {
    display: flex;
    opacity: 1;
    visibility: visible;
    background: rgba(0, 0, 0, 0.6);
}

.copy-block {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    border-radius: 8px;
    font-family: monospace;
    font-size: 1.25rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 1rem;
}

.share-text {
    white-space: pre-wrap;
    margin: 0;
}

#bragModal .modal {
    padding: 1.5rem !important;
    max-height: 95vh !important;
    overflow-y: visible !important;
    height: auto !important;
    max-width: 640px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

#bragModal .modal-header {
    border-bottom: none !important;
    padding: 0 !important;
    margin-bottom: 0.75rem !important;
    position: relative !important;
}

#bragModal .modal-close {
    position: absolute !important;
    top: -10px !important;
    right: -10px !important;
    background: var(--bg-primary) !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 50% !important;
    z-index: 1002 !important;
}

#bragModal .modal-body {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Mastodon sharing form styles */
.mastodon-share {
    display: flex;
    justify-content: center;
}

.mastodon-form {
    display: inline-block;
    margin: 0;
}

.mastodon-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 6px 0 0 6px;
    font-size: 1rem;
    width: 180px;
    vertical-align: top;
    height: 44px;
}

.mastodon-button {
    background: #6364FF;
    color: white;
    border: 1px solid #6364FF;
    border-radius: 0 6px 6px 0;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    cursor: pointer;
    height: 46px;
    vertical-align: top;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.social-buttons-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

/* Social sharing container with opaque background */
.social-sharing-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

/* Social media button styles */
.social-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    text-decoration: none;
    transition: all var(--transition-fast);
}

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

.social-btn.twitter {
    background: #1DA1F2;
}

.social-btn.threads {
    background: #000;
}

.social-btn.facebook {
    background: #4267B2;
}

.social-btn.linkedin {
    background: #0077B5;
}

.social-btn.reddit {
    background: #FF4500;
}

/* Hide per-game stats on mobile */
.per-game-stats-section {
    display: block;
}

@media (max-width: 768px) {
    .per-game-stats-section {
        display: none;
    }
}

/* Brag modal mobile optimizations */
@media (max-width: 768px) {
    #bragModal .copy-block {
        display: none; /* Hide scores text on mobile */
    }
    
    #bragModal .modal {
        padding: 1rem !important;
        margin: 1rem !important;
    }
    
    .mastodon-share {
        width: 100%;
    }
    
    .mastodon-form {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: none !important;
        gap: 0.5rem !important;
    }
    
    .mastodon-input {
        width: 100% !important;
        border-radius: 6px !important;
        font-size: 0.9rem !important;
        height: auto !important;
        padding: 0.6rem 0.75rem !important;
    }
    
    .mastodon-button {
        width: 100% !important;
        border-radius: 6px !important;
        font-size: 0.9rem !important;
        padding: 0.6rem 0.8rem !important;
        white-space: nowrap;
        height: auto !important;
        justify-content: center !important;
    }
    
    .social-buttons-row {
        gap: 0.4rem !important;
        width: 100%;
    }
    
    .social-buttons-row a {
        width: 36px !important;
        height: 36px !important;
    }
    
    .social-buttons-row svg {
        width: 18px !important;
        height: 18px !important;
    }
}

@media (max-width: 400px) {
    .mastodon-form {
        max-width: 280px;
    }
    
    .social-buttons-row {
        gap: 0.3rem !important;
    }
    
    .social-buttons-row a {
        width: 32px !important;
        height: 32px !important;
    }
    
    .social-buttons-row svg {
        width: 16px !important;
        height: 16px !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Modern CSS features for 2024+ */
/* CSS View Transitions API support */
@supports (view-transition-name: none) {
    .page-transition {
        view-transition-name: page;
    }
    
    .card-transition {
        view-transition-name: card;
    }
}

/* CSS Anchor Positioning (when supported) */
@supports (anchor-name: --tooltip) {
    .tooltip {
        position: absolute;
        anchor-name: --tooltip;
    }
    
    .tooltip-content {
        position: absolute;
        top: anchor(--tooltip bottom);
        left: anchor(--tooltip center);
        transform: translateX(-50%);
    }
}

/* Modern CSS Color Functions */
@supports (color: color-mix(in srgb, red, blue)) {
    .gradient-text {
        background: linear-gradient(
            135deg,
            color-mix(in srgb, var(--primary-color) 80%, white),
            color-mix(in srgb, var(--accent-color) 80%, white)
        );
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }
}

/* CSS Nesting (when supported) */
@supports (selector(&)) {
    .modern-card {
        background: var(--bg-secondary);
        border: 2px solid var(--border-color);
        border-radius: var(--border-radius-lg);
        padding: 1.5rem;
        transition: all var(--transition-normal);
        
        &:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow-lg);
        }
        
        & .card-title {
            font-size: 1.2rem;
            font-weight: 600;
            margin-bottom: 0.5rem;
        }
        
        & .card-content {
            color: var(--text-secondary);
        }
    }
}

/* Widget Styles */
.widget-error {
    color: red;
    font-family: monospace;
    padding: 1rem;
    text-align: center;
    background: var(--bg-primary);
    border: 1px solid var(--danger-color);
    border-radius: var(--border-radius);
    margin: 1rem;
}

/* Leaderboard Inline Style Replacements */
.period-selector-daily {
    justify-content: center;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.25rem;
}

.period-selector-weekly {
    justify-content: center;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.25rem;
}

.btn-nav {
    font-size: 0.85rem;
    padding: 0.15rem 0.4rem;
    line-height: 1;
}

.btn-today {
    font-size: 0.8rem;
    padding: 0.15rem 0.5rem;
    line-height: 1;
}

.btn-disabled {
    opacity: 0.5;
    pointer-events: none;
    font-size: 0.85rem;
    padding: 0.15rem 0.4rem;
    line-height: 1;
}

.compare-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: center;
    gap: 1rem;
    margin: 0.5rem 0 1rem;
    min-height: 160px;
}

.pedestal {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bar {
    width: 72px;
    height: var(--bar-height, 100px);
    background: var(--bar-color, var(--primary-color));
    border-radius: 6px 6px 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 0;
    font-weight: 700;
}

.bar-small {
    width: 68px;
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.bar-icon {
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bar-value {
    font-size: 0.9rem;
    line-height: 1;
}

.bar-label {
    margin-top: 6px;
    font-weight: 600;
}

.weekly-breakdown {
    max-width: 720px;
    width: 100%;
    margin: 1rem auto 0;
}

.weekly-days {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.weekly-day {
    min-width: 84px;
    text-align: center;
    padding: 4px 6px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
}

.weekly-day-label {
    font-weight: 600;
    margin-bottom: 2px;
}

.weekly-day-value {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.leaderboard-table-full {
    width: 100%;
}

.leaderboard-table-centered {
    max-width: 900px;
    margin: 0 auto;
}

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

.table-right {
    text-align: right;
}

.table-left {
    text-align: left;
}

.section-margin-top {
    margin-top: 1rem;
}

.section-margin-top-large {
    margin-top: 2rem;
}

.section-margin-top-xl {
    margin-top: 2.5rem;
}

.streaks-list {
    margin: 0;
    padding-left: 1rem;
    list-style-type: none;
}

.streaks-item {
    margin: 0.25rem 0;
}

.matrix-desktop {
    margin-top: 2rem;
}

.matrix-table {
    width: 100%;
    border-collapse: collapse;
}

.matrix-header {
    text-align: left;
}

.matrix-header-friend {
    text-align: center;
}

.matrix-row {
    text-align: left;
}

.compare-summary-small {
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    justify-content: center;
    margin: 2rem auto 1rem;
    min-height: 140px;
}

/* Common inline style replacements */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--text-primary); }

.margin-top-1 { margin-top: 1rem; }
.margin-top-2 { margin-top: 2rem; }
.margin-bottom-1 { margin-bottom: 1rem; }
.margin-bottom-2 { margin-bottom: 2rem; }

.padding-1 { padding: 1rem; }
.padding-2 { padding: 2rem; }

.width-100 { width: 100%; }
.max-width-900 { max-width: 900px; }
.max-width-720 { max-width: 720px; }

.margin-auto { margin: 0 auto; }

.font-size-sm { font-size: 0.875rem; }
.font-size-xs { font-size: 0.75rem; }

.opacity-50 { opacity: 0.5; }
.pointer-events-none { pointer-events: none; }

.border-1 { border: 1px solid var(--border-color); }
.border-radius-6 { border-radius: 6px; }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-column { flex-direction: column; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.gap-1 { gap: 1rem; }
.gap-2 { gap: 2rem; }

.min-height-160 { min-height: 160px; }
.min-height-140 { min-height: 140px; }

.list-none { list-style-type: none; }
.padding-left-1 { padding-left: 1rem; }

.overflow-auto { overflow: auto; }
.border-collapse { border-collapse: collapse; }

/* Specific component styles */
.pedestal-bar {
    height: var(--bar-height, 100px);
    background: var(--bar-color, var(--primary-color));
}

.pedestal-bar-small {
    height: var(--bar-height, 80px);
    background: var(--bar-color, var(--primary-color));
}

.weekly-day-item {
    min-width: 84px;
    text-align: center;
    padding: 4px 6px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.weekly-day-label {
    font-weight: 600;
    margin-bottom: 2px;
}

.weekly-day-value {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.streak-list {
    margin: 0;
    padding-left: 1rem;
    list-style-type: none;
}

.streak-item {
    margin: 0.25rem 0;
}

.matrix-container {
    width: 100%;
    overflow: auto;
}

.matrix-table {
    width: 100%;
    border-collapse: collapse;
}

.matrix-header {
    text-align: left;
}

.matrix-header-friend {
    text-align: center;
}

.matrix-row {
    text-align: left;
}

.section-spacing {
    margin-top: 1rem;
}

.section-spacing-large {
    margin-top: 2rem;
}

.section-spacing-xl {
    margin-top: 2.5rem;
}

.widget-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    max-width: 400px;
    margin: 0 auto;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
}

.widget-header {
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.widget-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.widget-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0.25rem 0 0 0;
}

.widget-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.widget-stat {
    text-align: center;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.widget-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
}

.widget-stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.widget-champion {
    text-align: center;
    margin: 1rem 0;
    padding: 1rem;
    background: linear-gradient(135deg, #f5c542, #f39c12);
    border-radius: var(--border-radius-lg);
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
}

.widget-footer {
    text-align: center;
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}

.modal-header {
    padding: 24px 24px 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body .form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.modal-body .btn {
    padding: 10px 20px;
    font-size: 0.875rem;
}

/* Dark mode modal styles */
@media (prefers-color-scheme: dark) {
    .modal-content {
        background: var(--bg-primary-dark);
        border-color: var(--border-color-dark);
    }
    
    .modal-header {
        border-bottom-color: var(--border-color-dark);
    }
    
    .modal-header h2 {
        color: var(--text-primary-dark);
    }
}
