:root {
    --bg-color: #0a0a0a;
    --panel-bg: #161616;
    --accent-color: #00e5ff;
    --threshold-color: #ff3d00;
    --text-color: #e0e0e0;
}

/* 全体的なボックスサイズの計算を正確にする */
* {
    box-sizing: border-box;
}

/* ボディの余白を最小限に */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Segoe UI', sans-serif;
    display: flex;
    justify-content: center;
    padding: 10px; /* 余白をモバイル向けに調整 */
    margin: 0;
    overflow-x: hidden; /* 横スクロールを完全に禁止 */
}

/* コンテナの幅を画面一杯に */
.container {
    width: 100%;
    max-width: 900px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid #333;
}

/* ボタンのレスポンシブ対応 */
button {
    background-color: var(--accent-color);
    color: #000;
    border: none;
    padding: 12px 24px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

#chordDisplay {
    background: var(--panel-bg);
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    margin: 20px 0;
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.1);
}

#chordName {
    /* 画面幅に合わせてフォントサイズを可変に (最小2.5rem, 最大4rem) */
    font-size: clamp(2.5rem, 10vw, 4rem);[cite: 6]
    font-weight: bold;
    letter-spacing: 2px;
}

/* 楽譜エリアの背景と枠線 */
#sheet-music svg * {
    fill: #000000 !important;   /* 塗りつぶしを黒に */
    stroke: #000000 !important; /* 線を黒に */
    stroke-width: 0.5;          /* 線の太さを安定させる */
    opacity: 1 !important;      /* 透明度を無効化 */
}

/* 五線譜の横線などはstrokeをメインにする */
#sheet-music svg path, 
#sheet-music svg line {
    stroke: #000000 !important;
    stroke-width: 1.2 !important; /* 五線譜を少し太くして視認性を上げる */
}

/* 楽譜背景の白を際立たせる */
#sheet-music-wrapper {
    background: #ffffff !important;
    border: 2px solid var(--accent-color);
    padding: 10px;
    border-radius: 8px;
}

#sheet-music svg .abcjs-note {
    fill: #000000 !important; /* 音符の中身を強制的に黒く塗りつぶす */
}

/* --- 追加: 履歴表示エリア --- */
#chord-history {
    background: var(--panel-bg);
    padding: 15px;
    border-radius: 8px;
    font-family: monospace;
    color: #888;
    margin-bottom: 20px;
    font-size: 0.9rem;
    word-break: break-all;
}

.visualizer-wrapper {
    position: relative;
    height: 350px;
    background: var(--panel-bg);
    border-radius: 8px;
    padding: 20px 20px 40px 20px; /* 下にラベル用の余白を確保 */
}

.grid-lines {
    position: absolute;
    top: 20px; bottom: 60px; left: 20px; right: 20px;
}

.line {
    position: absolute;
    width: 100%;
    border-top: 1px solid #333;
    font-size: 0.7rem;
    color: #666;
}

.line[style*="50%"] { /* 閾値の線を50%に修正 */
    border-top-color: var(--threshold-color); 
    color: var(--threshold-color); 
}

.chroma-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 10px;
    height: 100%; /* 親の350px一杯に広げる */
    align-items: flex-end; /* 中身を下に寄せる */
    z-index: 2;
    position: relative;
}

.chroma-bar-container {
    height: 100%; /* これがないと上に張り付きます */
    display: flex;
    flex-direction: column; 
    justify-content: flex-end; /* 下から順に積み上げる */
}

.bar {
    width: 100%;
    background: linear-gradient(to top, var(--accent-color), #bcff00);
    border-radius: 4px 4px 0 0;
    transition: height 0.1s ease-out;
}

.label {
    height: 30px;
    line-height: 30px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-color);
    margin-top: 5px;
}

/*[cite: 8] スマホ向けの詳細設定 */
@media (max-width: 600px) {
    h1 {
        font-size: 1.2rem; /* タイトルを小さく */
        margin: 5px 0;
    }

    #chordDisplay {
        padding: 15px; /* 内側の余白を削る */
        margin: 10px 0;
    }

    /*[cite: 8] 楽譜エリアの高さを抑える */
    #sheet-music-wrapper {
        margin: 5px 0;
        padding: 5px;
    }

    /*[cite: 8] 履歴エリアを一行に収める */
    #chord-history {
        padding: 8px;
        margin-bottom: 10px;
        font-size: 0.8rem;
    }

    /*[cite: 8] ビジュアライザーの高さをさらに抑える */
    .visualizer-wrapper {
        height: 200px; /* 250pxからさらに短縮 */
        padding: 10px;
    }

    /*[cite: 8] バーの隙間を最小にして見切れを防ぐ */
    .chroma-grid {
        gap: 2px; 
    }

    .label {
        font-size: 0.6rem; /* 音階ラベルを最小化 */
        margin-top: 4px;
    }
}