/* ギターコード練習アプリ - アコースティックテーマ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
    background: #f5f5f5;
}

/* 2カラムレイアウト */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* 左サイドバー - 黒板イメージ */
.sidebar {
    width: 280px;
    min-width: 280px;
    background: linear-gradient(180deg, #2d5016 0%, #1e3a0f 100%);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    border-right: 8px solid #8B5A2B;
    overflow-y: auto;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.3), 4px 0 15px rgba(0, 0, 0, 0.2);
    position: relative;
}

/* 黒板の木枠効果 */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(90deg, #8B5A2B, #A0522D, #8B5A2B);
}

.sidebar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(90deg, #8B5A2B, #A0522D, #8B5A2B);
}

.sidebar-header {
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px dashed rgba(255, 255, 255, 0.3);
}

.sidebar-header h1 {
    color: #ffffff;
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: 3px;
    font-family: 'Hiragino Mincho ProN', 'Yu Mincho', serif;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.sidebar-header h1 .subtitle {
    font-size: 1.5rem;
    font-weight: 400;
    letter-spacing: 2px;
}

/* コードセクション */
.chord-nav {
    flex: 1;
}

.chord-section {
    margin-bottom: 12px;
}

.chord-section h3 {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
    margin-bottom: 8px;
    padding-left: 0;
    border-left: none;
    letter-spacing: 1px;
    font-weight: 400;
    font-family: 'Hiragino Mincho ProN', 'Yu Mincho', serif;
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

/* コードボタン - チョーク風デザイン（3ゾーン分割） */
.chord-btn {
    position: relative;
    padding: 10px 10px;
    font-size: 1.2rem;
    font-weight: 600;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ffffff;
    background: transparent;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chord-btn .chord-label {
    pointer-events: none;
}

.chord-btn .btn-zone {
    position: absolute;
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
}

.chord-btn:hover .btn-zone {
    opacity: 1;
}

.chord-btn .zone-right-top {
    right: 2px;
    top: 2px;
    width: 18px;
    height: 18px;
    background: rgba(144, 192, 144, 0.8);
    border-radius: 0 6px 0 6px;
    font-size: 0.5rem;
}

.chord-btn .zone-right-bottom {
    right: 2px;
    bottom: 2px;
    width: 18px;
    height: 18px;
    background: rgba(200, 180, 140, 0.9);
    border-radius: 6px 0 6px 0;
    color: #5D4037;
    font-size: 0.75rem;
}

.chord-btn.major {
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.5);
}

.chord-btn.minor {
    color: rgba(255, 220, 200, 0.9);
    border-color: rgba(255, 220, 200, 0.5);
}

.chord-btn.seventh {
    color: rgba(200, 220, 255, 0.9);
    border-color: rgba(200, 220, 255, 0.5);
}

.chord-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.7);
}

.chord-btn:active {
    transform: scale(0.98);
}

.chord-btn.active {
    background: rgba(255, 255, 255, 0.15) !important;
    color: rgba(255, 255, 200, 1) !important;
    border-color: rgba(255, 255, 200, 0.8) !important;
    border-width: 2px;
}

/* 指番号凡例 */
.finger-legend {
    margin-top: auto;
    padding-top: 12px;
    border-top: 2px dashed rgba(255, 255, 255, 0.3);
}

.finger-legend h4 {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-align: center;
    letter-spacing: 2px;
    font-family: 'Hiragino Sans', 'Noto Sans JP', sans-serif;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.legend-item {
    font-size: 0.85rem;
    padding: 5px 10px;
    border-radius: 5px;
    color: #3a3a3a;
    font-weight: 700;
    font-family: 'Hiragino Sans', 'Noto Sans JP', sans-serif;
}

.finger-1 { background: #E8A0A0; }
.finger-2 { background: #90C090; }
.finger-3 { background: #A0B8E0; }
.finger-4 { background: #C8A8D8; }

/* メイン表示エリア - 音楽室の壁 */
.main-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: linear-gradient(180deg, #F5DEB3 0%, #DEB887 50%, #D2B48C 100%);
    padding: 20px 30px;
    overflow: hidden;
    position: relative;
}

/* 木目のテクスチャ効果 */
.main-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 100px,
        rgba(139, 69, 19, 0.03) 100px,
        rgba(139, 69, 19, 0.03) 102px
    );
    pointer-events: none;
}

/* コード名 */
.chord-name-container {
    margin-bottom: 10px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    position: relative;
    z-index: 1;
}

#chord-name {
    font-size: 5rem;
    font-weight: 700;
    color: #5D4037;
    text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.5), -1px -1px 0 rgba(0, 0, 0, 0.1);
    letter-spacing: 5px;
    font-family: 'Georgia', 'Hiragino Mincho ProN', serif;
}

/* アルペジオコントロール */
.arpeggio-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding: 15px 20px;
    background: transparent;
    position: relative;
    z-index: 1;
}

.arpeggio-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #8B7355;
    font-family: 'Hiragino Mincho ProN', 'Yu Mincho', serif;
}

.arpeggio-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-width: 650px;
}

/* アルペジオボタン - シンプルなアウトラインスタイル */
.arpeggio-btn {
    padding: 12px 20px;
    border: 1.5px solid #C4A882;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.5);
    color: #5D4E42;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Hiragino Sans', 'Noto Sans JP', sans-serif;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
}

.arpeggio-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: #A08060;
    color: #4A3C30;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.12);
}

.arpeggio-btn:active {
    transform: scale(0.98);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.arpeggio-btn.playing {
    background: rgba(144, 192, 144, 0.7);
    border-color: #7CB07C;
    color: #2D4D2D;
    font-weight: 700;
}

.arpeggio-btn.selected {
    background: rgba(210, 180, 140, 0.7);
    border-color: #A08060;
    color: #5D4037;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* コードダイアグラム */
.chord-diagram-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    max-width: 1400px;
}

.chord-diagram {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chord-diagram svg {
    max-width: 100%;
    max-height: 100%;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.15));
}

/* 弦ラベル */
.string-labels {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 80px;
    color: #8B4513;
    font-size: 0.9rem;
}

.string-labels span {
    text-align: center;
    min-width: 60px;
}

/* レスポンシブ対応 */
@media (max-width: 1024px) {
    .sidebar {
        width: 260px;
        min-width: 260px;
        padding: 20px;
    }

    #chord-name {
        font-size: 4rem;
    }

    .string-labels {
        gap: 50px;
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-width: 100%;
        max-height: 200px;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        border-right: none;
        border-bottom: 4px solid #5D3A1A;
    }

    .sidebar-header {
        display: none;
    }

    .chord-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 15px;
        justify-content: center;
    }

    .chord-section {
        margin-bottom: 0;
    }

    .chord-section h3 {
        display: none;
    }

    .button-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .chord-btn {
        padding: 10px 15px;
        font-size: 1rem;
    }

    .finger-legend {
        display: none;
    }

    .main-display {
        padding: 20px;
    }

    #chord-name {
        font-size: 3rem;
    }

    .chord-name-container {
        top: 10px;
    }

    .string-labels {
        gap: 30px;
        font-size: 0.7rem;
    }

    .sidebar-right {
        display: none;
    }
}

/* 右サイドバー - コード進行 */
.sidebar-right {
    width: 220px;
    min-width: 220px;
    background: linear-gradient(180deg, #F5F0E8 0%, #E8E0D5 100%);
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    border-left: 3px solid #C4A882;
    overflow-y: auto;
}

.progression-header {
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #D4C4B0;
    text-align: center;
}

.progression-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #5D4037;
    font-family: 'Hiragino Sans', 'Noto Sans JP', sans-serif;
    margin: 0;
    letter-spacing: 2px;
}

.add-chord-btn {
    padding: 6px 12px;
    border: 1.5px solid #8B7355;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.6);
    color: #5D4037;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.add-chord-btn:hover {
    background: rgba(144, 192, 144, 0.4);
    border-color: #6B8E5A;
}

.progression-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    margin-bottom: 15px;
    min-height: 100px;
}

.progression-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid #D4C4B0;
    border-radius: 6px;
    cursor: pointer;
}

.progression-item:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: #B4A490;
}

.progression-item.playing {
    background: rgba(144, 192, 144, 0.5);
    border-color: #7CB07C;
}

.progression-item .chord-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: #5D4037;
}

/* 速度コントロール */
.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 5px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
}

.speed-control label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #5D4037;
    white-space: nowrap;
}

.speed-control input[type="range"] {
    flex: 1;
    min-width: 60px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #D4C4B0;
    border-radius: 3px;
    cursor: pointer;
}

.speed-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #8B7355;
    border-radius: 50%;
    cursor: pointer;
}

.speed-control #speed-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #5D4037;
    min-width: 45px;
    text-align: right;
    flex-shrink: 0;
}

.progression-item .remove-btn {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(200, 100, 100, 0.2);
    color: #A05050;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    transition: all 0.2s ease;
}

.progression-item .remove-btn:hover {
    background: rgba(200, 100, 100, 0.4);
    color: #803030;
}

.progression-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #D4C4B0;
}

.play-progression-btn,
.stop-progression-btn,
.clear-progression-btn {
    flex: 1;
    min-width: 60px;
    padding: 10px 8px;
    border: 1.5px solid #C4A882;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.6);
    color: #5D4037;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: 'Hiragino Sans', 'Noto Sans JP', sans-serif;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.play-progression-btn:hover {
    background: rgba(144, 192, 144, 0.5);
    border-color: #7CB07C;
}

.play-progression-btn.playing {
    background: rgba(144, 192, 144, 0.7);
    border-color: #5A9A5A;
}

.stop-progression-btn:hover {
    background: rgba(200, 150, 100, 0.4);
    border-color: #A08060;
}

.clear-progression-btn:hover {
    background: rgba(200, 100, 100, 0.3);
    border-color: #C08080;
}
