/* Smartphone-first remote studio styles for MIDI Marbles Control (midi-marbles-c). */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    min-height: 100%;
    background: #090612;
    color: #f3effa;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: rgba(245, 185, 66, 0.22);
}

.hidden,
[hidden] {
    display: none !important;
}

.shell {
    width: 100%;
    max-width: 540px;
    margin: 0 auto;
    padding: 12px 12px 28px;
}

/* Navigation */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.nav-link {
    display: inline-block;
    padding: 8px 11px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: #140e24;
    color: #dfd7f2;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.nav-link:hover,
.nav-link:active {
    background: #23193e;
    border-color: rgba(255, 215, 106, 0.5);
    color: #fff6cf;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #140e24;
    border: 1px solid rgba(255, 215, 106, 0.25);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    flex-shrink: 0;
}

.brand-copy h1 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: #ffd76a;
    line-height: 1.15;
}

.brand-sub {
    font-size: 10px;
    letter-spacing: 0.14em;
    color: #b4a7ce;
    margin-top: 2px;
}

.status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #c8bddb;
    white-space: nowrap;
}

.status-badge.live {
    background: rgba(22, 101, 52, 0.44);
    border-color: rgba(134, 239, 172, 0.45);
    color: #86efac;
}

.status-badge.error {
    background: rgba(127, 29, 29, 0.52);
    border-color: rgba(248, 113, 113, 0.48);
    color: #fecaca;
}

/* Status Banner */
.status-banner {
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #1b122f;
    border: 1px solid rgba(255, 215, 106, 0.42);
    text-align: center;
}

.status-banner.error {
    background: #2b141a;
    border-color: #8a4252;
}

.status-banner-text {
    font-size: 13px;
    color: #ffe285;
    line-height: 1.4;
}

.status-banner.error .status-banner-text {
    color: #fce8ec;
}

.loading-track {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.14);
    overflow: hidden;
    margin-top: 8px;
}

.loading-fill {
    width: 0%;
    height: 100%;
    border-radius: 3px;
    background: #f5b942;
    transition: width 0.2s ease-out;
}

.banner-action {
    margin-top: 8px;
    padding: 8px 14px;
    border: 1px solid rgba(255, 215, 106, 0.55);
    border-radius: 6px;
    background: rgba(245, 185, 66, 0.2);
    color: #ffe285;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* Cards */
.card {
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 8px;
    background: #140e24;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.card-head h2 {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #d6cde8;
}

/* Music Pack Selector */
.pack-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pack-choice {
    flex: 1 1 calc(50% - 4px);
    min-width: 130px;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 7px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: #1d1532;
    color: #e2d9f4;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.pack-choice:hover:not(:disabled) {
    background: #291e46;
    border-color: rgba(255, 215, 106, 0.45);
}

.pack-choice.active {
    background: rgba(233, 165, 51, 0.22);
    border-color: #ffd76a;
    color: #fff6d1;
}

.pack-choice[data-pack="dramatic"].active {
    background: rgba(234, 88, 12, 0.24);
    border-color: #fb923c;
    color: #ffedd5;
}

.pack-choice[data-pack="lively"].active {
    background: rgba(233, 165, 51, 0.22);
    border-color: #ffd76a;
    color: #fff6d1;
}

.pack-choice[data-pack="calm"].active {
    background: rgba(56, 189, 248, 0.22);
    border-color: #7dd3fc;
    color: #e0f2fe;
}

.pack-choice[data-pack="christmas"].active {
    background: linear-gradient(135deg, rgba(185, 28, 28, 0.72) 0%, rgba(21, 128, 61, 0.72) 100%);
    border-color: #fde047;
    color: #fffbeb;
}

.pack-choice:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.pack-ico {
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
}

.pack-lbl {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.2;
    white-space: normal;
}

.pack-cnt {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.34);
    color: #d6cde8;
    flex-shrink: 0;
}

.mode-pill,
.sub-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.mode-pill {
    background: rgba(233, 165, 51, 0.2);
    border: 1px solid rgba(255, 215, 106, 0.45);
    color: #ffd76a;
}

.mode-pill.orbit-mode {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(167, 139, 250, 0.55);
    color: #e9ddff;
}

.sub-tag {
    background: rgba(139, 92, 246, 0.24);
    border: 1px solid rgba(167, 139, 250, 0.36);
    color: #ddd4f0;
}

.stat-badges {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fps-badge {
    font-size: 11px;
    font-family: monospace;
    font-weight: 700;
    color: #86efac;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(22, 101, 52, 0.42);
}

/* Now Playing & Transport */
.now-playing-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.np-copy {
    min-width: 0;
}

.np-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff6cf;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.np-sub {
    font-size: 12px;
    color: #b7aacf;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.timeline-block {
    margin-bottom: 10px;
}

.scrubber-wrap {
    position: relative;
    height: 28px;
    display: flex;
    align-items: center;
}

#chapter-ticks {
    position: absolute;
    inset: 0 8px;
    pointer-events: none;
}

.chapter-tick {
    position: absolute;
    top: 50%;
    width: 2px;
    height: 14px;
    transform: translate(-50%, -50%);
    background: rgba(255, 215, 106, 0.58);
    border-radius: 1px;
}

input[type="range"] {
    width: 100%;
    appearance: none;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.18);
    outline: none;
    cursor: pointer;
}

input[type="range"]:disabled {
    opacity: 0.45;
    cursor: default;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffd76a;
    border: 2px solid #160e04;
    cursor: pointer;
}

.time-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.time-label {
    font-size: 11px;
    font-family: monospace;
    color: #c8bddb;
}

.chapter-text {
    font-size: 11px;
    color: #a99cc4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.transport-row {
    display: flex;
    align-items: stretch;
    gap: 6px;
}

.ctrl-btn {
    min-height: 44px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.08);
    color: #f3effa;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}

.ctrl-btn:disabled {
    opacity: 0.42;
    cursor: default;
}

.ctrl-btn:active:not(:disabled) {
    background: rgba(255, 255, 255, 0.18);
}

.ctrl-btn.active {
    background: #e9a533;
    border-color: #ffd76a;
    color: #160e04;
    font-weight: 700;
}

.primary-btn {
    flex: 1;
    background: #f5b942;
    border-color: #ffd76a;
    color: #160e04;
    font-weight: 700;
    font-size: 14px;
}

.icon-btn {
    min-width: 44px;
    font-size: 16px;
}

/* Tab Bar */
.tab-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.tab-btn {
    min-height: 42px;
    padding: 8px 4px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: #140e24;
    color: #c8bddb;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
}

.tab-btn.active {
    background: #e9a533;
    border-color: #ffd76a;
    color: #160e04;
}

/* Upload Zone */
.upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 18px 12px;
    border-radius: 8px;
    border: 2px dashed rgba(255, 215, 106, 0.46);
    background: rgba(245, 185, 66, 0.08);
    text-align: center;
    cursor: pointer;
}

.upload-zone.dragover {
    background: rgba(245, 185, 66, 0.22);
    border-color: #ffd76a;
}

.upload-zone.disabled {
    opacity: 0.45;
    cursor: default;
}

.upload-icon {
    font-size: 26px;
}

.upload-title {
    font-size: 14px;
    font-weight: 700;
    color: #ffe285;
}

.upload-sub {
    font-size: 11px;
    color: #bfb3d6;
}

.upload-status {
    margin-top: 8px;
    padding: 7px 10px;
    border-radius: 6px;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(167, 139, 250, 0.35);
    font-size: 12px;
    color: #e9ddff;
}

.sf2-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px dashed rgba(167, 139, 250, 0.55);
    background: rgba(139, 92, 246, 0.14);
    color: #e9ddff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}

.sf2-upload-btn.disabled {
    opacity: 0.45;
    cursor: default;
}

/* Playlist */
.cycle-group {
    display: flex;
    gap: 4px;
}

.mini-btn,
.tiny-btn {
    padding: 5px 8px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    color: #cfc6e2;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.mini-btn.active {
    background: #e9a533;
    border-color: #ffd76a;
    color: #160e04;
    font-weight: 700;
}

.mini-btn:disabled,
.tiny-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.playlist-list,
.bank-list,
.mixer-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.track-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.track-item {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 11px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: #f3effa;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.track-item.active {
    background: rgba(245, 185, 66, 0.22);
    border-color: #ffd76a;
}

.track-item:disabled {
    opacity: 0.45;
    cursor: default;
}

.track-info {
    min-width: 0;
}

.track-name {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-item.active .track-name {
    color: #ffd76a;
}

.track-meta {
    display: block;
    font-size: 11px;
    color: #b4a7ce;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-dur {
    font-size: 11px;
    font-family: monospace;
    color: #c8bddb;
    flex-shrink: 0;
}

.track-del {
    width: 36px;
    min-height: 44px;
    border-radius: 6px;
    border: 1px solid rgba(248, 113, 113, 0.36);
    background: rgba(127, 29, 29, 0.34);
    color: #fecaca;
    font-size: 16px;
    cursor: pointer;
}

/* Bank List */
.bank-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 44px;
    padding: 9px 11px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.05);
    color: #e6dcf7;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

.bank-item.active {
    background: #e9a533;
    border-color: #ffd76a;
    color: #160e04;
    font-weight: 700;
}

.bank-item:disabled {
    opacity: 0.45;
    cursor: default;
}

.bank-tag {
    font-size: 10px;
    font-family: monospace;
    opacity: 0.85;
}

/* Sliders & Option Grids */
.slider-block,
.field-block {
    margin-bottom: 13px;
}

.last-block {
    margin-bottom: 0;
}

.field-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: #c8bddb;
    margin-bottom: 6px;
}

.inline-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.field-head output,
.field-readout {
    font-family: monospace;
    color: #ffd76a;
}

.sub-slider {
    margin-top: 8px;
}

.btn-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.btn-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.btn-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.btn-grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.preset-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }

.opt-btn {
    min-height: 42px;
    padding: 7px 5px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: #d6cde8;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
}

.opt-btn.active {
    background: #e9a533;
    border-color: #ffd76a;
    color: #160e04;
    font-weight: 700;
}

.opt-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

/* Channel Mixer */
.mixer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mixer-info {
    min-width: 0;
}

.mixer-name {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #f3effa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mixer-sub {
    display: block;
    font-size: 10px;
    color: #a99cc4;
}

.mixer-btns {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.ms-btn {
    width: 34px;
    height: 34px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #ddd4f0;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.ms-btn.mute-on {
    background: #dc2626;
    border-color: #f87171;
    color: #fff;
}

.ms-btn.solo-on {
    background: #e9a533;
    border-color: #ffd76a;
    color: #160e04;
}

/* Camera Touch Pad */
.camera-pad {
    position: relative;
    width: 100%;
    height: 204px;
    border-radius: 8px;
    background: #0c0817;
    border: 1px solid rgba(255, 215, 106, 0.34);
    overflow: hidden;
    touch-action: none;
    user-select: none;
    cursor: grab;
    margin-bottom: 10px;
}

.camera-pad.dragging {
    cursor: grabbing;
    border-color: #ffd76a;
    background: #130b26;
}

.camera-pad.disabled {
    opacity: 0.48;
    cursor: default;
}

.pad-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    border: 1px solid rgba(255, 215, 106, 0.16);
    pointer-events: none;
    transform: translate(-50%, -50%);
}

.pad-ring-outer { width: 156px; height: 156px; }
.pad-ring-inner { width: 78px; height: 78px; border-style: dashed; border-color: rgba(167, 139, 250, 0.25); }

.pad-axis { position: absolute; background: rgba(255, 255, 255, 0.08); pointer-events: none; }
.pad-axis-x { top: 50%; left: 14px; right: 14px; height: 1px; }
.pad-axis-y { left: 50%; top: 14px; bottom: 14px; width: 1px; }

.pad-puck {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 34px;
    height: 34px;
    margin-left: -17px;
    margin-top: -17px;
    border-radius: 50%;
    background: rgba(245, 185, 66, 0.24);
    border: 2px solid #ffd76a;
    pointer-events: none;
    transition: transform 0.15s ease-out;
}

.camera-pad.dragging .pad-puck {
    background: rgba(245, 185, 66, 0.45);
    transition: none;
}

.pad-hint {
    position: absolute;
    left: 12px;
    right: 58px;
    bottom: 10px;
    pointer-events: none;
}

.pad-hint-title { display: block; font-size: 12px; font-weight: 600; color: #e6dcf7; }
.pad-hint-sub { display: block; font-size: 11px; color: #9e91b8; margin-top: 1px; }

.pad-zoom-stack {
    position: absolute;
    right: 8px;
    bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 3;
}

.pad-zoom-btn {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(20, 14, 34, 0.92);
    color: #f3effa;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
}

.pad-zoom-btn:active:not(:disabled) {
    background: #e9a533;
    color: #160e04;
}

.resume-btn {
    width: 100%;
    min-height: 44px;
    margin-bottom: 10px;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid rgba(255, 215, 106, 0.6);
    background: rgba(245, 185, 66, 0.18);
    color: #ffe285;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.action-notice {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(255, 215, 106, 0.12);
    border: 1px solid rgba(255, 215, 106, 0.34);
    color: #ffe285;
    font-size: 12px;
    line-height: 1.4;
}

.empty-hint {
    font-size: 12px;
    color: #9b8eb6;
    text-align: center;
    padding: 10px 4px;
}

.app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 2px 0;
    font-size: 11px;
    color: #8f82a8;
}

@media screen and (max-width: 360px) {
    .shell { padding: 10px 8px 22px; }
    .tab-btn { font-size: 11px; }
    .btn-grid-6 { grid-template-columns: repeat(3, 1fr); }
    .camera-pad { height: 180px; }
}
