* {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            overflow: hidden;
            background: #1a1a2e;
            font-family: 'Cinzel', 'MedievalSharp', 'Georgia', serif;
        }
        
        canvas {
            display: block;
        }
        
        /* Modal Overlay */
        #modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 1000;
            transition: opacity 0.3s ease;
        }
        
        #modal-overlay.visible {
            display: flex;
            opacity: 1;
        }
        
        #modal-overlay.hidden {
            opacity: 0;
        }
        
        .modal-content {
            background: 
                linear-gradient(135deg, rgba(244, 228, 193, 0.9) 0%, rgba(234, 218, 183, 0.9) 50%, rgba(244, 228, 193, 0.9) 100%),
                repeating-linear-gradient(
                    0deg,
                    transparent,
                    transparent 2px,
                    rgba(139, 115, 85, 0.03) 2px,
                    rgba(139, 115, 85, 0.03) 4px
                ),
                url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
            background-color: #f4e4c1;
            border: 6px double #5c3317;
            border-radius: 12px;
            padding: 30px;
            max-width: 400px;
            text-align: center;
            box-shadow: 
                0 0 0 3px #d4af37,
                0 15px 50px rgba(0, 0, 0, 0.8),
                0 5px 20px rgba(92, 51, 23, 0.6),
                inset 0 2px 10px rgba(255, 255, 255, 0.3);
            position: relative;
        }
        
        .modal-content::before {
            content: '';
            position: absolute;
            top: -3px;
            left: -3px;
            right: -3px;
            bottom: -3px;
            border: 2px solid #d4af37;
            border-radius: 12px;
            pointer-events: none;
        }
        
        .modal-content h2 {
            color: #5c3317;
            margin-bottom: 15px;
            font-size: 24px;
            font-family: 'Cinzel', serif;
            font-weight: 600;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
        }
        
        .modal-content p {
            color: #3e2723;
            margin-bottom: 20px;
            font-size: 16px;
            line-height: 1.5;
            font-family: 'Cinzel', serif;
        }

        .modal-actions {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 12px;
        }

        .modal-action-buttons {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
            width: 100%;
        }

        .modal-action-buttons .modal-button {
            width: 100%;
        }
        
        .modal-button {
            background: 
                linear-gradient(135deg, #8b4513 0%, #6b3410 50%, #5c2e0a 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            color: #f4e4c1;
            border: 3px solid #5c2e0a;
            border-top: 2px solid #a0522d;
            border-bottom: 4px solid #3d1f0a;
            padding: 12px 24px;
            font-size: 16px;
            cursor: pointer;
            border-radius: 6px;
            font-family: 'Cinzel', serif;
            font-weight: 600;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
            box-shadow: 
                0 4px 8px rgba(0, 0, 0, 0.6),
                0 2px 4px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
            transition: all 0.2s ease;
            position: relative;
        }
        
        .modal-button:hover {
            background: 
                linear-gradient(135deg, #a0522d 0%, #8b4513 50%, #6b3410 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            transform: translateY(2px);
            box-shadow: 
                0 2px 4px rgba(0, 0, 0, 0.6),
                0 1px 2px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
            border-bottom: 2px solid #3d1f0a;
        }
        
        .modal-button:active {
            transform: translateY(3px);
            box-shadow: 
                0 1px 2px rgba(0, 0, 0, 0.6),
                inset 0 2px 4px rgba(0, 0, 0, 0.3);
        }

        .summary-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 2504;
            transition: opacity 0.3s ease;
        }

        .summary-modal.visible {
            display: flex;
            opacity: 1;
        }

        .summary-modal.hidden {
            opacity: 0;
        }

        .summary-content {
            background: 
                linear-gradient(135deg, rgba(244, 228, 193, 0.95) 0%, rgba(234, 218, 183, 0.95) 50%, rgba(244, 228, 193, 0.95) 100%),
                repeating-linear-gradient(
                    0deg,
                    transparent,
                    transparent 2px,
                    rgba(139, 115, 85, 0.03) 2px,
                    rgba(139, 115, 85, 0.03) 4px
                );
            background-color: #f4e4c1;
            border: 6px double #5c3317;
            border-radius: 12px;
            padding: 28px;
            max-width: 520px;
            width: 90%;
            max-height: 80vh;
            overflow-y: auto;
            box-shadow: 
                0 0 0 3px #d4af37,
                0 15px 50px rgba(0, 0, 0, 0.8),
                0 5px 20px rgba(92, 51, 23, 0.6);
            text-align: center;
        }

        .summary-content h2 {
            color: #5c3317;
            margin-bottom: 16px;
            font-size: 22px;
            font-family: 'Cinzel', serif;
        }

        .summary-body {
            text-align: left;
            display: grid;
            gap: 10px;
            font-family: 'Georgia', serif;
            color: #3e2723;
            font-size: 14px;
        }

        .summary-body strong {
            color: #5c3317;
        }

        .summary-actions {
            margin-top: 18px;
            display: flex;
            justify-content: center;
        }

        .summary-content::-webkit-scrollbar {
            width: 10px;
        }

        .summary-content::-webkit-scrollbar-track {
            background: rgba(92, 51, 23, 0.15);
            border-radius: 8px;
            border: 1px solid rgba(92, 51, 23, 0.3);
        }

        .summary-content::-webkit-scrollbar-thumb {
            background: linear-gradient(180deg, #c8b08b 0%, #8b7355 100%);
            border-radius: 8px;
            border: 2px solid rgba(92, 51, 23, 0.35);
        }

        .summary-content::-webkit-scrollbar-thumb:hover {
            background: linear-gradient(180deg, #d6c09a 0%, #a0866b 100%);
        }
        
        .close-modal {
            background: 
                linear-gradient(135deg, #654321 0%, #4a2c1a 50%, #3d1f0a 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            border: 3px solid #3d1f0a;
            border-top: 2px solid #654321;
            border-bottom: 4px solid #2a1508;
            margin-left: 10px;
            box-shadow: 
                0 4px 8px rgba(0, 0, 0, 0.6),
                0 2px 4px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
        }
        
        .close-modal:hover {
            background: 
                linear-gradient(135deg, #8b4513 0%, #654321 50%, #4a2c1a 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            transform: translateY(2px);
            box-shadow: 
                0 2px 4px rgba(0, 0, 0, 0.6),
                0 1px 2px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
            border-bottom: 2px solid #2a1508;
        }
        
        /* Structure Tooltip */
        .structure-tooltip {
            position: fixed;
            background: rgba(42, 42, 64, 0.95);
            border: 2px solid #8b7355;
            border-radius: 6px;
            padding: 12px;
            color: #ffffff;
            font-family: 'Cinzel', serif;
            font-size: 13px;
            pointer-events: none;
            z-index: 10002;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
            display: none;
            max-width: 280px;
        }
        
        .structure-tooltip.visible {
            display: block;
        }
        
        .structure-tooltip .tooltip-title {
            font-weight: bold;
            margin-bottom: 8px;
            color: #f4e4c1;
            border-bottom: 2px solid #5c4a35;
            padding-bottom: 5px;
            font-size: 15px;
        }
        
        .structure-tooltip .tooltip-current {
            margin: 8px 0;
            padding: 6px;
            background: rgba(139, 115, 85, 0.2);
            border-radius: 4px;
        }
        
        .structure-tooltip .tooltip-current-label {
            font-size: 11px;
            color: #d4c4a0;
            margin-bottom: 3px;
        }
        
        .structure-tooltip .tooltip-current-value {
            font-size: 16px;
            font-weight: bold;
            color: #ffffff;
        }
        
        .structure-tooltip .tooltip-history {
            margin-top: 10px;
            border-top: 1px solid #5c4a35;
            padding-top: 8px;
        }
        
        .structure-tooltip .tooltip-history-title {
            font-size: 11px;
            color: #d4c4a0;
            margin-bottom: 6px;
        }
        
        .structure-tooltip .tooltip-history-item {
            margin: 5px 0;
            font-size: 12px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .structure-tooltip .tooltip-history-date {
            color: #b8a890;
            font-size: 11px;
        }
        
        .structure-tooltip .tooltip-history-value {
            color: #ffffff;
            font-weight: bold;
        }
        
        /* Splash Screen */
        #splash-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, #1a1a2e 0%, #2a2a40 50%, #1a1a2e 100%);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 3000;
            transition: opacity 0.5s ease;
        }
        
        #splash-screen.hidden {
            opacity: 0;
            pointer-events: none;
        }
        
        .splash-content {
            text-align: center;
            color: #f4e4c1;
        }
        
        .splash-content h1 {
            font-size: 48px;
            margin-bottom: 20px;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
            color: #f4e4c1;
        }
        
        .splash-content p {
            font-size: 20px;
            margin-bottom: 40px;
            color: #d4c4a0;
        }
        
        .splash-buttons {
            display: flex;
            flex-direction: column;
            gap: 20px;
            min-width: 300px;
        }
        
        .splash-button {
            padding: 16px 32px;
            background: 
                linear-gradient(135deg, #8b4513 0%, #6b3410 50%, #5c2e0a 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 3px,
                    rgba(0, 0, 0, 0.15) 3px,
                    rgba(0, 0, 0, 0.15) 6px
                );
            background-size: 100% 100%, 12px 100%;
            color: #f4e4c1;
            border: 4px solid #5c2e0a;
            border-top: 3px solid #a0522d;
            border-bottom: 5px solid #3d1f0a;
            border-radius: 8px;
            font-size: 18px;
            font-family: 'Cinzel', serif;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            text-align: center;
            text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.6);
            box-shadow: 
                0 6px 12px rgba(0, 0, 0, 0.7),
                0 3px 6px rgba(0, 0, 0, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
            position: relative;
        }
        
        .splash-button:hover {
            background: 
                linear-gradient(135deg, #a0522d 0%, #8b4513 50%, #6b3410 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 3px,
                    rgba(0, 0, 0, 0.15) 3px,
                    rgba(0, 0, 0, 0.15) 6px
                );
            background-size: 100% 100%, 12px 100%;
            border-color: #6b3410;
            border-top: 3px solid #b87333;
            border-bottom: 3px solid #3d1f0a;
            transform: translateY(2px);
            box-shadow: 
                0 4px 8px rgba(0, 0, 0, 0.7),
                0 2px 4px rgba(0, 0, 0, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
        }
        
        .splash-button:active {
            transform: translateY(4px);
            box-shadow: 
                0 2px 4px rgba(0, 0, 0, 0.7),
                inset 0 2px 4px rgba(0, 0, 0, 0.3);
        }
        
        .splash-button.hidden {
            display: none;
        }
        
        /* Onboarding Overlay */
        #onboarding-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: radial-gradient(
                circle at center,
                rgba(0, 0, 0, 0.15) 0%,
                rgba(0, 0, 0, 0.15) 20%,
                rgba(0, 0, 0, 0.3) 40%,
                rgba(0, 0, 0, 0.4) 100%
            );
            z-index: 2500;
            display: none;
            pointer-events: none;
        }
        
        #onboarding-overlay.visible {
            display: block;
            pointer-events: all;
        }
        
        /* Steward Dialogue Box */
        .steward-dialogue {
            position: fixed;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            background: 
                linear-gradient(135deg, rgba(244, 228, 193, 0.9) 0%, rgba(234, 218, 183, 0.9) 50%, rgba(244, 228, 193, 0.9) 100%),
                repeating-linear-gradient(
                    0deg,
                    transparent,
                    transparent 2px,
                    rgba(139, 115, 85, 0.03) 2px,
                    rgba(139, 115, 85, 0.03) 4px
                ),
                url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
            background-color: #f4e4c1;
            border: 6px double #5c3317;
            border-radius: 12px;
            padding: 20px 30px;
            max-width: 600px;
            width: 90%;
            box-shadow: 
                0 0 0 3px #d4af37,
                0 15px 50px rgba(0, 0, 0, 0.8),
                0 5px 20px rgba(92, 51, 23, 0.6),
                inset 0 2px 10px rgba(255, 255, 255, 0.3);
            z-index: 2501;
            transition: all 0.5s ease;
            display: flex;
            align-items: flex-start;
            gap: 20px;
        }
        
        .steward-face {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            border: 3px solid #5c3317;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
            flex-shrink: 0;
            object-fit: cover;
            object-position: center 15%;
            background: #8b7355;
        }
        
        .steward-dialogue-content {
            flex: 1;
        }
        
        .steward-dialogue::before {
            content: '';
            position: absolute;
            top: -3px;
            left: -3px;
            right: -3px;
            bottom: -3px;
            border: 2px solid #d4af37;
            border-radius: 12px;
            pointer-events: none;
        }
        
        .steward-dialogue.positioned {
            /* When positioned relative to steward sprite */
            transform: none;
            left: auto;
            bottom: auto;
        }
        
        .steward-dialogue::after {
            content: '';
            position: absolute;
            bottom: -20px;
            left: 50px;
            width: 0;
            height: 0;
            border-left: 20px solid transparent;
            border-right: 20px solid transparent;
            border-top: 20px solid #5c3317;
            transition: all 0s ease;
            z-index: 1;
        }
        
        .steward-dialogue.positioned::after {
            /* Position arrow to point to steward */
            left: 20px;
        }
        
        
        .steward-dialogue-content h3 {
            color: #5c3317;
            margin-bottom: 12px;
            font-size: 20px;
            font-family: 'Georgia', 'Times New Roman', serif;
            font-weight: 600;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
        }

        .onboarding-step-indicator {
            display: inline-block;
            padding: 4px 8px;
            margin-bottom: 10px;
            border-radius: 999px;
            background: rgba(139, 115, 85, 0.2);
            color: #5c3317;
            font-size: 12px;
            font-family: 'Cinzel', serif;
            letter-spacing: 0.4px;
        }
        
        .steward-dialogue-content p {
            color: #3e2723;
            font-size: 16px;
            line-height: 1.7;
            margin: 0;
            font-family: 'Georgia', 'Times New Roman', serif;
            letter-spacing: 0.3px;
        }

        .steward-subtext {
            margin-top: 8px;
            font-size: 13px;
            color: #6b5a45;
            line-height: 1.4;
        }
        
        /* Onboarding Input Area */
        .onboarding-input-area {
            position: fixed;
            top: 38%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(42, 42, 64, 0.95);
            border: 3px solid #8b7355;
            border-radius: 12px;
            padding: 30px;
            min-width: 300px;
            max-width: 400px;
            max-height: none;
            overflow-y: visible;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
            z-index: 2502;
        }

        @media (max-height: 720px) {
            .onboarding-input-area {
                top: 32%;
                max-height: none;
            }
        }
        
        /* Archetype Selection Modal */
        .archetype-modal {
            position: fixed;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            background: 
                linear-gradient(135deg, rgba(244, 228, 193, 0.98) 0%, rgba(234, 218, 183, 0.98) 50%, rgba(244, 228, 193, 0.98) 100%);
            border: 6px double #5c3317;
            border-radius: 12px;
            padding: 25px;
            max-width: 650px;
            width: 90%;
            max-height: calc(100vh - 220px);
            overflow: hidden;
            box-shadow: 
                0 0 0 3px #d4af37,
                0 15px 50px rgba(0, 0, 0, 0.8);
            z-index: 2503;
            display: none;
            flex-direction: column;
        }
        
        .archetype-options-container {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 15px;
            margin-top: 15px;
            overflow-y: auto;
            padding-right: 6px;
            max-height: calc(100vh - 360px);
            scrollbar-width: thin;
            scrollbar-color: #8b7355 rgba(92, 51, 23, 0.15);
        }

        .archetype-options-container::-webkit-scrollbar {
            width: 10px;
        }

        .archetype-options-container::-webkit-scrollbar-track {
            background: rgba(92, 51, 23, 0.15);
            border-radius: 8px;
            border: 1px solid rgba(92, 51, 23, 0.3);
        }

        .archetype-options-container::-webkit-scrollbar-thumb {
            background: linear-gradient(180deg, #c8b08b 0%, #8b7355 100%);
            border-radius: 8px;
            border: 2px solid rgba(92, 51, 23, 0.35);
        }

        .archetype-options-container::-webkit-scrollbar-thumb:hover {
            background: linear-gradient(180deg, #d6c09a 0%, #a0866b 100%);
        }
        
        .archetype-modal.visible {
            display: flex;
        }
        
        .archetype-modal h2 {
            color: #5c3317;
            font-family: 'Georgia', serif;
            font-size: 22px;
            margin-bottom: 15px;
            text-align: center;
            font-weight: 600;
        }
        
        .archetype-option {
            display: flex;
            flex-direction: column;
        }
        
        .archetype-button {
            width: 100%;
            padding: 12px 15px;
            background: linear-gradient(135deg, #2a2a40 0%, #3a3a50 100%);
            color: #f4e4c1;
            border: 3px solid #8b7355;
            border-radius: 8px;
            font-size: 16px;
            font-weight: bold;
            font-family: 'Georgia', serif;
            cursor: pointer;
            transition: all 0.3s ease;
            text-align: center;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
        }
        
        .archetype-button:hover {
            background: linear-gradient(135deg, #3a3a50 0%, #4a4a60 100%);
            border-color: #d4c4a0;
            transform: translateY(-2px);
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
        }
        
        .archetype-crest {
            font-size: 24px;
            line-height: 1;
        }
        
        .archetype-description {
            font-size: 12px;
            color: #3e2723;
            font-style: italic;
            padding: 8px 10px;
            line-height: 1.4;
            font-family: 'Georgia', serif;
            text-align: center;
        }
        
        .onboarding-input-area label {
            display: block;
            color: #f4e4c1;
            margin-bottom: 10px;
            font-size: 18px;
            font-weight: bold;
            text-align: center;
        }
        
        .onboarding-input-area input[type="number"] {
            width: 100%;
            padding: 12px;
            margin-bottom: 20px;
            background: #1a1a2e;
            border: 2px solid #8b7355;
            border-radius: 6px;
            color: #f4e4c1;
            font-size: 20px;
            font-family: 'Georgia', serif;
            text-align: center;
        }

        .onboarding-input-hint {
            font-size: 12px;
            color: #d4c4a0;
            text-align: center;
            margin-top: -10px;
            margin-bottom: 10px;
            min-height: 16px;
        }

        .onboarding-error {
            font-size: 12px;
            color: #ffb3a7;
            text-align: center;
            margin-bottom: 10px;
            min-height: 16px;
        }

        .onboarding-actions {
            display: flex;
            gap: 10px;
        }

        .onboarding-actions button {
            width: auto;
            flex: 1;
        }
        
        .onboarding-input-area input[type="number"]:focus {
            outline: none;
            border-color: #d4c4a0;
            box-shadow: 0 0 8px rgba(212, 196, 160, 0.5);
        }
        
        .onboarding-input-area button {
            width: 100%;
            padding: 14px;
            background: 
                linear-gradient(135deg, #8b4513 0%, #6b3410 50%, #5c2e0a 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            color: #f4e4c1;
            border: 3px solid #5c2e0a;
            border-top: 2px solid #a0522d;
            border-bottom: 4px solid #3d1f0a;
            border-radius: 6px;
            font-size: 18px;
            font-family: 'Cinzel', serif;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
            box-shadow: 
                0 4px 8px rgba(0, 0, 0, 0.6),
                0 2px 4px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
        }

        .onboarding-back {
            background: linear-gradient(135deg, #2a2a40 0%, #3a3a50 100%);
            border: 2px solid #5c4a35;
            border-bottom: 3px solid #3d1f0a;
            font-size: 16px;
        }

        .onboarding-input-area button:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }
        
        .onboarding-input-area button:hover {
            background: 
                linear-gradient(135deg, #a0522d 0%, #8b4513 50%, #6b3410 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            transform: translateY(2px);
            box-shadow: 
                0 2px 4px rgba(0, 0, 0, 0.6),
                0 1px 2px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
            border-bottom: 2px solid #3d1f0a;
        }
        
        .onboarding-input-area button:active {
            transform: translateY(3px);
            box-shadow: 
                0 1px 2px rgba(0, 0, 0, 0.6),
                inset 0 2px 4px rgba(0, 0, 0, 0.3);
        }
        
        /* Control Panel Overlay */
        #control-panel {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 2000;
            transition: opacity 0.3s ease;
        }
        
        #control-panel.hidden {
            opacity: 0;
            pointer-events: none;
            display: none;
        }
        
        .control-panel-content {
            background: 
                linear-gradient(135deg, rgba(244, 228, 193, 0.95) 0%, rgba(234, 218, 183, 0.95) 50%, rgba(244, 228, 193, 0.95) 100%),
                repeating-linear-gradient(
                    0deg,
                    transparent,
                    transparent 2px,
                    rgba(139, 115, 85, 0.03) 2px,
                    rgba(139, 115, 85, 0.03) 4px
                ),
                url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
            background-color: #f4e4c1;
            border: 6px double #5c3317;
            border-radius: 12px;
            padding: 30px;
            max-width: 400px;
            width: 90%;
            max-height: 90vh;
            overflow-y: auto;
            scrollbar-width: thin;
            scrollbar-color: #8b7355 rgba(92, 51, 23, 0.15);
            box-shadow: 
                0 0 0 3px #d4af37,
                0 15px 50px rgba(0, 0, 0, 0.8),
                0 5px 20px rgba(92, 51, 23, 0.6),
                inset 0 2px 10px rgba(255, 255, 255, 0.3);
            position: relative;
        }

        .control-panel-content::-webkit-scrollbar {
            width: 10px;
        }

        .control-panel-content::-webkit-scrollbar-track {
            background: rgba(92, 51, 23, 0.15);
            border-radius: 8px;
            border: 1px solid rgba(92, 51, 23, 0.3);
        }

        .control-panel-content::-webkit-scrollbar-thumb {
            background: linear-gradient(180deg, #c8b08b 0%, #8b7355 100%);
            border-radius: 8px;
            border: 2px solid rgba(92, 51, 23, 0.35);
        }

        .control-panel-content::-webkit-scrollbar-thumb:hover {
            background: linear-gradient(180deg, #d6c09a 0%, #a0866b 100%);
        }
        
        .control-panel-content::before {
            content: '';
            position: absolute;
            top: -3px;
            left: -3px;
            right: -3px;
            bottom: -3px;
            border: 2px solid #d4af37;
            border-radius: 12px;
            pointer-events: none;
        }
        
        .control-panel-content h2 {
            color: #5c3317;
            margin-bottom: 20px;
            font-size: 24px;
            text-align: center;
            font-family: 'Cinzel', serif;
            font-weight: 600;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
        }
        
        .control-panel-content label {
            display: block;
            color: #5c3317;
            margin-bottom: 8px;
            font-size: 14px;
            font-weight: bold;
        }
        
        .control-panel-content input[type="number"] {
            width: 100%;
            padding: 10px;
            margin-bottom: 20px;
            background: #1a1a2e;
            border: 2px solid #4a4a6a;
            border-radius: 4px;
            color: #f4e4c1;
            font-size: 16px;
            font-family: 'Georgia', serif;
        }
        
        .control-panel-trend {
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 12px;
            color: #5c3317;
            margin: 4px 0 16px;
        }
        
        .control-panel-trend .trend-up {
            color: #90ee90;
        }
        
        .control-panel-trend .trend-down {
            color: #ff6b6b;
        }
        
        .control-panel-trend .trend-neutral {
            color: #d4c4a0;
        }
        
        .control-panel-content input[type="number"]:focus {
            outline: none;
            border-color: #8b7355;
        }
        
        .control-panel-content button {
            width: 100%;
            padding: 12px 24px;
            background: 
                linear-gradient(135deg, #8b4513 0%, #6b3410 50%, #5c2e0a 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            color: #f4e4c1;
            border: 3px solid #5c2e0a;
            border-top: 2px solid #a0522d;
            border-bottom: 4px solid #3d1f0a;
            border-radius: 6px;
            font-size: 18px;
            font-family: 'Cinzel', serif;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
            box-shadow: 
                0 4px 8px rgba(0, 0, 0, 0.6),
                0 2px 4px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
        }
        
        .control-panel-content button:hover {
            background: 
                linear-gradient(135deg, #a0522d 0%, #8b4513 50%, #6b3410 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            transform: translateY(2px);
            box-shadow: 
                0 2px 4px rgba(0, 0, 0, 0.6),
                0 1px 2px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
            border-bottom: 2px solid #3d1f0a;
        }
        
        .control-panel-content button:active {
            transform: translateY(3px);
            box-shadow: 
                0 1px 2px rgba(0, 0, 0, 0.6),
                inset 0 2px 4px rgba(0, 0, 0, 0.3);
        }
        
        .control-panel-content .button-group {
            display: flex;
            gap: 10px;
        }
        
        .control-panel-content .button-group button {
            flex: 1;
        }
        
        .control-panel-content button.cancel-btn {
            background: 
                linear-gradient(135deg, #654321 0%, #4a2c1a 50%, #3d1f0a 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            border: 3px solid #3d1f0a;
            border-top: 2px solid #654321;
            border-bottom: 4px solid #2a1508;
        }
        
        .control-panel-content button.cancel-btn:hover {
            background: 
                linear-gradient(135deg, #8b4513 0%, #654321 50%, #4a2c1a 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            transform: translateY(2px);
            border-bottom: 2px solid #2a1508;
        }
        
        /* Edit Data Button */
        .edit-data-btn {
            position: fixed;
            bottom: 20px;
            right: 20px;
            padding: 10px 20px;
            background: 
                linear-gradient(135deg, #8b4513 0%, #6b3410 50%, #5c2e0a 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            color: #f4e4c1;
            border: 3px solid #5c2e0a;
            border-top: 2px solid #a0522d;
            border-bottom: 4px solid #3d1f0a;
            border-radius: 6px;
            font-size: 14px;
            font-family: 'Cinzel', serif;
            font-weight: 600;
            cursor: pointer;
            z-index: 1500;
            transition: all 0.2s ease;
            display: none; /* Hidden during onboarding */
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
            box-shadow: 
                0 4px 8px rgba(0, 0, 0, 0.6),
                0 2px 4px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
        }
        
        .edit-data-btn:hover {
            background: 
                linear-gradient(135deg, #a0522d 0%, #8b4513 50%, #6b3410 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            transform: translateY(2px);
            box-shadow: 
                0 2px 4px rgba(0, 0, 0, 0.6),
                0 1px 2px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
            border-bottom: 2px solid #3d1f0a;
        }
        
        .edit-data-btn:active {
            transform: translateY(3px);
            box-shadow: 
                0 1px 2px rgba(0, 0, 0, 0.6),
                inset 0 2px 4px rgba(0, 0, 0, 0.3);
        }
        
        /* Settings Button (Top Left) */
        .settings-btn-top {
            position: fixed;
            top: 20px;
            left: 20px;
            width: 50px;
            height: 50px;
            padding: 0;
            background: 
                linear-gradient(135deg, #8b4513 0%, #6b3410 50%, #5c2e0a 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            color: #f4e4c1;
            border: 3px solid #5c2e0a;
            border-top: 2px solid #a0522d;
            border-bottom: 4px solid #3d1f0a;
            border-radius: 8px;
            font-size: 24px;
            font-family: 'Cinzel', serif;
            cursor: pointer;
            z-index: 1500;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 
                0 4px 8px rgba(0, 0, 0, 0.6),
                0 2px 4px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
        }
        
        .settings-btn-top:hover {
            background: 
                linear-gradient(135deg, #a0522d 0%, #8b4513 50%, #6b3410 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            transform: translateY(2px) scale(1.05);
            box-shadow: 
                0 2px 4px rgba(0, 0, 0, 0.6),
                0 1px 2px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
            border-bottom: 2px solid #3d1f0a;
        }
        
        .settings-btn-top:active {
            transform: translateY(3px) scale(0.98);
            box-shadow: 
                0 1px 2px rgba(0, 0, 0, 0.6),
                inset 0 2px 4px rgba(0, 0, 0, 0.3);
        }
        
        /* Camera Controls Panel */
        #camera-controls {
            position: fixed;
            bottom: 20px;
            left: 20px;
            padding: 10px 20px;
            background: 
                linear-gradient(135deg, #8b4513 0%, #6b3410 50%, #5c2e0a 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            color: #f4e4c1;
            border: 3px solid #5c2e0a;
            border-top: 2px solid #a0522d;
            border-bottom: 4px solid #3d1f0a;
            border-radius: 6px;
            font-size: 12px;
            font-family: 'Cinzel', serif;
            font-weight: 600;
            cursor: pointer;
            z-index: 1500;
            transition: all 0.2s ease;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
            box-shadow: 
                0 4px 8px rgba(0, 0, 0, 0.6),
                0 2px 4px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
            display: none; /* Hidden by default, shown after onboarding completes */
        }

        .camera-hint {
            position: fixed;
            bottom: 70px;
            left: 20px;
            background: rgba(26, 26, 46, 0.85);
            border: 1px solid #5c4a35;
            color: #d4c4a0;
            font-size: 11px;
            padding: 6px 10px;
            border-radius: 6px;
            font-family: 'Cinzel', serif;
            z-index: 1499;
            display: none;
        }

        .camera-hint.pulse {
            animation: hintPulse 2.4s ease-in-out infinite;
        }

        @keyframes hintPulse {
            0%, 100% {
                box-shadow: 0 0 0 rgba(212, 196, 160, 0);
                transform: translateY(0);
            }
            50% {
                box-shadow: 0 0 12px rgba(212, 196, 160, 0.35);
                transform: translateY(-2px);
            }
        }
        
        #camera-controls.collapsed {
            min-width: auto;
            width: auto;
            padding: 10px 15px;
        }
        
        #camera-controls.collapsed .camera-controls-content {
            display: none;
        }
        
        #camera-controls.collapsed .camera-controls-header {
            margin: 0;
            border: none;
            padding: 0;
            cursor: pointer;
            justify-content: center;
        }
        
        #camera-controls h3 {
            color: #f4e4c1;
            font-size: 16px;
            margin: 0 0 12px 0;
            text-align: center;
            border-bottom: 1px solid #5c4a35;
            padding-bottom: 8px;
            cursor: pointer;
            user-select: none;
            transition: all 0.3s ease;
        }
        
        #camera-controls.collapsed h3 {
            font-size: 28px;
            margin: 0;
            border: none;
            padding: 0;
            width: 100%;
        }
        
        #camera-controls h3:hover {
            color: #d4c4a0;
        }
        
        .camera-controls-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        
        .camera-minimize-btn {
            background: transparent;
            border: none;
            color: #d4c4a0;
            font-size: 14px;
            cursor: pointer;
            padding: 4px 8px;
            border-radius: 4px;
            transition: all 0.3s ease;
            font-family: 'Cinzel', serif;
        }
        
        .camera-minimize-btn:hover {
            background: rgba(139, 115, 85, 0.3);
            color: #f4e4c1;
        }
        
        #camera-controls.collapsed .camera-minimize-btn {
            display: none;
        }
        
        .camera-controls-content {
            transition: opacity 0.3s ease;
        }
        
        .camera-control-item {
            margin-bottom: 12px;
        }
        
        .camera-control-item:last-child {
            margin-bottom: 0;
        }
        
        .camera-toggle {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 8px;
        }
        
        .camera-toggle-label {
            display: flex;
            align-items: center;
            gap: 8px;
            flex: 1;
            color: #d4c4a0;
            font-size: 14px;
            cursor: pointer;
        }
        
        .camera-toggle-icon {
            font-size: 20px;
            width: 24px;
            text-align: center;
        }
        
        .camera-toggle-switch {
            position: relative;
            width: 50px;
            height: 24px;
            background: #4a4a6a;
            border-radius: 12px;
            cursor: pointer;
            transition: background 0.3s ease;
            flex-shrink: 0;
        }
        
        .camera-toggle-switch.active {
            background: #8b7355;
        }
        
        .camera-toggle-switch::after {
            content: '';
            position: absolute;
            top: 2px;
            left: 2px;
            width: 20px;
            height: 20px;
            background: #f4e4c1;
            border-radius: 50%;
            transition: transform 0.3s ease;
        }
        
        .camera-toggle-switch.active::after {
            transform: translateX(26px);
        }
        
        .camera-help-text {
            font-size: 11px;
            color: #b8a890;
            line-height: 1.4;
            margin-top: 4px;
            padding-left: 32px;
            font-style: italic;
        }
        
        .camera-control-divider {
            height: 1px;
            background: #5c4a35;
            margin: 10px 0;
        }
        
        /* Camera Controls - Button Mode Overrides */
        #camera-controls:hover {
            background: 
                linear-gradient(135deg, #a0522d 0%, #8b4513 50%, #6b3410 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            transform: translateY(2px);
            box-shadow: 
                0 2px 4px rgba(0, 0, 0, 0.6),
                0 1px 2px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
            border-bottom: 2px solid #3d1f0a;
        }
        
        #camera-controls:active {
            transform: translateY(3px);
            box-shadow: 
                0 1px 2px rgba(0, 0, 0, 0.6),
                inset 0 2px 4px rgba(0, 0, 0, 0.3);
        }
        
        /* Settings Menu */
        #settings-menu {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.85);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 5000;
        }
        
        #settings-menu.visible {
            display: flex;
        }
        
        .settings-content {
            background: 
                linear-gradient(135deg, rgba(244, 228, 193, 0.95) 0%, rgba(234, 218, 183, 0.95) 50%, rgba(244, 228, 193, 0.95) 100%),
                repeating-linear-gradient(
                    0deg,
                    transparent,
                    transparent 2px,
                    rgba(139, 115, 85, 0.03) 2px,
                    rgba(139, 115, 85, 0.03) 4px
                ),
                url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
            background-color: #f4e4c1;
            border: 6px double #5c3317;
            border-radius: 12px;
            padding: 30px;
            max-width: 800px;
            width: 90%;
            max-height: 90vh;
            display: flex;
            flex-direction: column;
            box-shadow: 
                0 0 0 3px #d4af37,
                0 15px 50px rgba(0, 0, 0, 0.8),
                0 5px 20px rgba(92, 51, 23, 0.6),
                inset 0 2px 10px rgba(255, 255, 255, 0.3);
            position: relative;
        }
        
        .settings-content::before {
            content: '';
            position: absolute;
            top: -3px;
            left: -3px;
            right: -3px;
            bottom: -3px;
            border: 2px solid #d4af37;
            border-radius: 12px;
            pointer-events: none;
        }
        
        .settings-content h2 {
            color: #5c3317;
            margin-bottom: 20px;
            font-size: 24px;
            text-align: center;
            border-bottom: 2px solid #8b7355;
            padding-bottom: 10px;
            font-family: 'Cinzel', serif;
            font-weight: 600;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
        }
        
        /* Settings Layout */
        .settings-layout {
            display: flex;
            gap: 20px;
            flex: 1;
            overflow: hidden;
            min-height: 0;
        }
        
        /* Settings Sidebar */
        .settings-sidebar {
            display: flex;
            flex-direction: column;
            gap: 8px;
            min-width: 160px;
            padding-right: 20px;
            border-right: 2px solid #8b7355;
        }
        
        .settings-category {
            background: rgba(92, 51, 23, 0.1);
            border: 2px solid #8b7355;
            border-radius: 6px;
            padding: 12px 16px;
            color: #5c3317;
            font-family: 'Cinzel', serif;
            font-size: 14px;
            font-weight: 500;
            text-align: left;
            cursor: pointer;
            transition: all 0.2s ease;
            white-space: nowrap;
        }
        
        .settings-category:hover {
            background: rgba(92, 51, 23, 0.2);
            border-color: #5c3317;
        }
        
        .settings-category.active {
            background: #5c3317;
            color: #f4e4c1;
            border-color: #3d1f0a;
            box-shadow: 
                inset 0 2px 4px rgba(0, 0, 0, 0.3),
                0 2px 8px rgba(92, 51, 23, 0.4);
        }
        
        /* Settings Panel */
        .settings-panel {
            flex: 1;
            overflow-y: auto;
            overflow-x: hidden;
            padding-right: 10px;
            scrollbar-width: thin;
            scrollbar-color: #8b7355 rgba(92, 51, 23, 0.15);
        }
        
        /* Scrollbar styling for settings panel */
        .settings-panel::-webkit-scrollbar {
            width: 10px;
        }
        
        .settings-panel::-webkit-scrollbar-track {
            background: rgba(92, 51, 23, 0.15);
            border-radius: 8px;
            border: 1px solid rgba(92, 51, 23, 0.3);
        }
        
        .settings-panel::-webkit-scrollbar-thumb {
            background: linear-gradient(180deg, #c8b08b 0%, #8b7355 100%);
            border-radius: 8px;
            border: 2px solid rgba(92, 51, 23, 0.35);
        }
        
        .settings-panel::-webkit-scrollbar-thumb:hover {
            background: linear-gradient(180deg, #d6c09a 0%, #a0866b 100%);
        }
        
        /* Responsive Design for Settings */
        @media (max-width: 768px) {
            .settings-content {
                max-width: 95%;
                padding: 20px;
            }
            
            .settings-layout {
                flex-direction: column;
            }
            
            .settings-sidebar {
                flex-direction: row;
                min-width: auto;
                padding-right: 0;
                padding-bottom: 15px;
                border-right: none;
                border-bottom: 2px solid #8b7355;
                overflow-x: auto;
                scrollbar-width: thin;
                scrollbar-color: #8b7355 rgba(92, 51, 23, 0.15);
            }

            .settings-sidebar::-webkit-scrollbar {
                height: 8px;
            }

            .settings-sidebar::-webkit-scrollbar-track {
                background: rgba(92, 51, 23, 0.15);
                border-radius: 8px;
                border: 1px solid rgba(92, 51, 23, 0.3);
            }

            .settings-sidebar::-webkit-scrollbar-thumb {
                background: linear-gradient(180deg, #c8b08b 0%, #8b7355 100%);
                border-radius: 8px;
                border: 2px solid rgba(92, 51, 23, 0.35);
            }

            .settings-sidebar::-webkit-scrollbar-thumb:hover {
                background: linear-gradient(180deg, #d6c09a 0%, #a0866b 100%);
            }
            
            .settings-category {
                min-width: 120px;
                padding: 10px 12px;
                font-size: 13px;
            }
        }
        
        .settings-category-panel {
            display: none;
        }
        
        .settings-category-panel.active {
            display: block;
        }
        
        .settings-category-panel h3 {
            color: #5c3317;
            font-size: 18px;
            margin-bottom: 16px;
            padding-bottom: 8px;
            border-bottom: 2px solid #8b7355;
            font-family: 'Cinzel', serif;
        }
        
        /* Settings Footer */
        .settings-footer {
            display: flex;
            gap: 10px;
            margin-top: 20px;
            padding-top: 20px;
            border-top: 2px solid #8b7355;
        }
        
        .settings-item {
            margin-bottom: 15px;
        }
        
        .settings-item label {
            display: block;
            color: #5c3317;
            margin-bottom: 8px;
            font-size: 14px;
            font-weight: 500;
        }

        .settings-subheading {
            margin: 12px 0 8px;
            font-size: 13px;
            text-transform: uppercase;
            letter-spacing: 0.6px;
            color: #6b5a45;
            border-bottom: 1px solid rgba(92, 51, 23, 0.3);
            padding-bottom: 4px;
        }
        
        .settings-item small {
            color: #8b7355;
            font-size: 12px;
            display: block;
            margin-top: 4px;
        }
        
        .settings-item select,
        .settings-item input[type="number"] {
            width: 100%;
            padding: 10px;
            background: #1a1a2e;
            border: 2px solid #4a4a6a;
            border-radius: 4px;
            color: #f4e4c1;
            font-size: 14px;
            font-family: 'Georgia', serif;
        }
        
        .settings-item select:focus,
        .settings-item input[type="number"]:focus {
            outline: none;
            border-color: #8b7355;
        }

        .settings-checkboxes {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
            gap: 8px;
            background: rgba(26, 26, 46, 0.5);
            border: 1px solid #4a4a6a;
            border-radius: 6px;
            padding: 10px;
        }

        .settings-checkboxes label {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 13px;
            color: #f4e4c1;
            margin: 0;
        }

        .settings-checkboxes input[type="checkbox"] {
            accent-color: #8b7355;
        }
        
        .settings-buttons {
            display: flex;
            gap: 10px;
            margin-top: 20px;
        }

        .settings-hint {
            margin-top: 10px;
            font-size: 12px;
            color: #8b7355;
        }

        .toggle-btn.active {
            background: linear-gradient(135deg, #2a2a40 0%, #3a3a50 100%);
            border-color: #8b7355;
        }
        
        .settings-btn {
            flex: 1;
            padding: 12px 24px;
            background: 
                linear-gradient(135deg, #8b4513 0%, #6b3410 50%, #5c2e0a 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            color: #f4e4c1;
            border: 3px solid #5c2e0a;
            border-top: 2px solid #a0522d;
            border-bottom: 4px solid #3d1f0a;
            border-radius: 6px;
            font-size: 16px;
            font-family: 'Cinzel', serif;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
            box-shadow: 
                0 4px 8px rgba(0, 0, 0, 0.6),
                0 2px 4px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
        }
        
        .settings-btn:hover {
            background: 
                linear-gradient(135deg, #a0522d 0%, #8b4513 50%, #6b3410 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            transform: translateY(2px);
            box-shadow: 
                0 2px 4px rgba(0, 0, 0, 0.6),
                0 1px 2px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
            border-bottom: 2px solid #3d1f0a;
        }
        
        .settings-btn:active {
            transform: translateY(3px);
            box-shadow: 
                0 1px 2px rgba(0, 0, 0, 0.6),
                inset 0 2px 4px rgba(0, 0, 0, 0.3);
        }
        
        .settings-btn.secondary {
            background: 
                linear-gradient(135deg, #654321 0%, #4a2c1a 50%, #3d1f0a 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            border: 3px solid #3d1f0a;
            border-top: 2px solid #654321;
            border-bottom: 4px solid #2a1508;
        }
        
        .settings-btn.secondary:hover {
            background: 
                linear-gradient(135deg, #8b4513 0%, #654321 50%, #4a2c1a 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            transform: translateY(2px);
            border-bottom: 2px solid #2a1508;
        }
        
        .settings-close-btn {
            position: absolute;
            top: 10px;
            right: 10px;
            background: transparent;
            border: none;
            color: #d4c4a0;
            font-size: 24px;
            cursor: pointer;
            width: 30px;
            height: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 4px;
            transition: all 0.3s ease;
        }
        
        .settings-close-btn:hover {
            background: rgba(139, 115, 85, 0.3);
            color: #f4e4c1;
        }
        
        /* Ledger Stone Container */
        #ledger-container {
            position: fixed;
            top: 10px;
            right: 10px;
            z-index: 1000;
            display: flex;
            flex-direction: column;
            gap: 10px;
            max-height: calc(100vh - 20px);
            overflow-y: auto;
            overflow-x: hidden;
            scrollbar-width: thin;
            scrollbar-color: #8b7355 rgba(92, 51, 23, 0.15);
        }

        #ledger-container::-webkit-scrollbar {
            width: 10px;
        }

        #ledger-container::-webkit-scrollbar-track {
            background: rgba(92, 51, 23, 0.15);
            border-radius: 8px;
            border: 1px solid rgba(92, 51, 23, 0.3);
        }

        #ledger-container::-webkit-scrollbar-thumb {
            background: linear-gradient(180deg, #c8b08b 0%, #8b7355 100%);
            border-radius: 8px;
            border: 2px solid rgba(92, 51, 23, 0.35);
        }

        #ledger-container::-webkit-scrollbar-thumb:hover {
            background: linear-gradient(180deg, #d6c09a 0%, #a0866b 100%);
        }
        
        #ledger-container.hidden {
            display: none;
        }
        
        /* Individual Ledger Stone */
        .ledger-stone {
            background: linear-gradient(135deg, #8b7355 0%, #6b5a45 100%);
            border: 3px solid #5c4a35;
            border-radius: 8px;
            padding: 15px 20px;
            min-width: 220px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
            font-family: 'Cinzel', serif;
            color: #f4e4c1;
            transform: translateX(0);
            transition: transform 0.3s ease, opacity 0.3s ease;
            opacity: 1;
        }
        
        .ledger-stone.new {
            animation: ledgerSlideIn 0.5s ease;
        }
        
        .ledger-stone.archiving {
            animation: ledgerSlideOut 0.5s ease forwards;
        }
        
        .ledger-stone h3 {
            margin: 0 0 8px 0;
            font-size: 16px;
            color: #f4e4c1;
            text-align: center;
            border-bottom: 2px solid #5c4a35;
            padding-bottom: 6px;
        }
        
        .ledger-stone .ledger-timestamp {
            font-size: 11px;
            color: #b8a890;
            text-align: center;
            margin-bottom: 8px;
            font-style: italic;
        }
        
        .ledger-stone .trend-item {
            margin: 6px 0;
            font-size: 12px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .ledger-stone .trend-label {
            font-weight: bold;
            color: #d4c4a0;
        }
        
        .ledger-stone .trend-value {
            display: flex;
            align-items: center;
            gap: 5px;
        }
        
        .ledger-stone .trend-up {
            color: #90ee90;
        }
        
        .ledger-stone .trend-down {
            color: #ff6b6b;
        }
        
        .ledger-stone .trend-neutral {
            color: #d4c4a0;
        }
        
        /* Animations */
        @keyframes ledgerSlideIn {
            0% { 
                transform: translateX(300px);
                opacity: 0;
            }
            100% { 
                transform: translateX(0);
                opacity: 1;
            }
        }
        
        @keyframes ledgerSlideOut {
            0% { 
                transform: translateX(0);
                opacity: 1;
            }
            100% { 
                transform: translateX(300px);
                opacity: 0;
            }
        }
        
        /* Archive Modal */
        #archive-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.85);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 3000;
            overflow-y: auto;
        }
        
        #archive-modal.visible {
            display: flex;
        }
        
        .archive-content {
            background: 
                linear-gradient(135deg, rgba(244, 228, 193, 0.95) 0%, rgba(234, 218, 183, 0.95) 50%, rgba(244, 228, 193, 0.95) 100%),
                repeating-linear-gradient(
                    0deg,
                    transparent,
                    transparent 2px,
                    rgba(139, 115, 85, 0.03) 2px,
                    rgba(139, 115, 85, 0.03) 4px
                ),
                url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
            background-color: #f4e4c1;
            border: 6px double #5c3317;
            border-radius: 12px;
            padding: 30px;
            max-width: 900px;
            width: 90%;
            max-height: 85vh;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            box-shadow: 
                0 0 0 3px #d4af37,
                0 15px 50px rgba(0, 0, 0, 0.8),
                0 5px 20px rgba(92, 51, 23, 0.6),
                inset 0 2px 10px rgba(255, 255, 255, 0.3);
            position: relative;
        }
        
        .archive-content::before {
            content: '';
            position: absolute;
            top: -3px;
            left: -3px;
            right: -3px;
            bottom: -3px;
            border: 2px solid #d4af37;
            border-radius: 12px;
            pointer-events: none;
        }
        
        .archive-content h2 {
            color: #5c3317;
            margin-bottom: 20px;
            text-align: center;
            font-size: 28px;
            font-family: 'Cinzel', serif;
            font-weight: 600;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
            flex-shrink: 0;
        }
        
        .archive-graph {
            background: #1a1a2e;
            border: 2px solid #4a4a6a;
            border-radius: 8px;
            padding: 20px;
            margin: 20px 0;
            height: 250px;
            flex-shrink: 0;
        }
        
        .archive-ledgers {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
            gap: 15px;
            margin-top: 20px;
            overflow-y: auto;
            flex-grow: 1;
            padding-right: 10px;
            scrollbar-width: thin;
            scrollbar-color: #8b7355 rgba(92, 51, 23, 0.15);
        }
        
        .archive-ledgers::-webkit-scrollbar {
            width: 10px;
        }
        
        .archive-ledgers::-webkit-scrollbar-track {
            background: rgba(92, 51, 23, 0.15);
            border-radius: 8px;
            border: 1px solid rgba(92, 51, 23, 0.3);
        }
        
        .archive-ledgers::-webkit-scrollbar-thumb {
            background: linear-gradient(180deg, #c8b08b 0%, #8b7355 100%);
            border-radius: 8px;
            border: 2px solid rgba(92, 51, 23, 0.35);
        }
        
        .archive-ledgers::-webkit-scrollbar-thumb:hover {
            background: linear-gradient(180deg, #d6c09a 0%, #a0866b 100%);
        }
        
        .archive-ledger-item {
            background: #3a3a50;
            border: 2px solid #5c4a35;
            border-radius: 6px;
            padding: 15px;
            font-size: 12px;
            color: #ffffff;
        }
        
        .archive-ledger-item .archive-date {
            font-weight: bold;
            color: #ffffff;
            margin-bottom: 8px;
            border-bottom: 1px solid #5c4a35;
            padding-bottom: 5px;
        }
        
        .archive-ledger-item .trend-item {
            color: #ffffff;
        }
        
        .archive-ledger-item .trend-label {
            color: #d4c4a0;
        }
        
        .archive-ledger-item .trend-value {
            color: #ffffff;
        }
        
        /* Graph Tooltip */
        .graph-tooltip {
            position: fixed;
            background: rgba(42, 42, 64, 0.95);
            border: 2px solid #8b7355;
            border-radius: 6px;
            padding: 10px;
            color: #ffffff;
            font-family: 'Cinzel', serif;
            font-size: 12px;
            pointer-events: none;
            z-index: 10001;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
            display: none;
            max-width: 250px;
            white-space: nowrap;
        }
        
        .graph-tooltip.visible {
            display: block;
        }
        
        .graph-tooltip .tooltip-title {
            font-weight: bold;
            margin-bottom: 5px;
            color: #f4e4c1;
            border-bottom: 1px solid #5c4a35;
            padding-bottom: 3px;
        }
        
        .graph-tooltip .tooltip-item {
            margin: 3px 0;
            color: #ffffff;
        }
        
        .graph-tooltip .tooltip-value {
            color: #d4c4a0;
        }
        
        .archive-close-btn {
            position: absolute;
            top: 20px;
            right: 20px;
            background: 
                linear-gradient(135deg, #8b4513 0%, #6b3410 50%, #5c2e0a 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            color: #f4e4c1;
            border: 3px solid #5c2e0a;
            border-top: 2px solid #a0522d;
            border-bottom: 4px solid #3d1f0a;
            border-radius: 6px;
            padding: 10px 20px;
            cursor: pointer;
            font-family: 'Cinzel', serif;
            font-weight: 600;
            font-size: 14px;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
            box-shadow: 
                0 4px 8px rgba(0, 0, 0, 0.6),
                0 2px 4px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
            transition: all 0.2s ease;
        }
        
        .archive-close-btn:hover {
            background: 
                linear-gradient(135deg, #a0522d 0%, #8b4513 50%, #6b3410 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            transform: translateY(2px);
            box-shadow: 
                0 2px 4px rgba(0, 0, 0, 0.6),
                0 1px 2px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
            border-bottom: 2px solid #3d1f0a;
        }
        
        .archive-close-btn:active {
            transform: translateY(3px);
            box-shadow: 
                0 1px 2px rgba(0, 0, 0, 0.6),
                inset 0 2px 4px rgba(0, 0, 0, 0.3);
        }
        
        .archive-clear-btn {
            position: absolute;
            top: 20px;
            left: 20px;
            background: 
                linear-gradient(135deg, #8b4513 0%, #6b3410 50%, #5c2e0a 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            color: #f4e4c1;
            border: 3px solid #5c2e0a;
            border-top: 2px solid #a0522d;
            border-bottom: 4px solid #3d1f0a;
            border-radius: 6px;
            padding: 10px 20px;
            cursor: pointer;
            font-family: 'Cinzel', serif;
            font-weight: 600;
            font-size: 14px;
            z-index: 10;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
            box-shadow: 
                0 4px 8px rgba(0, 0, 0, 0.6),
                0 2px 4px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
            transition: all 0.2s ease;
        }
        
        .archive-clear-btn:hover {
            background: 
                linear-gradient(135deg, #a0522d 0%, #8b4513 50%, #6b3410 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            transform: translateY(2px);
            box-shadow: 
                0 2px 4px rgba(0, 0, 0, 0.6),
                0 1px 2px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
            border-bottom: 2px solid #3d1f0a;
        }
        
        .archive-clear-btn:active {
            transform: translateY(3px);
            box-shadow: 
                0 1px 2px rgba(0, 0, 0, 0.6),
                inset 0 2px 4px rgba(0, 0, 0, 0.3);
        }
        
        /* Clear History Confirmation Modal */
        #clear-history-confirm {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.9);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 10003;
        }
        
        #clear-history-confirm.visible {
            display: flex;
        }
        
        .clear-confirm-content {
            background: 
                linear-gradient(135deg, rgba(244, 228, 193, 0.95) 0%, rgba(234, 218, 183, 0.95) 50%, rgba(244, 228, 193, 0.95) 100%),
                repeating-linear-gradient(
                    0deg,
                    transparent,
                    transparent 2px,
                    rgba(139, 115, 85, 0.03) 2px,
                    rgba(139, 115, 85, 0.03) 4px
                ),
                url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
            background-color: #f4e4c1;
            border: 6px double #5c3317;
            border-radius: 12px;
            padding: 30px;
            max-width: 400px;
            width: 90%;
            box-shadow: 
                0 0 0 3px #d4af37,
                0 15px 50px rgba(0, 0, 0, 0.8),
                0 5px 20px rgba(92, 51, 23, 0.6),
                inset 0 2px 10px rgba(255, 255, 255, 0.3);
            text-align: center;
            position: relative;
        }
        
        .clear-confirm-content::before {
            content: '';
            position: absolute;
            top: -3px;
            left: -3px;
            right: -3px;
            bottom: -3px;
            border: 2px solid #d4af37;
            border-radius: 12px;
            pointer-events: none;
        }
        
        .clear-confirm-content h3 {
            color: #5c3317;
            margin-bottom: 15px;
            font-size: 20px;
            font-family: 'Cinzel', serif;
            font-weight: 600;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
        }
        
        .clear-confirm-content p {
            color: #3e2723;
            margin-bottom: 25px;
            font-size: 14px;
            line-height: 1.5;
            font-family: 'Cinzel', serif;
        }
        
        .clear-confirm-buttons {
            display: flex;
            gap: 15px;
            justify-content: center;
        }
        
        .clear-confirm-btn {
            padding: 12px 24px;
            border-radius: 6px;
            font-family: 'Cinzel', serif;
            font-weight: 600;
            font-size: 14px;
            cursor: pointer;
            transition: all 0.2s ease;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
            box-shadow: 
                0 4px 8px rgba(0, 0, 0, 0.6),
                0 2px 4px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
        }
        
        .clear-confirm-btn.yes {
            background: 
                linear-gradient(135deg, #8b4513 0%, #6b3410 50%, #5c2e0a 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            color: #f4e4c1;
            border: 3px solid #5c2e0a;
            border-top: 2px solid #a0522d;
            border-bottom: 4px solid #3d1f0a;
        }
        
        .clear-confirm-btn.yes:hover {
            background: 
                linear-gradient(135deg, #a0522d 0%, #8b4513 50%, #6b3410 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            transform: translateY(2px);
            box-shadow: 
                0 2px 4px rgba(0, 0, 0, 0.6),
                0 1px 2px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
            border-bottom: 2px solid #3d1f0a;
        }
        
        .clear-confirm-btn.yes:active {
            transform: translateY(3px);
            box-shadow: 
                0 1px 2px rgba(0, 0, 0, 0.6),
                inset 0 2px 4px rgba(0, 0, 0, 0.3);
        }
        
        .clear-confirm-btn.no {
            background: 
                linear-gradient(135deg, #654321 0%, #4a2c1a 50%, #3d1f0a 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            color: #f4e4c1;
            border: 3px solid #3d1f0a;
            border-top: 2px solid #654321;
            border-bottom: 4px solid #2a1508;
        }
        
        .clear-confirm-btn.no:hover {
            background: 
                linear-gradient(135deg, #8b4513 0%, #654321 50%, #4a2c1a 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            transform: translateY(2px);
            box-shadow: 
                0 2px 4px rgba(0, 0, 0, 0.6),
                0 1px 2px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
            border-bottom: 2px solid #2a1508;
        }
        
        .clear-confirm-btn.no:active {
            transform: translateY(3px);
            box-shadow: 
                0 1px 2px rgba(0, 0, 0, 0.6),
                inset 0 2px 4px rgba(0, 0, 0, 0.3);
        }
        
        .view-archive-btn {
            position: fixed;
            top: 20px;
            right: 20px;
            background: 
                linear-gradient(135deg, #8b4513 0%, #6b3410 50%, #5c2e0a 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            color: #f4e4c1;
            border: 3px solid #5c2e0a;
            border-top: 2px solid #a0522d;
            border-bottom: 4px solid #3d1f0a;
            border-radius: 6px;
            padding: 10px 20px;
            font-size: 12px;
            font-family: 'Cinzel', serif;
            font-weight: 600;
            cursor: pointer;
            z-index: 1001;
            transition: all 0.2s ease;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
            box-shadow: 
                0 4px 8px rgba(0, 0, 0, 0.6),
                0 2px 4px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
        }
        
        .view-archive-btn:hover {
            background: 
                linear-gradient(135deg, #a0522d 0%, #8b4513 50%, #6b3410 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            transform: translateY(2px);
            box-shadow: 
                0 2px 4px rgba(0, 0, 0, 0.6),
                0 1px 2px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
            border-bottom: 2px solid #3d1f0a;
        }
        
        .view-archive-btn:active {
            transform: translateY(3px);
            box-shadow: 
                0 1px 2px rgba(0, 0, 0, 0.6),
                inset 0 2px 4px rgba(0, 0, 0, 0.3);
        }
        
        /* Attract Mode Overlay */
        #attract-mode-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.3);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 2000;
            opacity: 1;
            transition: opacity 1s ease-out;
            pointer-events: auto;
        }
        
        #attract-mode-overlay.hidden {
            opacity: 0;
            pointer-events: none;
            display: none !important;
        }
        
        .attract-mode-content {
            text-align: center;
            color: #f4e4c1;
            text-shadow: 
                3px 3px 0px rgba(0, 0, 0, 0.8),
                0px 0px 10px rgba(212, 175, 55, 0.5);
        }
        
        .attract-mode-title {
            font-family: 'Press Start 2P', monospace;
            font-size: 48px;
            margin-bottom: 30px;
            color: #d4af37;
            letter-spacing: 2px;
            line-height: 1.4;
        }
        
        .attract-mode-subtitle {
            font-family: 'Cinzel', serif;
            font-size: 20px;
            margin-bottom: 50px;
            color: #f4e4c1;
            font-weight: 400;
            letter-spacing: 1px;
        }
        
        .attract-mode-cta {
            font-family: 'Press Start 2P', monospace;
            font-size: 16px;
            padding: 20px 40px;
            background: 
                linear-gradient(135deg, #8b4513 0%, #6b3410 50%, #5c2e0a 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            color: #f4e4c1;
            border: 4px solid #5c2e0a;
            border-top: 3px solid #a0522d;
            border-bottom: 5px solid #3d1f0a;
            border-radius: 8px;
            cursor: pointer;
            text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.8);
            box-shadow: 
                0 6px 12px rgba(0, 0, 0, 0.8),
                0 3px 6px rgba(0, 0, 0, 0.6),
                inset 0 2px 0 rgba(255, 255, 255, 0.2);
            transition: all 0.3s ease;
            animation: pulse 2s ease-in-out infinite;
        }
        
        .attract-mode-cta:hover {
            background: 
                linear-gradient(135deg, #a0522d 0%, #8b4513 50%, #6b3410 100%),
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.1) 2px,
                    rgba(0, 0, 0, 0.1) 4px
                );
            background-size: 100% 100%, 8px 100%;
            transform: translateY(-2px);
            box-shadow: 
                0 8px 16px rgba(0, 0, 0, 0.9),
                0 4px 8px rgba(0, 0, 0, 0.7),
                inset 0 2px 0 rgba(255, 255, 255, 0.3);
        }
        
        .attract-mode-cta:active {
            transform: translateY(0px);
            box-shadow: 
                0 3px 6px rgba(0, 0, 0, 0.8),
                inset 0 3px 6px rgba(0, 0, 0, 0.4);
        }
        
        @keyframes pulse {
            0%, 100% {
                box-shadow: 
                    0 6px 12px rgba(0, 0, 0, 0.8),
                    0 3px 6px rgba(0, 0, 0, 0.6),
                    inset 0 2px 0 rgba(255, 255, 255, 0.2),
                    0 0 0 0 rgba(212, 175, 55, 0.7);
            }
            50% {
                box-shadow: 
                    0 6px 12px rgba(0, 0, 0, 0.8),
                    0 3px 6px rgba(0, 0, 0, 0.6),
                    inset 0 2px 0 rgba(255, 255, 255, 0.2),
                    0 0 0 10px rgba(212, 175, 55, 0);
            }
        }
        
        .attract-mode-buttons {
            display: flex;
            flex-direction: column;
            gap: 20px;
            align-items: center;
        }
        
        @media (max-width: 768px) {
            .attract-mode-title {
                font-size: 32px;
            }
            
            .attract-mode-subtitle {
                font-size: 16px;
            }
            
            .attract-mode-cta {
                font-size: 12px;
                padding: 15px 30px;
            }
            
            .attract-mode-buttons {
                gap: 15px;
            }
        }
        
        /* Import Modal */
        #import-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 3000;
            display: flex;
            justify-content: center;
            align-items: center;
            opacity: 1;
            transition: opacity 0.3s ease;
        }
        
        #import-modal.hidden {
            opacity: 0;
            pointer-events: none;
            display: none !important;
        }
        
        .modal-overlay-background {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.6);
            backdrop-filter: blur(4px);
        }
        
        #import-modal .modal-content {
            position: relative;
            z-index: 3001;
            max-width: 500px;
            width: 90%;
        }
        
        .import-modal-steps {
            margin-top: 20px;
        }
        
        .import-step {
            margin-bottom: 25px;
        }
        
        .import-step h3 {
            color: #5c3317;
            font-family: 'Cinzel', serif;
            font-size: 18px;
            font-weight: 600;
            margin-bottom: 15px;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
        }

        .audio-enable-pill {
            position: fixed;
            right: 20px;
            bottom: 20px;
            padding: 10px 14px;
            border-radius: 999px;
            background: rgba(42, 42, 64, 0.95);
            border: 2px solid #8b7355;
            color: #f4e4c1;
            font-family: 'Cinzel', serif;
            font-size: 12px;
            cursor: pointer;
            z-index: 2505;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
        }

        .audio-enable-pill.hidden {
            display: none;
        }

        .toast {
            position: fixed;
            right: 20px;
            top: 20px;
            padding: 10px 14px;
            border-radius: 8px;
            background: rgba(26, 26, 46, 0.92);
            border: 1px solid #5c4a35;
            color: #f4e4c1;
            font-family: 'Cinzel', serif;
            font-size: 12px;
            z-index: 2505;
            opacity: 0;
            pointer-events: none;
            transform: translateY(-6px);
            transition: opacity 0.25s ease, transform 0.25s ease;
        }

        .toast.visible {
            opacity: 1;
            transform: translateY(0);
        }
