* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    overflow: hidden;
    user-select: none;
}

#app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Canvas Panel (Left) */
#canvas-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 360px;
    min-width: 360px;
    background: #16213e;
    border-right: 2px solid #0f3460;
    padding: 20px;
}

#canvas-container {
    background: #0f3460;
    border: 3px solid #0f3460;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 0 30px rgba(15, 52, 96, 0.5);
}

#portrait-canvas {
    display: block;
    width: 256px;
    height: 256px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background: #1a1a2e;
    border-radius: 4px;
}

/* Action Buttons */
#action-buttons {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.action-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: #fff;
}

#btn-random {
    background: #e94560;
}
#btn-random:hover {
    background: #ff6b81;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

#btn-random-mild {
    background: #3a8c5c;
}
#btn-random-mild:hover {
    background: #4aac6c;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(58, 140, 92, 0.4);
}

#btn-export {
    background: #0f3460;
}
#btn-export:hover {
    background: #1a5276;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(15, 52, 96, 0.4);
}

.action-btn:active {
    transform: translateY(0);
}

/* Color Pickers */
#color-pickers {
    margin-top: 16px;
    background: #0f3460;
    border-radius: 10px;
    padding: 12px 14px;
    width: 100%;
    max-width: 300px;
}

.color-section {
    margin-bottom: 10px;
}
.color-section:last-child {
    margin-bottom: 0;
}

.color-label {
    font-size: 12px;
    font-weight: 600;
    color: #a0b4d0;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

/* Preset swatches */
.preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.preset-swatch {
    width: 24px;
    height: 24px;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    box-sizing: border-box;
}

.preset-swatch:hover {
    transform: scale(1.2);
    z-index: 1;
}

.preset-swatch.active {
    border-color: #e94560;
    box-shadow: 0 0 6px rgba(233, 69, 96, 0.6);
}

.preset-default {
    background: repeating-conic-gradient(#555 0% 25%, #333 0% 50%) 50% / 8px 8px !important;
    border: 2px dashed #666;
}

/* Controls Panel (Right) */
#controls-panel {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
    background: #1a1a2e;
}

#controls-panel h2 {
    font-size: 20px;
    font-weight: 700;
    color: #e94560;
    margin-bottom: 16px;
    text-align: center;
    letter-spacing: 1px;
}

/* Layer Control */
.layer-control {
    background: #16213e;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.layer-control:hover {
    background: #1a2744;
}

.layer-name {
    width: 130px;
    min-width: 120px;
    font-size: 13px;
    font-weight: 500;
    color: #a0b4d0;
}

.layer-nav-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #0f3460;
    border-radius: 6px;
    background: #0f3460;
    color: #e0e0e0;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.layer-nav-btn:hover:not(:disabled) {
    background: #1a5276;
    border-color: #e94560;
}
.layer-nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}
.layer-nav-btn:active:not(:disabled) {
    transform: scale(0.92);
}

.layer-index {
    width: 32px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #e94560;
    font-variant-numeric: tabular-nums;
}

.layer-total {
    font-size: 12px;
    color: #5a7a9a;
    margin-left: -4px;
}

/* Vertical movement controls */
.layer-move-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #0f3460;
    border-radius: 6px;
    background: #1a2744;
    color: #7ee081;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.layer-move-btn:hover {
    background: #1a5276;
    border-color: #7ee081;
}
.layer-move-btn:active {
    transform: scale(0.92);
}

.layer-offset {
    width: 28px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #7ee081;
    font-variant-numeric: tabular-nums;
}

.layer-reset-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #3a2a4a;
    border-radius: 6px;
    background: #2a1a3a;
    color: #a080c0;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.layer-reset-btn:hover {
    background: #3a2a5a;
    border-color: #a080c0;
}
.layer-reset-btn:active {
    transform: scale(0.92);
}

/* Shortcuts hint */
#shortcuts-hint {
    margin-top: 16px;
    text-align: center;
    font-size: 11px;
    color: #5a7a9a;
}
#shortcuts-hint kbd {
    background: #0f3460;
    border-radius: 3px;
    padding: 1px 5px;
    font-family: inherit;
    font-size: 11px;
    color: #a0b4d0;
}

/* Scrollbar */
#controls-panel::-webkit-scrollbar {
    width: 6px;
}
#controls-panel::-webkit-scrollbar-track {
    background: #1a1a2e;
}
#controls-panel::-webkit-scrollbar-thumb {
    background: #0f3460;
    border-radius: 3px;
}
#controls-panel::-webkit-scrollbar-thumb:hover {
    background: #1a5276;
}