/* Tablet Web Mode: focused sequence editing without changing the engine. */

.tablet-seq-switch,
.tablet-live-switch {
    display: none;
}

@media (min-width: 768px) and (max-width: 1180px) {
    body.tablet-layout {
        height: 100dvh;
        padding: 4px;
    }

    body.tablet-layout .groovebox {
        max-width: none;
        padding: 6px;
        gap: 6px;
        border-radius: 8px;
    }

    body.tablet-layout .controls {
        display: grid;
        grid-template-columns: auto minmax(148px, 1fr) minmax(148px, 1fr) auto;
        grid-template-areas:
            "logo tempo swing actions"
            "play drums synth actions"
            "pattern pattern pattern pattern";
        align-items: center;
        gap: 6px;
        min-height: 0;
        padding: 6px;
    }

    body.tablet-layout .app-logo {
        grid-area: logo;
        white-space: nowrap;
        font-size: 12px;
    }

    body.tablet-layout #playBtn {
        grid-area: play;
        min-width: 82px;
        height: 34px;
        padding: 0 16px;
        font-size: 12px;
    }

    body.tablet-layout .tempo-group {
        grid-area: tempo;
    }

    body.tablet-layout .swing-group {
        grid-area: swing;
    }

    body.tablet-layout .drum-global-group {
        grid-area: drums;
    }

    body.tablet-layout .synth-global-group {
        grid-area: synth;
    }

    body.tablet-layout .right-controls {
        grid-area: actions;
        align-self: stretch;
        justify-self: end;
        display: grid;
        grid-template-columns: repeat(4, minmax(48px, 1fr));
        gap: 6px;
        margin-left: 0;
    }

    body.tablet-layout .btn-coffee {
        display: none;
    }

    body.tablet-layout .bpm-container,
    body.tablet-layout .top-group {
        min-width: 0;
        height: 34px;
        box-sizing: border-box;
        white-space: nowrap;
    }

    body.tablet-layout .bpm-container {
        justify-content: center;
    }

    body.tablet-layout .top-group {
        justify-content: center;
        padding: 3px 7px;
    }

    body.tablet-layout .top-group select {
        min-width: 48px;
    }

    body.tablet-layout #bpmSlider,
    body.tablet-layout #swingSlider {
        width: clamp(54px, 11vw, 92px);
    }

    body.tablet-layout .master-slider {
        width: clamp(42px, 7vw, 64px);
    }

    body.tablet-layout .editable-display {
        width: 34px;
    }

    body.tablet-layout .btn-help,
    body.tablet-layout .btn-clear-all,
    body.tablet-layout .tool-btn,
    body.tablet-layout .tool-btn-drum,
    body.tablet-layout .shift-btn {
        min-height: 32px;
    }

    body.tablet-layout .pattern-group {
        grid-area: pattern;
        justify-content: flex-start;
        height: auto;
        min-height: 34px;
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        scrollbar-width: thin;
    }

    body.tablet-layout .pattern-status,
    body.tablet-layout .pattern-launch-row {
        flex-shrink: 0;
    }

    body.tablet-layout .btn-pattern {
        min-height: 28px;
        height: 28px;
        flex: 0 0 auto;
    }

    body.tablet-layout .pattern-tools {
        height: 28px;
        flex: 0 0 auto;
    }

    body.tablet-layout .pattern-tools-panel {
        top: 32px;
    }

    body.tablet-layout .views-wrapper,
    body.tablet-layout .view {
        gap: 6px;
    }

    body.tablet-layout .tablet-seq-switch {
        display: flex;
        flex: 0 0 auto;
        gap: 6px;
        background: #121214;
        border: 1px solid #2a2a35;
        border-radius: 8px;
        padding: 5px;
    }

    body.tablet-layout .tablet-seq-btn {
        flex: 1;
        min-height: 40px;
        background: #202027;
        color: #aaa;
        border: 1px solid #4c4c58;
        border-radius: 6px;
        font-size: 12px;
        font-weight: 900;
        letter-spacing: 1px;
        text-transform: uppercase;
    }

    body.tablet-layout .tablet-seq-btn.active {
        color: #121214;
        border-color: #00e676;
        background: #00e676;
    }

    body.tablet-layout .tablet-live-btn {
        flex: 1;
        min-height: 40px;
        background: #202027;
        color: #aaa;
        border: 1px solid #4c4c58;
        border-radius: 6px;
        font-size: 12px;
        font-weight: 900;
        letter-spacing: 1px;
        text-transform: uppercase;
    }

    body.tablet-layout .tablet-live-btn.active {
        color: #121214;
        border-color: #00e676;
        background: #00e676;
    }

    body.tablet-layout #view-seq {
        overflow: hidden;
    }

    body.tablet-layout #view-seq,
    body.tablet-layout .workspace-grid,
    body.tablet-layout .panel {
        min-height: 0;
    }

    body.tablet-layout .workspace-grid {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr);
        gap: 0;
        min-height: 0;
        overflow: hidden;
    }

    body.tablet-layout[data-tablet-seq-panel="drums"] .bass-panel,
    body.tablet-layout[data-tablet-seq-panel="synth"] .drum-panel {
        display: none;
    }

    body.tablet-layout .panel {
        height: 100%;
        padding: 6px;
        border-radius: 6px;
    }

    body.tablet-layout .panel-header-row {
        flex: 0 0 auto;
        flex-wrap: nowrap;
        gap: 8px;
        margin-bottom: 6px;
        padding-bottom: 6px;
    }

    body.tablet-layout .header-left {
        flex: 0 0 auto;
    }

    body.tablet-layout .drum-tools-row,
    body.tablet-layout .bass-tools-row {
        min-width: 0;
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: thin;
    }

    body.tablet-layout .tracks-container {
        display: grid;
        flex: 1 1 auto;
        min-height: 0;
        gap: 5px;
        justify-content: initial;
        overflow: hidden;
        padding-bottom: 0;
        -webkit-overflow-scrolling: touch;
    }

    body.tablet-layout .drum-panel .tracks-container {
        grid-template-rows: repeat(7, minmax(0, 1fr));
    }

    body.tablet-layout .bass-panel .tracks-container {
        grid-template-rows: repeat(13, minmax(0, 1fr));
    }

    body.tablet-layout .track-row {
        flex: initial;
        height: auto;
        min-height: 0;
    }

    body.tablet-layout .drum-panel .track-controls,
    body.tablet-layout .bass-panel .track-controls,
    body.tablet-layout .master-last-step-spacer {
        width: 84px;
    }

    body.tablet-layout .track-label,
    body.tablet-layout .bass-transposer {
        font-size: 13px;
    }

    body.tablet-layout .btn-mute,
    body.tablet-layout .btn-clear-track {
        width: clamp(24px, 3.8dvh, 30px);
        height: clamp(24px, 3.8dvh, 30px);
    }

    body.tablet-layout .master-last-step-row {
        flex: 0 0 auto;
        gap: 6px;
        margin-bottom: 4px;
    }

    body.tablet-layout .last-step-timeline {
        height: clamp(10px, 2.1dvh, 16px);
        min-height: 0;
    }

    body.tablet-layout .grid-block > .last-step-timeline {
        flex: 0 0 clamp(10px, 2.1dvh, 16px);
    }

    body.tablet-layout .master-last-step-row .last-step-timeline {
        flex: 1 1 auto;
    }

    body.tablet-layout .grid-block {
        min-height: 0;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 0;
        scrollbar-width: thin;
    }

    body.tablet-layout .grid {
        min-height: 0;
        height: 100%;
    }

    body.tablet-layout .drum-panel .grid {
        height: calc(100% - clamp(10px, 2.1dvh, 16px) - 4px);
    }

    body.tablet-layout .grid,
    body.tablet-layout .last-step-timeline {
        min-width: 560px;
    }

    body.tablet-layout .pad,
    body.tablet-layout .ls-dot {
        border-radius: 4px;
    }

    body.tablet-layout #view-live {
        padding: 0;
        overflow: hidden;
    }

    body.tablet-layout #view-live .live-view-grid {
        flex: 1 1 auto;
        grid-template-columns: minmax(0, 1.12fr) minmax(300px, 0.88fr);
        gap: 6px;
        height: auto;
        min-height: 0;
        overflow: hidden;
        padding: 0;
    }

    body.tablet-layout #view-live .live-column {
        gap: 6px;
        min-height: 0;
        overflow: hidden;
    }

    body.tablet-layout #view-live .live-mixer-column {
        display: grid;
        grid-template-rows: minmax(0, 1fr) auto auto;
    }

    body.tablet-layout #view-live .live-mixer-half {
        flex: initial;
        min-height: 0;
        padding: 6px;
    }

    body.tablet-layout #view-live .live-grid {
        display: grid !important;
        grid-template-columns: repeat(8, minmax(52px, 1fr));
        gap: 4px;
        height: 100%;
        min-height: 0;
        overflow: visible;
        padding-bottom: 0;
    }

    body.tablet-layout #view-live .live-track-col {
        min-width: 0;
        flex: initial;
        gap: 3px;
        padding: 5px 3px;
        border-radius: 6px;
    }

    body.tablet-layout #view-live .live-track-col h3 {
        min-height: 14px;
        font-size: 10px;
    }

    body.tablet-layout #view-live .live-mute-pad {
        min-height: 38px;
        height: clamp(38px, 5.8dvh, 48px);
        font-size: 15px;
    }

    body.tablet-layout #view-live .custom-param-zone {
        height: clamp(28px, 4.6dvh, 36px);
    }

    body.tablet-layout #view-live .send-knobs-mini {
        gap: 3px;
    }

    body.tablet-layout #view-live .mini-knob {
        width: 24px;
        height: 24px;
    }

    body.tablet-layout #view-live .rack-card,
    body.tablet-layout #view-live .tool-box {
        border-radius: 6px;
        padding: 7px;
    }

    body.tablet-layout #view-live .rack-card h3,
    body.tablet-layout #view-live .tool-box h4 {
        margin-bottom: 5px;
        padding-bottom: 4px;
    }

    body.tablet-layout #view-live .knobs-container {
        gap: 6px;
    }

    body.tablet-layout #view-live .live-tool-btn {
        min-height: 40px;
        height: auto;
    }

    body.tablet-layout #view-live .roller-row .live-tool-btn {
        min-height: 58px;
        font-size: 12px;
    }

    body.tablet-layout #view-live .transposer-row {
        display: grid;
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 4px;
    }

    body.tablet-layout #view-live .master-fx-container {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    body.tablet-layout #view-live .master-fx-separator {
        display: none;
    }

    body.tablet-layout #view-live .master-fx-knobs {
        width: 100%;
        min-height: 64px;
    }

    body.tablet-layout #view-live #smartPad {
        max-width: none !important;
        height: clamp(150px, 22dvh, 200px) !important;
    }
}

@media (min-width: 768px) and (max-width: 860px) {
    body.tablet-layout .controls {
        grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto;
        grid-template-areas:
            "play tempo swing actions"
            "drums drums synth synth"
            "pattern pattern pattern pattern";
    }

    body.tablet-layout .app-logo {
        display: none;
    }

    body.tablet-layout .top-group {
        justify-content: flex-start;
    }

    body.tablet-layout .top-group label {
        margin-left: 0;
    }

    body.tablet-layout .synth-global-group {
        justify-content: flex-end;
    }

    body.tablet-layout .pattern-group {
        padding-right: 6px;
    }

    body.tablet-layout #view-live .tablet-live-switch {
        display: flex;
        flex: 0 0 auto;
        gap: 6px;
        background: #121214;
        border: 1px solid #2a2a35;
        border-radius: 8px;
        padding: 5px;
    }

    body.tablet-layout #view-live .live-view-grid {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr);
    }

    body.tablet-layout[data-tablet-live-panel="mixer"] #view-live .live-mixer-column {
        display: grid;
        grid-template-rows: minmax(0, 1fr);
    }

    body.tablet-layout[data-tablet-live-panel="mixer"] #view-live .live-mixer-column > .rack-card,
    body.tablet-layout[data-tablet-live-panel="mixer"] #view-live .live-performance-column {
        display: none;
    }

    body.tablet-layout[data-tablet-live-panel="perform"] #view-live .live-view-grid {
        grid-template-rows: none;
        grid-auto-rows: auto;
        align-content: start;
        align-items: start;
        overflow-y: auto;
        padding-right: 4px;
        scrollbar-width: thin;
    }

    body.tablet-layout[data-tablet-live-panel="perform"] #view-live .live-mixer-column {
        display: flex;
        flex-direction: column;
        height: auto;
    }

    body.tablet-layout[data-tablet-live-panel="perform"] #view-live .live-mixer-column,
    body.tablet-layout[data-tablet-live-panel="perform"] #view-live .live-performance-column {
        align-self: start;
        height: auto;
        overflow: visible;
    }

    body.tablet-layout[data-tablet-live-panel="perform"] #view-live .live-mixer-half {
        display: none;
    }

    body.tablet-layout[data-tablet-live-panel="perform"] #view-live .rack-card[style*="flex-grow"] {
        min-height: 360px;
        flex-grow: 0 !important;
    }

    body.tablet-layout #view-live #smartPad {
        height: clamp(190px, 24dvh, 240px) !important;
    }
}
