/* Pipe Dream Control styles — smartphone-first circa-2015 CSS 3 with WebKit prefixes
   and lean-paint overrides matching Pipe Dream's violet & warm gold palette. */
*,
*:before,
*:after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    min-height: 100%;
    background: #07050c;
    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 24px;
}

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

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

.nav-link:hover,
.nav-link:active {
    background: #22183a;
    border-color: rgba(255, 215, 106, 0.48);
    color: #fff6cf;
}

.nav-actions {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
}

.nav-install {
    margin-right: 6px;
    border-color: rgba(255, 215, 106, 0.45);
    color: #ffe285;
    font-family: inherit;
    cursor: pointer;
}

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

.brand {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    margin-right: 8px;
}

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

.brand-copy h1 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.16em;
    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.42);
    border-color: rgba(134, 239, 172, 0.45);
    color: #86efac;
}

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

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

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

.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;
    -webkit-transition: width 0.2s ease-out;
    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;
}

.banner-action:active {
    background: rgba(245, 185, 66, 0.35);
}

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

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

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

.mode-pill,
.chapter-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 4px;
    white-space: nowrap;
    max-width: 65%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.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;
}

.chapter-pill {
    background: rgba(139, 92, 246, 0.28);
    border: 1px solid rgba(167, 139, 250, 0.42);
    color: #ddd4f0;
}

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

/* 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;
    -webkit-user-select: none;
    user-select: none;
    cursor: grab;
    cursor: -webkit-grab;
    margin-bottom: 10px;
}

.camera-pad.dragging {
    cursor: grabbing;
    cursor: -webkit-grabbing;
    border-color: #ffd76a;
    background: #120b24;
}

.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.14);
    pointer-events: none;
    -webkit-transform: translate(-50%, -50%);
    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.24);
}

.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;
    -webkit-transition: -webkit-transform 0.16s ease-out, background-color 0.15s;
    transition: transform 0.16s ease-out, background-color 0.15s;
}

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

.pad-hint {
    position: absolute;
    left: 12px;
    right: 58px;
    bottom: 10px;
    pointer-events: none;
    -webkit-transition: opacity 0.18s ease;
    transition: opacity 0.18s ease;
}

.camera-pad.dragging .pad-hint {
    opacity: 0.32;
}

.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: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-flex-direction: column;
    flex-direction: column;
    z-index: 3;
}

.pad-zoom-btn {
    width: 40px;
    height: 40px;
    margin-top: 6px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(20, 14, 34, 0.92);
    color: #f3effa;
    font-family: inherit;
    font-size: 20px;
    font-weight: 700;
    line-height: 38px;
    text-align: center;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.pad-zoom-btn:first-child {
    margin-top: 0;
}

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

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

.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;
}

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

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

/* Camera Preset Buttons */
.preset-grid {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    margin: -3px;
}

.preset-btn {
    -webkit-box-flex: 1;
    -webkit-flex: 1 0 30%;
    flex: 1 0 30%;
    min-width: 92px;
    min-height: 44px;
    margin: 3px;
    padding: 8px 6px;
    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;
    -webkit-transition: background-color 0.15s, border-color 0.15s, color 0.15s;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

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

.preset-btn:active:not(:disabled):not(.active) {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

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

/* Timeline */
.timeline-block {
    margin-bottom: 12px;
}

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

#chapter-ticks {
    position: absolute;
    top: 0;
    right: 8px;
    bottom: 0;
    left: 8px;
    pointer-events: none;
}

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

input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    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 {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffd76a;
    border: 2px solid #160e04;
    cursor: pointer;
}

.time-row {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    margin-top: 2px;
}

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

/* Transport Controls */
.transport-row {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: stretch;
    -webkit-align-items: stretch;
    align-items: stretch;
    margin: 0 -4px 14px;
}

.ctrl-btn {
    min-height: 46px;
    margin: 0 4px;
    padding: 8px 12px;
    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;
    white-space: nowrap;
    -webkit-transition: background-color 0.15s, border-color 0.15s, color 0.15s;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

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

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

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

.primary-btn:active:not(:disabled) {
    background: #ffd16b;
}

.icon-wide {
    min-width: 52px;
    font-size: 18px;
}

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

/* Volume & Speed */
.slider-block {
    margin-bottom: 14px;
}

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

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

.speed-row {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    margin: -3px;
}

.speed-btn {
    -webkit-box-flex: 1;
    -webkit-flex: 1 0 15%;
    flex: 1 0 15%;
    min-width: 46px;
    min-height: 42px;
    margin: 3px;
    padding: 6px 4px;
    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;
}

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

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

/* Display Options */
.display-row {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    margin: 0 -4px;
}

.toggle-btn {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    min-height: 46px;
    padding: 8px 6px;
    font-size: 12px;
}

.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;
}

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

/* Lean-paint overrides */
.lean-paint .nav-link,
.lean-paint .loading-fill,
.lean-paint .pad-puck,
.lean-paint .pad-hint,
.lean-paint .preset-btn,
.lean-paint .ctrl-btn {
    -webkit-transition: none;
    transition: none;
}

/* Compact phone screens (320px - 360px) */
@media screen and (max-width: 360px) {
    .shell {
        padding: 10px 8px 20px;
    }

    .camera-pad {
        height: 184px;
    }

    .preset-btn {
        font-size: 11px;
        min-width: 84px;
    }

    .ctrl-btn {
        padding: 8px 8px;
        font-size: 12px;
    }

    .primary-btn {
        font-size: 14px;
    }
}
