:root {
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --text-dark: #1a1a1a;
    --text-light: #ffffff;
    --accent: #4a90e2;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    overflow: hidden;
    height: 100vh;
    background-color: #000;
}

.seo-content {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Global Controls Panel */
.global-controls {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: scale(1);
}

.col-count-display {
    font-weight: 600;
    font-size: 1.1rem;
    min-width: 20px;
    text-align: center;
}

/* Palette Container */
.palette-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.color-section {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 5vh;
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), flex 0.5s ease, opacity 0.5s ease;
    position: relative;
    overflow: hidden;
}

/* Entry/Exit Animation */
.color-section.entering {
    flex: 0;
    opacity: 0;
}

.controls {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.controls:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.15);
}

.hex-input {
    background: transparent;
    border: none;
    color: inherit;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    width: 90px;
    text-align: center;
    text-transform: uppercase;
    outline: none;
    padding: 4px;
}

.picker-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid var(--glass-border);
    color: inherit;
    cursor: pointer;
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.picker-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.screen-picker-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid var(--glass-border);
    color: inherit;
    cursor: crosshair;
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.screen-picker-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.screen-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.screen-picker-panel {
    width: min(100%, 1400px);
    max-height: 100%;
    background: rgba(15, 15, 15, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.screen-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px 8px;
    color: #fff;
}

.screen-picker-hint {
    padding: 0 20px 16px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
}

.screen-picker-close {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    color: #fff;
    padding: 8px 14px;
    cursor: pointer;
}

.screen-picker-stage {
    position: relative;
    overflow: auto;
    max-height: calc(100vh - 160px);
    padding: 0 20px 20px;
}

.screen-picker-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 18px;
    cursor: crosshair;
    margin: 0 auto;
}

.screen-picker-loupe {
    position: absolute;
    display: none;
    pointer-events: none;
    transform: translate(-50%, -50%);
    background: rgba(12, 12, 12, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    padding: 10px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.screen-picker-loupe.visible {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.screen-picker-zoom {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    image-rendering: pixelated;
}

.screen-picker-hex {
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.color-picker {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

/* Contrast adjustment classes */
.dark-text { color: var(--text-dark); }
.light-text { color: var(--text-light); }

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .palette-container {
        flex-direction: column;
    }

    .color-section {
        flex: 1;
        padding-bottom: 0;
        justify-content: center;
    }

    .controls {
        transform: scale(0.9);
    }

    .global-controls {
        top: auto;
        bottom: 16px;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100vw - 24px);
        max-width: 560px;
        padding: 8px 10px;
        gap: 8px;
        border-radius: 24px;
        justify-content: center;
        flex-wrap: wrap;
    }

    .screen-picker-overlay {
        padding: 12px;
    }

    .screen-picker-panel {
        width: 100%;
        border-radius: 18px;
    }

    .screen-picker-header {
        padding: 16px 16px 8px;
    }

    .screen-picker-hint {
        padding: 0 16px 12px;
        font-size: 0.9rem;
    }

    .screen-picker-stage {
        max-height: calc(100vh - 140px);
        padding: 0 16px 16px;
    }
}

@media (max-width: 520px) {
    .global-controls {
        width: calc(100vw - 16px);
        bottom: 10px;
        gap: 6px;
        padding: 6px 8px;
    }

    .control-btn {
        width: 32px;
        height: 32px;
    }

    .col-count-display {
        font-size: 1rem;
        min-width: 16px;
    }
}
