:root {
    --tp-base-background-color: #2f231d;
    --tp-base-shadow-color: rgba(31, 24, 20, 0.2);
    --tp-button-background-color: #f5f1f0;
    --tp-button-background-color-active: #fbfaf9;
    --tp-button-background-color-focus: #f7f4f3;
    --tp-button-background-color-hover: #f3efed;
    --tp-button-foreground-color: #2f231d;
    --tp-container-background-color: hsla(20, 20%, 95%, 0.1);
    --tp-container-background-color-active: hsla(20, 20%, 95%, 0.25);
    --tp-container-background-color-focus: hsla(20, 20%, 95%, 0.2);
    --tp-container-background-color-hover: hsla(20, 20%, 95%, 0.15);
    --tp-container-foreground-color: #f5f1f0;
    --tp-groove-foreground-color: hsla(20, 20%, 95%, 0.1);
    --tp-input-background-color: hsla(20, 20%, 95%, 0.1);
    --tp-input-background-color-active: hsla(20, 20%, 95%, 0.25);
    --tp-input-background-color-focus: hsla(20, 20%, 95%, 0.2);
    --tp-input-background-color-hover: hsla(20, 20%, 95%, 0.15);
    --tp-input-foreground-color: #f5f1f0;
    --tp-label-foreground-color: hsla(20, 20%, 95%, 0.7);
    --tp-monitor-background-color: rgba(47, 35, 30, 0.2);
    --tp-monitor-foreground-color: hsla(20, 20%, 95%, 0.7);
}

*,
::after,
::before {
    border-style: solid;
    border-width: 0;
    box-sizing: border-box;
}

* {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

body {
    align-items: flex-start;
    background: linear-gradient(to bottom, #0a0a1a 0%, #2d1b4e 50%, #8b1a8b 100%);
    background-attachment: fixed;
    color: #f6f2f0;
    display: grid;
    font-family: Arial, sans-serif;
    justify-items: center;
    line-height: 1.5;
    margin: 0;
    min-height: 100vh;
    position: relative;
    width: 100%;
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    opacity: 0.6;
    mix-blend-mode: screen;
    z-index: 0;
    pointer-events: none;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 100%;
    padding: 0;
    gap: 2rem;
    position: relative;
    z-index: 1;
}

.upload-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 200px;
    padding: 2rem;
    position: sticky;
    top: 0;
    background: linear-gradient(to bottom, #0a0a1a 0%, #2d1b4e 50%, #8b1a8b 100%);
    background-attachment: fixed;
    z-index: 100;
}

.upload-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

.upload-text {
    font-size: 1.125rem;
    color: #f6f2f0;
    margin: 0;
    opacity: 0.9;
}

.upload-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f1f0;
    color: #2f231d;
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
    border: 2px solid transparent;
    min-height: 3rem;
}

.upload-button:hover {
    background-color: #fbfaf9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.upload-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.upload-button-text {
    pointer-events: none;
}

.canvas-wrapper {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    gap: 1.5rem;
    padding: 1rem;
}

.canvas-wrapper.active {
    display: flex;
}

canvas {
    display: block;
    position: relative;
    width: calc(100vmin - 4rem);
    max-width: 100%;
    height: auto;
}

#visualizer {
    width: 100vw;
    height: 150px;
    background: transparent;
    margin-top: 1rem;
    display: block;
}

.image-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 600px;
}

.playback-controls {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.control-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f1f0;
    color: #2f231d;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    border: 2px solid transparent;
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
    min-height: 2.75rem;
    font-family: inherit;
    touch-action: manipulation;
}

.control-btn:hover {
    background-color: #fbfaf9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.control-btn span {
    pointer-events: none;
}

.icon-btn {
    width: 3rem;
    height: 3rem;
    padding: 0;
    border-radius: 50%;
    min-height: 3rem;
}

.icon {
    font-size: 1.25rem;
    line-height: 1;
    display: inline-block;
}

.upload-new-btn {
    background-color: rgba(245, 241, 240, 0.2);
    color: #f5f1f0;
    border-color: #f5f1f0;
}

.upload-new-btn:hover {
    background-color: rgba(245, 241, 240, 0.3);
    border-color: #fbfaf9;
}

.audio-controls {
    width: 100%;
    max-width: 600px;
    display: none;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background: rgba(245, 241, 240, 0.1);
    border-radius: 0.5rem;
    backdrop-filter: blur(10px);
}

.audio-controls.active {
    display: flex;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.control-label {
    color: #f5f1f0;
    font-size: 0.9375rem;
    font-weight: 600;
    min-width: 80px;
    text-align: left;
}

.control-slider {
    flex: 1;
    height: 0.5rem;
    background: rgba(245, 241, 240, 0.2);
    border-radius: 0.25rem;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.control-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    background: #f5f1f0;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.control-slider::-webkit-slider-thumb:hover {
    background: #fbfaf9;
    transform: scale(1.1);
}

.control-slider::-moz-range-thumb {
    width: 1.25rem;
    height: 1.25rem;
    background: #f5f1f0;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease-in-out;
}

.control-slider::-moz-range-thumb:hover {
    background: #fbfaf9;
    transform: scale(1.1);
}

.control-value {
    color: #f5f1f0;
    font-size: 0.875rem;
    font-weight: 600;
    min-width: 60px;
    text-align: right;
}

.control-select {
    flex: 1;
    background-color: #f5f1f0;
    color: #2f231d;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    border: 2px solid transparent;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    min-height: 2.75rem;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%232f231d' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.control-select:hover {
    background-color: #fbfaf9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.control-select:focus {
    outline: none;
    border-color: #f5f1f0;
}

/* Tweakpane positioning for mobile */
.tp-dfwv {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto;
}

/* Mobile styles */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        padding: 0;
        gap: 1.5rem;
    }

    .upload-container {
        min-height: 150px;
        padding: 1.5rem 1rem;
        position: sticky;
        top: 0;
    }

    .upload-text {
        font-size: 1rem;
    }

    .upload-button {
        padding: 0.625rem 1.5rem;
        font-size: 0.9375rem;
    }

    canvas {
        width: calc(100vw - 1rem);
        margin: 0;
    }

    #visualizer {
        width: 100vw;
        height: 120px;
        margin-top: 0.75rem;
    }

    .image-controls {
        gap: 0.75rem;
        padding: 0 0.5rem;
    }

    .playback-controls {
        gap: 0.5rem;
    }

    .icon-btn {
        width: 2.75rem;
        height: 2.75rem;
        min-height: 2.75rem;
    }

    .icon {
        font-size: 1.125rem;
    }

    .control-btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        min-height: 2.5rem;
    }

    .upload-new-btn {
        width: 100%;
    }

    .audio-controls {
        padding: 1rem;
        gap: 0.75rem;
    }

    .control-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .control-label {
        min-width: auto;
    }

    .control-slider {
        width: 100%;
    }

    .control-value {
        min-width: auto;
        text-align: left;
    }

    .control-select {
        width: 100%;
    }

    .tp-dfwv {
        width: 100% !important;
        max-width: 100% !important;
    }
}

.alert-box {
    animation: popIn .3s ease-out forwards;
    background-color: rgba(33, 24, 20, .75);
    border-radius: .5rem;
    color: #f6f2f0;
    font-size: .875rem;
    font-weight: 300;
    left: 50%;
    letter-spacing: .025em;
    line-height: 1.3;
    padding: 1rem;
    position: fixed;
    text-align: center;
    top: 50%;
    transform: translate(-50%, -50%) scale(0);
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    width: -moz-max-content;
    width: max-content;
    z-index: 1000;
}

.alert-box.out {
    animation: popOut .2s ease-in forwards;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }

    60% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes popOut {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
}

.button {
    align-items: center;
    background-color: #211814;
    border: .0625rem solid;
    color: #f6f2f0;
    cursor: pointer;
    display: inline-flex;
    font-family: inherit;
    justify-content: center;
    min-height: 2rem;
    min-width: 4rem;
    pointer-events: auto;
    position: relative;
    touch-action: manipulation;
    transition: all .2s ease-in-out;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    width: -moz-max-content;
    width: max-content;
}

.button:before {
    content: "";
    display: inline-block;
    height: 1rem;
    vertical-align: middle;
}

.button .text {
    display: inline-flex;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .025em;
    line-height: normal;
    padding: .25rem .5rem;
    pointer-events: none;
    text-align: center;
    text-transform: uppercase;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    width: auto;
}

.button:focus-visible {
    background-color: #f6f2f0;
    color: #211814;
    outline: none;
}

.button:disabled {
    cursor: not-allowed;
}

.button:active {
    background-color: #f6f2f0;
    color: #211814;
}

.tp-demo-thumbnails {
    display: grid;
    gap: .1875rem;
    grid-gap: .1875rem;
    grid-template-columns: repeat(4, 1fr);
    padding: 0 .25rem .1875rem;
    width: 100%;
}

.tp-demo-thumbnail {
    align-items: center;
    aspect-ratio: 1;
    background-color: var(--cnt-bg);
    border-radius: .25rem;
    cursor: pointer;
    display: grid;
    height: auto;
    justify-items: center;
    overflow: hidden;
    place-items: center;
    width: 100%;
}

.tp-demo-thumbnail:after {
    aspect-ratio: 1;
    border: .125rem solid transparent;
    border-radius: .25rem;
    content: "";
    display: block;
    grid-area: 1/-1;
    pointer-events: none;
    position: relative;
    transition: border .3s;
    width: 100%;
}

.tp-demo-thumbnail:active:after {
    border: .125rem solid var(--cnt-fg);
}

.tp-demo-thumbnail img {
    border-radius: .25rem;
    display: block;
    grid-area: 1/-1;
    height: auto;
    -o-object-fit: cover;
    object-fit: cover;
    width: 100%;
}

.resources-layer {
    bottom: 0;
    display: block;
    position: fixed;
    right: 0;
    z-index: 1000;
}

.resources {
    background: rgba(33, 24, 20, .75);
    display: grid;
    font-size: .6875rem;
    font-weight: 300;
    grid-auto-flow: column;
    line-height: 1.3;
    padding: .5rem;
    pointer-events: auto;
}

.resources a {
    align-content: center;
    display: grid;
    justify-content: center;
    padding: 0 .5rem;
    place-content: center;
    transition: color .2s ease-in-out;
}

.resources a,
.resources a:visited {
    color: rgba(246, 242, 240, .75);
}

.resources a:active {
    color: #f6f2f0;
}

.resources a:focus-visible {
    color: #f6f2f0;
    outline: none;
}

.resources a:not(:first-child) {
    border-inline-start: .0625rem solid currentColor;
}

@media (hover:hover) and (pointer:fine) {
    .button:hover:not(:disabled) {
        background-color: #f6f2f0;
        color: #211814;
    }

    .tp-demo-thumbnail:hover:not(:disabled):after {
        border: .125rem solid var(--cnt-fg);
    }

    .resources a:active:not(:hover),
    .resources a:hover {
        color: #f6f2f0;
    }
}