@charset "UTF-8";

:root {
    --bg-color: #121212;
    --panel-color: #1e1e1e;
    --text-color: #e2e8f0;
    --text-muted: #a0aec0;
    --accent-color: #3182ce;
    --accent-hover: #4299e1;
    --input-bg: #2d3748;
    --border-color: #4a5568;
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    padding: 0.5rem 1rem 0;
    text-align: center;
}

h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    display: inline-block;
}

p.subtitle {
    margin: 0 0 0 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    display: inline-block;
}

main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0.25rem;
}

.container {
    background-color: var(--panel-color);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    width: 100%;
    max-width: 900px;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
    }
}

/* 子要素がコンテンツに応じて勝手に広がらないようにする */
.picker-area, .settings-area {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.picker-area {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Color Box */
.color-box-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: red;
    cursor: crosshair;
    border: 1px solid var(--border-color);
}
.color-box-overlay-white {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to right, #fff, rgba(255,255,255,0));
}
.color-box-overlay-black {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to top, #000, rgba(0,0,0,0));
}
.cursor {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
    pointer-events: none;
}

/* Sliders */
.slider-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.slider-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--input-bg);
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--accent-color);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.hue-slider {
    background: linear-gradient(to right, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 66%, magenta 83%, red 100%) !important;
}

.settings-area {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

section-title {
    display: block;
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.preview-box {
    height: 60px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}
.preview-box::before {
    content: '';
    position: absolute;
    z-index: -1;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: linear-gradient(45deg, #2d3748 25%, transparent 25%), linear-gradient(-45deg, #2d3748 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #2d3748 75%), linear-gradient(-45deg, transparent 75%, #2d3748 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.value-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
    font-size: 0.875rem;
}
.value-label {
    color: var(--text-muted);
    font-weight: 500;
}
.value-content {
    font-family: 'Consolas', 'Monaco', monospace;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    user-select: none;
}
.checkbox-label input {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
}

.output-area {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    width: 100%;
    margin-top: 0.5rem;
}

.code-output {
    background: #000;
    border: 1px solid var(--accent-color);
    color: #4ade80; /* 見やすいグリーン */
    font-family: 'Consolas', 'Monaco', monospace;
    padding: 0.6rem;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.8rem;
    white-space: pre;
    overflow-x: scroll; /* 常にスクロールバーを表示 */
    overflow-y: hidden;
    resize: none;
    outline: none;
}

/* スクロールバーを見やすく強調 */
.code-output::-webkit-scrollbar {
    height: 10px;
}
.code-output::-webkit-scrollbar-track {
    background: #1a1a1a;
}
.code-output::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 5px;
}

.btn-copy {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.95rem;
    transition: background-color 0.2s;
}
.btn-copy:hover {
    background-color: var(--accent-hover);
}
.btn-copy:active {
    transform: scale(0.98);
}

footer {
    padding: 0.5rem;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
}
