/* SIMUL8OR BACKGROUND MUSIC — settings panel, Option C (chips).
   Used by the Background Music section of the Settings pane on index.aspx
   (replay) and live-trading-simulator.aspx (live). Both pages share
   Terminal.Master, so this file is linked once there.

   Tokens only - no literal colours except the white-on-accent chip label. */

/* ── chip grid ──
   Five tracks wrap onto three lines in a 340px sidebar, which is the whole
   point of this option over a list: same one-tap switching, half the height. */
.s8-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s8-2);
    padding-top: var(--s8-3);
}

.s8-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: var(--s8-h);
    padding: 0 13px;
    border: 1px solid var(--s8-line-2);
    border-radius: var(--s8-r-pill);
    background: var(--s8-inset);
    color: var(--s8-fg-2);
    font: inherit;
    font-size: var(--s8-fs-sm);
    font-weight: 500;
    cursor: pointer;
    transition: background var(--s8-t) var(--s8-ease), border-color var(--s8-t) var(--s8-ease), color var(--s8-t) var(--s8-ease);
}

.s8-chip:hover {
    background: var(--s8-hover);
    color: var(--s8-fg);
}

.s8-chip:focus-visible {
    box-shadow: var(--s8-focus);
    outline: 0;
}

.s8-chip[aria-pressed="true"] {
    background: var(--s8-accent-tint);
    border-color: var(--s8-accent-line);
    color: #fff;
}

/* ── equalizer bars ──
   The only motion cue in the panel. It marks which track is playing, so it
   animates on the selected chip and only while audio is actually running -
   a paused or blocked context must not show dancing bars. */
.s8-eq {
    display: none;
    align-items: flex-end;
    gap: 2px;
    height: 13px;
    flex: none;
}

.s8-chip[aria-pressed="true"] .s8-eq {
    display: flex;
}

.s8-eq i {
    width: 2px;
    border-radius: 1px;
    background: var(--s8-accent);
}

.s8-chip[aria-pressed="true"] .s8-eq i {
    background: var(--s8-accent-fg);
}

/* Bars hold at their static heights until the track is really playing. */
.s8-music.is-playing .s8-eq i {
    animation: s8-eqb 1.1s var(--s8-ease) infinite;
}

.s8-eq i:nth-child(1) { height: 5px;  animation-delay: 0s; }
.s8-eq i:nth-child(2) { height: 12px; animation-delay: .18s; }
.s8-eq i:nth-child(3) { height: 8px;  animation-delay: .36s; }
.s8-eq i:nth-child(4) { height: 11px; animation-delay: .54s; }

@keyframes s8-eqb { 50% { height: 3px; } }

@media (prefers-reduced-motion: reduce) {
    .s8-music.is-playing .s8-eq i { animation: none; }
}

/* ── volume ── */
.s8-vol {
    display: flex;
    align-items: center;
    gap: var(--s8-3);
    padding-top: var(--s8-3);
}

.s8-vol > svg {
    width: 16px;
    height: 16px;
    flex: none;
    stroke: currentColor;
    stroke-width: 1.7;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    color: var(--s8-fg-4);
}

.s8-vol input[type="range"] {
    flex: 1;
    min-width: 0;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--s8-active);
    border-radius: var(--s8-r-pill);
    outline: 0;
    cursor: pointer;
}

.s8-vol input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 0;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}

.s8-vol input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 0;
    cursor: pointer;
}

.s8-vol input[type="range"]:focus-visible {
    box-shadow: var(--s8-focus);
}

.s8-vol b {
    width: 34px;
    flex: none;
    text-align: right;
    font-size: var(--s8-fs-xs);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--s8-fg-3);
}

/* ── master toggle off ──
   Dims like #commissionFields does behind its own master switch, but the
   chips stay clickable on purpose: picking a track is the second way to turn
   music on, and it is the one people actually find. Only the volume slider
   goes inert, since dragging it would do nothing audible. */
.s8-music__body {
    transition: opacity var(--s8-t) var(--s8-ease);
}

.s8-music__body.off {
    opacity: .5;
}

.s8-music__body.off .s8-vol {
    pointer-events: none;
}
