        :root {
            --bg: #0f172a; --surface: #1e293b; --surface-light: #334155;
            --accent-h: 259; --accent-s: 94%; --accent-l: 66%;
            --accent: hsl(var(--accent-h), var(--accent-s), var(--accent-l));
            --accent-glow: hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.4);
            --text: #f8fafc; --text-dim: #94a3b8;
            --success: #10b981; --danger: #ef4444; --warning: #f59e0b;
            --safe-top: env(safe-area-inset-top);
            --safe-bottom: env(safe-area-inset-bottom);
        }
        * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
        body { background-color: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; line-height: 1.5; touch-action: manipulation; }
        header { position: sticky; top: 0; background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(12px); padding: calc(1rem + var(--safe-top)) 1.5rem 1rem; z-index: 1000; border-bottom: 1px solid rgba(255,255,255,0.05); }
        main { flex: 1; display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 600px; margin: 0 auto; padding: 1rem; padding-bottom: calc(6rem + var(--safe-bottom)); }
        h1 { font-size: 1.75rem; font-weight: 800; background: linear-gradient(135deg, #a78bfa, #8b5cf6, #ec4899); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
        h2 { font-size: 1.25rem; font-weight: 700; color: var(--text); }
        .subtitle { font-size: 0.8rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
        .view { display: none; width: 100%; flex-direction: column; gap: 1.25rem; animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
        .view.active { display: flex; }
        @keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
        .card { background: var(--surface); border-radius: 1.5rem; padding: 1.5rem; border: 1px solid rgba(255,255,255,0.05); box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5); width: 100%; }
        .btn { cursor: pointer; border: none; border-radius: 1rem; padding: 1rem; font-weight: 700; font-size: 1rem; display: flex; align-items: center; justify-content: center; gap: 0.5rem; transition: all 0.2s; min-height: 3.5rem; }
        .btn:active { transform: scale(0.96); opacity: 0.9; }
        .btn-primary { background: var(--accent); color: white; box-shadow: 0 8px 20px var(--accent-glow); }
        .btn-secondary { background: var(--surface-light); color: var(--text); }
        .btn-ghost { background: transparent; color: var(--text-dim); border: 1.5px solid var(--surface-light); }
        .btn-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
        .btn-icon { padding: 0.5rem; min-height: 0; border-radius: 0.75rem; display: flex; width: auto; }
        .input-row { display: flex; gap: 0.5rem; width: 100%; }
        input { flex: 1; background: var(--bg); border: 1.5px solid var(--surface-light); border-radius: 1rem; padding: 1rem; color: var(--text); font-size: 1.1rem; outline: none; min-width: 0; }
        input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
        .player-row { display: flex; align-items: center; gap: 1rem; padding: 1.25rem; background: var(--surface); border-radius: 1.25rem; border: 1px solid rgba(255,255,255,0.03); width: 100%; }
        .rank-num { font-size: 1.25rem; font-weight: 900; color: var(--accent); min-width: 1.5rem; opacity: 0.5; }
        .player-score { font-size: 1.75rem; font-weight: 800; font-variant-numeric: tabular-nums; margin-left: auto; }
        .winning .player-score { color: var(--success); text-shadow: 0 0 15px rgba(16, 185, 129, 0.3); }
        .fab { position: fixed; bottom: calc(1.5rem + var(--safe-bottom)); right: 1.5rem; width: 4.5rem; height: 4.5rem; border-radius: 2.25rem; background: var(--accent); color: white; box-shadow: 0 12px 24px rgba(139, 92, 246, 0.4); display: flex; align-items: center; justify-content: center; z-index: 1000; font-size: 2rem; border: none; }
        .sync-pill { display: flex; align-items: center; gap: 0.5rem; background: rgba(255,255,255,0.05); padding: 0.4rem 0.75rem; border-radius: 2rem; font-size: 0.7rem; font-weight: 600; color: var(--text-dim); margin-top: 4px; width: fit-content; }
        .dot { width: 6px; height: 6px; background: var(--success); border-radius: 50%; animation: pulse 2s infinite; }
        @keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.8); } }
        .score-box { background: var(--bg); border-radius: 1.5rem; padding: 1.5rem; text-align: center; border: 2px solid var(--accent); box-shadow: 0 0 20px var(--accent-glow); }
        .score-val { font-size: 3.5rem; font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
        .score-label { font-size: 0.8rem; text-transform: uppercase; color: var(--text-dim); letter-spacing: 2px; }
        .score-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.5rem; width: 100%; margin-top: 1rem; }
        .score-btn { aspect-ratio: 1; border: none; border-radius: 0.75rem; background: var(--surface-light); color: var(--text); font-weight: 800; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; }
        .score-btn:active { background: var(--accent); color: white; transform: scale(0.9); }
        .score-btn.neg { color: var(--success); }
        .progress-bar { display: flex; gap: 4px; width: 100%; }
        .progress-dot { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-light); }
        .progress-dot.filled { background: var(--accent); }
        .modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); backdrop-filter: blur(8px); display: none; justify-content: center; align-items: center; z-index: 2000; padding: 1.5rem; }
        .modal-overlay.active { display: flex; }
        .modal { background: var(--surface); border-radius: 2rem; padding: 2rem; width: 100%; max-width: 400px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); }
        #toast-container { position: fixed; top: calc(1rem + var(--safe-top)); left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 0.75rem; width: 90%; max-width: 400px; pointer-events: none; }
        .toast { background: rgba(30, 41, 59, 0.95); backdrop-filter: blur(10px); color: var(--text); padding: 1rem 1.25rem; border-radius: 1.25rem; border-left: 4px solid var(--accent); animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
        @keyframes toastIn { from { transform: translateY(-100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
        .sparkline { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; }
        .hidden { display: none !important; }
        #qrcode-container { background: white; padding: 1.25rem; border-radius: 1.5rem; margin: 1.5rem auto; width: fit-content; }
        .typing-indicator { font-size: 0.65rem; font-style: italic; color: var(--warning); margin-left: auto; display: flex; align-items: center; gap: 4px; }
        .typing-dot { width: 4px; height: 4px; background: var(--warning); border-radius: 50%; animation: typing 1s infinite; }
        @keyframes typing { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
        .list { display: flex; flex-direction: column; gap: 0.75rem; width: 100%; }
        .list-item { display: flex; align-items: center; justify-content: space-between; padding: 1rem; background: var(--surface); border-radius: 1.25rem; border: 1px solid rgba(255,255,255,0.03); }
        .toggle-btn { background: var(--bg); border: 1px solid var(--surface-light); color: var(--text-dim); padding: 0.4rem 0.8rem; font-size: 0.75rem; border-radius: 2rem; font-weight: 700; }
        .toggle-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
        .history-container { overflow-x: auto; margin-top: 1rem; width: 100%; border-radius: 1rem; }
        table { width: 100%; border-collapse: collapse; font-size: 0.85rem; color: var(--text-dim); min-width: 200px; }
        th { text-align: left; padding: 0.75rem; border-bottom: 1px solid var(--surface-light); color: var(--text); }
        td { padding: 0.75rem; border-bottom: 1px solid rgba(255, 255, 255, 0.02); }
        tr.clickable:active { background: var(--surface-light); }
        .chip { padding: 0.5rem 1rem; background: var(--surface-light); border-radius: 2rem; font-size: 0.85rem; cursor: pointer; transition: all 0.2s; border: 1px solid rgba(255,255,255,0.05); }
        .chip:active { background: var(--accent); color: white; }
        #picker-canvas { position: fixed; inset: 0; z-index: 5000; display: none; touch-action: none; background: rgba(15,23,42,0.95); }
        #picker-msg { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; width: 100%; pointer-events: none; }
        .picker-circle { position: absolute; width: 90px; height: 90px; border-radius: 50%; border: 4px solid var(--accent); transform: translate(-50%, -50%); pointer-events: none; box-shadow: 0 0 40px var(--accent-glow); transition: transform 0.1s cubic-bezier(0.17, 0.67, 0.83, 0.67); }
        .picker-circle.selected { border-color: var(--success); box-shadow: 0 0 60px rgba(16, 185, 129, 0.8); transform: translate(-50%, -50%) scale(1.3) !important; }
        .picker-circle.vibrate { animation: jiggle 0.15s infinite; }
        @keyframes jiggle {
            0% { transform: translate(-50%, -50%) rotate(0deg) scale(1); }
            25% { transform: translate(-52%, -48%) rotate(3deg) scale(1.05); }
            50% { transform: translate(-50%, -50%) rotate(0deg) scale(1); }
            75% { transform: translate(-48%, -52%) rotate(-3deg) scale(1.05); }
            100% { transform: translate(-50%, -50%) rotate(0deg) scale(1); }
        }
        .reaction-bubble { position: fixed; bottom: -50px; right: 20px; font-size: 2.5rem; pointer-events: none; z-index: 10000; animation: floatUp 3s ease-in forwards; filter: drop-shadow(0 5px 15px rgba(0,0,0,0.3)); }
        @keyframes floatUp {
            0% { transform: translateY(0) rotate(0deg) scale(0.5); opacity: 0; }
            10% { transform: translateY(-5vh) rotate(-10deg) scale(1.2); opacity: 1; }
            100% { transform: translateY(-90vh) rotate(20deg) scale(1); opacity: 0; }
        }
        .reaction-bar { position: fixed; top: calc(1rem + var(--safe-top)); right: 1rem; display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; z-index: 2000; }
        .reaction-toggle { width: 2.5rem; height: 2.5rem; border-radius: 50%; background: var(--surface-light); border: 1.5px solid var(--accent); color: var(--text); font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(0,0,0,0.3); transition: all 0.2s; }
        .reaction-toggle:active { transform: scale(0.9); }
        .reaction-menu { display: flex; flex-direction: column; gap: 0.5rem; transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); transform-origin: top; }
        .reaction-menu.collapsed { transform: scaleY(0); opacity: 0; pointer-events: none; height: 0; }
        .reaction-btn { width: 2.5rem; height: 2.5rem; border-radius: 50%; background: rgba(30, 41, 59, 0.85); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.1); font-size: 1.25rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
        .reaction-btn:active { transform: scale(1.2); background: var(--accent); }
        .theme-grid { display: flex; gap: 0.75rem; margin-top: 0.5rem; flex-wrap: wrap; }
        .theme-circle { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 3px solid rgba(255,255,255,0.1); transition: all 0.2s; }
        .theme-circle.active { border-color: white; transform: scale(1.2); box-shadow: 0 0 15px var(--accent-glow); }
        .lang-dropdown { position: relative; display: flex; align-items: center; gap: 0.5rem; background: var(--surface-light); padding: 0.5rem 0.75rem; border-radius: 1rem; cursor: pointer; width: fit-content; border: 1px solid rgba(255,255,255,0.05); }
        .lang-dropdown select { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; -webkit-appearance: none; }
        .lang-dropdown:active { transform: scale(0.95); }
