        .container { max-width: 550px; width: 100%; }
        h1 { text-align: center; color: var(--accent); letter-spacing: 2px; margin-bottom: 20px; text-transform: uppercase; }

        .player-tag { display: inline-block; padding: 4px 8px; border-radius: 4px; font-weight: bold; color: #1a1a2e; font-size: 0.75rem; text-transform: uppercase; text-align: center; min-width: 70px; }
        .player-toggle-zone { background: var(--card-bg); padding: 15px; border-radius: 12px; margin-bottom: 15px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; border: 1px solid var(--secondary); }
        .p-chk { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; }
        .p-chk input { width: 22px; height: 22px; accent-color: var(--accent); }

        .results { background: var(--card-bg); padding: 15px; border-radius: 15px; margin-bottom: 10px; border: 2px solid var(--secondary); }
        .player-row { display: flex; align-items: flex-start; background: rgba(255, 255, 255, 0.05); padding: 10px; border-radius: 10px; gap: 12px; margin-bottom: 8px; }
        .char-img-roll { width: 65px; height: 65px; border-radius: 8px; object-fit: cover; border: 1px solid var(--accent); }
        .roll-stats { font-size: 0.65rem; color: #aaa; margin-top: 4px; display: flex; flex-direction: column; gap: 2px; }
        .char-select { flex: 1; background: #1a1a2e; color: white; border: 1px solid var(--secondary); padding: 10px; border-radius: 5px; outline: none; width: 100%; }
        /* Validation Styling */
        .char-select.error { border-color: var(--danger); background: #301014; }
        #error-msg { color: var(--danger); font-size: 0.85rem; font-weight: bold; text-align: center; margin: 10px 0; display: none; background: rgba(148, 27, 45, 0.1); padding: 8px; border-radius: 5px; border: 1px solid var(--danger); }

        #rollBtn { background: var(--accent); width: 100%; padding: 15px; font-size: 1.1rem; border: none; border-radius: 8px; color: white; font-weight: bold; cursor: pointer; }
        .btn-confirm { background: #28a745; display: none; width: 100%; padding: 15px; border: none; border-radius: 8px; color: white; font-weight: bold; margin-top: 10px; cursor: pointer; }
        .btn-confirm.disabled { background: #444 !important; opacity: 0.5; cursor: not-allowed; }

        .db-toggle-btn { background: var(--secondary); color: white; width: 100%; padding: 10px; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; margin: 25px 0 15px 0; text-transform: uppercase; font-size: 0.8rem; }
        #dbSection { display: none; width: 100%; }

        .admin-toggle-btn { background: red; color: white; width: 100%; padding: 10px; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; margin: 25px 0 15px 0; text-transform: uppercase; font-size: 0.8rem; }
        #adminSection { display: none; width: 100%; }

        /* Management Form */
        .manage-form { background: var(--card-bg); padding: 15px; border-radius: 12px; margin-bottom: 20px; border: 1px solid var(--secondary); }
        .form-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 10px; }
        input[type="text"] { background: #1a1a2e; color: white; border: 1px solid var(--secondary); padding: 10px; border-radius: 5px; font-size: 0.9rem; }
        .btn-save { background: var(--accent); color: white; border: none; padding: 12px; border-radius: 6px; width: 100%; cursor: pointer; font-weight: bold; }
        .btn-cancel { background: #444; color: white; border: none; padding: 8px; border-radius: 6px; width: 100%; cursor: pointer; margin-top: 5px; font-size: 0.8rem; }

        .char-item { background: var(--card-bg); border-radius: 12px; padding: 15px; margin-bottom: 15px; border: 1px solid var(--secondary); display: flex; gap: 15px; position: relative; }
        .btn-edit-small { position: absolute; top: 10px; right: 10px; background: var(--edit); border: none; padding: 4px 8px; border-radius: 4px; font-size: 0.6rem; font-weight: bold; cursor: pointer; color: #1a1a2e; }
        .list-thumb { width: 70px; height: 70px; border-radius: 8px; object-fit: cover; border: 2px solid var(--accent); }
        .hero-details { flex: 1; }
        .hero-name { font-size: 1.1rem; font-weight: bold; color: var(--accent); margin-bottom: 8px; display: inline flow-root; }
        .group-label { font-variant-caps:all-small-caps; font-size: 0.8rem;}

        .stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 10px; }
        .player-stat-box { background: rgba(0,0,0,0.2); padding: 8px; border-radius: 6px; border-left: 3px solid transparent; }
        .stat-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
        .stat-label { font-size: 0.6rem; color: #aaa; text-transform: uppercase; }
        .stat-value { font-size: 0.7rem; font-weight: bold; }
        .stat-date { font-size: 0.55rem; color: #666; display: block; text-align: right; margin-top: 2px; }

        .sort-controls { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 15px; justify-content: center; }
        .btn-sort { color: black; border: none; padding: 6px 10px; border-radius: 4px; font-size: 0.7rem; font-weight: bold; cursor: pointer; }
        /* Container for the horizontal row */
        .sort-row { display: flex; gap: 8px; width: 100%; overflow-x: auto; padding-top: 10px; padding-bottom: 5px; scrollbar-width: none; justify-content: center; }
        .sort-row::-webkit-scrollbar { display: none; }
        /* The Compact Player Card */
        .player-card-mini { flex: 0 0 auto; background: rgba(255, 255, 255, 0.05); border-left: 4px solid transparent; border-radius: 4px; padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; min-width: 40px; }
        .mini-name { font-size: 0.6rem; font-weight: bold; text-transform: uppercase; opacity: 0.7; }
        .mini-actions { display: grid; gap: 4px; }
        .btn-mini-sort { flex: 1; background: var(--secondary); border: 1px solid transparent; color: white; padding: 4px 0; font-size: 0.65rem; border-radius: 3px; cursor: pointer; }
        /* Active State: The button turns the player's color */
        .btn-mini-sort.active { color: white; background: var(--accent); border-color: white; font-weight: bold; }
        .btn-danger { background: var(--danger); color: white; border: none; padding: 10px; border-radius: 6px; font-size: 0.75rem; font-weight: bold; cursor: pointer; width: 100%; margin-top: 10px; }
        /* Style the X button */
        .clear-btn { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); cursor: pointer; font-size: 16px; color: #888; display: none; /* hidden by default */ user-select: none; }
        .clear-btn:hover { color: #000; }