:root {
    --bg-color: #f4f4f9;
    --text-color: #333;
    --panel-bg: #fff;
    --accent-color: #333;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* --- メインエリア: カラーボックス --- */
#palette-container {
    flex: 1;
    display: flex;
    width: 100%;
    transition: all 0.3s ease;
}

.color-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: flex-grow 0.3s ease;
    position: relative;
    min-width: 50px;
}

.color-box:hover {
    flex-grow: 1.5;
    z-index: 1;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
}

.color-info {
    font-weight: bold;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    pointer-events: none;
    user-select: none;
    background: rgba(255,255,255,0.2);
    padding: 5px 10px;
    border-radius: 4px;
    backdrop-filter: blur(2px);
}

/* --- コントロールパネル --- */
#controls {
    background-color: var(--panel-bg);
    padding: 20px 40px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 10;
}

.control-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 200px;
}

label {
    font-weight: bold;
    font-size: 0.85rem;
    width: 50px;
    flex-shrink: 0;
}

input[type="range"] {
    flex: 1;
    cursor: pointer;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    appearance: none;
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: 2px solid var(--panel-bg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
button:hover { background-color: #555; }
button.secondary { background-color: #e0e0e0; color: #333; }
button.secondary:hover { background-color: #ccc; }

.title {
    text-align: center;
    margin: 0;
    font-size: 1rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- 独自カラーピッカーモーダル --- */
#picker-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

#picker-content {
    background: white;
    padding: 25px;
    border-radius: 16px;
    width: 340px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: popIn 0.2s ease-out;
    display: flex; flex-direction: column; gap: 20px;
}

@keyframes popIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.top-actions {
    display: flex; gap: 10px; height: 40px;
}

/* プレビュー兼入力欄 */
.picker-preview-wrapper {
    flex: 1;
    border-radius: 8px;
    border: 1px solid #ddd;
    overflow: hidden;
    display: flex;
    position: relative;
}
#picker-hex-input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-weight: bold;
    font-family: monospace;
    font-size: 1.1rem;
    outline: none;
    color: inherit; /* JSで制御 */
}

#eyedropper-btn {
    padding: 0 15px; background: #eee; color: #333;
}
#eyedropper-btn:hover { background: #ddd; }


/* --- 2D SV パレットエリア (HSVモデル) --- */
.sv-palette-container {
    position: relative;
    width: 100%;
    height: 180px;
    border-radius: 8px;
    overflow: hidden;
    cursor: crosshair;
    border: 1px solid #ddd;
}
/* レイヤー構成:
    1. 背景色 (Pure Hue)
    2. 左から右への白グラデーション (Saturation用)
    3. 下から上への黒グラデーション (Value/Brightness用)
*/
#sv-palette-bg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-color: red; /* JSでHueを設定 */
}
.sv-palette-white {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to right, #fff, rgba(255,255,255,0));
}
.sv-palette-black {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, #000, rgba(0,0,0,0));
}

/* カーソル */
#sv-cursor {
    position: absolute;
    width: 12px; height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 2px rgba(0,0,0,0.5);
    transform: translate(-50%, -50%);
    pointer-events: none;
}


/* ピッカー内のスライダー */
.picker-sliders { display: flex; flex-direction: column; gap: 12px; }
.picker-slider-row {
    display: flex; align-items: center; gap: 10px;
}

#picker-h {
    background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
}

.close-btn { width: 100%; margin-top: 10px; }
