/* Retro MacPaint 1-bit style aesthetics */

:root {
    --bg-color: #ffffff;
    --fg-color: #000000;
    --highlight-cyan: #00ffff;
    --highlight-pink: #ff00ff;
    --highlight-yellow: #ffff00;
}

body {
    background-color: #aaaaaa; /* Desktop background */
    font-family: 'VT323', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    /* Dithered background pattern for body */
    background-image: radial-gradient(#000 1px, transparent 1px);
    background-size: 4px 4px;
}

@keyframes boilUI {
    0%, 100% { filter: url(#uiWiggle1); }
    25% { filter: url(#uiWiggle2); }
    50% { filter: url(#uiWiggle3); }
    75% { filter: url(#uiWiggle4); }
}

.mac-window {
    background-color: var(--bg-color);
    border: 3px solid var(--fg-color);
    width: 800px;
    box-shadow: 4px 4px 0px rgba(0,0,0,1);
    display: flex;
    flex-direction: column;
}

/* Menu Bar */
.menu-bar {
    border-bottom: 2px solid var(--fg-color);
    display: flex;
    padding: 2px 10px;
    font-size: 20px;
    font-weight: bold;
    gap: 15px;
    animation: boilUI 0.3s infinite step-end;
}

.menu-bar span {
    cursor: pointer;
}

.menu-bar span:hover {
    background-color: var(--fg-color);
    color: var(--bg-color);
}

/* Main Content Area */
.main-content {
    display: flex;
    border-bottom: 2px solid var(--fg-color);
    /* MacPaint style stippled background pattern */
    background-image: 
      linear-gradient(45deg, #000 25%, transparent 25%, transparent 75%, #000 75%, #000), 
      linear-gradient(45deg, #000 25%, transparent 25%, transparent 75%, #000 75%, #000);
    background-size: 4px 4px;
    background-position: 0 0, 2px 2px;
    background-color: white;
}

/* Canvas Area */
.canvas-container {
    flex-grow: 1;
    padding: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#paintCanvas {
    background-color: #ffffff;
    border: 2px solid var(--fg-color);
    box-shadow: 2px 2px 0px rgba(0,0,0,1);
    cursor: crosshair; /* Will change based on tool */
    touch-action: none; /* Crucial for preventing mobile scrolling while drawing */
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: crisp-edges;
    image-rendering: pixelated; /* Ensures crunchy 1-bit look on high-res screens */
}

/* Tool Palette */
.tool-palette {
    width: 150px;
    background-color: #ffffff;
    border-left: 2px solid var(--fg-color);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: boilUI 0.3s infinite step-end;
}

.tool-btn {
    background: transparent;
    border: none;
    font-family: 'VT323', monospace;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
    width: 100%;
}

.tool-btn svg {
    width: 100%;
    height: auto;
}

.tool-btn:active, .tool-btn.selected {
    transform: translate(2px, 2px);
    filter: drop-shadow(2px 2px 0px var(--fg-color));
}

.color-palette {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
    align-items: center;
}

.color-row {
    display: flex;
    gap: 10px;
}

.color-blob {
    width: 30px;
    height: 30px;
    border: 2px solid var(--fg-color);
    cursor: pointer;
    /* Hand-drawn blob shape */
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
    box-shadow: 2px 2px 0px rgba(0,0,0,1);
    transition: all 0.1s;
}

.color-blob:active {
    transform: translate(2px, 2px);
    box-shadow: 0px 0px 0px rgba(0,0,0,1);
}

.color-blob.selected {
    border-width: 4px;
    transform: scale(1.1);
}

/* Bottom Toolbar */
.bottom-toolbar {
    display: flex;
    background-color: #ffffff;
    padding: 5px;
    gap: 10px;
    border-bottom: 2px solid var(--fg-color);
    /* Match the stippled background */
    background-image: 
      linear-gradient(45deg, #000 25%, transparent 25%, transparent 75%, #000 75%, #000), 
      linear-gradient(45deg, #000 25%, transparent 25%, transparent 75%, #000 75%, #000);
    background-size: 4px 4px;
    background-position: 0 0, 2px 2px;
    animation: boilUI 0.3s infinite step-end;
}

.toolbar-section {
    background-color: white;
    border: 2px solid var(--fg-color);
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
}

.retro-btn {
    background: transparent;
    border: none;
    font-family: 'VT323', monospace;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
}

.retro-btn:active {
    transform: translate(1px, 1px);
}

.oops-btn {
    background-color: black;
    color: white;
    padding: 5px 15px;
}

.obliterate-btn {
    display: flex;
    align-items: center;
    gap: 5px;
}

.size-selector {
    flex-direction: column;
    font-size: 16px;
    font-weight: bold;
}

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

.size-controls button {
    background: white;
    border: 1px solid black;
    cursor: pointer;
}

#currentSizeIndicator {
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.dot {
    background-color: black;
    border-radius: 50%;
    width: 6px;
    height: 6px;
}

/* Audio Toolbar */
.audio-toolbar {
    background-color: #ffffff;
    padding: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    animation: boilUI 0.3s infinite step-end;
}

.audio-toolbar input {
    flex-grow: 1;
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 5px;
    border: 2px solid var(--fg-color);
}

.audio-toolbar button {
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 5px 15px;
    background-color: var(--bg-color);
    border: 2px solid var(--fg-color);
    box-shadow: 2px 2px 0px var(--fg-color);
    cursor: pointer;
}

.audio-toolbar button:active {
    box-shadow: inset 2px 2px 0px var(--fg-color);
    transform: translate(2px, 2px);
}

.audio-toolbar button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

#timeDisplay {
    font-family: 'VT323', monospace;
    font-size: 24px;
    font-weight: bold;
    min-width: 60px;
    text-align: right;
}

/* Styling for the seek slider */
.playback-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-grow: 1;
}

#seekSlider {
    flex-grow: 1;
    min-width: 150px;
    cursor: pointer;
    -webkit-appearance: none;
    background: transparent;
}
#seekSlider::-webkit-slider-runnable-track {
    height: 4px;
    background: var(--fg-color);
}
#seekSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    background: var(--bg-color);
    border: 2px solid var(--fg-color);
    margin-top: -6px;
}

/* Mobile-friendly hidden YouTube player */
.hidden-player {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0.01;
    pointer-events: none;
    z-index: -1000;
}
