/* PLAYER PANELS */
#player-panels {
    width: 100%;
    max-width: 760px;
    flex-shrink: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 6px;
}

.player-panel {
    border-radius: 10px;
    padding: 7px 8px 6px;
    border: 1px solid transparent;
    border-left: 3px solid transparent;
    background: rgba(255,255,255,0.05);
    transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.player-panel.active-turn {
    background: rgba(255,255,255,0.09);
    box-shadow: 0 0 10px rgba(255,255,255,0.06);
}

/* Row 1 — avatar + name + turn badge */
.panel-header {
    display: flex;
    align-items: center;
    gap: 5px;
}

.panel-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
    text-transform: uppercase;
}

.panel-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.panel-name {
    font-size: 11px;
    font-weight: bold;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.turn-badge {
    font-size: 7px;
    padding: 2px 5px;
    border-radius: 20px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

/* Row 2 — token pips */
.panel-pips {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 1px 0;
}

.panel-pip {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

/* On board — full player color */
.panel-pip.out {
    border-color: transparent;
    box-shadow: none;
}

/* Reached home — bright with inner glow */
.panel-pip.home {
    border-color: rgba(255,255,255,0.6);
    box-shadow: 0 0 4px currentColor;
}

/* Row 3 — stake + place badge */
.panel-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 10px;
    color: rgba(255,255,255,0.45);
}

.panel-stake { flex: 1; }

.panel-place {
    font-size: 13px;
    line-height: 1;
}

/* SETTINGS PANEL */
#settings-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 299;
}

#settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100vh;
    background: linear-gradient(180deg, #1a1a2e, #141428);
    border-left: 1px solid rgba(255,255,255,0.08);
    z-index: 300;
    box-shadow: -10px 0 40px rgba(0,0,0,0.5);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

#settings-panel.open {
    transform: translateX(0);
}

#settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px 14px;
    font-size: 18px;
    font-weight: bold;
    color: white;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

#close-settings-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.15s;
}

#close-settings-btn:hover { background: rgba(255,255,255,0.2); }

#settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 20px 16px;
}

#settings-footer {
    padding: 12px 20px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.settings-section {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.settings-section:last-child { border-bottom: none; }

.settings-section-title {
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255,215,0,0.7);
    margin-bottom: 10px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
}

.setting-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.setting-item-name {
    font-size: 14px;
    color: white;
    font-weight: 600;
}

.setting-item-hint {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
}

/* Toggle switch */
.setting-toggle {
    position: relative;
    width: 46px;
    height: 26px;
    border-radius: 26px;
    border: none;
    background: rgba(255,255,255,0.12);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: background 0.2s;
}

.setting-toggle[aria-checked="true"] {
    background: gold;
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: transform 0.2s;
}

.setting-toggle[aria-checked="true"] .toggle-thumb {
    transform: translateX(20px);
}

/* Token speed slider */
.speed-wrap {
    width: 150px;
    flex-shrink: 0;
}

#speed-slider {
    width: 100%;
    margin: 0;
    accent-color: gold;
    cursor: pointer;
}

.speed-labels {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: rgba(255,255,255,0.4);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.setting-full-btn {
    width: 100%;
    padding: 11px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    text-align: center;
}

.setting-full-btn:hover { background: rgba(255,255,255,0.1); }

.setting-full-btn.danger {
    color: #ff5555 !important;
    border-color: rgba(255,90,90,0.5);
    background: rgba(255,90,90,0.08);
}

.setting-full-btn.danger:hover { background: rgba(255,90,90,0.16); }

/* Background picker */
#bg-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 8px;
    margin-top: 4px;
    max-height: 280px;
    overflow-y: auto;
    padding: 3px;
    scrollbar-width: thin;
}

.bg-swatch {
    appearance: none;
    width: 100%;
    min-width: 0;
    aspect-ratio: 1.35;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s, transform 0.15s;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.85);
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    padding: 2px;
    box-sizing: border-box;
}

.bg-swatch:hover  { transform: scale(1.03); }
.bg-swatch.active { border-color: gold; box-shadow:0 0 0 1px #ffdc3a,0 0 12px rgba(255,215,0,.35); }
.bg-swatch:focus-visible{outline:2px solid #5cdbff;outline-offset:2px}

/* Rules modal content */
.rules-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 0;
}

.rules-content p {
    font-size: 13px;
    color: rgba(255,255,255,0.8);
    line-height: 1.5;
    margin: 0;
}

/* Independent audio controls keep music, effects, and voice adjustable. */
.audio-volume-setting{display:grid!important;grid-template-columns:minmax(112px,1fr) minmax(100px,1.4fr) 42px;align-items:center;gap:10px}.audio-volume-setting label{color:#d9e4ec;font-size:13px;font-weight:700}.audio-volume-setting input{width:100%;accent-color:#ffdc00}.audio-volume-setting output{color:#ffdc00;font-size:12px;text-align:right;font-variant-numeric:tabular-nums}
.music-style-setting{display:grid!important;gap:9px}.music-style-options,.audio-preview-actions{display:flex;gap:8px}.music-style-options button,.audio-preview-actions button{min-height:34px;padding:0 12px;border:1px solid #40586a;border-radius:7px;background:#0b1924;color:#dbe7f1;font-weight:700;cursor:pointer}.music-style-options button.active{border-color:#ffdc00;background:#3e3510;color:#ffdc00}.audio-preview-actions{padding:3px 0 8px}.audio-preview-actions button{flex:1;font-size:12px}
