/* ==========================================================
   SYNTH PLAYER — Component styles
   TRANSMISSION design language. Mono voice dominant.
   ========================================================== */

/* --- Page shell --- */
.synth-page {
    width: var(--body-width, 87.5%);
    padding-left: var(--body-offset, 12.5%);
}

.synth-shell {
    padding: var(--sp-4, 3rem) 0;
    max-width: 56rem;
    overflow-x: hidden;
}

/* --- Header --- */
.synth-header {
    margin-bottom: var(--sp-2, 2rem);
    border-bottom: 1px solid var(--rule, #333);
    padding-bottom: var(--sp-1, 1.5rem);
}

.synth-title {
    font-family: var(--mono);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin: 0;
    line-height: 1;
}

.synth-sub {
    font-family: var(--serif);
    font-size: 0.9rem;
    font-style: italic;
    color: var(--fg-dim, #888);
    margin-top: 0.5rem;
    max-width: 42ch;
}

/* --- Seed bar --- */
.synth-seed-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: var(--sp-1, 1.5rem);
}

.synth-seed-label {
    font-family: var(--mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--fg-dim, #888);
    flex-shrink: 0;
}

.synth-seed-input {
    flex: 1;
    font-family: var(--mono);
    font-size: 0.85rem;
    background: transparent;
    border: 1px solid var(--rule, #333);
    color: var(--fg, #eee);
    padding: 0.4rem 0.6rem;
    outline: none;
    letter-spacing: 0.02em;
}

.synth-seed-input:focus {
    border-color: var(--fg-dim, #888);
}

.synth-seed-input::placeholder {
    color: var(--fg-dim, #888);
    opacity: 0.5;
}

.synth-btn {
    font-family: var(--mono);
    font-size: 0.85rem;
    background: transparent;
    border: 1px solid var(--rule, #333);
    color: var(--fg, #eee);
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    line-height: 1;
    transition: border-color 0.15s;
}

.synth-btn:hover {
    border-color: var(--fg-dim, #888);
}

/* --- Composition info --- */
.synth-info {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--fg-dim, #888);
    letter-spacing: 0.03em;
    margin-bottom: var(--sp-1, 1.5rem);
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
}

.synth-info-sep {
    opacity: 0.4;
}

.synth-hash {
    opacity: 0.6;
    cursor: help;
}

/* --- Arrangement timeline --- */
.synth-arrangement {
    margin-bottom: var(--sp-1, 1.5rem);
}

.synth-arrangement-label {
    font-family: var(--mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--fg-dim, #888);
    margin-bottom: 0.4rem;
}

.synth-arrangement-track {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.synth-section-block {
    font-family: var(--mono);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0;
    border: 1px solid var(--rule, #333);
    background: transparent;
    color: var(--fg-dim, #888);
    white-space: nowrap;
    transition: all 0.15s;
    flex-shrink: 0;
    display: flex;
    align-items: stretch;
    position: relative;
}

.synth-section-label-btn {
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    color: inherit;
    background: transparent;
    border: none;
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    flex: 1;
}

.synth-section-actions {
    display: none;
    align-items: center;
    gap: 0;
    border-left: 1px solid var(--rule, #333);
}

.synth-section-block:hover .synth-section-actions {
    display: flex;
}

.synth-section-action {
    font-family: var(--mono);
    font-size: 0.55rem;
    background: transparent;
    border: none;
    color: var(--fg-dim, #888);
    cursor: pointer;
    padding: 0.2rem 0.35rem;
    line-height: 1;
}

.synth-section-action:hover {
    color: var(--fg, #eee);
    background: oklch(0.2 0.02 160);
}

.synth-section-block:hover {
    border-color: var(--fg-dim, #888);
    color: var(--fg, #eee);
}

.synth-section-block.section-current {
    border-color: var(--fg-dim, #888);
    color: var(--fg, #eee);
}

.synth-section-block.section-active {
    background: oklch(0.2 0.05 160);
    border-color: oklch(0.5 0.1 160);
    color: var(--fg, #eee);
}

/* Section type colors */
.synth-section-block.section-intro   { border-left: 3px solid oklch(0.5 0.08 230); }
.synth-section-block.section-verse   { border-left: 3px solid oklch(0.5 0.08 160); }
.synth-section-block.section-chorus  { border-left: 3px solid oklch(0.6 0.12 25); }
.synth-section-block.section-bridge  { border-left: 3px solid oklch(0.5 0.08 300); }
.synth-section-block.section-buildup { border-left: 3px solid oklch(0.5 0.1 60); }
.synth-section-block.section-drop    { border-left: 3px solid oklch(0.65 0.15 25); }
.synth-section-block.section-outro   { border-left: 3px solid oklch(0.4 0.05 230); }

/* --- Section display in transport --- */
.synth-section-display {
    font-family: var(--mono);
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    margin-left: 0.5rem;
}

.synth-section-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--fg, #eee);
}

.synth-section-beat {
    font-size: 0.65rem;
    color: var(--fg-dim, #888);
}

/* --- Transport --- */
.synth-transport {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: var(--sp-2, 2rem);
    border-bottom: 1px solid var(--rule, #333);
    padding-bottom: var(--sp-1, 1.5rem);
}

.synth-transport-btn {
    font-size: 1.1rem;
    background: transparent;
    border: 1px solid var(--rule, #333);
    color: var(--fg, #eee);
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.15s;
    line-height: 1;
}

.synth-transport-btn:hover {
    border-color: var(--fg-dim, #888);
}

/* BPM control */
.synth-bpm-control {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: 0.5rem;
    font-family: var(--mono);
}

.synth-bpm-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--fg-dim, #888);
}

.synth-bpm-slider {
    width: 5rem;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--rule, #333);
    outline: none;
    cursor: pointer;
}

.synth-bpm-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    background: var(--fg, #eee);
    border: none;
    cursor: pointer;
}

.synth-bpm-slider::-moz-range-thumb {
    width: 10px;
    height: 10px;
    background: var(--fg, #eee);
    border: none;
    cursor: pointer;
}

.synth-bpm-value {
    font-size: 0.85rem;
    min-width: 2.5ch;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.synth-beat-display {
    margin-left: auto;
    font-family: var(--mono);
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.synth-beat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--fg-dim, #888);
}

.synth-beat-num {
    font-size: 1.2rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
}

/* --- Stems --- */
.synth-stems {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.synth-stem-row {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--rule, #333);
    transition: opacity 0.2s;
}

.synth-stem-row.stem-muted {
    opacity: 0.35;
}

.synth-stem-row.stem-soloed {
    opacity: 1;
}

.synth-stem-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    grid-column: 1 / -1;
}

.synth-stem-name {
    font-family: var(--mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--fg-dim, #888);
    flex-shrink: 0;
}

.synth-voice-select {
    font-family: var(--mono);
    font-size: 0.65rem;
    background: transparent;
    border: 1px solid var(--rule, #333);
    color: var(--fg, #eee);
    padding: 0.15rem 0.3rem;
    cursor: pointer;
    outline: none;
    flex-shrink: 0;
}

.synth-voice-select:hover,
.synth-voice-select:focus {
    border-color: var(--fg-dim, #888);
}

.synth-voice-select option {
    background: var(--bg, #111);
    color: var(--fg, #eee);
}

.synth-stem-viz {
    width: 100%;
    height: 48px;
    display: block;
    image-rendering: pixelated;
}

.synth-stem-controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.synth-stem-btn {
    font-family: var(--mono);
    font-size: 0.65rem;
    font-weight: 700;
    width: 1.6rem;
    height: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--rule, #333);
    background: transparent;
    color: var(--fg-dim, #888);
    cursor: pointer;
    transition: all 0.15s;
}

.synth-mute-btn.active {
    background: oklch(0.4 0.08 25);
    border-color: oklch(0.5 0.1 25);
    color: var(--fg, #eee);
}

.synth-solo-btn.active {
    background: oklch(0.4 0.08 230);
    border-color: oklch(0.5 0.1 230);
    color: var(--fg, #eee);
}

.synth-stem-btn:hover {
    border-color: var(--fg-dim, #888);
}

/* Volume slider */
.synth-volume {
    width: 4rem;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--rule, #333);
    outline: none;
    cursor: pointer;
}

.synth-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    background: var(--fg, #eee);
    border: none;
    cursor: pointer;
}

.synth-volume::-moz-range-thumb {
    width: 10px;
    height: 10px;
    background: var(--fg, #eee);
    border: none;
    cursor: pointer;
}

/* --- Colophon --- */
.synth-colophon {
    margin-top: var(--sp-4, 3rem);
    width: 100%;
}

/* --- Footer --- */
.synth-footer {
    max-width: 56rem;
}

/* --- Fidelity control --- */
.synth-fidelity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: var(--sp-2, 2rem);
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--rule, #333);
}

.synth-fidelity-label {
    font-family: var(--mono, monospace);
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--fg-dim, #888);
    white-space: nowrap;
}

.synth-fidelity-track {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.synth-fidelity-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: var(--rule, #333);
    outline: none;
    border-radius: 0;
}

.synth-fidelity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--fg, #eee);
    border: none;
    cursor: pointer;
}

.synth-fidelity-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--fg, #eee);
    border: none;
    cursor: pointer;
}

.synth-fidelity-marks {
    display: flex;
    justify-content: space-between;
    font-family: var(--mono, monospace);
    font-size: 0.5rem;
    color: var(--fg-dim, #666);
    letter-spacing: 0.05em;
}

.synth-fidelity-value {
    font-family: var(--mono, monospace);
    font-size: 0.7rem;
    color: var(--fg, #eee);
    min-width: 4rem;
    text-align: right;
}

/* --- Add/Remove stem --- */
.synth-add-stem {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: var(--sp-1, 1rem);
    margin-bottom: var(--sp-2, 2rem);
}

.synth-add-stem-select {
    font-family: var(--mono, monospace);
    font-size: 0.65rem;
    background: transparent;
    color: var(--fg, #eee);
    border: 1px solid var(--rule, #333);
    padding: 0.3rem 0.5rem;
}

.synth-add-stem-btn {
    font-size: 0.65rem;
    padding: 0.3rem 0.75rem;
}

.synth-remove-btn {
    color: var(--fg-dim, #888);
    font-size: 0.6rem;
}

.synth-remove-btn:hover {
    color: #f44;
}

/* --- Responsive --- */
@media (max-width: 760px) {
    .synth-page {
        width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    .synth-shell {
        padding: var(--sp-1, 1.5rem) var(--sp-half, 0.75rem);
    }

    .synth-header {
        margin-bottom: var(--sp-1, 1.5rem);
    }

    .synth-title {
        font-size: 1.4rem;
    }

    .synth-sub {
        font-size: 0.7rem;
    }

    /* Seed bar — input full width, buttons row below */
    .synth-seed-bar {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .synth-seed-label {
        order: 1;
        flex-basis: auto;
    }

    .synth-seed-input {
        min-width: 0;
        flex: 1;
        order: 2;
    }

    .synth-btn {
        order: 3;
        min-width: 2.2rem;
        min-height: 2.2rem;
    }

    /* Arrangement — horizontal scroll */
    .synth-arrangement-track {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.25rem;
    }

    .synth-section-block {
        font-size: 0.55rem;
        padding: 0;
    }

    .synth-section-label-btn {
        padding: 0.3rem 0.45rem;
    }

    /* Always show section actions on mobile (no hover) */
    .synth-section-actions {
        display: flex;
    }

    /* Fidelity — compact on mobile */
    .synth-fidelity {
        flex-wrap: wrap;
        gap: 0.3rem;
    }

    .synth-fidelity-marks {
        font-size: 0.45rem;
    }

    /* Add stem */
    .synth-add-stem {
        flex-wrap: wrap;
    }

    /* Transport — grid layout for mobile */
    .synth-transport {
        display: grid;
        grid-template-columns: auto auto 1fr;
        grid-template-rows: auto auto;
        gap: 0.4rem 0.5rem;
        align-items: center;
    }

    .synth-transport-btn {
        width: 2.8rem;
        height: 2.8rem;
        font-size: 1.2rem;
    }

    .synth-section-display {
        grid-column: 3;
        grid-row: 1;
        justify-self: end;
    }

    .synth-bpm-control {
        grid-column: 1 / 3;
        grid-row: 2;
        margin-left: 0;
        overflow: hidden;
        min-width: 0;
    }

    .synth-bpm-slider {
        flex: 1;
        width: auto;
        min-width: 2rem;
    }

    .synth-beat-display {
        grid-column: 3;
        grid-row: 2;
        justify-self: end;
        margin-left: 0;
    }

    .synth-beat-num {
        font-size: 1rem;
    }

    /* Info bar */
    .synth-info {
        font-size: 0.6rem;
        flex-wrap: wrap;
    }

    /* Stems — stack vertically, full-width canvas */
    .synth-stem-row {
        grid-template-columns: 1fr;
        gap: 0.3rem;
        padding: 0.6rem 0;
    }

    /* Stem header: name + voice + controls in one row */
    .synth-stem-name {
        font-size: 0.65rem;
        display: inline;
    }

    .synth-voice-select {
        font-size: 0.6rem;
    }

    /* Canvas: full width, taller for easier tapping */
    .synth-stem-viz {
        height: 56px;
        touch-action: manipulation;
    }

    /* Controls row */
    .synth-stem-controls {
        justify-content: flex-start;
        gap: 0.5rem;
    }

    .synth-stem-btn {
        width: 2rem;
        height: 2rem;
        font-size: 0.7rem;
    }

    .synth-volume {
        flex: 1;
        max-width: 10rem;
        height: 6px;
    }

    .synth-volume::-webkit-slider-thumb {
        width: 16px;
        height: 16px;
    }

    .synth-volume::-moz-range-thumb {
        width: 16px;
        height: 16px;
    }

    .synth-bpm-slider::-webkit-slider-thumb {
        width: 16px;
        height: 16px;
    }

    .synth-bpm-slider::-moz-range-thumb {
        width: 16px;
        height: 16px;
    }

    /* Colophon */
    .synth-colophon {
        width: 100%;
    }

    .synth-colophon dl {
        font-size: 0.55rem;
    }
}

/* Small phones */
@media (max-width: 400px) {
    .synth-seed-input {
        flex-basis: 100%;
    }

    .synth-bpm-slider {
        width: 3rem;
    }

    .synth-stem-viz {
        height: 64px;
    }
}

/* Extra small (phones in portrait) */
@media (max-width: 420px) {
    .synth-shell {
        padding: 1rem 0.5rem;
    }

    .synth-transport-btn {
        width: 3rem;
        height: 3rem;
        font-size: 1.3rem;
    }

    .synth-stem-viz {
        height: 64px;
    }

    .synth-bpm-slider {
        min-width: 4rem;
    }
}
