:root {
    --bg-color: #121212;
    --panel-color: #1e1e1e;
    --text-color: #e0e0e0;
    --accent-color: #4a90e2;
    --danger-color: #e24a4a;
    --border-color: #333;
}

body {
    margin: 0; padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
    overflow: hidden;
    display: flex;
    height: 100vh;
}

/* サイドバー */
#sidebar {
    width: 340px;
    background-color: var(--panel-color);
    padding: 20px;
    box-shadow: 2px 0 10px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 10;
    overflow-y: auto;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
}

h1 { 
    font-size: 18px; 
    margin: 0 0 5px 0; 
    border-bottom: 1px solid #444; 
    padding-bottom: 15px; 
    color: #fff; 
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

h2 { 
    font-size: 11px; 
    margin: 10px 0 5px 0; 
    color: #888; 
    text-transform: uppercase; 
    letter-spacing: 0.05em; 
    font-weight: bold; 
}

.control-group {
    background: #2c2c2c;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 5px;
    align-items: center;
    color: #ccc;
}

.highlight-label {
    color: #fff;
    margin-top: 10px;
    font-weight: bold;
}


input[type="range"] {
    width: 100%;
    cursor: pointer;
    margin-bottom: 8px;
    height: 6px;
    background: #444;
    border-radius: 3px;
    appearance: none;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 14px; height: 14px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #2c2c2c;
    transition: transform 0.1s;
}
input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

input[type="range"]:last-child { margin-bottom: 0; }

.btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    transition: background 0.2s, transform 0.1s;
}
.btn:hover { background-color: #357abd; }
.btn:active { transform: translateY(1px); }

.btn-secondary { background-color: #444; font-weight: normal; }
.btn-secondary:hover { background-color: #555; }

#compare-btn { user-select: none; }
#compare-btn.active {
    background-color: var(--danger-color);
    content: "オリジナル表示中";
}

.file-area { margin-bottom: 5px; }
.action-area { margin-top: auto; padding-top: 20px; }

/* ワークスペース */
#workspace {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    background-color: #000;
    background-image: radial-gradient(#333 1px, transparent 1px);
    background-size: 20px 20px;
    cursor: grab;
}
#workspace:active { cursor: grabbing; }

#drop-zone {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 20;
    transition: opacity 0.3s, visibility 0.3s;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
}

#drop-zone.hidden { 
    opacity: 0; 
    visibility: hidden; 
}

#drop-zone-text {
    font-size: 18px;
    border: 2px dashed #888;
    padding: 40px;
    border-radius: 10px;
    background: rgba(0,0,0,0.8);
    color: #ddd;
    font-weight: bold;
}

canvas {
    display: block;
    position: absolute;
    left: 0; top: 0;
    transform-origin: 0 0;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
}

.val-disp { color: var(--accent-color); font-family: monospace; font-weight: bold; }
.info-text { font-size: 10px; color: #777; margin-top: 4px; line-height: 1.3; }

/* Scrollbar styling */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--panel-color); }
::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }