@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

#fullscreenEdge,
.fullscreen-actions {
    display: none
}

body.immersive {
    overflow: hidden;
    background: #080f1a
}

body.immersive>header,
body.immersive>footer {
    display: none
}

body.immersive main {
    position: fixed;
    inset: 0;
    display: block;
    margin: 0;
    border: 0;
    border-radius: 0;
    max-width: none
}

body.immersive .viewer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0
}

body.immersive .view-top,
body.immersive .view-bottom {
    display: none
}

body.immersive #controls {
    position: absolute;
    z-index: 3;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(350px, calc(100vw - 24px));
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform .2s, visibility .2s;
    box-shadow: -12px 0 40px #0003
}

body.immersive.controls-open #controls {
    transform: translateX(0);
    visibility: visible
}

body.immersive #fullscreenEdge {
    display: block;
    position: absolute;
    z-index: 2;
    right: 0;
    top: 0;
    bottom: 0;
    width: 24px;
    border: 0;
    background: transparent;
    padding: 0
}

body.immersive #fullscreenEdge:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -3px;
    background: #ffffff20
}

body.immersive .fullscreen-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 24px;
    position: sticky;
    top: -28px;
    background: var(--paper);
    padding: 12px 0;
    z-index: 4
}

.fullscreen-actions button {
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--paper);
    font-size: 11px
}

.fullscreen-actions #exitFullscreen {
    margin-right: auto;
    color: #b64424
}

@media(prefers-reduced-motion:reduce) {
    body.immersive #controls {
        transition: none
    }
}

:root {
    color-scheme: light;
    --paper: #f7f6f2;
    --ink: #282b29;
    --muted: #8a8c83;
    --accent: #e66b42;
    --line: #e4e3dc
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: 'DM Sans', sans-serif;
    font-size: 13px
}

button,
a,
input,
label {
    -webkit-tap-highlight-color: transparent
}

button {
    font: inherit;
    cursor: pointer;
    color: inherit
}

button:focus-visible,
a:focus-visible,
label:focus-within {
    outline: 3px solid var(--accent);
    outline-offset: 3px
}

header {
    height: 94px;
    padding: 0 42px;
    display: flex;
    align-items: center;
    justify-content: space-between
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font: 800 32px 'Manrope', sans-serif;
    letter-spacing: -1.8px;
    text-decoration: none;
    color: var(--ink)
}

.brand-icon {
    color: var(--accent);
    font-size: 44px
}

.studio {
    font: 600 9px 'DM Sans', sans-serif;
    letter-spacing: 1.8px;
    border-left: 1px solid #ccc;
    margin-left: 14px;
    padding-left: 22px;
    max-width: 130px;
    line-height: 1.7
}

.header-right {
    display: flex;
    align-items: center;
    gap: 28px
}

.local {
    font-size: 9px;
    letter-spacing: 1.5px;
    color: #777c6e
}

.local:first-letter {
    color: #7a8b68
}

.subtle {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: transparent;
    padding: 10px 14px
}

main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    margin: 0 30px;
    gap: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden
}

.viewer {
    position: relative;
    min-height: 740px;
    background: #080f1a;
    overflow: hidden;
    touch-action: none;
    cursor: grab
}

.viewer:active {
    cursor: grabbing
}

canvas {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    display: block
}

.view-top {
    position: absolute;
    top: 26px;
    left: 28px;
    right: 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #d0d7d8;
    font-size: 9px;
    letter-spacing: 1.7px;
    pointer-events: none
}

.pill {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #ffffff30;
    border-radius: 30px;
    background: #0b152570;
    padding: 9px 12px
}

.pill i {
    width: 5px;
    height: 5px;
    background: #c4e6b5;
    border-radius: 50%
}

.view-bottom {
    position: absolute;
    bottom: 32px;
    left: 32px;
    right: 28px;
    display: flex;
    justify-content: space-between;
    align-items: end;
    pointer-events: none;
    color: #fff;
    text-shadow: 0 1px 20px #000
}

.view-bottom .eyebrow {
    font-size: 8px;
    letter-spacing: 2px;
    color: #ddd8c7
}

h1 {
    font: 500 clamp(32px, 3.6vw, 60px)/1.05 'Manrope', sans-serif;
    letter-spacing: -2.5px;
    margin: 14px 0
}

.view-bottom p {
    font-size: 11px;
    color: #c8cdd3
}

.pause {
    pointer-events: auto;
    width: 44px;
    height: 44px;
    border: 1px solid #ffffff50;
    border-radius: 50%;
    background: #15202a90;
    color: white;
    font-size: 18px
}

.eyebrow {
    font-size: 8px;
    letter-spacing: 1.5px;
    color: var(--muted);
    font-weight: 600
}

aside {
    padding: 28px 25px;
    background: var(--paper)
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between
}

h2 {
    font: 600 27px 'Manrope', sans-serif;
    letter-spacing: -1.2px;
    margin: 7px 0 23px
}

.spark {
    font-size: 38px;
    color: var(--accent);
    margin-top: -15px
}

.tabs {
    display: flex;
    background: #eeede7;
    padding: 4px;
    border-radius: 7px;
    margin-bottom: 25px
}

.tabs button {
    flex: 1;
    border: 0;
    background: none;
    border-radius: 5px;
    padding: 10px;
    font-size: 11px;
    color: #85867d
}

.tabs button.active {
    background: #fff;
    color: var(--ink);
    box-shadow: 0 1px 4px #0000000a
}

.section-title {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 1.7px;
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--line);
    padding-top: 19px;
    margin: 21px 0 17px
}

.section-title span {
    color: #aaa
}

.control {
    margin-bottom: 16px
}

.control label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    margin-bottom: 7px
}

.control output {
    color: #797d72;
    font-variant-numeric: tabular-nums;
    font-size: 10px
}

input[type=range] {
    width: 100%;
    height: 3px;
    accent-color: var(--accent);
    cursor: pointer;
    display: block;
    margin: 12px 0 0
}

.palette-list {
    display: flex;
    gap: 9px
}

.palette {
    border: 1px solid transparent;
    border-radius: 24px;
    padding: 5px;
    background: transparent;
    display: flex;
    gap: 0
}

.palette.selected {
    border-color: var(--accent)
}

.palette i {
    display: block;
    width: 14px;
    height: 22px
}

.palette i:first-child {
    border-radius: 15px 0 0 15px
}

.palette i:last-child {
    border-radius: 0 15px 15px 0
}

.presets {
    display: flex;
    gap: 6px
}

.presets button {
    flex: 1;
    padding: 9px 3px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: transparent;
    font-size: 10px
}

.presets .selected {
    border-color: #9a9e8e;
    background: #eeefe8
}

.random {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    border: 1px dashed #c9cabf;
    border-radius: 6px;
    padding: 13px 11px;
    width: 100%;
    margin-top: 19px;
    font-size: 11px
}

.random span {
    color: #929488;
    font-size: 9px
}

.save-row {
    display: flex;
    gap: 7px;
    margin-top: 22px
}

.save-row button {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 11px;
    background: transparent
}

.save-row .primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    flex: 1;
    text-align: left;
    font-size: 12px
}

.primary span {
    float: right;
    opacity: .65;
    font-size: 9px;
    padding-top: 3px
}

.panel-note {
    text-align: center;
    color: #9a9c91;
    font-size: 9px;
    margin: 13px 0 0
}

footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 21px 33px 25px;
    font-size: 9px;
    color: #8a8e82;
    letter-spacing: .5px
}

footer>span:first-child {
    font-size: 8px;
    letter-spacing: 1.4px
}

footer b {
    margin-left: 10px
}

footer button {
    border: 0;
    background: none;
    color: #73796b;
    font-size: 10px
}

.upload {
    display: block;
    border: 1px dashed #bbbfb0;
    padding: 17px 10px;
    text-align: center;
    border-radius: 6px;
    cursor: pointer
}

.upload strong {
    font-size: 11px
}

.upload small {
    display: block;
    font-size: 9px;
    color: #93988b;
    margin-top: 7px
}

#imageName {
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

#dropOverlay {
    display: none;
    position: absolute;
    inset: 0;
    background: #14242de8;
    border: 3px dashed #e9bc82;
    place-items: center;
    color: #fff;
    font-size: 24px
}

.viewer.dragging #dropOverlay {
    display: grid
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
    background: #28352d;
    color: white;
    padding: 13px 22px;
    border-radius: 8px;
    transition: .2s;
    z-index: 10
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0)
}

.viewer:fullscreen {
    height: 100vh;
    width: 100vw
}

.audio-controls {
    margin: -4px 0 20px
}

.audio-actions {
    display: flex;
    gap: 7px
}

.audio-actions button,
.audio-upload,
.audio-status button {
    border: 1px solid var(--line);
    border-radius: 5px;
    background: #fff;
    padding: 9px 7px;
    font: inherit;
    font-size: 10px;
    text-align: center
}

.audio-actions button,
.audio-upload {
    flex: 1;
    cursor: pointer
}

.audio-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
    color: #777d73;
    font-size: 9px
}

.audio-status span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.audio-status button {
    padding: 4px 8px
}

.audio-controls audio:not([hidden]) {
    display: block;
    width: 100%;
    height: 34px;
    margin-top: 8px
}

.audio-meter,
.audio-labels {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px
}

.audio-meter {
    margin-top: 10px
}

.audio-meter span {
    height: 4px;
    overflow: hidden;
    border-radius: 4px;
    background: #e4e3dc
}

.audio-meter i {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width .08s linear
}

.audio-labels {
    margin-top: 5px;
    color: #96988e;
    font-size: 7px;
    letter-spacing: .5px;
    text-align: center
}

.audio-intensity {
    display: block;
    margin-top: 12px;
    font-size: 10px
}

.audio-intensity span {
    display: flex;
    justify-content: space-between
}

.audio-intensity output {
    color: #797d72;
    font-variant-numeric: tabular-nums
}

button:hover {
    filter: brightness(.95)
}

@media(min-width:1500px) {
    main {
        max-width: 1660px;
        margin: auto
    }

    .viewer {
        min-height: calc(100vh - 155px)
    }
}

@media(max-width:900px) {
    header {
        padding: 0 22px;
        height: 80px
    }

    .local {
        display: none
    }

    main {
        margin: 0 16px;
        grid-template-columns: minmax(0, 1fr) 285px
    }

    aside {
        padding: 24px 18px
    }

    .viewer {
        min-height: 740px
    }

    .view-top {
        left: 18px;
        right: 18px
    }

    .view-top>span:last-child {
        display: none
    }

    .view-bottom {
        left: 22px
    }

    footer>span:first-child {
        display: none
    }
}

@media(max-width:640px) {
    .studio {
        font-size: 7px;
        padding-left: 12px;
        margin-left: 4px
    }

    .brand {
        font-size: 27px
    }

    .header-right {
        gap: 0
    }

    .subtle span {
        display: none
    }

    main {
        display: flex;
        flex-direction: column
    }

    .viewer {
        min-height: 0;
        height: 65vh
    }

    aside {
        padding: 24px
    }

    .view-bottom h1 {
        font-size: 40px
    }

    .view-bottom p {
        margin-bottom: 0
    }

    footer {
        margin: 18px;
        gap: 10px;
        font-size: 8px
    }

    .palette-list {
        gap: 15px
    }

    .palette i {
        width: 18px
    }

    .panel-heading h2 {
        margin-bottom: 18px
    }
}

@media(prefers-reduced-motion:reduce) {
    * {
        scroll-behavior: auto
    }
}