        @import url('https://fonts.googleapis.com/css2?family=Allura&display=swap');
        
        html {
            height: 100%;
            margin: 0;
            padding: 0;
            overflow: hidden;
        }

        body { 
            background-color: #111;
            background-image: url('/static/brick.png');
            background-size: auto;
            background-repeat: repeat;
            color: white; 
            font-family: sans-serif; 
            text-align: center; 
            margin: 0; 
            overflow: hidden; 
            height: 100vh; 
            display: flex; 
            flex-direction: column; 
        }

        body::before {
            content: "";
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background: radial-gradient(circle, transparent 20%, rgba(0,0,0,0.8) 100%);
            pointer-events: none;
            z-index: 1;
        }

        .hidden { display: none !important; }
        .plex-yellow { color: #e5a00d; }
        .jellyfin-blue { color: #00a4dc; }
        
        .menu-btn { position: relative; z-index: 2; background: #e5a00d; border: none; padding: 15px; font-size: 1.2rem; border-radius: 8px; cursor: pointer; margin: 10px; font-weight: bold; width: 240px; color: black; }
        
        #login-section, #main-menu { position: relative; z-index: 2; padding: 60px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; }
        .main-title { font-size: clamp(4.5rem, 18vw, 7.5rem); margin: 0 0 50px 0; font-weight: normal; color: #ff3131; font-family: 'allura', cursive; white-space: nowrap; line-height: 0.9; text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 20px #ff3131, 0 0 40px #ff3131, 0 0 80px #ff3131, 0 0 120px #ff3131, 0 0 160px #8a0606; animation: neon-blink 5s infinite; }

        @keyframes neon-blink {
            0%, 18%, 22%, 25%, 53%, 57%, 100% {
                text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 20px #ff3131, 0 0 40px #ff3131, 0 0 80px #ff3131, 0 0 120px #ff3131, 0 0 160px #8a0606;
                color: #ff3131;
            }
            19%, 21%, 23%, 24%, 54%, 56% {
                text-shadow: none;
                color: #330000;
            }
        }
        
        #game-area { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; background: #111; z-index: 100; }
        #swipe-deck { position: relative; width: min(92vw, 380px); aspect-ratio: 2 / 3; margin: 8vh auto 0 auto; max-height: calc(100vh - 22vh); }
        
        .movie-card, .mini-poster { perspective: 1000px; }
        .card-inner, .mini-inner { position: relative; width: 100%; height: 100%; transition: transform 0.6s, box-shadow 0.3s ease; transform-style: preserve-3d; border-radius: 20px; }
        .flipped .card-inner, .flipped .mini-inner { transform: rotateY(180deg); }
        .card-front, .card-back, .mini-front, .mini-back { position: absolute; width: 100%; height: 100%; -webkit-backface-visibility: hidden; backface-visibility: hidden; border-radius: 20px; overflow: hidden; }
        .card-back, .mini-back { transform: rotateY(180deg); background: #1a1a1a; display: flex; flex-direction: column; align-items: center; justify-content: center; box-sizing: border-box; border: 2px solid #e5a00d; }
        .movie-card { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; z-index: 5; border-radius: 20px; user-select: none; -webkit-user-select: none; }
        .movie-card img { -webkit-user-drag: none; user-drag: none; pointer-events: none; }
        .movie-card img { width: 100%; height: 100%; object-fit: contain; display: block; background: #1a1a1a; }
        .movie-card.fallback-card img { object-fit: cover; }
        .movie-title { margin-bottom: 10px; font-weight: bold; font-size: 1.8rem; color: #e5a00d; padding: 0 10px; line-height: 1.1; }
        .trailer-btn { background: #e5a00d; color: black; border: none; padding: 10px; width: 90%; font-weight: bold; border-radius: 8px; margin: 5px 0; cursor: pointer; font-size: 0.8rem; z-index: 200; }
        .trailer-box { width: 90%; aspect-ratio: 16/9; background: #000; margin: 5px 0; border-radius: 8px; display: none; overflow: hidden; }
        .trailer-box iframe { width: 100%; height: 100%; border: none; }
        #matches-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.98); z-index: 20000; display: flex; flex-direction: column; align-items: center; padding: 20px; box-sizing: border-box; }
        #matches-list { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; width: 100%; max-width: 500px; overflow-y: auto; padding-bottom: 120px; }
        .mini-poster { width: 100%; aspect-ratio: 2/3; border-radius: 10px; }
        .mini-front img { width: 100%; height: 100%; object-fit: cover; }
        .mini-front { border: 2px solid #333; }
        .mini-back { padding: 10px; border-radius: 10px; }
        .plex-open-btn { background: #e5a00d; color: black; border: none; padding: 10px 5px; border-radius: 4px; font-weight: bold; font-size: 0.75rem; cursor: pointer; text-decoration: none; width: 90%; margin-top: 10px; display: block; text-align: center; }
        .mini-title-text { font-size: 1.1rem; font-weight: bold; color: #e5a00d; text-align: center; margin-bottom: 5px; line-height: 1.1; }
        .stats-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
        .stat-badge { background: black; color: #e5a00d; padding: 4px 8px; border-radius: 5px; font-weight: bold; font-size: 0.8rem; }
        .back-content { overflow-y: auto; flex-grow: 1; margin-bottom: 10px; padding: 0 15px; }
        .back-content p { font-size: 0.95rem; line-height: 1.4; color: #eee; margin: 0; text-align: left; }
        .glow-side { position: absolute; top: 0; width: 40%; height: 100%; pointer-events: none; z-index: 10; opacity: 0; transition: opacity 0.2s; }
        #glow-left { left: 0; background: linear-gradient(to right, rgba(211, 47, 47, 0.8), transparent); }
        #glow-right { right: 0; background: linear-gradient(to left, rgba(76, 175, 80, 0.8), transparent); }
        .pill-btn { position: fixed; bottom: 2.5vh; width: 120px; height: 45px; border-radius: 30px; border: none; font-weight: bold; font-size: 0.9rem; z-index: 9999; cursor: pointer; box-shadow: 0 4px 15px rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; }
        #matches-pill { right: 20px; background: #e5a00d; color: black; }
        #quit-pill { left: 20px; background: #d32f2f; color: black; }
        #undo-btn { position: fixed; bottom: 9vh; left: 50%; transform: translateX(-50%); background: #222; color: #a64703; width: 65px; height: 65px; border-radius: 50%; border: 3px solid #a64703; font-size: 1.0rem; z-index: 9999; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 15px rgba(0,0,0,0.8); }
        
        #match-overlay { position: fixed; top: 15px; left: 4vw; width: 92vw; max-width: 450px; background: linear-gradient(135deg, #1e1e1e 0%, #121212 100%); z-index: 15000; display: grid; grid-template-columns: 95px 1fr; gap: 16px; padding: 20px; box-sizing: border-box; backdrop-filter: blur(12px); border: 2px solid #e5a00d; border-radius: 18px; box-shadow: 0 12px 35px rgba(0,0,0,0.85), 0 0 25px rgba(229, 160, 13, 0.25); transform: translateY(-160%); transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.2); touch-action: none; overflow: hidden; }
        @media (min-width: 480px) { #match-overlay { left: calc(50% - 225px); } }
        #match-overlay.show { transform: translateY(0); }
        .match-poster-preview { grid-column: 1; grid-row: 1; width: 95px; height: 142px; border-radius: 12px; object-fit: cover; border: 2px solid #2a2a2a; box-shadow: 0 6px 14px rgba(0,0,0,0.6); flex-shrink: 0; }
        .match-details-grid { grid-column: 2; display: grid; grid-template-columns: 1fr 85px; gap: 6px; align-items: center; position: relative; }
        .match-heading-container { grid-column: 1 / span 2; text-align: left; margin-bottom: 2px; }
        .match-text-info { grid-column: 1 / span 2; text-align: left; padding-right: 70px; align-self: start; min-width: 0; }
        .avatar-frame { position: absolute; bottom: 0; right: 0; width: 60px; height: 80px; overflow: hidden; flex-shrink: 0; }
        .match-logo { width: 100%; height: 100%; object-fit: contain; }
        
        .match-instruction { color: #ffffff; font-size: 0.9rem; font-style: italic; z-index: 20001; pointer-events: none; }
        .pill-modal-btn { background: #e5a00d; color: black; border: none; padding: 10px 22px; font-size: 0.85rem; border-radius: 25px; cursor: pointer; font-weight: bold; z-index: 20001; }
        #poster-instruction { position: fixed; bottom: 18vh; left: 50%; transform: translateX(-50%); width: 100%; }
        #modal-instruction { position: fixed; bottom: 70px; left: 0; width: 100%; text-align: center; }
        
        #genre-pill { position: fixed; top: 15px; right: 15px; width: 100px; height: 35px; border-radius: 20px; border: 1px solid #e5a00d; background: rgba(0,0,0,0.6); color: #e5a00d; font-weight: bold; font-size: 0.8rem; z-index: 10001; cursor: pointer; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(5px); }
        #genre-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.95); z-index: 30000; display: flex; flex-direction: column; align-items: center; padding: 20px; box-sizing: border-box; overflow: hidden; }
        #genre-modal h1 { flex-shrink: 0; margin: 20px 0 15px; }
        #genre-modal .menu-btn { flex-shrink: 0; margin: 15px 0 10px; }
        .genre-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 400px; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 5px; }
        .genre-item { background: #222; border: 1px solid #333; color: white; padding: 15px; border-radius: 10px; text-align: center; font-weight: bold; cursor: pointer; }
        .genre-item.active { border-color: #e5a00d; color: #e5a00d; }
        
        #solo-badge { position: fixed; top: 15px; left: 15px; background: rgba(0,0,0,0.6); border: 1px solid #666; color: #aaa; font-size: 0.75rem; font-weight: bold; padding: 6px 12px; border-radius: 20px; z-index: 10001; backdrop-filter: blur(5px); letter-spacing: 0.05em; }
        #match-solo-label { font-size: 1rem; color: #bbb; font-style: italic; margin: 12px 0 0 0; }
        
        #quit-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.92); z-index: 40000; display: flex; flex-direction: column; align-items: center; justify-content: center; backdrop-filter: blur(10px); }
        #quit-modal h2 { font-size: 1.8rem; color: #ff3131; margin: 0 0 10px; text-shadow: 0 0 10px #ff3131; }
        #quit-modal p { color: #888; font-size: 0.95rem; margin: 0 0 35px; padding: 0 30px; line-height: 1.5; }
        .quit-btn-row { display: flex; flex-direction: column; align-items: center; gap: 12px; }
        #quit-confirm-btn { background: #d32f2f; color: white; border: none; padding: 14px 30px; border-radius: 8px; font-size: 1rem; font-weight: bold; cursor: pointer; transition: box-shadow 0.3s; width: 200px; }
        #quit-confirm-btn:hover { box-shadow: 0 0 20px rgba(211,47,47,0.7); }
        #quit-cancel-btn { background: #222; color: #aaa; border: 1px solid #444; padding: 14px 30px; border-radius: 8px; font-size: 1rem; font-weight: bold; cursor: pointer; transition: border-color 0.3s, color 0.3s; width: 200px; }
        #quit-cancel-btn:hover { border-color: #888; color: white; }
        
        #delete-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 49999; }
        #delete-modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #1a1a1a; border: 1px solid #333; border-radius: 16px; z-index: 50000; padding: 30px 25px; width: 280px; box-shadow: 0 8px 40px rgba(0,0,0,0.8); text-align: center; }
        #delete-modal h3 { font-size: 1.2rem; color: #ff3131; margin: 0 0 8px; }
        #delete-modal p { color: #888; font-size: 0.85rem; margin: 0 0 25px; line-height: 1.4; }
        .delete-btn-col { display: flex; flex-direction: column; align-items: center; gap: 10px; }
        #delete-confirm-btn { background: #d32f2f; color: white; border: none; padding: 12px 0; border-radius: 8px; font-size: 0.95rem; font-weight: bold; cursor: pointer; width: 100%; }
        #delete-cancel-btn { background: #222; color: #aaa; border: 1px solid #444; padding: 12px 0; border-radius: 8px; font-size: 0.95rem; font-weight: bold; cursor: pointer; width: 100%; }
        
        .stamp-yes, .stamp-no { position: absolute; top: 20px; font-size: 4rem; opacity: 0; pointer-events: none; transition: opacity 0.1s; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6)); }
        .stamp-yes { left: 20px; }
        .stamp-no  { right: 20px; }

        .solo-add-stamp { position: fixed; top: 50%; left: 50%; --tilt: -10deg; transform: translate(-50%, -50%) rotate(var(--tilt)) scale(0.7); background: rgba(245, 240, 225, 0.94); color: #d32f2f; border: 4px double #d32f2f; padding: 10px 24px; border-radius: 6px; font-weight: 900; font-size: 1.3rem; text-transform: uppercase; letter-spacing: 0.12em; white-space: nowrap; opacity: 0; pointer-events: none; z-index: 9000; transition: opacity 0.15s ease, transform 0.15s ease; text-shadow: 0 0 1px #d32f2f; box-shadow: 0 0 0 1px rgba(211,47,47,0.3) inset, 0 4px 18px rgba(0,0,0,0.5); font-family: 'Arial Black', sans-serif; }
        .solo-add-stamp.jf { color: #00a4dc; border-color: #00a4dc; text-shadow: 0 0 1px #00a4dc; box-shadow: 0 0 0 1px rgba(0,164,220,0.3) inset, 0 4px 18px rgba(0,0,0,0.5); }
        .solo-add-stamp.show { opacity: 0.96; transform: translate(-50%, -50%) rotate(var(--tilt)) scale(1); }

        .cast-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 6px 8px 0; width: 100%; box-sizing: border-box; }
        .cast-member { display: flex; flex-direction: column; align-items: center; width: 56px; flex-shrink: 0; }
        .cast-member img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 2px solid #e5a00d; background: #333; }
        .cast-member .no-photo { width: 52px; height: 52px; border-radius: 50%; background: #333; border: 2px solid #555; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
        .cast-member span { font-size: 0.58rem; color: #ccc; text-align: center; margin-top: 4px; line-height: 1.2; word-break: break-word; }
        
        .logout-btn { background: none; border: 1px solid #444; color: #666; padding: 8px 20px; border-radius: 20px; text-decoration: none; cursor: pointer; margin-top: 20px; font-size: 0.95rem; font-weight: bold; transition: all 0.3s ease; }
        .logout-btn:hover { color: #ccc; border-color: #888; background: rgba(255,255,255,0.05); }
        .signature { position: fixed; bottom: 10px; width: 100%; font-family: 'allura', cursive; color: rgba(79, 5, 5, 0.9); font-size: 1.8rem; pointer-events: none; z-index: 2; }

        #jellyfin-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.95); z-index: 60000; display: flex; flex-direction: column; align-items: center; justify-content: center; backdrop-filter: blur(10px); }
        #plex-profile-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.95); z-index: 60000; display: flex; flex-direction: column; align-items: center; justify-content: center; backdrop-filter: blur(10px); padding: 20px; box-sizing: border-box; }
        .plex-profile-btn { display: flex; align-items: center; gap: 14px; width: 100%; background: #1a1a1a; border: 1px solid #333; border-radius: 12px; padding: 12px 16px; cursor: pointer; transition: border-color 0.2s, background 0.2s; text-align: left; }
        .plex-profile-btn:hover { border-color: #e5a00d; background: #222; }
        .plex-profile-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: #333; flex-shrink: 0; }
        .plex-profile-name { color: white; font-size: 1rem; font-weight: bold; }
        .plex-profile-restricted { font-size: 0.75rem; color: #e5a00d; margin-top: 2px; }
        .login-form { width: 85%; max-width: 300px; display: flex; flex-direction: column; gap: 15px; }
        .login-form input { padding: 15px; border-radius: 8px; border: 1px solid #444; background: #222; color: white; font-size: 1rem; }

        @keyframes shake {
            0%, 100% { transform: translateX(-50%) rotate(0deg); }
            15% { transform: translateX(calc(-50% - 6px)) rotate(-4deg); }
            30% { transform: translateX(calc(-50% + 6px)) rotate(4deg); }
            45% { transform: translateX(calc(-50% - 4px)) rotate(-3deg); }
            60% { transform: translateX(calc(-50% + 4px)) rotate(3deg); }
            75% { transform: translateX(calc(-50% - 2px)) rotate(-1deg); }
        }
        .undo-shake { animation: shake 0.4s ease; }

        #toast { position: fixed; bottom: 9vh; left: 50%; transform: translateX(-50%); background: #d32f2f; color: white; padding: 10px 20px; border-radius: 20px; font-size: 0.85rem; font-weight: bold; z-index: 99999; opacity: 0; transition: opacity 0.3s ease; pointer-events: none; white-space: nowrap; box-shadow: 0 4px 15px rgba(0,0,0,0.6); }
        #toast.show { opacity: 1; }

        .btn-spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(0,0,0,0.3); border-top-color: black; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; margin-right: 6px; }
        @keyframes spin { to { transform: rotate(360deg); } }

        #end-of-deck {
            position: absolute; inset: 0; display: flex; flex-direction: column;
            align-items: center; justify-content: center; border-radius: 20px;
            background: #111; border: 2px solid #333; padding: 30px 20px; box-sizing: border-box;
        }
        #end-of-deck .end-quote {
            font-family: 'allura', cursive; font-size: 2rem; color: #e5a00d;
            line-height: 1.3; margin-bottom: 12px;
            text-shadow: 0 0 8px rgba(229,160,13,0.3);
        }
        #end-of-deck .end-attr {
            font-size: 0.75rem; color: #666; font-style: italic; margin-bottom: 28px; letter-spacing: 0.05em;
        }
        #end-of-deck .end-sub {
            font-size: 0.85rem; color: #555; margin-bottom: 20px;
        }
        #end-of-deck .end-btn {
            background: none; border: 1px solid #e5a00d; color: #e5a00d;
            padding: 10px 24px; border-radius: 20px; font-size: 0.85rem;
            font-weight: bold; cursor: pointer; transition: background 0.2s;
        }
        #end-of-deck .end-btn:hover { background: rgba(229,160,13,0.1); }

