/* Subscription Badge */
.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
    background-color: var(--text-secondary);
}

.badge.premium {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #000;
    box-shadow: 0 2px 5px rgba(255, 170, 0, 0.4);
}

.badge.free {
    background-color: #888;
}

/* Premium Feature Lock */
.premium-lock {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

.premium-lock::after {
    content: '🔒 Premium';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    white-space: nowrap;
}

/* Membership Comparison UI */
.membership-comparison {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.membership-card {
    flex: 1;
    min-width: 250px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.membership-card h4 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    color: var(--text-main);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 5px;
}

.current-badge {
    background: var(--primary-color);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}

.feature-list li {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    padding-left: 15px;
    position: relative;
    line-height: 1.4;
}

.feature-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--text-muted);
}

/* Premium Card Special Styles */
.membership-card.premium {
    border: 1px solid rgba(255, 215, 0, 0.3);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.05), rgba(255, 215, 0, 0.1));
}

.membership-card.premium h4 {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.membership-card.premium .feature-list li strong {
    color: #ffaa00;
    /* Goldish text for emphasis */
}

/* Upgrade Button in Card */
.upgrade-btn {
    margin-top: 15px;
    width: 100%;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: black;
    font-weight: bold;
    border: none;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 170, 0, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(255, 170, 0, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 170, 0, 0);
    }
}

/* Active Card Highlight */
.membership-card.active {
    border: 2px solid var(--primary-color);
    background: rgba(var(--primary-rgb), 0.1);
}

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

.stats-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
}

.stats-card h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.stats-table-wrapper {
    overflow-x: auto;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.stats-table th,
.stats-table td {
    padding: 0.75rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.stats-table th {
    font-weight: 600;
    color: var(--text-muted);
}

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

.stats-table .badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.stats-table .badge.premium {
    background: rgba(255, 170, 0, 0.15);
    color: #ffaa00;
}

.stats-table .badge.free {
    background: rgba(52, 199, 89, 0.15);
    color: #34c759;
}

.stats-table .badge.guest {
    background: rgba(142, 142, 147, 0.15);
    color: #8e8e93;
}

/* Select Option Visibility Fix */
select option {
    background-color: #1e293b;
    /* Dark slate background */
    color: #f1f5f9;
    /* Light text */
}

/* Specific fix for Admin Select in Index.html */
#admin-history-select option {
    background-color: #1e293b;
    color: white;
}

/* ===== New Statistics Ball Classes Mapped to Existing Styles ===== */
.lotto-ball {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 800;
    color: white !important;
    /* Force white text */
    position: relative;
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15), inset 0 -3px 6px rgba(0, 0, 0, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    /* Stronger shadow */
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.lotto-ball::after {
    content: '';
    position: absolute;
    top: 6%;
    left: 18%;
    width: 35%;
    height: 25%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.1));
    border-radius: 50%;
    filter: blur(0.5px);
}

.lotto-ball.ball-10 {
    background: var(--ball-1);
    color: white;
}

.lotto-ball.ball-20 {
    background: var(--ball-2);
    color: white;
}

.lotto-ball.ball-30 {
    background: var(--ball-3);
    color: white;
}

.lotto-ball.ball-40 {
    background: var(--ball-4);
    color: white;
}

.lotto-ball.ball-45 {
    background: var(--ball-5);
    color: white;
}

/* ===== Statistics Section Headers ===== */
.stats-section {
    margin-bottom: 3rem;
    /* Increased vertical spacing */
}

.stats-section h4 {
    color: #ffffff !important;
    font-weight: 800;
    font-size: 0.95rem;
    /* Reduced font size */
    margin-bottom: 1.25rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    /* visual grouping separator */
    padding-bottom: 0.5rem;
}

/* ===== Statistics Overview Cards ===== */
.stats-overview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 3rem;
    /* Spacing */
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 16px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 1.25rem;
    /* Reduced size */
    font-weight: 800;
    color: white;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stat-label {
    font-size: 0.75rem;
    /* Reduced size */
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

/* ===== Statistics Center Components ===== */
.ball-list-scrollable {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding: 10px 5px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) rgba(255, 255, 255, 0.05);
}

.ball-list-scrollable::-webkit-scrollbar {
    height: 4px;
}

.ball-list-scrollable::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 2px;
}

.color-bar-container {
    display: flex;
    width: 100%;
    height: 24px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.stat-count-badge {
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Frequency Matrix Table */
#frequency-matrix-body td {
    border-color: rgba(255, 255, 255, 0.05) !important;
}

#frequency-matrix-body .lotto-ball {
    transform: scale(0.85);
    /* Slightly smaller in matrix */
    margin: -2px;
}

/* ===== Profile Photo Edit Enhancement ===== */
.avatar-edit-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 0;
}

.avatar-profile-header {
    text-align: center;
    margin-bottom: 2rem;
}

.avatar-preview-main {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 1.5rem;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.avatar-preview-main:hover {
    transform: scale(1.05);
}

.avatar-image-container {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid var(--primary-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), 0 0 20px var(--primary-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.avatar-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-fallback-large {
    font-size: 4rem;
    color: var(--text-muted);
}

/* Avatar Gallery Tabbed Interface - Basic Design */
.gallery-tabs-wrapper {
    position: relative;
    margin-bottom: 1.25rem;
    overflow: hidden;
    background: #e9ecef;
    /* Common sliding bar background color */
    border-radius: 12px;
    border: 1px solid #dee2e6;
}

.gallery-tabs-wrapper::before,
.gallery-tabs-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    z-index: 10;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.gallery-tabs-wrapper::before {
    left: 0;
    background: linear-gradient(to right, #e9ecef 0%, transparent 100%);
}

.gallery-tabs-wrapper::after {
    right: 0;
    background: linear-gradient(to left, #e9ecef 0%, transparent 100%);
}

.gallery-tabs {
    display: flex;
    overflow-x: auto;
    gap: 0;
    padding: 0.4rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.gallery-tabs::-webkit-scrollbar {
    display: none;
}

.gallery-tab-btn {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    color: #495057;
    font-size: 0.9rem;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-align: center;
    position: relative;
    z-index: 2;
}

.gallery-tab-btn:hover {
    color: #000;
}

.gallery-tab-btn.active {
    color: #000;
}

/* Sliding Indicator */
.gallery-tab-indicator {
    position: absolute;
    bottom: 0.5rem;
    /* Match bottom padding */
    left: 0;
    height: calc(100% - 1rem);
    /* Full height minus padding */
    background: var(--primary-color);
    border-radius: 20px;
    z-index: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    pointer-events: none;
}

.gallery-group {
    display: none;
    /* Hidden by default */
    grid-template-columns: repeat(auto-fill, minmax(55px, 1fr));
    /* Slightly smaller min-width for better fit */
    gap: 12px;
    justify-items: center;
    /* Center items in their cells */
    animation: fadeIn 0.3s ease;
}

.gallery-group.active {
    display: grid;
}

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

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

/* Hide legacy category titles in tabbed view */
.gallery-category-title {
    display: none;
}

.avatar-edit-badge {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 42px;
    height: 42px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: 3px solid #0f172a;
    /* Same as bg base to create separation */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 2;
    transition: all 0.2s;
}

.avatar-preview-main:hover .avatar-edit-badge {
    transform: scale(1.1);
    background: var(--secondary-color);
}

/* Hover overlay on the image itself */
.avatar-image-container::after {
    content: '변경하기';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s;
    backdrop-filter: blur(2px);
}

.avatar-preview-main:hover .avatar-image-container::after {
    opacity: 1;
}

.avatar-username {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.avatar-status-msg {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Gallery Styling */
.avatar-gallery {
    width: 100%;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1rem;
    margin-top: 1rem;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.gallery-header h4 {
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 700;
}

.close-gallery-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.close-gallery-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.gallery-grid {
    display: block;
    /* Removed grid to allow children groups to take full width */
    width: 100%;
}

.gallery-item {
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.gallery-item:hover {
    transform: translateY(-5px) scale(1.05);
}

.gallery-item .avatar-circle {
    width: 50px;
    height: 50px;
    margin: 0 auto;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 2px solid transparent;
}

.gallery-item:hover .avatar-circle {
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

/* Avatar Color Palettes */
.avatar-circle.purple {
    background: linear-gradient(135deg, #818cf8, #4f46e5);
}

.avatar-circle.pink {
    background: linear-gradient(135deg, #f472b6, #db2777);
}

.avatar-circle.coral {
    background: linear-gradient(135deg, #fb7185, #e11d48);
}

.avatar-circle.sun {
    background: linear-gradient(135deg, #fbbf24, #d97706);
}

.avatar-circle.silver {
    background: linear-gradient(135deg, #94a3b8, #475569);
}

.avatar-circle.slate {
    background: linear-gradient(135deg, #4b5563, #1f2937);
}

.avatar-circle.sand {
    background: linear-gradient(135deg, #d6d3d1, #78716c);
}

.avatar-circle.indigo {
    background: linear-gradient(135deg, #6366f1, #3730a3);
}

.avatar-circle.mocha {
    background: linear-gradient(135deg, #a8a29e, #57534e);
}

.avatar-circle.night {
    background: linear-gradient(135deg, #334155, #0f172a);
}

.avatar-circle.volcanic {
    background: linear-gradient(135deg, #ef4444, #7f1d1d);
}

.avatar-circle.ocean {
    background: linear-gradient(135deg, #0ea5e9, #075985);
}

.avatar-circle.lavender {
    background: linear-gradient(135deg, #c084fc, #7c3aed);
}

.avatar-circle.cyan {
    background: linear-gradient(135deg, #22d3ee, #0891b2);
}

.avatar-circle.orange {
    background: linear-gradient(135deg, #fb923c, #c2410c);
}

.avatar-circle.lime {
    background: linear-gradient(135deg, #84cc16, #4d7c0f);
}

.avatar-circle.forest {
    background: linear-gradient(135deg, #22c55e, #15803d);
}

.avatar-circle.rose {
    background: linear-gradient(135deg, #fb7185, #be123c);
}

.avatar-circle.sky {
    background: linear-gradient(135deg, #38bdf8, #0369a1);
}

.avatar-circle.violet {
    background: linear-gradient(135deg, #a78bfa, #6d28d9);
}

.avatar-circle.emerald {
    background: linear-gradient(135deg, #34d399, #059669);
}

.avatar-circle.mint {
    background: linear-gradient(135deg, #6ee7b7, #10b981);
}

.avatar-circle.pastel {
    background: linear-gradient(135deg, #fda4af, #fb7185);
}

.avatar-circle.electric {
    background: linear-gradient(135deg, #fde047, #eab308);
}

.avatar-circle.ruby {
    background: linear-gradient(135deg, #fb7185, #be123c);
}

.avatar-circle.mystic {
    background: linear-gradient(135deg, #a78bfa, #6d28d9);
}

.avatar-circle.blue {
    background: linear-gradient(135deg, #60a5fa, #2563eb);
}

.avatar-circle.amber {
    background: linear-gradient(135deg, #fbbf24, #d97706);
}

.avatar-circle.teal {
    background: linear-gradient(135deg, #2dd4bf, #0d9488);
}

.avatar-circle.gold {
    background: linear-gradient(135deg, #fcd34d, #d97706);
}

/* Action Sheet Polish */
.action-sheet {
    z-index: 3000 !important;
}

.action-sheet-content {
    background: rgba(15, 23, 42, 0.9) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 24px 24px 0 0 !important;
    padding: 1.5rem 2rem 2.5rem !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5) !important;
}

.pull-bar {
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 0 auto 1.5rem;
}

.action-list-item {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: 16px !important;
    padding: 1rem 1.2rem !important;
    margin-bottom: 0.75rem !important;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white !important;
    font-weight: 600 !important;
    transition: all 0.2s !important;
}

.action-list-item:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    transform: translateX(5px);
}

.action-list-item .action-label {
    flex: 1;
}

.action-list-item.danger {
    color: #ff4d4d !important;
}

.action-list-item.danger:hover {
    background: rgba(255, 77, 77, 0.1) !important;
}

.action-icon {
    font-size: 1.25rem;
}

.action-sheet-cancel {
    width: 100%;
    margin-top: 0.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    border-radius: 16px !important;
    font-weight: 700 !important;
    cursor: pointer;
    transition: all 0.2s;
}

.action-sheet-cancel:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* Wrapper for Header Avatar */
.user-avatar-container {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

/* Header Avatar Image */
.header-user-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Header Avatar Fallback (Emoji) */
.header-user-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-muted);
}

/* Icon Only Button (Logout) */
.auth-btn.icon-only {
    padding: 0 !important;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    /* text-muted */
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s;
}

.auth-btn.icon-only:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.auth-btn.icon-only svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.5px;
}

/* Fix AI Model Logo Visibility & Add Interactivity */
.model-brand-logo {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    animation: logoFloat 4s infinite ease-in-out;
}

@keyframes logoFloat {

    0%,
    100% {
        transform: translateY(0) scale(1);
        filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.2));
    }

    50% {
        transform: translateY(-5px) scale(1.02);
        filter: drop-shadow(0 8px 15px rgba(0, 0, 0, 0.3));
    }
}

.model-brand-logo:hover {
    transform: scale(1.15) rotate(3deg);
    animation-play-state: paused;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4) !important;
    z-index: 10;
}

.model-brand-logo:active {
    transform: scale(0.95);
}

[data-theme="dark"] .model-brand-logo {
    mix-blend-mode: normal !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border-radius: 12px !important;
    padding: 6px !important;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1) !important;
}

/* Log Viewer & AI Status Styles */
.log-tab.active {
    background: rgba(99, 102, 241, 0.3) !important;
    border: 1px solid rgba(99, 102, 241, 0.5) !important;
}

.ai-status-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.2s;
}

.ai-status-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot.online {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.dot.offline {
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
}

.dot.error {
    background: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
}

.log-viewer::-webkit-scrollbar {
    width: 6px;
}

.log-viewer::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.log-viewer::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

/* ===== Light Theme Palette (NEWS reference) ===== */
[data-theme="light"] body {
    background-color: #f8fafc;
    background-image: radial-gradient(circle at 0% 0%, #e0e7ff 0%, transparent 50%),
        radial-gradient(circle at 100% 0%, #fce7f3 0%, transparent 45%),
        radial-gradient(circle at 50% 100%, #dbeafe 0%, transparent 45%);
    color: #0f172a;
}

[data-theme="light"] .app-header {
    background: rgba(248, 250, 252, 0.62);
}

[data-theme="light"] .logo-container {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .app-title {
    color: #0f172a;
    background: none;
    -webkit-text-fill-color: initial;
    text-shadow: none;
}

[data-theme="light"] .app-subtitle {
    color: #64748b;
}

[data-theme="light"] .tab-nav {
    background: rgba(255, 255, 255, 0.92);
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .tab-btn {
    color: #64748b;
}

[data-theme="light"] .tab-btn:hover {
    color: #334155;
    background: rgba(15, 23, 42, 0.04);
}

[data-theme="light"] .tab-btn.active {
    color: #0f172a;
    background: transparent;
}

[data-theme="light"] .tab-btn.active .tab-icon {
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.35));
}

[data-theme="light"] .section-title,
[data-theme="light"] .sub-view-title,
[data-theme="light"] .back-btn {
    color: #0f172a;
    text-shadow: none;
}

[data-theme="light"] .refresh-btn {
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(15, 23, 42, 0.08);
    color: #334155;
}

[data-theme="light"] .refresh-btn:hover {
    background: #ffffff;
    color: #0f172a;
}

[data-theme="light"] .menu-list-container {
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .menu-item {
    background: rgba(255, 255, 255, 0.88);
}

[data-theme="light"] .menu-item:hover {
    background: rgba(241, 245, 249, 0.95);
}

[data-theme="light"] .menu-item:active {
    background: rgba(226, 232, 240, 0.95);
}

[data-theme="light"] .menu-text {
    color: #0f172a;
}

[data-theme="light"] .menu-subtext {
    color: #64748b;
}

[data-theme="light"] .menu-arrow {
    color: #64748b;
}

[data-theme="light"] .view-container .setting-item label,
[data-theme="light"] .view-container .form-group label {
    color: #334155 !important;
}

[data-theme="light"] .view-container .setting-title {
    color: #0f172a !important;
    border-bottom-color: rgba(15, 23, 42, 0.08) !important;
}

[data-theme="light"] .view-container .admin-info-label {
    color: #64748b !important;
}

[data-theme="light"] .view-container .admin-info-value {
    color: #0f172a !important;
}

[data-theme="light"] .toggle-slider,
[data-theme="light"] .slider {
    background-color: rgba(148, 163, 184, 0.35);
}

[data-theme="light"] .toggle-slider:hover,
[data-theme="light"] .slider:hover {
    background-color: rgba(148, 163, 184, 0.5);
}

[data-theme="light"] .toggle-slider:before,
[data-theme="light"] .slider:before {
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.25);
}

[data-theme="light"] .modal {
    background-color: rgba(15, 23, 42, 0.36);
}

/* Mobile app users must never see admin UI */
html.admin-mobile-block #admin-tab-btn,
html.admin-mobile-block #admin-menu-item,
html.admin-mobile-block #admin-tab,
html.admin-mobile-block #admin-login-modal,
html.admin-mobile-block #admin-user-detail-modal {
    display: none !important;
}

/* ===== Light Mode Visual Tuning (mobile screenshots) ===== */
[data-theme="light"] .next-draw-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .next-draw-card::before,
[data-theme="light"] .next-draw-card::after {
    opacity: 0.55;
}

[data-theme="light"] .next-draw-subtitle,
[data-theme="light"] .lotto-label {
    color: #7c3aed;
}

[data-theme="light"] .next-draw-title,
[data-theme="light"] .results-title {
    background: none !important;
    color: #1e293b !important;
    -webkit-text-fill-color: #1e293b !important;
    filter: none;
}

[data-theme="light"] .header-nav-btn {
    background: rgba(255, 255, 255, 0.95);
    color: #475569;
    border: 1px solid rgba(15, 23, 42, 0.12);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .header-nav-btn:hover:not(:disabled) {
    background: #ffffff;
    color: #1e293b;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.2);
}

[data-theme="light"] .results-date {
    color: #64748b;
}

[data-theme="light"] .results-container {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 8px 26px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .result-numbers-section {
    background: radial-gradient(circle at center, rgba(99, 102, 241, 0.08) 0%, transparent 72%);
}

[data-theme="light"] .prize-section {
    background: linear-gradient(135deg, #475569 0%, #64748b 100%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
}

[data-theme="light"] #prediction-filter-container label {
    color: #64748b !important;
}

[data-theme="light"] #prediction-model-select {
    background: #ffffff !important;
    color: #1e293b !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
}

[data-theme="light"] .stats-section h4 {
    color: #1e293b !important;
    text-shadow: none;
    border-bottom-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .stat-card {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .stat-value {
    color: #334155;
    text-shadow: none;
}

[data-theme="light"] .stat-label {
    color: #64748b;
}

[data-theme="light"] .color-bar-container {
    background: rgba(15, 23, 42, 0.06);
    box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .stat-count-badge {
    background: rgba(15, 23, 42, 0.08);
    color: #334155;
    text-shadow: none;
    border-color: rgba(15, 23, 42, 0.12);
}

[data-theme="light"] #settings-app-info-view h3 {
    color: #1e293b !important;
    text-shadow: none !important;
}

[data-theme="light"] #settings-app-info-view span {
    color: #334155 !important;
}

[data-theme="light"] #settings-app-info-view .update-notice {
    background: rgba(255, 255, 255, 0.92) !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] #settings-app-info-view .update-notice h4 {
    color: #7c3aed !important;
}

[data-theme="light"] #settings-app-info-view .update-notice ul,
[data-theme="light"] #settings-app-info-view .update-notice li {
    color: #334155 !important;
}

[data-theme="light"] #settings-app-info-view .update-notice li span {
    color: #64748b !important;
}

[data-theme="light"] #personalization-modal .qr-modal-full {
    background: #f8fafc !important;
}

[data-theme="light"] #personalization-modal .qr-res-header {
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    color: #1e293b;
}

[data-theme="light"] #personalization-modal .qr-res-title {
    color: #1e293b;
}

[data-theme="light"] #personalization-modal .qr-header-close-btn {
    background: rgba(15, 23, 42, 0.08);
    color: #334155;
}

[data-theme="light"] #personalization-modal .qr-res-body {
    color: #334155;
}

[data-theme="light"] #personalization-modal .qr-notice-section {
    background: rgba(255, 255, 255, 0.92) !important;
    border: 1px solid rgba(99, 102, 241, 0.25) !important;
}

[data-theme="light"] #personalization-modal .qr-notice-section p,
[data-theme="light"] #personalization-modal .qr-notice-section strong,
[data-theme="light"] #personalization-modal label {
    color: #1e293b !important;
}

[data-theme="light"] #personalization-modal .setting-input {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid rgba(15, 23, 42, 0.12);
}

/* ===== Light Mode — Full UI Recomposition (Mobile UX) ===== */
[data-theme="light"] .logo-container,
[data-theme="light"] .logo-container * {
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
    text-shadow: none !important;
}
[data-theme="light"] .app-subtitle {
    color: #475569 !important;
}
[data-theme="light"] .ai-settings-icon {
    color: #334155 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}
[data-theme="light"] .next-draw-subtitle,
[data-theme="light"] .lotto-label {
    color: #5b21b6 !important;
    font-weight: 800;
}
[data-theme="light"] .next-draw-title,
[data-theme="light"] .results-title {
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
    filter: none;
}
[data-theme="light"] .header-nav-btn {
    background: #ffffff !important;
    color: #334155 !important;
    border: 1px solid rgba(15, 23, 42, 0.15) !important;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12) !important;
}
[data-theme="light"] .header-nav-btn:hover:not(:disabled) {
    background: #f8fafc !important;
    color: #0f172a !important;
    border-color: #6366f1 !important;
}
[data-theme="light"] .results-date {
    color: #475569 !important;
}
[data-theme="light"] .sub-view-header .back-btn,
[data-theme="light"] .sub-view-title {
    color: #0f172a !important;
    text-shadow: none !important;
}
[data-theme="light"] .setting-group {
    background: rgba(255, 255, 255, 0.98) !important;
    border: 1px solid rgba(15, 23, 42, 0.1) !important;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08) !important;
}
[data-theme="light"] .setting-group .setting-title {
    color: #0f172a !important;
    border-bottom-color: rgba(15, 23, 42, 0.1) !important;
}
[data-theme="light"] .setting-item label,
[data-theme="light"] .setting-item p {
    color: #1e293b !important;
}
[data-theme="light"] .setting-item p {
    color: #475569 !important;
}
[data-theme="light"] #settings-app-info-view .settings-container,
[data-theme="light"] #settings-app-info-view h3,
[data-theme="light"] #settings-app-info-view p,
[data-theme="light"] #settings-app-info-view span,
[data-theme="light"] #settings-app-info-view .settings-container h3,
[data-theme="light"] #settings-app-info-view .settings-container p,
[data-theme="light"] #settings-app-info-view .settings-container p span {
    color: #1e293b !important;
    text-shadow: none !important;
}
[data-theme="light"] #settings-app-info-view p {
    color: #475569 !important;
}
[data-theme="light"] #settings-app-info-view .settings-container > div:first-of-type h3 {
    color: #0f172a !important;
    font-weight: 700;
}
[data-theme="light"] #settings-app-info-view .update-notice,
[data-theme="light"] #settings-app-info-view .update-notice * {
    color: #334155 !important;
}
[data-theme="light"] #settings-app-info-view .update-notice h4 {
    color: #5b21b6 !important;
}
[data-theme="light"] #settings-app-info-view .update-notice li span {
    color: #64748b !important;
}
[data-theme="light"] .more-menu-content {
    background: rgba(255, 255, 255, 0.98) !important;
    border: 1px solid rgba(15, 23, 42, 0.1) !important;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.15) !important;
}
[data-theme="light"] .more-menu-item {
    color: #1e293b !important;
    background: transparent !important;
}
[data-theme="light"] .more-menu-item:hover {
    background: rgba(15, 23, 42, 0.06) !important;
    color: #0f172a !important;
}
[data-theme="light"] .more-menu-item .menu-text,
[data-theme="light"] .more-menu-item .menu-subtext,
[data-theme="light"] .more-menu-item .menu-icon,
[data-theme="light"] .more-menu-item .menu-arrow {
    color: inherit !important;
}
[data-theme="light"] .tab-btn .tab-icon {
    filter: none;
}
[data-theme="light"] .tab-btn:not(.active) .tab-icon {
    opacity: 0.85;
}
[data-theme="light"] .tab-nav {
    background: #ffffff !important;
    border-top: 1px solid rgba(15, 23, 42, 0.1) !important;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08) !important;
}
[data-theme="light"] .bonus-label,
[data-theme="light"] .plus-sign {
    color: #475569 !important;
}
[data-theme="light"] .empty-state h4,
[data-theme="light"] .empty-state p {
    color: #1e293b !important;
}
[data-theme="light"] .empty-state p {
    color: #64748b !important;
}
[data-theme="light"] .draw-info,
[data-theme="light"] .draw-number {
    color: #1e293b !important;
}
[data-theme="light"] .draw-number span {
    color: #4f46e5 !important;
}
[data-theme="light"] .app-header {
    background: rgba(241, 245, 249, 0.95) !important;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
[data-theme="light"] .logo-container {
    background: #ffffff !important;
    border: 1px solid rgba(15, 23, 42, 0.1) !important;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08) !important;
}
[data-theme="light"] .qr-scan-header-btn {
    color: #334155 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08) !important;
}
[data-theme="light"] .qr-scan-header-btn:hover {
    color: #0f172a !important;
    background: #ffffff !important;
}
[data-theme="light"] .results-header .lotto-label {
    color: #5b21b6 !important;
    font-weight: 700;
}
[data-theme="light"] .view-mode-toggle,
[data-theme="light"] .view-mode-btn {
    color: #334155 !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(15, 23, 42, 0.1) !important;
}
[data-theme="light"] .view-mode-btn:hover,
[data-theme="light"] .view-mode-btn.active {
    color: #0f172a !important;
}