/* ═══ VARIABLES ═══════════════════════════════════════════════ */
:root {
    --bg: #0a0a0a;
    --surface: #111;
    --surface2: #181818;
    --surface3: #1e1e1e;
    --border: #2a2a2a;
    --accent: #e8ff3a;
    --text: #f0f0f0;
    --muted: #555;
    --muted2: #3a3a3a;
    --danger: #ff3a3a;
    --touch: 44px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'IBM Plex Mono', monospace;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0 80px;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: repeating-linear-gradient(0deg, transparent, transparent 40px, rgba(255, 255, 255, .01) 40px, rgba(255, 255, 255, .01) 41px),
    repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(255, 255, 255, .01) 40px, rgba(255, 255, 255, .01) 41px);
}

button {
    -webkit-tap-highlight-color: transparent;
}

/* ═══ LAYOUT ══════════════════════════════════════════════════ */
.page-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1440px;
    padding: 0 16px;
}

/* ═══ TOP BAR ═════════════════════════════════════════════════ */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-bar-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(28px, 5vw, 48px);
    letter-spacing: .1em;
    line-height: 1;
    color: var(--accent);
    text-shadow: 0 0 20px rgba(232, 255, 58, .2);
}

.top-bar-sub {
    font-size: 9px;
    letter-spacing: .25em;
    color: var(--muted);
    text-transform: uppercase;
    display: none;
}

.mp3-open-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    padding: 0 14px;
    height: var(--touch);
    min-width: var(--touch);
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    text-transform: uppercase;
}

.mp3-open-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.mp3-open-btn:hover, .mp3-open-btn.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.mp3-open-btn:active {
    transform: scale(.96);
}

/* ═══ THEMES ══════════════════════════════════════════════════ */
:root[data-theme="dark"] {
    --bg: #0a0a0a;
    --surface: #111;
    --surface2: #181818;
    --surface3: #1e1e1e;
    --border: #2a2a2a;
    --accent: #e8ff3a;
    --text: #f0f0f0;
    --muted: #555;
    --muted2: #3a3a3a;
    --danger: #ff3a3a;
}

:root[data-theme="light"] {
    --bg: #f0f0ec;
    --surface: #fff;
    --surface2: #f5f5f0;
    --surface3: #ebebea;
    --border: #d0d0c8;
    --accent: #1a1a1a;
    --text: #1a1a1a;
    --muted: #999;
    --muted2: #ccc;
    --danger: #cc2222;
}

/* theme switcher bar */
.theme-bar {
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-btn {
    background: transparent;
    border: 1px solid var(--muted2);
    color: var(--muted);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .1em;
    padding: 0 10px;
    height: 28px;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}

.theme-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.theme-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: transparent;
}

/* ═══ MAIN GRID ═══════════════════════════════════════════════ */
.main-grid {
    display: grid;
    grid-template-columns:1fr;
    gap: 16px;
}

/* ═══ SECTIONS ════════════════════════════════════════════════ */
.section {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 16px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-title {
    font-size: 10px;
    letter-spacing: .3em;
    color: var(--muted);
    text-transform: uppercase;
}

/* ═══ BPM ═════════════════════════════════════════════════════ */
.bpm-section {
    position: relative;
    overflow: hidden;
    container-type: inline-size;
    container-name: bpm;
}

.bpm-section::after {
    content: 'BPM';
    position: absolute;
    top: -8px;
    right: 12px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 72px;
    color: rgba(255, 255, 255, .025);
    pointer-events: none;
    line-height: 1;
}

.bpm-display {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 16px;
}

/* группы кнопок слева и справа */
.bpm-btn-group {
    display: flex;
    flex-direction: row;
    gap: 8px;
    flex-shrink: 0;
}

.bpm-step-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    padding: 0 12px;
    height: var(--touch);
    min-width: var(--touch);
    cursor: pointer;
    transition: all .1s;
    letter-spacing: .05em;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bpm-step-btn:hover {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.bpm-step-btn:active {
    transform: scale(.94);
}

.bpm-value-wrap {
    flex: 1;
    border: 1px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-width: 160px;
}

/* при сжатии секции — кнопки строятся в столбик */
@container bpm (max-width:360px) {
    .bpm-btn-group {
        flex-direction: column;
    }

    .bpm-step-btn {
        height: auto;
        min-height: var(--touch);
        padding: 6px 8px;
    }
}

.bpm-value {
    color: var(--accent);
    font-family: 'Bebas Neue', sans-serif;
    font-size: 72px;
    line-height: 1;
    padding: 4px 16px;
    user-select: none;
    white-space: nowrap;
    display: block;
    text-align: center;
}

.bpm-label {
    font-size: 10px;
    letter-spacing: .2em;
    color: var(--muted);
    padding: 2px 8px 8px;
    align-self: flex-end;
    white-space: nowrap;
    flex-shrink: 0;
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: var(--border);
    outline: none;
    cursor: pointer;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--accent);
    cursor: pointer;
    border-radius: 0;
    transition: transform .1s;
}

input[type=range]::-webkit-slider-thumb:active {
    transform: scale(1.3);
}

input[type=range]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--accent);
    border: none;
    border-radius: 0;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: var(--muted);
    margin-top: 6px;
    letter-spacing: .06em;
}

.slider-labels span {
    display: none;
}

.slider-labels span:first-child, .slider-labels span:last-child {
    display: inline;
}

.tempo-name {
    text-align: center;
    font-size: 10px;
    letter-spacing: .3em;
    color: var(--muted);
    text-transform: uppercase;
    margin-top: 10px;
}

/* ═══ BEATS ═══════════════════════════════════════════════════ */
.beats-count-ctrl {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ctrl-btn {
    width: var(--touch);
    height: var(--touch);
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'IBM Plex Mono', monospace;
    transition: all .1s;
    line-height: 1;
}

.ctrl-btn:hover {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.ctrl-btn:active {
    transform: scale(.93);
}

.beats-count-label {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 28px;
    color: var(--text);
    min-width: 26px;
    text-align: center;
}

.position-bar {
    height: 3px;
    background: var(--border);
    margin-bottom: 16px;
    overflow: hidden;
}

.position-indicator {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width .04s linear;
}

.beats-grid {
    display: grid;
    grid-template-columns:1fr;
    gap: 10px;
}

/* ═══ BEAT CARD ═══════════════════════════════════════════════ */
.beat-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    padding: 10px 9px 9px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    transition: border-color .06s, box-shadow .06s;
}

.beat-card.lit {
    border-color: var(--beat-color, #e8ff3a);
    box-shadow: 0 0 18px -2px var(--beat-color, #e8ff3a);
}

.beat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
}

.beat-num {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 22px;
    color: var(--beat-color, #e8ff3a);
    line-height: 1;
}

.beat-dot {
    width: 10px;
    height: 10px;
    background: transparent;
    border: 1.5px solid var(--beat-color, #e8ff3a);
    transition: background .06s, box-shadow .06s;
    flex-shrink: 0;
}

.beat-card.lit .beat-dot {
    background: var(--beat-color, #e8ff3a);
    box-shadow: 0 0 10px var(--beat-color, #e8ff3a);
}

.sound-rows {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sound-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sound-row-label {
    font-size: 9px;
    letter-spacing: .1em;
    color: var(--muted);
    width: 13px;
    text-align: right;
    flex-shrink: 0;
}

.sound-sel {
    flex: 1;
    background: var(--surface3);
    border: 1px solid var(--muted2);
    color: var(--text);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    padding: 4px 5px;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    letter-spacing: .04em;
    min-width: 0;
    min-height: 30px;
}

.sound-sel:focus {
    border-color: var(--beat-color, #e8ff3a);
}

.sound-del-btn {
    width: 28px;
    height: 30px;
    background: transparent;
    border: 1px solid var(--muted2);
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
    transition: all .1s;
    padding: 0;
}

.sound-del-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.add-sound-btn {
    width: 100%;
    background: transparent;
    border: 1px dashed var(--muted2);
    color: var(--muted);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    padding: 6px;
    cursor: pointer;
    letter-spacing: .1em;
    transition: all .1s;
    min-height: 30px;
}

.add-sound-btn:hover:not(:disabled) {
    border-color: var(--beat-color, #e8ff3a);
    color: var(--beat-color, #e8ff3a);
}

.add-sound-btn:disabled {
    opacity: .3;
    cursor: default;
}

/* ═══ PLAY BUTTON ═════════════════════════════════════════════ */
.play-section {
    display: flex;
    justify-content: center;
    margin: 4px 0 0;
}

.play-btn {
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(24px, 5vw, 32px);
    letter-spacing: .2em;
    padding: 0 clamp(40px, 10vw, 80px);
    height: clamp(52px, 10vw, 64px);
    cursor: pointer;
    transition: all .15s;
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 360px;
}

.play-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent);
    transform: translateX(-101%);
    transition: transform .2s;
    z-index: -1;
}

.play-btn:hover::before {
    transform: translateX(0);
}

.play-btn:hover {
    color: #000;
}

.play-btn.playing {
    background: var(--accent);
    color: #000;
}

/* светлая тема: ховер — рамка и текст акцентом, без тёмного фона */
:root[data-theme="light"] .play-btn::before {
    background: transparent;
}

:root[data-theme="light"] .play-btn:hover::before {
    transform: translateX(-101%);
}

:root[data-theme="light"] .play-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    border-width: 3px;
}

:root[data-theme="light"] .play-btn.playing {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

/* ═══ PRESETS ═════════════════════════════════════════════════ */
.settings-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: stretch;
}

.preset-name-input {
    flex: 1;
    min-width: 120px;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    padding: 0 10px;
    outline: none;
    height: var(--touch);
}

.preset-name-input:focus {
    border-color: var(--accent);
}

.save-btn {
    background: var(--surface2);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    padding: 0 14px;
    height: var(--touch);
    cursor: pointer;
    transition: all .1s;
    letter-spacing: .06em;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.save-btn:hover {
    background: var(--accent);
    color: #000;
}

.save-btn:active {
    transform: scale(.96);
}

.save-btn.danger {
    border-color: var(--danger);
    color: var(--danger);
}

.save-btn.danger:hover {
    background: var(--danger);
    color: #000;
}

.presets-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    min-height: 10px;
}

.preset-chip {
    display: flex;
    align-items: center;
    background: var(--surface2);
    border: 1px solid var(--muted2);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    letter-spacing: .05em;
    transition: border-color .1s;
    min-height: 36px;
}

.preset-chip:hover {
    border-color: var(--accent);
}

.preset-chip-load {
    padding: 0 10px;
    cursor: pointer;
    color: var(--text);
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: inherit;
    letter-spacing: inherit;
    transition: color .1s;
    height: 100%;
    min-height: 36px;
    display: flex;
    align-items: center;
}

.preset-chip-load:hover {
    color: var(--accent);
}

.preset-chip-del {
    padding: 0 8px;
    cursor: pointer;
    color: var(--muted2);
    background: transparent;
    border: none;
    border-left: 1px solid var(--muted2);
    font-size: 14px;
    line-height: 1;
    transition: color .1s;
    height: 100%;
    min-height: 36px;
    display: flex;
    align-items: center;
}

.preset-chip-del:hover {
    color: var(--danger);
}

/* ═══ VOICE INFO ══════════════════════════════════════════════ */
.voice-info {
    text-align: center;
    font-size: 9px;
    letter-spacing: .1em;
    color: var(--muted);
    margin-top: 12px;
    padding-bottom: 4px;
}

/* ═══ TOAST ═══════════════════════════════════════════════════ */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: #000;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: .1em;
    padding: 10px 24px;
    opacity: 0;
    transition: opacity .2s;
    pointer-events: none;
    z-index: 200;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
}

/* ═══ MP3 PLAYER OVERLAY ══════════════════════════════════════ */
.player-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, .85);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.player-overlay.open {
    display: flex;
}

.player-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 560px;
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.player-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

.player-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.player-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    letter-spacing: .15em;
    color: var(--accent);
}

.player-close {
    width: var(--touch);
    height: var(--touch);
    background: transparent;
    border: 1px solid var(--muted2);
    color: var(--muted);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
}

.player-close:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* folder tabs */
.player-folders {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.player-folders::-webkit-scrollbar {
    display: none;
}

.folder-tab {
    background: transparent;
    border: none;
    border-right: 1px solid var(--border);
    color: var(--muted);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 0 20px;
    height: 40px;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
    flex-shrink: 0;
    position: relative;
}

.folder-tab:hover {
    background: var(--surface2);
    color: var(--text);
}

.folder-tab.active {
    background: var(--surface2);
    color: var(--accent);
}

.folder-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

.folder-tab.loading {
    opacity: .6;
}

/* now playing */
.player-now {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
    flex-shrink: 0;
}

.player-track-name {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .05em;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 10px;
}

.player-progress-wrap {
    position: relative;
    height: 6px;
    background: var(--border);
    cursor: pointer;
    margin-bottom: 8px;
}

.player-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    pointer-events: none;
    transition: width .1s linear;
}

.player-progress-wrap:hover .player-progress-bar {
    background: #fff;
}

.player-time {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    letter-spacing: .08em;
    color: var(--muted);
}

/* transport */
.player-transport {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.pt-btn {
    width: var(--touch);
    height: var(--touch);
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .12s;
    flex-shrink: 0;
}

.pt-btn:hover {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.pt-btn:active {
    transform: scale(.93);
}

.pt-btn.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.pt-btn svg {
    width: 18px;
    height: 18px;
}

.pt-btn-play {
    width: 56px;
    height: 56px;
    border-width: 2px;
    border-color: var(--accent);
    color: var(--accent);
}

.pt-btn-play svg {
    width: 22px;
    height: 22px;
}

.pt-btn-play.playing {
    background: var(--accent);
    color: #000;
}

/* volume */
.player-vol {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.player-vol-label {
    font-size: 9px;
    letter-spacing: .15em;
    color: var(--muted);
    flex-shrink: 0;
    text-transform: uppercase;
}

/* playlist */
.player-playlist {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--muted2) transparent;
}

.player-playlist::-webkit-scrollbar {
    width: 4px;
}

.player-playlist::-webkit-scrollbar-thumb {
    background: var(--muted2);
}

.playlist-empty {
    padding: 24px 20px;
    text-align: center;
    font-size: 11px;
    letter-spacing: .15em;
    color: var(--muted);
}

.playlist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background .1s;
    min-height: var(--touch);
}

.playlist-item:hover {
    background: var(--surface2);
}

.playlist-item.active {
    background: var(--surface2);
}

.playlist-item.active .pi-name {
    color: var(--accent);
}

.pi-idx {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 14px;
    color: var(--muted);
    width: 24px;
    text-align: right;
    flex-shrink: 0;
}

.playlist-item.active .pi-idx {
    color: var(--accent);
}

.pi-icon {
    width: 16px;
    flex-shrink: 0;
    color: var(--muted);
    font-size: 10px;
}

.playlist-item.active .pi-icon {
    color: var(--accent);
}

.pi-name {
    flex: 1;
    font-size: 11px;
    letter-spacing: .04em;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pi-dur {
    font-size: 9px;
    color: var(--muted);
    flex-shrink: 0;
}

/* ═══ BLOCKED STATE ═══════════════════════════════════════════ */
.main-grid.blocked {
    pointer-events: none;
    opacity: .45;
    user-select: none;
}

/* ═══ BEAT COLORS ═════════════════════════════════════════════ */
.bc-0 {
    --beat-color: #e8ff3a
}

.bc-1 {
    --beat-color: #3affb8
}

.bc-2 {
    --beat-color: #ff3a8c
}

.bc-3 {
    --beat-color: #3a8cff
}

.bc-4 {
    --beat-color: #ff8c3a
}

.bc-5 {
    --beat-color: #c83aff
}

.bc-6 {
    --beat-color: #3affe8
}

.bc-7 {
    --beat-color: #ff3a3a
}

.bc-8 {
    --beat-color: #e8ff3a
}

.bc-9 {
    --beat-color: #3affb8
}

.bc-10 {
    --beat-color: #ff3a8c
}

.bc-11 {
    --beat-color: #3a8cff
}

.bc-12 {
    --beat-color: #ff8c3a
}

.bc-13 {
    --beat-color: #c83aff
}

.bc-14 {
    --beat-color: #3affe8
}

.bc-15 {
    --beat-color: #ff3a3a
}

.bc-16 {
    --beat-color: #e8ff3a
}

.bc-17 {
    --beat-color: #3affb8
}

.bc-18 {
    --beat-color: #ff3a8c
}

.bc-19 {
    --beat-color: #3a8cff
}

.bc-20 {
    --beat-color: #ff8c3a
}

.bc-21 {
    --beat-color: #c83aff
}

.bc-22 {
    --beat-color: #3affe8
}

.bc-23 {
    --beat-color: #ff3a3a
}

.bc-24 {
    --beat-color: #e8ff3a
}

.bc-25 {
    --beat-color: #3affb8
}

.bc-26 {
    --beat-color: #ff3a8c
}

.bc-27 {
    --beat-color: #3a8cff
}

.bc-28 {
    --beat-color: #ff8c3a
}

.bc-29 {
    --beat-color: #c83aff
}

.bc-30 {
    --beat-color: #3affe8
}

.bc-31 {
    --beat-color: #ff3a3a
}

optgroup {
    color: var(--muted);
    background: var(--surface3);
    font-size: 9px;
}

option {
    background: var(--surface3);
    color: var(--text);
}

/* ═══ MOBILE (до 768px) ══════════════════════════════════════ */
@media (max-width: 767px) {
    :root {
        --touch: 56px;
    }

    /* секции */
    .section {
        padding: 20px 16px;
    }

    .section-title {
        font-size: 12px;
        letter-spacing: .25em;
    }

    /* BPM */
    .bpm-step-btn {
        font-size: 16px;
        font-weight: 700;
    }

    .bpm-value {
        font-size: 80px;
    }

    .bpm-label {
        font-size: 13px;
    }

    .slider-labels {
        font-size: 11px;
    }

    .tempo-name {
        font-size: 13px;
        letter-spacing: .2em;
    }

    /* такт */
    .beats-count-label {
        font-size: 36px;
    }

    .ctrl-btn {
        font-size: 26px;
    }

    /* beat card */
    .beat-num {
        font-size: 28px;
    }

    .beat-dot {
        width: 14px;
        height: 14px;
    }

    .sound-row-label {
        font-size: 12px;
        width: 18px;
    }

    .sound-sel {
        font-size: 13px;
        min-height: 44px;
        padding: 6px 8px;
    }

    .sound-del-btn {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }

    .add-sound-btn {
        font-size: 12px;
        min-height: 44px;
    }

    /* play button */
    .play-btn {
        font-size: 28px;
        height: 72px;
    }

    /* presets */
    .preset-name-input {
        font-size: 14px;
    }

    .save-btn {
        font-size: 13px;
        height: 52px;
        padding: 0 18px;
    }

    .preset-chip {
        min-height: 48px;
    }

    .preset-chip-load {
        font-size: 13px;
        padding: 0 14px;
    }

    .preset-chip-del {
        font-size: 18px;
        padding: 0 12px;
    }

    /* top bar */
    .mp3-open-btn {
        font-size: 13px;
        height: 52px;
        padding: 0 18px;
    }

    .theme-btn {
        font-size: 12px;
        height: 36px;
        padding: 0 14px;
    }

    /* voice */
    .voice-info {
        font-size: 11px;
    }
}

/* ═══ RESPONSIVE 768px ════════════════════════════════════════ */
@media (min-width: 768px) {
    .page-wrap {
        padding: 0 24px;
    }

    .top-bar-sub {
        display: block;
    }

    .section {
        padding: 20px 24px;
    }

    .slider-labels span {
        display: inline;
    }

    .beats-grid {
        grid-template-columns:repeat(auto-fill, minmax(280px, 1fr));
        gap: 12px;
    }

    .main-grid {
        gap: 20px;
    }

    .play-btn {
        max-width: 400px;
    }

    .player-modal {
        max-width: 600px;
    }
}

/* ═══ RESPONSIVE 1024px ═══════════════════════════════════════ */
@media (min-width: 1024px) {
    .page-wrap {
        padding: 0 32px;
    }

    .section {
        padding: 24px 28px;
    }

    .main-grid {
        grid-template-columns:340px 1fr;
        grid-template-rows:auto 1fr 1fr auto;
        gap: 20px;
    }

    .bpm-section {
        grid-column: 1;
        grid-row: 1;
    }

    .play-section-wrap {
        grid-column: 1;
        grid-row: 2;
    }

    .beats-section {
        grid-column: 2;
        grid-row: 1/3;
    }

    .presets-section {
        grid-column: 1/3;
        grid-row: 3;
    }

    .voice-row {
        grid-column: 1/3;
        grid-row: 4;
    }

    .beats-grid {
        grid-template-columns:repeat(auto-fill, minmax(150px, 1fr));
    }

    .play-btn {
        max-width: 100%;
        width: 100%;
    }
}

/* ═══ RESPONSIVE 1280px ═══════════════════════════════════════ */
@media (min-width: 1280px) {
    .page-wrap {
        padding: 0 40px;
    }

    .main-grid {
        grid-template-columns:380px 1fr;
        gap: 24px;
    }

    .beats-grid {
        grid-template-columns:repeat(auto-fill, minmax(160px, 1fr));
        gap: 14px;
    }

    .section {
        padding: 28px 32px;
    }
}

/* ═══ RESPONSIVE 1440px ═══════════════════════════════════════ */
@media (min-width: 1440px) {
    .page-wrap {
        padding: 0 60px;
    }

    .main-grid {
        grid-template-columns:420px 1fr;
        gap: 28px;
    }

    .bpm-section::after {
        font-size: 100px;
    }
}
