/**
 * Who Is Singing - Main Stylesheet
 * Vibrant game-show interface with purple/pink gradient
 */

/* ==================== CSS Variables ==================== */
:root {
    --primary: #8B5CF6;
    --primary-dark: #7C3AED;
    --primary-light: #A78BFA;
    --secondary: #EC4899;
    --secondary-dark: #DB2777;
    --accent: #F59E0B;

    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    --card-gradient: linear-gradient(145deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));

    --success: #10B981;
    --success-light: #34D399;
    --error: #EF4444;
    --error-light: #F87171;

    --white: #FFFFFF;
    --black: #000000;
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --text-muted: rgba(255, 255, 255, 0.6);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.5);

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    --font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ==================== Reset & Base ==================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    background: var(--bg-gradient);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

/* ==================== Game Container ==================== */
.game-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    position: relative;
}

/* ==================== Header ==================== */
.game-header {
    text-align: center;
    padding: 20px 0 30px;
}

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

.game-title {
    font-size: 2rem;
    font-weight: 800;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
}

.title-icon {
    font-size: 2.5rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.game-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Language Switcher */
.language-switcher {
    display: flex;
    gap: 5px;
}

.lang-btn {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition-fast);
}

.lang-btn:hover,
.lang-btn.active {
    background: var(--white);
    color: var(--primary);
}

/* ==================== Screens ==================== */
.screen {
    display: none;
    animation: fadeIn var(--transition-normal);
}

.screen.active {
    display: block;
}

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

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

/* ==================== Start Screen ==================== */
.start-content {
    text-align: center;
    padding: 60px 20px;
}

.logo-animation {
    font-size: 4rem;
    margin-bottom: 30px;
}

.note {
    display: inline-block;
    animation: float 3s ease-in-out infinite;
}

.note.delay-1 {
    animation-delay: 0.5s;
}

.note.delay-2 {
    animation-delay: 1s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-15px) rotate(-10deg);
    }

    75% {
        transform: translateY(-5px) rotate(10deg);
    }
}

.start-content h2 {
    font-size: 2rem;
    margin-bottom: 15px;
}

.start-content p {
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-size: 1.1rem;
}

/* ==================== Buttons ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-large {
    padding: 18px 40px;
    font-size: 1.2rem;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(236, 72, 153, 0.7);
    }

    70% {
        box-shadow: 0 0 0 20px rgba(236, 72, 153, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(236, 72, 153, 0);
    }
}

/* ==================== Score Bar ==================== */
.score-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    margin-bottom: 25px;
}

.score-item {
    text-align: center;
    flex: 1;
}

.score-center-text {
    flex: 1;
    text-align: center;
    font-size: 1rem;
    color: var(--text-secondary);
}

.score-center-text p {
    margin: 0;
}

.score-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-value {
    font-size: 1.5rem;
    font-weight: 700;
}

/* ==================== Timer ==================== */
.timer-display {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 auto 15px;
    transition: all 0.3s ease;
}

.timer-display.warning {
    background: rgba(245, 158, 11, 0.3);
    animation: pulse-timer 1s infinite;
}

.timer-display.critical {
    background: rgba(239, 68, 68, 0.3);
    animation: pulse-timer 0.5s infinite;
}

@keyframes pulse-timer {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}


/* ==================== Audio Player Section ==================== */
.audio-player-section {
    text-align: center;
    padding: 10px;
    background: var(--card-gradient);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    /* Grid positioning for Mobile (Default) */
    grid-column: 2 / 4;
    grid-row: 2 / 4;
    width: 100%;
    height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.audio-visualizer-container {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.audio-visualizer {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 6px;
    height: 60px;
}

.visualizer-bar {
    width: 8px;
    background: linear-gradient(to top, var(--secondary), var(--primary));
    border-radius: 4px;
    animation: visualize 1s ease-in-out infinite;
}

.visualizer-bar:nth-child(1) {
    height: 20px;
    animation-delay: 0s;
}

.visualizer-bar:nth-child(2) {
    height: 35px;
    animation-delay: 0.1s;
}

.visualizer-bar:nth-child(3) {
    height: 50px;
    animation-delay: 0.2s;
}

.visualizer-bar:nth-child(4) {
    height: 35px;
    animation-delay: 0.3s;
}

.visualizer-bar:nth-child(5) {
    height: 20px;
    animation-delay: 0.4s;
}

@keyframes visualize {

    0%,
    100% {
        transform: scaleY(1);
    }

    50% {
        transform: scaleY(1.5);
    }
}

.audio-hint {
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-size: 0.95rem;
}

/* ==================== Character Grid Wrapper ==================== */
.character-grid-wrapper {
    width: 100%;
    margin: 0 auto;
}

.character-grid {
    display: grid;
    /* Force 4 columns for ALL screens to maintain the layout */
    grid-template-columns: repeat(4, 1fr) !important;
    grid-auto-rows: min-content;
    grid-auto-flow: dense;
    gap: 8px;
    /* Reduced gap for mobile */
    width: 100%;
    padding-bottom: 20px;
}

/* Hide empty slots to prevent layout gaps */
.character-slot:empty {
    display: none;
}

.character-slot {
    width: 100%;
}

@media (min-width: 600px) {
    .character-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }

    /* On larger screens, put audio player back on top or keep layout? 
       Let's put it on top for better usability on desktop */
    .audio-player-section {
        /* Keep grid positioning on desktop too! */
        grid-column: 2 / 4;
        grid-row: 2 / 4;
        margin-bottom: 0;
        min-height: auto;
    }
}

@media (min-width: 900px) {
    .character-grid-wrapper {
        max-width: 1000px;
    }
}

/* ==================== Character Grid Items ==================== */

.character-card {
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-normal);
    border: 3px solid transparent;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

/* Watermark background effect */
.character-card.has-watermark::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    opacity: 0.15;
    z-index: 0;
    filter: blur(2px);
}

.character-card>* {
    position: relative;
    z-index: 1;
}

.character-image-wrapper {
    position: relative;
    z-index: 1;
}

.character-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.25);
    box-shadow: var(--shadow-md);
}

.character-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
}

.character-card.correct {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.3);
    animation: correctPulse 0.5s ease;
}

.character-card.incorrect {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.3);
    animation: shake 0.5s ease;
}

.character-card.disabled {
    pointer-events: none;
    opacity: 0.6;
}

@keyframes correctPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-5px);
    }

    40%,
    80% {
        transform: translateX(5px);
    }
}

.character-image {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    object-fit: contain;
    object-position: center;
    margin-bottom: 5px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
}

.character-card {
    padding: 8px;
    /* Reduce padding for mobile */
}

.character-name {
    font-size: 0.8rem;
    /* Smaller text for mobile */
}

.character-name {
    font-weight: 600;
    font-size: 0.8rem;
    /* Mobile default */
    line-height: 1.2;
    word-wrap: break-word;
}

@media (min-width: 600px) {
    .character-image {
        margin-bottom: 10px;
    }

    .character-card {
        padding: 15px;
    }

    .character-name {
        font-size: 0.95rem;
    }
}

/* ==================== Result Screen ==================== */
.result-content {
    text-align: center;
    padding: 60px 20px;
}

.result-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: pop 0.5s ease;
}

@keyframes pop {
    0% {
        transform: scale(0);
    }

    80% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.result-content h2 {
    font-size: 2rem;
    margin-bottom: 15px;
}

.result-content p {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1.1rem;
}

/* ==================== Game Over Screen ==================== */
.gameover-content {
    text-align: center;
    padding: 60px 20px;
}

.trophy-icon {
    font-size: 6rem;
    margin-bottom: 20px;
    animation: trophy 1s ease;
}

@keyframes trophy {
    0% {
        transform: scale(0) rotate(-180deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
    }
}

.gameover-content h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.final-score {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.gameover-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* ==================== Loading Overlay ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 20px;
    z-index: 1000;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== Maintenance Mode ==================== */
.maintenance-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-gradient);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.maintenance-content {
    text-align: center;
    padding: 40px;
}

.maintenance-icon {
    font-size: 5rem;
    display: block;
    margin-bottom: 20px;
    animation: rotate 3s ease-in-out infinite;
}

@keyframes rotate {

    0%,
    100% {
        transform: rotate(-10deg);
    }

    50% {
        transform: rotate(10deg);
    }
}

/* ==================== Responsive Design ==================== */
@media (max-width: 600px) {
    .game-container {
        padding: 10px;
        /* No extra padding needed as audio player is at top */
    }

    .game-title {
        font-size: 1.5rem;
    }

    .title-icon {
        font-size: 2rem;
    }

    .game-header {
        padding: 10px 0 15px;
        margin-bottom: 0;
    }

    .header-content {
        margin-bottom: 5px;
    }

    /* Score Bar - Compact & Aligned */
    .score-bar {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0;
        padding: 12px 20px;
        margin-bottom: 15px;
        font-size: 0.95rem;
        background: rgba(255, 255, 255, 0.2);
    }

    .score-center-text {
        display: none;
    }

    .score-item {
        flex: 0 0 auto;
        width: auto;
        text-align: left;
        display: flex;
        align-items: center;
        gap: 5px;
    }

    .score-item:last-child {
        text-align: right;
        justify-content: flex-end;
    }

    .score-label::after {
        content: " :";
    }

    .score-label {
        display: inline-block;
        font-size: 0.85rem;
        margin: 0;
        color: rgba(255, 255, 255, 0.9);
        font-weight: 600;
    }

    .score-value {
        font-size: 1.1rem;
        font-weight: 800;
    }

    /* Hide Audio Hint Text */
    .audio-hint {
        display: none;
    }

    /* 4-Column Grid for Mobile */
    .character-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px;
        padding-top: 0;
    }

    /* Audio Player - Compact & Centered */
    .audio-player-section {
        padding: 15px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        grid-column: 2 / 4 !important;
        grid-row: 2 / 4 !important;
    }

    .audio-visualizer-container {
        margin-bottom: 5px;
    }

    .character-card {
        padding: 5px;
        border-radius: 8px;
    }

    .character-image {
        width: 40px;
        height: 40px;
        border-width: 2px;
        margin-bottom: 4px;
    }

    .character-name {
        font-size: 0.7rem;
        line-height: 1.1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .btn-large {
        padding: 15px 30px;
        font-size: 1.1rem;
    }

    /* Audio Player - Centered Layout (Duplicate removed/merged) */
    /* .audio-player-section styles handled above */
}

.audio-visualizer {
    height: 40px;
}

.timer-display {
    width: 45px;
    height: 45px;
    font-size: 1.3rem;
    margin: 0 auto 10px auto;
    /* Ensure centered margin */
}

/* Button Text Switching - Mobile Override */
.desktop-text {
    display: none !important;
}

.mobile-text {
    display: inline !important;
}

/* ==================== Utility Classes ==================== */
.mobile-text {
    display: none;
}

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

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

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

.mt-1 {
    margin-top: 10px;
}

.mt-2 {
    margin-top: 20px;
}

.mt-3 {
    margin-top: 30px;
}

.mb-1 {
    margin-bottom: 10px;
}

.mb-2 {
    margin-bottom: 20px;
}

.mb-3 {
    margin-bottom: 30px;
}

.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

/* ==================== Ad Container ==================== */
.game-ad-container {
    width: 100%;
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-sm);
    overflow: hidden;
}


/* ==================== Player Profile ==================== */
.profile-content {
    text-align: center;
    padding: 40px 20px;
}

.form-control-lg {
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    border-radius: var(--radius-md);
    border: none;
    margin-bottom: 20px;
    text-align: center;
}

.avatar-grid-selection {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 30px;
}

.avatar-option {
    font-size: 2.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    padding: 10px;
    cursor: pointer;
    transition: 0.2s;
}

.avatar-option.selected {
    background: var(--white);
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--accent);
}

.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.profile-avatar-large {
    font-size: 5rem;
    margin-bottom: 10px;
}

.stats-grid {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: var(--radius-md);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    display: block;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.recovery-section {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.code-display {
    background: var(--black);
    color: var(--accent);
    font-family: monospace;
    font-size: 1.5rem;
    padding: 10px;
    border-radius: var(--radius-sm);
    margin: 10px 0;
    letter-spacing: 2px;
}

#current-player-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 15px;
    border-radius: var(--radius-full);
    width: fit-content;
    margin: 0 auto;
}

.mini-avatar {
    font-size: 1.5rem;
}


@media (max-width: 600px) {
    .profile-content {
        padding: 20px 10px;
    }

    .avatar-grid-selection {
        gap: 5px;
    }

    .avatar-option {
        font-size: 2rem;
        padding: 5px;
    }

    .form-control-lg {
        font-size: 1rem;
        padding: 10px;
    }
}

/* ==================== Offline Settings Screen ==================== */
.offline-settings-content {
    padding: 20px;
    max-width: 500px;
    margin: 0 auto;
}

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

.offline-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
}

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

/* Status Card */
.status-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.status-card.online {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.5);
}

.status-card.offline {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
}

.status-icon {
    font-size: 2rem;
}

.status-text {
    flex: 1;
}

.status-text strong {
    display: block;
    font-size: 1.1rem;
}

.status-text small {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Offline Cards */
.offline-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 15px;
}

.offline-card h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.offline-card.warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge {
    background: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
}

.card-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* Stats Grid (Offline) */
.offline-card .stats-grid {
    display: flex;
    justify-content: space-around;
    gap: 10px;
    margin-bottom: 10px;
}

.offline-card .stat-item {
    text-align: center;
}

.offline-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-light);
    display: block;
}

.offline-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.info-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
}

/* Difficulty Selector */
.difficulty-selector {
    margin-bottom: 20px;
}

.difficulty-selector label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.difficulty-btns {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.diff-btn {
    padding: 12px 15px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.diff-btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.1);
}

.diff-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Progress Container */
.progress-container {
    margin-bottom: 20px;
}

.progress-bar {
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 5px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Info Card */
.offline-info-card {
    background: rgba(59, 130, 246, 0.15);
    border-radius: var(--radius-md);
    padding: 15px 20px;
    margin-bottom: 15px;
}

.offline-info-card h4 {
    font-size: 1rem;
    margin-bottom: 10px;
}

.offline-info-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.offline-info-card li {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 6px 0;
    padding-left: 20px;
    position: relative;
}

.offline-info-card li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary-light);
}

/* Link Button */
.btn-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 10px;
    width: 100%;
    text-align: center;
    transition: var(--transition-fast);
}

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

.btn-link.danger {
    color: var(--error);
}

.btn-link.danger:hover {
    color: var(--error-light);
}

/* Offline Indicator */
.offline-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(239, 68, 68, 0.2);
    padding: 8px 15px;
    border-radius: var(--radius-full);
    margin-top: 15px;
    animation: fadeIn 0.3s ease;
}

.indicator-dot {
    width: 8px;
    height: 8px;
    background: var(--error);
    border-radius: 50%;
    animation: pulse-dot 1.5s infinite;
}

.indicator-text {
    font-size: 0.85rem;
    color: var(--error-light);
    font-weight: 500;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Responsive */
@media (max-width: 400px) {
    .difficulty-btns {
        grid-template-columns: 1fr;
    }

    .offline-card .stats-grid {
        flex-direction: column;
        gap: 15px;
    }
}

/* ==================== Leaderboard Screen ==================== */
.screen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0 10px;
}

.back-btn {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px;
}

.leaderboard-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding: 0 10px;
}

.leaderboard-tab {
    flex: 1;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.leaderboard-tab.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.user-rank-card {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    margin: 0 10px 20px;
    padding: 15px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow-md);
}

.rank-pos {
    font-size: 1.5rem;
    font-weight: bold;
    color: #FFD700;
}

.rank-info {
    flex: 1;
}

.rank-name {
    font-weight: bold;
    font-size: 1.1rem;
}

.rank-score {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.leaderboard-list {
    padding: 0 10px 80px; /* Bottom padding for mobile nav */
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    transition: var(--transition-fast);
}

.leaderboard-item.highlight {
    border: 1px solid var(--primary);
    background: rgba(139, 92, 246, 0.1);
}

.rank-badge {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--text-secondary);
}

.rank-badge.top-3 {
    font-size: 1.5rem;
}

.player-avatar {
    font-size: 1.5rem;
}

.player-info {
    flex: 1;
}

.player-name {
    font-weight: 600;
    color: var(--text-primary);
}

.player-level {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.player-score {
    font-weight: bold;
    color: var(--primary-light);
}

/* ==================== Daily Challenge Screen ==================== */
.daily-content {
    padding: 0 15px 40px;
}

.challenge-card {
    background: var(--card-gradient);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.date-badge {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.difficulty-badge {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: bold;
}

.bonus-banner {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent);
    padding: 10px;
    border-radius: var(--radius-sm);
    font-weight: bold;
    margin-bottom: 20px;
    display: inline-block;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.challenge-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 25px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat .icon {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.stat .val {
    font-weight: 600;
}

#start-daily-btn.completed {
    background: var(--success);
    cursor: default;
    transform: none;
    box-shadow: none;
}

.daily-leaderboard h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.mini-leaderboard {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    padding: 10px;
}

.mini-lb-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mini-lb-item:last-child {
    border-bottom: none;
}

.mini-lb-item .rank {
    width: 30px;
    color: var(--text-muted);
}

.mini-lb-item .name {
    flex: 1;
    color: var(--text-primary);
}

.mini-lb-item .score {
    font-weight: bold;
    color: var(--secondary);
}

.no-data {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
    font-style: italic;
}

/* ==================== Achievements Screen ==================== */
.achievement-summary {
    background: var(--card-gradient);
    margin: 0 15px 15px;
    padding: 20px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ach-summary-text {
    display: flex;
    flex-direction: column;
}

.ach-summary-text .label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.ach-summary-text .value {
    font-size: 2rem;
    font-weight: bold;
}

.ach-summary-chart {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 4px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-text {
    font-weight: bold;
    color: var(--primary);
}

.progress-bar-container {
    margin: 0 15px 20px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.5s ease;
}

.category-scroll {
    display: flex;
    overflow-x: auto;
    padding: 0 15px 20px;
    gap: 10px;
    scrollbar-width: none; /* Hide scrollbar Firefox */
}

.category-scroll::-webkit-scrollbar {
    display: none; /* Hide scrollbar Chrome/Safari */
}

.cat-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition-fast);
}

.cat-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.achievements-list {
    padding: 0 15px 40px;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    transition: var(--transition-fast);
    border: 1px solid transparent;
}

.achievement-item.locked {
    opacity: 0.7;
}

.achievement-item.unlocked {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.05);
}

.ach-icon-wrapper {
    position: relative;
}

.ach-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
}

.check-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: var(--success);
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #2d3436;
}

.ach-info {
    flex: 1;
}

.ach-name {
    font-weight: 600;
    margin-bottom: 2px;
}

.ach-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.2;
}

.ach-xp {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--primary-light);
}

.ach-progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.ach-progress-fill {
    height: 100%;
    background: var(--text-muted);
}

.ach-progress-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
    text-align: right;
}

/* Main Menu Grid Update */
.main-menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 30px 0;
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.menu-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 1.5rem;
}

.menu-btn span {
    font-size: 0.9rem;
    font-weight: 600;
}

.menu-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}



/* ==================== Enhanced Profile Styles ==================== */
.level-container {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.level-badge {
    background: var(--primary);
    color: white;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-weight: bold;
    font-size: 1.1rem;
    white-space: nowrap;
}

.xp-bar-container {
    flex: 1;
}

.xp-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.xp-progress {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 5px;
}

.xp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
    border-radius: var(--radius-full);
}

.xp-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: var(--radius-md);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stat-icon {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.streaks-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.streak-item {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: var(--radius-md);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.streak-icon {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.streak-val {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--white);
}

.streak-lbl {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

