/* Soundtracker layout over the Six Finger Punch shell */

:root {
    --panel-bg: rgba(20, 21, 27, 0.78);
    --line: rgba(255, 255, 255, 0.08);
    --muted: #8b8d9c;
    --cyan: #5ce1e6;
    --amber: #ffae42;
}

body {
    background: radial-gradient(ellipse at 55% 20%, #2d2f3a 0%, #1d1e24 58%, #15161b 100%);
}

body.dragover::after {
    content: "DROP .MOD";
    position: fixed;
    inset: 16px;
    z-index: 9;
    display: grid;
    place-items: center;
    background: rgba(18, 19, 24, 0.85);
    border: 2px dashed var(--punch);
    color: var(--punch);
    font: 700 28px/1 "Chakra Petch", sans-serif;
    letter-spacing: 0.12em;
    pointer-events: none;
}

#app {
    position: fixed;
    inset: 0;
    padding: max(18px, env(safe-area-inset-top)) 20px calc(var(--gap) + 74px) 70px;
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
    gap: 16px;
    box-sizing: border-box;
}

/* Track selector rail */
#sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--panel-bg);
    border: 1px solid var(--line);
    padding: 12px 10px;
    overflow-y: auto;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.group-head {
    font: 700 11px/1 "Chakra Petch", sans-serif;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--punch);
    padding: 6px 8px 6px;
    margin-top: 8px;
}

.group-head:first-child {
    margin-top: 0;
}

.track-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.track-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    width: 100%;
    padding: 8px 9px;
    text-align: left;
    border-left: 2px solid transparent;
    transition: background 0.12s, border-color 0.12s;
}

.track-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.track-btn.active {
    background: rgba(255, 252, 0, 0.1);
    border-left-color: var(--punch);
}

.track-btn .t-name {
    font: 700 14px/1.15 "Chakra Petch", sans-serif;
    color: #fff;
}

.track-btn.active .t-name {
    color: var(--punch);
}

.track-btn .t-sub {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Main tracker deck */
#deck {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    gap: 10px;
}

#readout {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 14px;
    background: var(--panel-bg);
    border: 1px solid var(--line);
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.title-block {
    display: flex;
    align-items: baseline;
    gap: 12px;
    min-width: 0;
}

#mod-title {
    margin: 0;
    font: 700 22px/1 "Chakra Petch", sans-serif;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#mod-meta {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.counters {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
    font-size: 12px;
    color: var(--punch);
    font-variant-numeric: tabular-nums;
}

/* Position scrubber bar */
#seek-bar {
    height: 18px;
    background: var(--panel-bg);
    border: 1px solid var(--line);
    padding: 3px;
    box-sizing: border-box;
    cursor: pointer;
}

#seek-cells {
    display: flex;
    gap: 2px;
    height: 100%;
}

.seek-cell {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    transition: background 0.08s;
}

.seek-cell.past {
    background: rgba(255, 252, 0, 0.35);
}

.seek-cell.now {
    background: var(--punch);
}

/* Main live canvas + sample inspector */
#stage {
    position: relative;
    flex: 1;
    min-height: 0;
    background: var(--panel-bg);
    border: 1px solid var(--line);
    overflow: hidden;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

#tracker-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* Sample inspector */
#samples-view {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    align-content: start;
    gap: 8px;
    background: rgba(18, 19, 24, 0.94);
}

#samples-view[hidden] {
    display: none;
}

.smp-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    text-align: left;
    transition: border-color 0.12s, background 0.12s;
}

.smp-card:hover {
    border-color: var(--punch);
    background: rgba(255, 252, 0, 0.06);
}

.smp-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}

.smp-num {
    color: var(--punch);
    font-weight: 700;
}

.smp-name {
    flex: 1;
    color: #e6e6ea;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smp-size {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.smp-wave {
    display: block;
    width: 100%;
    height: 36px;
    background: rgba(10, 11, 15, 0.7);
}

/* Bar separator */
#bar .sep {
    width: 1px;
    height: 22px;
    align-self: center;
    margin: 0 5px;
    background: rgba(255, 255, 255, 0.16);
}

#vol-panel {
    width: 180px;
    padding: 10px 14px;
}

/* Responsive layout for upright phones and narrower viewports */
@media (max-width: 820px) {
    #app {
        padding: max(64px, env(safe-area-inset-top)) 12px calc(var(--gap) + 70px) 12px;
        grid-template-columns: 1fr;
        grid-template-rows: 138px minmax(0, 1fr);
        gap: 10px;
    }

    #sidebar {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        align-items: stretch;
        gap: 6px;
        padding: 8px;
    }

    .group-head {
        writing-mode: vertical-rl;
        transform: rotate(180deg);
        margin: 0;
        padding: 4px 2px;
        white-space: nowrap;
        letter-spacing: 0.08em;
    }

    .track-list {
        flex-direction: row;
        gap: 6px;
    }

    .track-btn {
        width: 148px;
        flex-shrink: 0;
        border-left: 0;
        border-bottom: 2px solid transparent;
        background: rgba(255, 255, 255, 0.03);
    }

    .track-btn.active {
        border-bottom-color: var(--punch);
    }

    #mod-meta {
        display: none;
    }
}
