/* --- NAVIGATION BUTTON --- */
#back-btn {
    /* position: absolute; REMOVED for unified header */
    /* top: 20px; */
    /* left: 20px; */
    /* z-index: 200; */
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-dim);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

#back-btn:hover {
    background: var(--text-main);
    color: #000;
    border-color: var(--text-main);
    transform: translateX(-3px);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

#back-btn .arrow {
    font-size: 1.1rem;
    transition: transform 0.3s;
}

#back-btn:hover .arrow {
    transform: translateX(-3px);
}



#back-btn.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

/* --- MUSIC CONTROLS --- */
#music-control-container {
    position: fixed;
    bottom: 20px;
    /* Moved to bottom to avoid header overlap */
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 200;
    align-items: flex-end;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 12px;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#music-control-container:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: var(--accent-gold);
}

.sound-control-group {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

#music-control-container:hover .sound-control-group {
    width: 150px;
    opacity: 1;
}

.sound-icon {
    font-size: 1.2rem;
    min-width: 25px;
    text-align: center;
}

.volume-slider {
    width: 100%;
    cursor: pointer;
    accent-color: var(--accent-gold);
    height: 6px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.2);
}

#music-toggle-btn {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-dim);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    z-index: 201;
}

#music-toggle-btn:hover {
    background: var(--text-main);
    color: #000;
    border-color: var(--text-main);
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

/* --- BUTTONS & CARDS --- */
.gaddar-btn,
.category-card,
.option-btn,
.difficulty-btn,
.mode-btn {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    touch-action: manipulation;
}

.gaddar-btn {
    background: linear-gradient(135deg, var(--accent-red), var(--accent-dark-red));
    color: #fff;
    border: none;
    padding: 1.2rem 3.5rem;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-radius: 50px;
    box-shadow: 0 10px 25px rgba(255, 59, 59, 0.3);
    position: relative;
    overflow: hidden;
}

.gaddar-btn.secondary {
    background: transparent;
    border: 2px solid var(--accent-gold);
    color: var(--accent-gold);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

.gaddar-btn.secondary:hover {
    background: var(--accent-gold);
    color: #000;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
}

.gaddar-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(255, 255, 255, 0.2), transparent);
    opacity: 0;
    transition: 0.3s;
}

.gaddar-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(255, 59, 59, 0.4);
}

.gaddar-btn:hover::before {
    opacity: 1;
}

/* --- CATEGORY CARDS --- */
.category-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 2rem 1.5rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.category-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
}

.category-card .icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
    transition: transform 0.3s;
}

.category-card:hover .icon {
    transform: scale(1.1);
}

.category-card .cat-name {
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: 1px;
    font-size: 1.1rem;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
    z-index: 2;
    position: relative;
}

/* --- INPUTS --- */
.gaddar-input,
.gaddar-select {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-family: var(--font-body);
    font-size: 1rem;
}

.gaddar-input:focus,
.gaddar-select:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

.gaddar-select {
    padding: 0.8rem 1rem;
    background: #111;
    /* Opaque background to prevent rendering issues */
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #fff;
}

.gaddar-select:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

.gaddar-select option {
    background-color: #000 !important;
    color: #fff !important;
    padding: 10px;
    text-shadow: none;
}

/* --- FEEDBACK STYLES (Added Fix) --- */
.option-btn.correct {
    background: rgba(0, 255, 0, 0.2) !important;
    border-color: #00ff00 !important;
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.4) !important;
    transform: scale(1.02);
}

.option-btn.correct .opt-badge {
    background: #00ff00;
    color: #000;
}

.option-btn.correct .opt-text {
    color: #fff;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.option-btn.wrong {
    background: rgba(255, 0, 0, 0.2) !important;
    border-color: #ff0000 !important;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.4) !important;
    transform: scale(0.98);
}

.option-btn.wrong .opt-badge {
    background: #ff0000;
    color: #fff;
}


/* --- SETTINGS BUTTON & MODAL --- */
#settings-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 300;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(5px);
}

#settings-btn:hover {
    transform: rotate(90deg) scale(1.1);
    background: var(--text-main);
    color: #000;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* --- SETTINGS MODAL --- */
.settings-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    z-index: 400;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 80px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.settings-modal:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.settings-content {
    width: 90%;
    max-width: 400px;
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    transform: translateY(-50px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.settings-modal:not(.hidden) .settings-content {
    transform: translateY(0);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

.settings-header h3 {
    margin: 0;
    font-family: var(--font-header);
    color: var(--accent-gold);
    font-size: 1.5rem;
    letter-spacing: 2px;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s;
}

.close-btn:hover {
    color: var(--accent-red);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 0.5rem 0;
}

.setting-col {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 70%;
}

.setting-col label {
    font-size: 1.1rem;
    font-weight: 600;
}

.setting-col .volume-slider {
    width: 100%;
}

/* --- SWITCH TOGGLE --- */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

input:checked+.slider {
    background-color: var(--accent-gold);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--accent-gold);
}

input:checked+.slider:before {
    transform: translateX(30px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* --- SELECT GROUP --- */
.setting-group {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.group-label {
    font-size: 0.9rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hint-text {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
}

.settings-footer {
    margin-top: 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    font-family: monospace;
}

/* --- SIDEBAR & TOGGLE --- */
/* Top Left Toggle Button */
.gaddar-icon-btn.top-left {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 20000;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);

    /* Enhanced Visibility */
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(20, 20, 20, 0.95), rgba(50, 0, 0, 0.9));
    border: 1px solid var(--accent-red);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.3);

    display: flex;
    /* Ensure centering */
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    /* Larger icon */
    color: #fff;
    cursor: pointer;

    animation: pulse-red 2s infinite;
    /* Subtle pulse */
}

.gaddar-icon-btn.top-left:hover {
    transform: scale(1.1);
    box-shadow: 0 0 25px rgba(255, 0, 0, 0.6);
    background: linear-gradient(135deg, rgba(40, 0, 0, 1), rgba(80, 0, 0, 1));
}

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

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

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

.gaddar-icon-btn.top-left.shifted-down {
    top: 80px;
    /* Below the back button */
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 29999;
    /* Below sidebar, above everything else */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Sidebar Drawer */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 300px;
    /* Default width */
    max-width: 80%;
    background: rgba(10, 10, 10, 0.95);
    border-right: none;
    /* Removed based on user feedback */
    z-index: 30000;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
    /* Dark Scrollbar */
}

/* Hide scrollbar for Chrome/Safari/Edge */
.app-sidebar::-webkit-scrollbar {
    width: 6px;
}

.app-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.app-sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.app-sidebar.active {
    transform: translateX(0);
}

/* Sidebar Header */
.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    margin: 0;
    color: var(--accent-gold);
    font-family: var(--font-heading);
    letter-spacing: 2px;
}

/* Sidebar Content */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-section h4 {
    color: var(--accent-red);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 59, 59, 0.3);
    padding-bottom: 0.5rem;
    display: inline-block;
}

.sidebar-section p {
    color: var(--text-dim);
    line-height: 1.6;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.sidebar-section .highlight-text {
    color: #fff;
    font-style: italic;
    border-left: 3px solid var(--accent-gold);
    padding-left: 1rem;
}

/* Sidebar List */
.sidebar-list {
    list-style: none;
    padding: 0;
}

.sidebar-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    font-size: 0.9rem;
}

.sidebar-list li span:first-child {
    color: #fff;
    font-weight: 600;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1.5rem;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.faded {
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.8rem;
}

/* Fun Fact Box */
.fun-fact-box {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid var(--accent-gold);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 2rem;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.fun-fact-box .fact-icon {
    position: absolute;
    top: -10px;
    /* Adjusted top */
    left: -10px;
    /* Move more to corner */
    font-size: 1.5rem;
    background: #000;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--accent-gold);
    z-index: 2;
}

#fun-fact-text {
    font-size: 0.95rem;
    /* Slightly larger */
    color: #ffd700;
    line-height: 1.5;
    font-style: italic;
    margin: 0;
    padding-left: 10px;
    /* Add padding to prevent text hitting icon area if wrapped */
    text-indent: 15px;
    /* Indent first line for the icon */
}

/* Sidebar Menu Buttons */
.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 2rem;
    width: 100%;
}

.sidebar-nav-btn {
    background: linear-gradient(90deg, rgba(20, 20, 20, 0.9), rgba(40, 40, 40, 0.8));
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
    padding: 1.2rem;
    text-align: left;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    font-family: var(--font-heading);
    letter-spacing: 1px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.sidebar-nav-btn:hover {
    background: linear-gradient(90deg, rgba(50, 0, 0, 0.9), rgba(80, 0, 0, 0.8));
    border-color: var(--accent-red);
    color: #fff;
    transform: translateX(8px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5);
}

.sidebar-nav-btn .icon {
    font-size: 1.5rem;
    opacity: 0.8;
    transition: transform 0.3s;
}

.sidebar-nav-btn:hover .icon {
    transform: scale(1.1);
    opacity: 1;
    color: var(--accent-red);
}