:root {
    --bg: #0f0f0f;
    --panel: #1a1a1a;
    --accent: #00ffcc;
    --text: #f0f0f0;
    --border: #333;

    --left-w: 10%;
    --center-w: 30%;
    --minimap-w: 60px;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', 'Meiryo UI', Tahoma, sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    line-height: 1.6;
}

/* ===== D&Dオーバーレイ ===== */
#drop-zone {
    position: fixed;
    inset: 0;
    border: 4px dashed var(--accent);
    background: rgba(0, 255, 204, 0.05);
    z-index: 9999;
    visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    color: var(--accent);
    pointer-events: none;
}
body.dragover #drop-zone { visibility: visible; }

/* ===== 3ペインレイアウト ===== */
#app {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* --- 左ペイン --- */
#left-pane {
    width: var(--left-w);
    min-width: 140px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#left-header {
    padding: 12px 10px 8px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

#left-header h2 {
    margin: 0 0 10px;
    font-size: 0.85em;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
}
#left-header h2 small {
    color: #666;
    font-size: 0.8em;
}

.setting-block {
    margin-bottom: 8px;
}
.setting-block label {
    display: block;
    font-size: 0.7em;
    color: #888;
    margin-bottom: 3px;
}
.setting-block input[type="number"] {
    width: 100%;
    background: #222;
    color: #fff;
    border: 1px solid #444;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}
.setting-block button {
    width: 100%;
    padding: 5px 8px;
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75em;
    transition: 0.2s;
    white-space: nowrap;
}
.setting-block button:hover { border-color: var(--accent); }

/* 曲リスト */
#song-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 6px;
}
#song-list-empty {
    color: #555;
    font-size: 0.75em;
    text-align: center;
    margin-top: 20px;
}

.song-entry { margin-bottom: 4px; }

.song-title {
    padding: 6px 8px;
    font-size: 0.8em;
    cursor: pointer;
    border-radius: 4px;
    color: #ccc;
    transition: 0.15s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.song-title:hover { background: #2a2a2a; color: #fff; }
.song-title.active { color: var(--accent); }

.diff-list { display: none; padding-left: 8px; }
.diff-list.open { display: block; }

.diff-item {
    padding: 3px 8px;
    font-size: 0.72em;
    cursor: pointer;
    border-radius: 3px;
    color: #888;
    transition: 0.15s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.diff-item:hover { background: #2a2a2a; color: #ccc; }
.diff-item.active { color: var(--accent); background: rgba(0,255,204,0.05); }

/* --- 中央ペイン --- */
#center-pane {
    width: var(--center-w);
    min-width: 300px;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    background: var(--bg);
}

#center-content {
    padding: 20px 16px;
}

#center-welcome {
    color: #555;
    text-align: center;
    margin-top: 40px;
    font-size: 0.9em;
}

/* 中央の難易度カード */
.chart-card {
    background: var(--panel);
    padding: 16px;
    border-radius: 10px;
    border-left: 4px solid var(--accent);
    box-shadow: 0 3px 12px rgba(0,0,0,0.4);
}

.card-title {
    font-size: 1em;
    font-weight: bold;
    color: #fff;
    margin-bottom: 2px;
}
.card-scale {
    font-size: 0.75em;
    color: #aaa;
    margin-bottom: 10px;
}
.card-scale span { color: var(--accent); }

.card-totals {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
}
.total-box {
    flex: 1;
    background: rgba(0,255,204,0.06);
    border: 1px solid rgba(0,255,204,0.2);
    border-radius: 6px;
    padding: 6px 10px;
    text-align: center;
}
.total-box .label {
    font-size: 0.65em;
    color: #888;
    letter-spacing: 1px;
    display: block;
}
.total-box .value {
    font-size: 1.6em;
    font-weight: 900;
    color: var(--accent);
}

/* レーダーチャート */
.canvas-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}
.canvas-wrapper canvas {
    max-width: 100%;
    height: auto;
}

/* メトリクスグリッド */
.metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.metric-item {
    background: rgba(255,255,255,0.03);
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.05);
    transition: border-color 0.2s;
}
.metric-item:hover { border-color: var(--accent); }

.metric-item strong {
    display: block;
    color: var(--accent);
    font-size: 0.7em;
    letter-spacing: 1px;
    margin-bottom: 2px;
}
.metric-item .val {
    font-size: 1.2em;
    font-weight: bold;
}
.metric-item .detail {
    font-size: 0.7em;
    color: #666;
    display: block;
    margin-top: 2px;
    line-height: 1.4;
}

/* CHORD / SOF-LAN の内訳 */
.sub-scroll {
    max-height: 80px;
    overflow-y: auto;
    margin-top: 4px;
    padding: 4px;
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
    font-size: 0.7em;
    color: #ccc;
}
.chord-badge {
    display: flex;
    justify-content: space-between;
    padding: 1px 3px;
    border-left: 2px solid var(--accent);
    margin-bottom: 2px;
}
.chord-badge span:first-child { color: var(--accent); }

/* ゲージ情報 */
.gauge-info {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #333;
    color: #666;
    font-size: 0.72em;
    font-family: monospace;
    line-height: 1.6;
}

/* --- 右ペイン：ビューア --- */
#right-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #000;
}

#viewer-controls {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: 8px 14px;
    display: flex;
    gap: 20px;
    align-items: center;
    flex-shrink: 0;
}

.ctrl-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8em;
    color: #aaa;
}
.ctrl-row input[type="range"] {
    width: 100px;
    accent-color: var(--accent);
    cursor: pointer;
}
#zoom-val { font-size: 0.85em; color: #ccc; min-width: 36px; }

#viewer-controls button {
    padding: 4px 12px;
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    transition: 0.2s;
}
#viewer-controls button:hover { background: #444; }
#viewer-controls button.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

#main-view {
    flex: 1;
    overflow-y: scroll;
    overflow-x: auto;
    position: relative;
    display: flex;
    justify-content: center;
}

#viewer-welcome {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #333;
    font-size: 0.9em;
    pointer-events: none;
    white-space: nowrap;
}

#chart-area {
    position: relative;
    background: #080808;
    min-height: 100%;
    border-left: 1px solid #1a1a1a;
    border-right: 1px solid #1a1a1a;
    flex-shrink: 0;
}

/* ノーツ */
.note-container {
    position: absolute;
    width: 40px;
    height: 40px;
    z-index: 5;
    pointer-events: none;
}
.frz-bar {
    position: absolute;
    width: 16px;
    z-index: 2;
    opacity: 0.6;
    pointer-events: none;
    box-sizing: border-box;
}

/* --- ミニマップ --- */
#minimap-pane {
    width: var(--minimap-w);
    min-width: var(--minimap-w);
    background: var(--panel);
    border-left: 1px solid var(--border);
    position: relative;
    cursor: crosshair;
}
#minimap-canvas {
    width: 100%;
    height: 100%;
    display: block;
}
#view-indicator {
    position: absolute;
    width: 100%;
    background: rgba(0,255,204,0.1);
    border-top: 1px solid var(--accent);
    border-bottom: 1px solid var(--accent);
    pointer-events: none;
    left: 0;
}

/* ===== ハイライトトグル ===== */
.hl-row {
    flex-wrap: wrap;
    gap: 4px;
}

#highlight-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.hl-toggle-btn {
    padding: 3px 8px;
    font-size: 0.72em;
    background: #222;
    color: #aaa;
    border: 1px solid #444;
    border-radius: 3px;
    cursor: pointer;
    transition: 0.15s;
    white-space: nowrap;
}

.hl-toggle-btn:hover {
    border-color: var(--hl-color, #fff);
    color: #fff;
}

.hl-toggle-btn.active {
    background: var(--hl-color, #fff);
    color: #000;
    border-color: var(--hl-color, #fff);
    font-weight: bold;
}

/* クリップボード読み込み */
#clipboard-section {
    padding: 6px 8px;
    border-bottom: 1px solid #2a2a2a;
}
#clipboard-toggle {
    width: 100%;
    background: #1a2a1a;
    color: #00cc88;
    border: 1px solid #00cc88;
    padding: 4px 8px;
    font-size: 0.8em;
    cursor: pointer;
    border-radius: 3px;
}
#clipboard-toggle:hover { background: #223322; }
#clipboard-area {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
#clipboard-input {
    width: 100%;
    box-sizing: border-box;
    background: #111;
    color: #ccc;
    border: 1px solid #333;
    padding: 4px;
    font-size: 0.75em;
    resize: vertical;
    font-family: monospace;
    border-radius: 3px;
}
#clipboard-load {
    background: #00cc88;
    color: #000;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    font-weight: bold;
    border-radius: 3px;
}
#clipboard-load:hover { background: #00ffaa; }
