/* Tome System Styling - Dark Fantasy Theme */

/* Tome Screen Overlay */
.tome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.5s ease-out;
}

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

/* Main Tome Container */
.tome-container {
    width: 90%;
    max-width: 1200px;
    height: 85%;
    background: linear-gradient(135deg, #2a1810 0%, #3d251a 50%, #2a1810 100%);
    border: 3px solid #8b4513;
    border-radius: 15px;
    box-shadow: 
        0 0 50px rgba(139, 69, 19, 0.6),
        inset 0 0 20px rgba(0, 0, 0, 0.8);
    position: relative;
    overflow: hidden;
    animation: bookOpen 0.8s ease-out;
}

/* Tome Header */
.tome-header {
    background: linear-gradient(90deg, #1a0f0a 0%, #3d251a 50%, #1a0f0a 100%);
    padding: 20px;
    text-align: center;
    border-bottom: 2px solid #8b4513;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.tome-title {
    font-family: 'SFPixelate', 'Serif', 'Times New Roman', serif;
    font-size: 32px;
    color: #dda0dd;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(221, 160, 221, 0.3);
    margin: 0;
    letter-spacing: 2px;
}

/* Header Info Layout */
.header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    gap: 30px;
}

/* Build Button Container in Header */
.build-button-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-build-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #228b22 0%, #006400 100%);
    border: none;
    border-radius: 25px;
    color: white;
    cursor: var(--cm-cursor-action, pointer);
    font-family: 'Serif', serif;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 
        0 4px 15px rgba(34, 139, 34, 0.4),
        0 0 20px rgba(34, 139, 34, 0.2);
}

.header-build-btn:hover:where(body:not(.gamepad-active) *) {
    background: linear-gradient(135deg, #32cd32 0%, #228b22 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 6px 20px rgba(34, 139, 34, 0.6),
        0 0 25px rgba(34, 139, 34, 0.4);
}

.header-build-btn:active {
    transform: translateY(0) scale(1.02);
}

.header-build-btn.disabled {
    background: linear-gradient(135deg, #666 0%, #444 100%);
    cursor: var(--cm-cursor-disabled, not-allowed);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transform: none;
}

.header-build-btn.disabled:hover:where(body:not(.gamepad-active) *) {
    background: linear-gradient(135deg, #666 0%, #444 100%);
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.header-build-btn.pulsing {
    animation: headerBtnPulse 2s ease-in-out infinite;
}

.header-build-btn.gamepad-selected {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 6px 20px rgba(255, 215, 0, 0.6),
        0 0 25px rgba(255, 215, 0, 0.4);
    border: 2px solid #ffd700;
}

.build-icon {
    font-size: 18px;
    line-height: 1;
}

.build-text {
    font-size: 14px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.build-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: linear-gradient(135deg, #ffd700 0%, #daa520 100%);
    color: #000;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    text-shadow: none;
}

@keyframes headerBtnPulse {
    0%, 100% { 
        box-shadow: 
            0 4px 15px rgba(34, 139, 34, 0.4),
            0 0 20px rgba(34, 139, 34, 0.2);
    }
    50% { 
        box-shadow: 
            0 6px 20px rgba(34, 139, 34, 0.6),
            0 0 25px rgba(34, 139, 34, 0.4);
    }
}

.souls-display {
    font-size: 18px;
    color: #ffd700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
}

.souls-display .soul-icon {
    color: #87ceeb;
    margin-right: 5px;
}

/* Progress Display in Header */
.progress-display {
    flex: 1;
    max-width: 300px;
}

.progress-label {
    font-size: 14px;
    color: #dda0dd;
    margin-bottom: 5px;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.progress-display .progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(139, 69, 19, 0.3);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(139, 69, 19, 0.5);
}

.progress-display .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8a2be2, #dda0dd);
    border-radius: 3px;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(138, 43, 226, 0.4);
}

/* Tome Content Area */
.tome-content {
    display: flex;
    height: calc(100% - 120px);
}

/* Chapter Navigation */
.chapter-nav {
    width: 200px;
    background: linear-gradient(180deg, #1a0f0a 0%, #2a1810 100%);
    border-right: 2px solid #8b4513;
    padding: 20px 10px;
    overflow-y: auto;
}

.chapter-nav::-webkit-scrollbar {
    width: 8px;
}

.chapter-nav::-webkit-scrollbar-track {
    background: rgba(139, 69, 19, 0.2);
}

.chapter-nav::-webkit-scrollbar-thumb {
    background: #8b4513;
    border-radius: 4px;
}

.chapter-nav::-webkit-scrollbar-thumb:hover {
    background: #a0522d;
}

.chapter-tab {
    display: block;
    width: 100%;
    padding: 15px 10px;
    margin-bottom: 5px;
    background: linear-gradient(135deg, #3d251a 0%, #2a1810 100%);
    border: 1px solid #8b4513;
    border-radius: 8px;
    color: #ddd;
    font-family: 'SFPixelate', 'Serif', serif;
    font-size: 14px;
    text-align: center;
    cursor: var(--cm-cursor-action, pointer);
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.chapter-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(221, 160, 221, 0.1), transparent);
    transition: left 0.5s ease;
}

.chapter-tab:hover:where(body:not(.gamepad-active) *) {
    background: linear-gradient(135deg, #4a2f20 0%, #3d251a 100%);
    color: #dda0dd;
    box-shadow: 0 0 10px rgba(221, 160, 221, 0.3);
    transform: translateY(-2px);
}

.chapter-tab:hover:where(body:not(.gamepad-active) *)::before {
    left: 100%;
}

.chapter-tab.active {
    background: linear-gradient(135deg, #8a2be2 0%, #6a1b9a 100%);
    color: #fff;
    box-shadow: 
        0 0 15px rgba(138, 43, 226, 0.5),
        inset 0 0 10px rgba(255, 255, 255, 0.1);
}

.chapter-tab.gamepad-selected {
    background: linear-gradient(135deg, #4a2f20 0%, #3d251a 100%);
    color: #ffd700;
    border: 2px solid #ffd700;
    box-shadow: 
        0 0 15px rgba(255, 215, 0, 0.5),
        0 0 25px rgba(255, 215, 0, 0.3);
    transform: translateY(-2px) scale(1.02);
}

.chapter-tab.gamepad-selected.active {
    background: linear-gradient(135deg, #8a2be2 0%, #6a1b9a 100%);
    border: 2px solid #ffd700;
    box-shadow: 
        0 0 15px rgba(255, 215, 0, 0.6),
        0 0 25px rgba(138, 43, 226, 0.4);
}

.chapter-progress {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

/* Spell Grid Area */
.spell-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 50 50"><rect width="50" height="50" fill="%23241810"/><path d="M0 0L50 50M50 0L0 50" stroke="%23342218" stroke-width="0.5" opacity="0.3"/></svg>');
}

.spell-area::-webkit-scrollbar {
    width: 12px;
}

.spell-area::-webkit-scrollbar-track {
    background: rgba(139, 69, 19, 0.2);
}

.spell-area::-webkit-scrollbar-thumb {
    background: #8b4513;
    border-radius: 6px;
}

.spell-area::-webkit-scrollbar-thumb:hover {
    background: #a0522d;
}

.chapter-info {
    margin-bottom: 30px;
    text-align: center;
}

.chapter-info h2 {
    font-family: 'Serif', serif;
    font-size: 28px;
    color: #dda0dd;
    margin: 0 0 10px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.chapter-description {
    color: #ccc;
    font-style: italic;
    font-size: 16px;
    line-height: 1.4;
}

/* Spell Grid */
.spell-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Spell Card */
.spell-card {
    background: linear-gradient(135deg, #2a1810 0%, #3d251a 100%);
    border: 2px solid #8b4513;
    border-radius: 12px;
    padding: 20px;
    position: relative;
    transition: all 0.3s ease;
    cursor: var(--cm-cursor-action, pointer);
    overflow: hidden;
}

.spell-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, transparent, rgba(221, 160, 221, 0.3), transparent);
    border-radius: 12px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.spell-card:hover:where(body:not(.gamepad-active) *)::before {
    opacity: 1;
}

.spell-card.unlocked {
    border-color: #228b22;
    background: linear-gradient(135deg, #1a2a1a 0%, #2a3d2a 100%);
}

.spell-card.can-unlock {
    border-color: #ffd700;
    background: linear-gradient(135deg, #2a2a1a 0%, #3d3d2a 100%);
    animation: glow 2s ease-in-out infinite alternate;
}

.spell-card.locked {
    opacity: 0.6;
    border-color: #666;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
}

.spell-card:hover:where(body:not(.gamepad-active) *):not(.locked) {
    transform: translateY(-5px);
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(221, 160, 221, 0.3);
}

.spell-card.gamepad-selected {
    transform: translateY(-5px);
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.5),
        0 0 25px rgba(255, 215, 0, 0.6);
    border-color: #ffd700;
    background: linear-gradient(135deg, #3d2810 0%, #4a351a 100%);
}

.spell-card.gamepad-selected.locked {
    opacity: 0.8;
    box-shadow: 
        0 5px 15px rgba(0, 0, 0, 0.3),
        0 0 15px rgba(255, 215, 0, 0.3);
}

/* Spell Icon Container */
.spell-icon-container {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(139, 69, 19, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
}

.spell-icon {
    width: 46px;
    height: 46px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.spell-card:hover:where(body:not(.gamepad-active) *) .spell-icon-container {
    border-color: rgba(221, 160, 221, 0.8);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 10px rgba(221, 160, 221, 0.3);
}

.spell-card.unlocked .spell-icon-container {
    border-color: rgba(34, 139, 34, 0.8);
    background: rgba(0, 50, 0, 0.3);
    box-shadow: 0 0 8px rgba(34, 139, 34, 0.4);
}

.spell-card.can-unlock .spell-icon-container {
    border-color: rgba(255, 215, 0, 0.8);
    background: rgba(50, 50, 0, 0.3);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
    animation: iconGlow 2s ease-in-out infinite alternate;
}

.spell-card.locked .spell-icon-container {
    border-color: rgba(102, 102, 102, 0.5);
    background: rgba(0, 0, 0, 0.6);
}

.spell-card.gamepad-selected .spell-icon-container {
    border-color: rgba(255, 215, 0, 1);
    background: rgba(80, 60, 0, 0.4);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

@keyframes iconGlow {
    from { 
        box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
    }
    to { 
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.7);
    }
}

/* Spell Card Content */
.spell-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    margin-left: 60px; /* Make room for icon */
}

.spell-name {
    font-family: 'SFPixelate', 'Serif', serif;
    font-size: 20px;
    color: #dda0dd;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.spell-cost {
    background: linear-gradient(135deg, #4a0e4e 0%, #2a0a2e 100%);
    color: #87ceeb;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
}

.spell-description {
    color: #ccc;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 15px;
}

.spell-lore {
    color: #999;
    font-style: italic;
    font-size: 12px;
    line-height: 1.3;
    margin-bottom: 15px;
    border-left: 3px solid #8b4513;
    padding-left: 10px;
    opacity: 0.8;
}

/* Prerequisites */
.spell-prerequisites {
    margin-bottom: 15px;
}

.prerequisites-label {
    font-size: 12px;
    color: #999;
    margin-bottom: 5px;
}

.prerequisite-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.prerequisite-spell {
    background: rgba(139, 69, 19, 0.3);
    color: #ddd;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 12px;
    border: 1px solid #8b4513;
}

.prerequisite-spell.unlocked {
    background: rgba(34, 139, 34, 0.3);
    border-color: #228b22;
    color: #90ee90;
}

/* Spell Actions */
.spell-actions {
    display: flex;
    justify-content: center;
    margin-top: 15px;
}

.unlock-btn {
    background: linear-gradient(135deg, #ffd700 0%, #daa520 100%);
    color: #000;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    cursor: var(--cm-cursor-action, pointer);
    transition: all 0.3s ease;
    font-size: 14px;
    text-shadow: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.unlock-btn:hover:where(body:not(.gamepad-active) *) {
    background: linear-gradient(135deg, #ffed4e 0%, #e6b800 100%);
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.4);
}

.unlock-btn:disabled {
    background: linear-gradient(135deg, #666 0%, #444 100%);
    color: #999;
    cursor: var(--cm-cursor-disabled, not-allowed);
    transform: none;
}

.unlocked-label {
    background: linear-gradient(135deg, #228b22 0%, #006400 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Close Button */
.tome-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #8b0000 0%, #660000 100%);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: var(--cm-cursor-action, pointer);
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.tome-close:hover:where(body:not(.gamepad-active) *) {
    background: linear-gradient(135deg, #a00 0%, #800 100%);
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.4);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes bookOpen {
    from {
        transform: scale3d(0.8, 0.8, 1) rotateY(-15deg);
        opacity: 0;
    }
    to {
        transform: scale3d(1, 1, 1) rotateY(0deg);
        opacity: 1;
    }
}

@keyframes glow {
    from { 
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
    }
    to { 
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    }
}

/* Progress Indicator */
.tome-progress {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 15px;
    color: #ddd;
    font-size: 14px;
    border: 1px solid #8b4513;
}

.progress-bar {
    width: 200px;
    height: 6px;
    background: rgba(139, 69, 19, 0.3);
    border-radius: 3px;
    margin: 5px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8a2be2, #dda0dd);
    border-radius: 3px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
}

/* Responsive Design */
@media (max-width: 768px) {
    .tome-container {
        width: 95%;
        height: 90%;
    }
    
    .tome-content {
        flex-direction: column;
    }
    
    .chapter-nav {
        width: 100%;
        height: 120px;
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 10px;
    }
    
    .chapter-tab {
        min-width: 120px;
        margin-right: 10px;
        margin-bottom: 0;
    }
    
    .spell-grid {
        grid-template-columns: 1fr;
    }
    
    .tome-title {
        font-size: 24px;
    }
}

/* Responsive Header */
@media (max-width: 768px) {
    .header-info {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .progress-display {
        max-width: 250px;
    }
    
    .header-build-btn {
        padding: 10px 16px;
        font-size: 12px;
    }
    
    .build-icon {
        font-size: 16px;
    }
    
    .build-text {
        font-size: 12px;
    }
    
    .build-badge {
        width: 20px;
        height: 20px;
        font-size: 12px;
        top: -3px;
        right: -3px;
    }
}

/* Gamepad Navigation Hints */
.gamepad-hints {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #8b4513;
    border-radius: 12px;
    padding: 15px;
    font-family: 'Serif', serif;
    font-size: 12px;
    color: #dda0dd;
    box-shadow: 
        0 0 20px rgba(0, 0, 0, 0.7),
        inset 0 0 10px rgba(139, 69, 19, 0.2);
    animation: fadeInHints 0.5s ease-out;
}

.gamepad-hints .hint-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    color: #ccc;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
}

.gamepad-hints .hint-item:last-child {
    margin-bottom: 0;
}

.gamepad-hints .hint-item:first-child {
    color: #ffd700;
    font-weight: bold;
    border-bottom: 1px solid rgba(139, 69, 19, 0.5);
    padding-bottom: 8px;
    margin-bottom: 12px;
}

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

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .spell-card,
    .chapter-tab,
    .unlock-btn,
    .build-fab {
        transition: none;
    }
    
    .spell-card.can-unlock {
        animation: none;
        border-color: #ffd700;
    }
    
    .build-fab.pulsing {
        animation: none;
    }
    
    .tome-container {
        animation: none;
    }
    
    .gamepad-hints {
        animation: none;
    }
}

/* Responsive Gamepad Hints */
@media (max-width: 768px) {
    .gamepad-hints {
        bottom: 10px;
        right: 10px;
        font-size: 12px;
        padding: 12px;
    }
    
    .gamepad-hints .hint-item {
        margin-bottom: 6px;
    }
    
    .gamepad-hints .hint-item:first-child {
        padding-bottom: 6px;
        margin-bottom: 8px;
    }
}

/* Reset Progress Button */
.header-reset-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #dc143c 0%, #8b0000 100%);
    border: none;
    border-radius: 25px;
    color: white;
    cursor: var(--cm-cursor-action, pointer);
    font-family: 'Serif', serif;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 15px rgba(220, 20, 60, 0.4),
        0 0 20px rgba(220, 20, 60, 0.2);
}

.header-reset-btn:hover:where(body:not(.gamepad-active) *) {
    background: linear-gradient(135deg, #ff1447 0%, #dc143c 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 6px 20px rgba(220, 20, 60, 0.6),
        0 0 25px rgba(220, 20, 60, 0.4);
}

.header-reset-btn:active {
    transform: translateY(0) scale(1.02);
}

.header-reset-btn.gamepad-selected {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 6px 20px rgba(255, 215, 0, 0.6),
        0 0 25px rgba(255, 215, 0, 0.4);
    border: 2px solid #ffd700;
}

.reset-icon {
    font-size: 18px;
    line-height: 1;
}

.reset-text {
    font-size: 14px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Reset Progress Confirmation Popup */
.reset-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 20000;
    display: none;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease-out;
}

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

.reset-container {
    width: 90%;
    max-width: 500px;
    background: linear-gradient(135deg, #2a0a0a 0%, #4a1a1a 50%, #2a0a0a 100%);
    border: 3px solid #dc143c;
    border-radius: 20px;
    box-shadow: 
        0 0 50px rgba(220, 20, 60, 0.6),
        inset 0 0 20px rgba(0, 0, 0, 0.8);
    position: relative;
    overflow: hidden;
    animation: resetPopupShow 0.4s ease-out;
}

.reset-header {
    background: linear-gradient(90deg, #1a0505 0%, #4a1a1a 50%, #1a0505 100%);
    padding: 20px;
    text-align: center;
    border-bottom: 2px solid #dc143c;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    position: relative;
}

.reset-title {
    font-family: 'Serif', 'Times New Roman', serif;
    font-size: 24px;
    color: #ff6b6b;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(255, 107, 107, 0.3);
    margin: 0;
    letter-spacing: 1px;
}

.reset-warning-icon {
    font-size: 48px;
    color: #ffd700;
    margin-top: 10px;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    animation: warningPulse 2s ease-in-out infinite;
}

.reset-content {
    padding: 30px;
    text-align: center;
}

.reset-message {
    font-size: 18px;
    color: #ff6b6b;
    margin: 0 0 20px 0;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.reset-details {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #dc143c;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    text-align: left;
}

.reset-detail-item {
    color: #ccc;
    font-size: 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.reset-detail-item:last-child {
    margin-bottom: 0;
}

.reset-warning {
    color: #ffd700;
    font-size: 16px;
    font-weight: bold;
    margin: 20px 0 0 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.reset-actions {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 30px 30px 30px;
}

.reset-btn {
    flex: 1;
    padding: 15px 20px;
    border: none;
    border-radius: 25px;
    font-family: 'Serif', serif;
    font-weight: bold;
    font-size: 16px;
    cursor: var(--cm-cursor-action, pointer);
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.reset-btn.cancel {
    background: linear-gradient(135deg, #666 0%, #333 100%);
    color: white;
    box-shadow: 
        0 4px 15px rgba(102, 102, 102, 0.4),
        0 0 20px rgba(102, 102, 102, 0.2);
}

.reset-btn.cancel:hover:where(body:not(.gamepad-active) *) {
    background: linear-gradient(135deg, #777 0%, #444 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 6px 20px rgba(102, 102, 102, 0.6),
        0 0 25px rgba(102, 102, 102, 0.4);
}

.reset-btn.confirm {
    background: linear-gradient(135deg, #dc143c 0%, #8b0000 100%);
    color: white;
    box-shadow: 
        0 4px 15px rgba(220, 20, 60, 0.4),
        0 0 20px rgba(220, 20, 60, 0.2);
}

.reset-btn.confirm:hover:where(body:not(.gamepad-active) *) {
    background: linear-gradient(135deg, #ff1447 0%, #dc143c 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 6px 20px rgba(220, 20, 60, 0.6),
        0 0 25px rgba(220, 20, 60, 0.4);
}

.reset-btn.gamepad-selected {
    transform: translateY(-2px) scale(1.05);
    border: 2px solid #ffd700;
    box-shadow: 
        0 6px 20px rgba(255, 215, 0, 0.6),
        0 0 25px rgba(255, 215, 0, 0.4);
}

.reset-btn:active {
    transform: translateY(0) scale(1.02);
}

.btn-text {
    position: relative;
    z-index: 1;
}

/* Reset Popup Animations */
@keyframes resetPopupShow {
    from {
        transform: scale3d(0.8, 0.8, 1);
        opacity: 0;
    }
    to {
        transform: scale3d(1, 1, 1);
        opacity: 1;
    }
}

@keyframes warningPulse {
    0%, 100% {
        transform: scale3d(1, 1, 1);
        opacity: 1;
    }
    50% {
        transform: scale3d(1.1, 1.1, 1);
        opacity: 0.8;
    }
}

/* Responsive Reset Popup */
@media (max-width: 768px) {
    .reset-container {
        width: 95%;
        max-width: 400px;
    }
    
    .reset-title {
        font-size: 20px;
    }
    
    .reset-warning-icon {
        font-size: 36px;
    }
    
    .reset-message {
        font-size: 16px;
    }
    
    .reset-actions {
        flex-direction: column;
        gap: 15px;
    }
    
    .reset-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .reset-content {
        padding: 20px;
    }
    
    .reset-detail-item {
        font-size: 13px;
    }
}

/* Unlock All Button */
.header-unlock-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #228b22 0%, #006400 100%);
    border: none;
    border-radius: 25px;
    color: white;
    cursor: var(--cm-cursor-action, pointer);
    font-family: 'Serif', serif;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 15px rgba(34, 139, 34, 0.4),
        0 0 20px rgba(34, 139, 34, 0.2);
}

.header-unlock-btn:hover:where(body:not(.gamepad-active) *) {
    background: linear-gradient(135deg, #32cd32 0%, #228b22 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 6px 20px rgba(34, 139, 34, 0.6),
        0 0 25px rgba(34, 139, 34, 0.4);
}

.header-unlock-btn:active {
    transform: translateY(0) scale(1.02);
}

.header-unlock-btn.gamepad-selected {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 6px 20px rgba(255, 215, 0, 0.6),
        0 0 25px rgba(255, 215, 0, 0.4);
    border: 2px solid #ffd700;
}

.unlock-icon {
    font-size: 18px;
    line-height: 1;
}

.unlock-text {
    font-size: 14px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Unlock All Confirmation Popup */
.unlock-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 20000;
    display: none;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease-out;
}

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

.unlock-container {
    width: 90%;
    max-width: 500px;
    background: linear-gradient(135deg, #0a2a0a 0%, #1a4a1a 50%, #0a2a0a 100%);
    border: 3px solid #228b22;
    border-radius: 20px;
    box-shadow: 
        0 0 50px rgba(34, 139, 34, 0.6),
        inset 0 0 20px rgba(0, 0, 0, 0.8);
    position: relative;
    overflow: hidden;
    animation: unlockPopupShow 0.4s ease-out;
}

.unlock-header {
    background: linear-gradient(90deg, #051a05 0%, #1a4a1a 50%, #051a05 100%);
    padding: 20px;
    text-align: center;
    border-bottom: 2px solid #228b22;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    position: relative;
}

.unlock-title {
    font-family: 'Serif', 'Times New Roman', serif;
    font-size: 24px;
    color: #90ee90;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(144, 238, 144, 0.3);
    margin: 0;
    letter-spacing: 1px;
}

.unlock-success-icon {
    font-size: 48px;
    color: #ffd700;
    margin-top: 10px;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    animation: successPulse 2s ease-in-out infinite;
}

.unlock-content {
    padding: 30px;
    text-align: center;
}

.unlock-message {
    font-size: 18px;
    color: #90ee90;
    margin: 0 0 20px 0;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.unlock-details {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #228b22;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    text-align: left;
}

.unlock-detail-item {
    color: #ccc;
    font-size: 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.unlock-detail-item:last-child {
    margin-bottom: 0;
}

.unlock-note {
    color: #ffd700;
    font-size: 16px;
    font-weight: bold;
    margin: 20px 0 0 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.unlock-actions {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 30px 30px 30px;
}

.unlock-btn {
    flex: 1;
    padding: 15px 20px;
    border: none;
    border-radius: 25px;
    font-family: 'Serif', serif;
    font-weight: bold;
    font-size: 16px;
    cursor: var(--cm-cursor-action, pointer);
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.unlock-btn.cancel {
    background: linear-gradient(135deg, #666 0%, #333 100%);
    color: white;
    box-shadow: 
        0 4px 15px rgba(102, 102, 102, 0.4),
        0 0 20px rgba(102, 102, 102, 0.2);
}

.unlock-btn.cancel:hover:where(body:not(.gamepad-active) *) {
    background: linear-gradient(135deg, #777 0%, #444 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 6px 20px rgba(102, 102, 102, 0.6),
        0 0 25px rgba(102, 102, 102, 0.4);
}

.unlock-btn.confirm {
    background: linear-gradient(135deg, #228b22 0%, #006400 100%);
    color: white;
    box-shadow: 
        0 4px 15px rgba(34, 139, 34, 0.4),
        0 0 20px rgba(34, 139, 34, 0.2);
}

.unlock-btn.confirm:hover:where(body:not(.gamepad-active) *) {
    background: linear-gradient(135deg, #32cd32 0%, #228b22 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 6px 20px rgba(34, 139, 34, 0.6),
        0 0 25px rgba(34, 139, 34, 0.4);
}

.unlock-btn.gamepad-selected {
    transform: translateY(-2px) scale(1.05);
    border: 2px solid #ffd700;
    box-shadow: 
        0 6px 20px rgba(255, 215, 0, 0.6),
        0 0 25px rgba(255, 215, 0, 0.4);
}

.unlock-btn:active {
    transform: translateY(0) scale(1.02);
}

/* Unlock Popup Animations */
@keyframes unlockPopupShow {
    from {
        transform: scale3d(0.8, 0.8, 1);
        opacity: 0;
    }
    to {
        transform: scale3d(1, 1, 1);
        opacity: 1;
    }
}

@keyframes successPulse {
    0%, 100% {
        transform: scale3d(1, 1, 1);
        opacity: 1;
    }
    50% {
        transform: scale3d(1.1, 1.1, 1);
        opacity: 0.8;
    }
}

/* Responsive Unlock Popup */
@media (max-width: 768px) {
    .unlock-container {
        width: 95%;
        max-width: 400px;
    }
    
    .unlock-title {
        font-size: 20px;
    }
    
    .unlock-success-icon {
        font-size: 36px;
    }
    
    .unlock-message {
        font-size: 16px;
    }
    
    .unlock-actions {
        flex-direction: column;
        gap: 15px;
    }
    
    .unlock-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .unlock-content {
        padding: 20px;
    }
    
    .unlock-detail-item {
        font-size: 13px;
    }
}
