:root {
    --bg-dark: #0f0f0f;
    --card-bg: #1a1a1a;
    --compare-blue: #2196f3;
    --inspect-green: #00e676;
}

* { box-sizing: border-box; }

body { 
    font-family: -apple-system, sans-serif; 
    margin: 0; padding: 15px; 
    background-color: var(--bg-dark); color: #eee;
    height: 100vh; display: flex; flex-direction: column;
    transition: background 0.3s ease;
}

/* 検査モード時の背景色変化 */
body.inspect-mode { background-color: #121412; }

.container { max-width: 500px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; height: 100%; }

/* モード切替 */
.mode-selector { display: flex; gap: 2px; background: #333; border-radius: 8px; padding: 4px; margin-bottom: 15px; }
.mode-btn { flex: 1; padding: 12px; border: none; background: transparent; color: #888; font-weight: bold; cursor: pointer; border-radius: 6px; }

body.compare-mode #modeCompare { background: var(--compare-blue); color: white; }
body.inspect-mode #modeInspect { background: var(--inspect-green); color: black; }

/* ガイド */
.guide-box { background: #222; border-left: 4px solid var(--compare-blue); padding: 12px; margin-bottom: 10px; font-size: 13px; min-height: 70px; }
body.inspect-mode .guide-box { border-left-color: var(--inspect-green); }
.guide-title { display: block; font-weight: bold; margin-bottom: 4px; color: #bbb; }

/* キャンバス */
.canvas-container { position: relative; background: #000; border-radius: 8px; border: 1px solid #333; height: 180px; margin-bottom: 15px; }
canvas { width: 100%; height: 100%; display: block; }
#overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; font-size: 50px; font-weight: bold; color: var(--inspect-green); background: rgba(0,0,0,0.6); }

/* 操作系：ここが画像で崩れていた部分 */
.control-panel { display: flex; flex-direction: column; gap: 10px; }
.rec-group { display: flex; gap: 10px; }
.btn-rec { flex: 1; height: 55px; background: #333; color: white; border: 1px solid #444; border-radius: 8px; font-weight: bold; }

.btn-main { width: 100%; height: 60px; border: none; border-radius: 8px; font-size: 18px; font-weight: bold; cursor: pointer; color: white; transition: 0.2s; }
body.compare-mode .btn-main { background: var(--compare-blue); }
body.inspect-mode .btn-main { background: var(--inspect-green); color: black; }

.btn-reset { background: none; border: none; color: #666; padding: 10px; text-decoration: underline; cursor: pointer; }

/* 結果表示 */
#resultArea { margin-top: 15px; flex: 1; overflow-y: auto; }
.report { background: var(--card-bg); border: 1px solid #333; padding: 15px; border-radius: 8px; }
.metric-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #333; }
.pass { color: var(--inspect-green); } .fail { color: #ff5252; }
/* --- 既存のスタイルに以下を追加 --- */

.metric-row { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 12px 0; 
    border-bottom: 1px solid #333;
    font-size: 14px;
}

/* ⓘ マークにマウスを当てると説明が出るように */
.metric-row span strong {
    border-bottom: 1px dotted #888;
    cursor: help;
}

.pass { color: #00e676; font-weight: bold; }

.report h3 { margin-top: 0; color: #bbb; border-bottom: 1px solid #444; padding-bottom: 5px; }

/* 判定ラベル */
.judgement { 
    margin-top: 15px; text-align: center; padding: 10px; 
    border-radius: 4px; font-weight: bold; font-size: 20px;
}
.pass-bg { background: rgba(0, 230, 118, 0.2); color: #00e676; border: 1px solid #00e676; }

/* ツールチップ本体 */
.metric-row::after {
    content: attr(data-tooltip); /* HTMLのdata-tooltip属性を表示 */
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #444;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    white-space: pre-wrap; /* 改行を有効に */
    width: 200px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    display: none; /* 通常は非表示 */
    z-index: 100;
}

/* ホバー時に表示 */
.metric-row:hover::after {
    display: block;
}

/* モバイル対応：タップしたときも少し見やすく */
@media (max-width: 600px) {
    .metric-row::after {
        width: 160px;
        left: 0;
        transform: none;
    }
}

/* 録音中などはこれ */
#resultArea.loading { opacity: 0.5; filter: grayscale(0.5); }

/* 解析完了後はこれ */
#resultArea.ready { opacity: 1; filter: none; }