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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #2c2c2c 0%, #1a1a1a 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #333;
}

.container {
    background: #1a1a1a;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 1800px;
    width: 100%;
    padding: 30px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

header h1 {
    font-size: 2.5rem;
    color: #f5f5f5;
    font-weight: 700;
}

/* ヘッダーコントロール */
.header-controls {
    position: absolute;
    top: 5px;
    right: 0;
    display: flex;
    gap: 15px;
    align-items: center;
}

/* 右カラム */
.right-column {
    flex: 1;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

/* タイマーパネル */
.timer-panel {
    background: #222;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.timer-panel-header {
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #333;
}

.timer-panel-header h3 {
    font-size: 1.1rem;
    color: #f5f5f5;
    margin: 0;
}

.timer-display-large {
    font-size: 3rem;
    font-weight: 700;
    color: #f5f5f5;
    text-align: center;
    background: #2c2c2c;
    padding: 20px;
    border-radius: 12px;
    border: 2px solid #444;
    letter-spacing: 3px;
}

.timer-display-large.warning {
    color: #ff6b6b;
    border-color: #ff6b6b;
    animation: timerBlink 0.5s ease-in-out infinite;
}

.timer-settings {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* トグルスイッチ共通スタイル */
.theme-toggle-switch,
.lang-toggle-switch {
    position: relative;
    display: inline-block;
    width: 70px;
    height: 32px;
}

.theme-toggle-switch input,
.lang-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #555;
    transition: 0.3s;
    border-radius: 30px;
    border: 2px solid #777;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: #ddd;
    transition: 0.3s;
    border-radius: 50%;
}

.theme-toggle-switch input:checked + .toggle-slider,
.lang-toggle-switch input:checked + .toggle-slider {
    background-color: #e0e0e0;
    border-color: #ccc;
}

.theme-toggle-switch input:checked + .toggle-slider:before,
.lang-toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(38px);
    background-color: #666;
}

.theme-toggle-switch:hover .toggle-slider,
.lang-toggle-switch:hover .toggle-slider {
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

/* トグルアイコン */
.toggle-icon {
    position: absolute;
    top: 4px;
    height: 24px;
    width: 24px;
    font-size: 0.85rem;
    pointer-events: none;
    z-index: 1;
    line-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-icon.left {
    left: 4px;
}

.toggle-icon.right {
    right: 4px;
}

/* メインコンテンツレイアウト */
main {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* 左カラム: タイマーとプリセット */
.left-column {
    flex: 1;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.saved-presets-panel {
    background: #222;
    border-radius: 15px;
    padding: 20px;
    max-height: 50vh;
    overflow-y: auto;
    flex-shrink: 0;
}

.saved-presets-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #333;
}

.saved-presets-header h3 {
    font-size: 1.1rem;
    color: #f5f5f5;
    margin: 0;
}

.btn-save-preset {
    background: #2c2c2c;
    color: #4CAF50;
    border: 2px solid #4CAF50;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-save-preset:hover {
    background: #4CAF50;
    color: white;
}

.saved-presets-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preset-item {
    background: #2c2c2c;
    border: 2px solid #444;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preset-item:hover {
    background: #333;
    border-color: #666;
    transform: translateX(5px);
}

.preset-item.active {
    border-color: #4CAF50;
    background: #1a3a1a;
}

.preset-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.preset-name {
    font-weight: 600;
    color: #f5f5f5;
    font-size: 0.95rem;
}

.preset-delete-btn {
    background: transparent;
    border: none;
    color: #ff6b6b;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 5px;
    transition: all 0.2s ease;
}

.preset-delete-btn:hover {
    color: #ff4444;
    transform: scale(1.2);
}

.preset-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    color: #aaa;
}

.preset-info-row {
    display: flex;
    justify-content: space-between;
}

.preset-info-label {
    color: #888;
}

.preset-info-value {
    color: #ccc;
    font-weight: 500;
}

/* 音楽解析パネル */
.music-analysis-panel {
    background: #222;
    border-radius: 15px;
    padding: 20px;
}

.music-analysis-header {
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #333;
    margin-bottom: 15px;
}

.music-analysis-header h3 {
    font-size: 1.1rem;
    color: #f5f5f5;
    margin: 0;
}

.music-analysis-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.file-upload-area {
    background: #2c2c2c;
    border: 2px dashed #555;
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-upload-area:hover {
    border-color: #888;
    background: #333;
}

.file-upload-area.dragover {
    border-color: #4CAF50;
    background: #1a3a1a;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #aaa;
}

.upload-icon {
    font-size: 2.5rem;
}

.upload-hint {
    font-size: 0.75rem;
    color: #777;
}

.music-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.music-info-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-label {
    font-size: 0.8rem;
    color: #888;
}

.info-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: #f5f5f5;
    word-break: break-all;
}

/* BPM調整ボタン */
.bpm-adjust-controls {
    display: flex;
    gap: 8px;
    margin-top: 5px;
}

.btn-bpm-adjust {
    flex: 1;
    padding: 6px 12px;
    background: #2c2c2c;
    border: 2px solid #4a90e2;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #4a90e2;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-bpm-adjust:hover {
    background: #4a90e2;
    color: white;
    transform: translateY(-1px);
}

.btn-bpm-adjust:active {
    transform: translateY(0);
}

body.light-mode .btn-bpm-adjust {
    background: #ffffff;
    border-color: #4a90e2;
    color: #4a90e2;
}

body.light-mode .btn-bpm-adjust:hover {
    background: #4a90e2;
    color: white;
}

.music-controls {
    display: flex;
    gap: 8px;
    margin-top: 5px;
}

.btn-music-control {
    flex: 1;
    background: #2c2c2c;
    color: #4a90e2;
    border: 2px solid #4a90e2;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-music-control:hover {
    background: #4a90e2;
    color: white;
}

.btn-music-control.playing {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.btn-music-remove {
    flex: 1;
    background: #2c2c2c;
    color: #ff6b6b;
    border: 2px solid #ff6b6b;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-music-remove:hover {
    background: #3a1a1a;
    color: #ff8888;
}

.sync-controls {
    margin-top: 5px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 拍位置ずらしボタン */
.btn-shift-beat {
    width: 100%;
    padding: 10px 15px;
    background: #2c2c2c;
    border: 2px solid #ff9800;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #ff9800;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 5px;
}

.btn-shift-beat:hover {
    background: #ff9800;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
}

.btn-shift-beat:active {
    transform: translateY(0);
}

body.light-mode .btn-shift-beat {
    background: #ffffff;
    border-color: #f57c00;
    color: #f57c00;
}

body.light-mode .btn-shift-beat:hover {
    background: #f57c00;
    color: white;
}

/* 拍位置調整コントロール */
.beat-shift-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.btn-shift-beat-small {
    padding: 8px 16px;
    background: #2c2c2c;
    border: 2px solid #ff9800;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    color: #ff9800;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 50px;
}

.btn-shift-beat-small:hover {
    background: #ff9800;
    color: white;
    transform: scale(1.05);
}

.btn-shift-beat-small:active {
    transform: scale(0.95);
}

.beat-shift-display {
    flex: 1;
    text-align: center;
    font-size: 0.9rem;
    color: #ccc;
    background: #2c2c2c;
    padding: 8px 15px;
    border-radius: 6px;
    border: 2px solid #444;
}

#beatOffsetValue {
    font-weight: 700;
    color: #ff9800;
}

body.light-mode .btn-shift-beat-small {
    background: #ffffff;
    border-color: #f57c00;
    color: #f57c00;
}

body.light-mode .btn-shift-beat-small:hover {
    background: #f57c00;
    color: white;
}

body.light-mode .beat-shift-display {
    background: #f8f9fa;
    color: #666;
    border-color: #ccc;
}

body.light-mode #beatOffsetValue {
    color: #f57c00;
}

.analysis-progress {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    background: #2c2c2c;
    border-radius: 8px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #444;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a90e2 0%, #5ba3f5 100%);
    width: 0%;
    transition: width 0.3s ease;
    animation: progressAnimation 1.5s ease-in-out infinite;
}

@keyframes progressAnimation {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.progress-text {
    text-align: center;
    font-size: 0.85rem;
    color: #aaa;
}

.main-content {
    flex: 1;
    min-width: 0;
}

/* ビジュアル表示エリア */
.visual-display {
    position: relative;
    height: 300px;
    background: linear-gradient(to bottom, #2c2c2c, #222);
    border-radius: 15px;
    margin-bottom: 30px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 振り子アニメーション */
.animation-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 20px;
}

.pendulum {
    width: 4px;
    height: 200px;
    background: linear-gradient(to top, #ddd 0%, #ddd 80%, transparent 80%);
    transform-origin: bottom center;
    position: relative;
    transform: rotate(-30deg); /* 初期位置を左側に */
}

.pendulum::after {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    background: #bbb;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.pendulum.accent::after {
    background: #ff6b6b;
    animation: accentPulse 0.3s ease-out;
}

@keyframes accentPulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.3); }
}

/* BPM表示 */
.bpm-display {
    font-size: 4rem;
    font-weight: 700;
    color: #f5f5f5;
    z-index: 10;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.bpm-display.flash {
    animation: flashBPM 0.15s ease-out;
}

@keyframes flashBPM {
    0%, 100% { transform: scale(1); color: #f5f5f5; }
    50% { transform: scale(1.1); color: #ff6b6b; }
}

/* 拍インジケーター */
.beat-indicator {
    position: absolute;
    bottom: 20px;
    font-size: 1.5rem;
    font-weight: 600;
    color: #f5f5f5;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 20px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* コントロールパネル */
.controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-weight: 600;
    color: #ccc;
    font-size: 0.95rem;
}

/* セクション区切り */
.control-group.section-divider {
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 2px solid #333;
}

/* 拍子とリズムパターンの横並び */
.beat-rhythm-row {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
}

.beat-section,
.rhythm-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (max-width: 600px) {
    .beat-rhythm-row {
        flex-direction: column;
        gap: 15px;
    }
}

/* 再生コントロール */
.play-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, #333 0%, #555 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 160px;
    min-height: 52px;
}

#playIcon {
    display: inline-block;
    width: 18px;
    text-align: center;
    font-size: 1rem;
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    background: linear-gradient(135deg, #444 0%, #666 100%);
}

.btn-primary:active {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.btn-primary.playing {
    background: linear-gradient(135deg, #1a1a1a 0%, #2c2c2c 100%);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.btn-secondary {
    background: #2c2c2c;
    color: #f5f5f5;
    border: 2px solid #555;
    padding: 15px 30px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #555;
    color: white;
    transform: translateY(-2px);
}

/* テンポ入力 */
.tempo-input {
    width: 80px;
    padding: 5px 10px;
    font-size: 1.1rem;
    font-weight: 600;
    border: 2px solid #444;
    border-radius: 8px;
    text-align: center;
    margin-left: 10px;
    background: #2c2c2c;
    color: #f5f5f5;
}

/* スライダー */
.slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #444;
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #bbb;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #ddd;
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #bbb;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    background: #ddd;
}

/* セレクト入力 */
.select-input {
    padding: 10px 15px;
    font-size: 1rem;
    border: 2px solid #444;
    border-radius: 8px;
    background: #2c2c2c;
    color: #f5f5f5;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.select-input:focus {
    outline: none;
    border-color: #666;
}

/* プリセットボタン */
.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-preset {
    flex: 1;
    min-width: 120px;
    padding: 10px 15px;
    background: #2c2c2c;
    border: 2px solid #444;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #ccc;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-preset:hover {
    background: #444;
    color: white;
    border-color: #666;
    transform: translateY(-2px);
}

/* リセットボタン */
.btn-reset {
    width: 100%;
    padding: 12px 20px;
    background: #2c2c2c;
    border: 2px solid #555;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: #ff6b6b;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-reset:hover {
    background: #3a1a1a;
    color: #ff8888;
    border-color: #ff6b6b;
    transform: translateY(-2px);
}

/* チェックボックス */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    cursor: pointer;
    color: #ccc;
    font-size: 0.95rem;
}

.checkbox-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #666;
}

/* 音量表示 */
#volumeValue,
#subdivisionVolumeValue {
    font-weight: 600;
    color: #ccc;
    margin-left: 10px;
}

/* 細分化拍音量コントロール */
.subdivision-volume-control {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.subdivision-volume-control label {
    font-size: 0.9rem;
    color: #aaa;
}

/* フッター */
footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #333;
}

.shortcuts {
    text-align: center;
}

.shortcuts h3 {
    font-size: 1.1rem;
    color: #ccc;
    margin-bottom: 10px;
}

.shortcuts ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.shortcuts li {
    font-size: 0.9rem;
    color: #999;
}

kbd {
    background: #2c2c2c;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 2px 8px;
    font-family: monospace;
    font-weight: 600;
    color: #ccc;
    box-shadow: 0 2px 0 #333;
}

/* レスポンシブ対応 */
@media (max-width: 1024px) {
    main {
        flex-direction: column;
    }

    .left-column {
        width: 100%;
        order: 1;
    }

    .saved-presets-panel {
        max-height: 300px;
    }

    .right-column {
        width: 100%;
        order: 2;
    }

    .main-content {
        width: 100%;
        order: 3;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    header {
        margin-bottom: 20px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .header-controls {
        position: static;
        justify-content: center;
        margin-top: 15px;
        flex-wrap: wrap;
    }

    .timer-display-header {
        font-size: 1.2rem;
        padding: 6px 12px;
        min-width: 80px;
    }

    .bpm-display {
        font-size: 3rem;
    }

    .visual-display {
        height: 250px;
    }

    .play-controls {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }

    .preset-buttons {
        flex-direction: column;
    }

    .btn-preset {
        width: 100%;
    }

    .shortcuts ul {
        flex-direction: column;
        gap: 10px;
    }

    .saved-presets-panel {
        max-height: 250px;
    }

    .timer-display-large {
        font-size: 2rem;
        padding: 15px;
    }
}

/* パルスアニメーション用 */
.visual-display.pulse-mode .bpm-display {
    transition: transform 0.1s ease-out;
}

.visual-display.pulse-mode .bpm-display.pulse {
    animation: pulseAnimation 0.2s ease-out;
}

@keyframes pulseAnimation {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* 点滅モード */
.visual-display.flash-mode {
    transition: background-color 0.1s ease;
}

.visual-display.flash-mode.flash-active {
    background: linear-gradient(to bottom, #444, #222);
}

.visual-display.flash-mode.flash-active .bpm-display {
    color: white;
}

/* ライトモード */
body.light-mode {
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
}

body.light-mode .container {
    background: #ffffff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}

body.light-mode header h1 {
    color: #333;
}

body.light-mode .visual-display {
    background: linear-gradient(to bottom, #f8f8f8, #e8e8e8);
}

body.light-mode .beat-indicator {
    background: rgba(255, 255, 255, 0.8);
    color: #333;
}

body.light-mode .bpm-display {
    color: #333;
}

body.light-mode .bpm-display.flash {
    animation: flashBPMLightMode 0.15s ease-out;
}

@keyframes flashBPMLightMode {
    0%, 100% { transform: scale(1); color: #333; }
    50% { transform: scale(1.1); color: #ff6b6b; }
}

body.light-mode .control-group label {
    color: #555;
}

body.light-mode .btn-primary {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

body.light-mode .btn-primary:hover {
    background: linear-gradient(135deg, #5ba3f5 0%, #4a90e2 100%);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

body.light-mode .btn-primary.playing {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

body.light-mode .btn-secondary {
    background: #f8f9fa;
    color: #333;
    border-color: #ccc;
}

body.light-mode .btn-secondary:hover {
    background: #e0e0e0;
    color: #333;
    border-color: #999;
}

body.light-mode .tempo-input {
    background: #f8f9fa;
    color: #333;
    border-color: #ccc;
}

body.light-mode .slider {
    background: #ddd;
}

body.light-mode .slider::-webkit-slider-thumb {
    background: #666;
}

body.light-mode .slider::-webkit-slider-thumb:hover {
    background: #444;
}

body.light-mode .slider::-moz-range-thumb {
    background: #666;
}

body.light-mode .slider::-moz-range-thumb:hover {
    background: #444;
}

body.light-mode .select-input {
    background: #f8f9fa;
    color: #333;
    border-color: #ccc;
}

body.light-mode .select-input:focus {
    border-color: #999;
}

body.light-mode .btn-preset {
    background: #f8f9fa;
    border-color: #ccc;
    color: #555;
}

body.light-mode .btn-preset:hover {
    background: #e0e0e0;
    color: #333;
    border-color: #999;
}

body.light-mode .btn-reset {
    background: #f8f9fa;
    border-color: #ffcccc;
    color: #d63031;
}

body.light-mode .btn-reset:hover {
    background: #ffe5e5;
    color: #c0392b;
    border-color: #ff6b6b;
}

body.light-mode .pendulum {
    background: linear-gradient(to top, #666 0%, #666 80%, transparent 80%);
}

body.light-mode .pendulum::after {
    background: #888;
}

body.light-mode .pendulum.accent::after {
    background: #ff6b6b;
    animation: accentPulse 0.3s ease-out;
}

body.light-mode .theme-toggle-switch:hover .toggle-slider,
body.light-mode .lang-toggle-switch:hover .toggle-slider {
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
}

body.light-mode header h1 {
    color: #333;
}

body.light-mode #volumeValue,
body.light-mode #subdivisionVolumeValue {
    color: #555;
}

body.light-mode .subdivision-volume-control label {
    color: #666;
}

body.light-mode .checkbox-label {
    color: #555;
}

body.light-mode .checkbox-input {
    accent-color: #333;
}

body.light-mode footer {
    border-top-color: #ddd;
}

body.light-mode .shortcuts h3 {
    color: #555;
}

body.light-mode .shortcuts li {
    color: #777;
}

body.light-mode kbd {
    background: #f8f9fa;
    border-color: #ccc;
    color: #555;
    box-shadow: 0 2px 0 #ddd;
}

body.light-mode .visual-display.flash-mode.flash-active {
    background: linear-gradient(to bottom, #ddd, #ccc);
}

body.light-mode .visual-display.flash-mode.flash-active .bpm-display {
    color: #333;
}

/* タイマー共通 */
.timer-inputs {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: center;
}

.timer-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timer-input {
    width: 70px;
    padding: 8px 12px;
    font-size: 1rem;
    font-weight: 600;
    border: 2px solid #444;
    border-radius: 8px;
    text-align: center;
    background: #2c2c2c;
    color: #f5f5f5;
}

.timer-input-group span {
    color: #ccc;
    font-size: 0.9rem;
    font-weight: 500;
}

@keyframes timerBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ライトモード - タイマー */
body.light-mode .timer-input {
    background: #f8f9fa;
    color: #333;
    border-color: #ccc;
}

body.light-mode .timer-input-group span {
    color: #555;
}

body.light-mode .timer-panel {
    background: #f8f8f8;
}

body.light-mode .timer-panel-header {
    border-bottom-color: #ddd;
}

body.light-mode .timer-panel-header h3 {
    color: #333;
}

body.light-mode .timer-display-large {
    background: #ffffff;
    color: #333;
    border-color: #ccc;
}

body.light-mode .timer-display-large.warning {
    color: #d63031;
    border-color: #ff6b6b;
}

/* ライトモード - プリセットパネル */
body.light-mode .saved-presets-panel {
    background: #f8f8f8;
}

body.light-mode .saved-presets-header {
    border-bottom-color: #ddd;
}

body.light-mode .saved-presets-header h3 {
    color: #333;
}

body.light-mode .btn-save-preset {
    background: #ffffff;
    color: #4CAF50;
    border-color: #4CAF50;
}

body.light-mode .btn-save-preset:hover {
    background: #4CAF50;
    color: white;
}

body.light-mode .preset-item {
    background: #ffffff;
    border-color: #ccc;
}

body.light-mode .preset-item:hover {
    background: #f0f0f0;
    border-color: #999;
}

body.light-mode .preset-item.active {
    border-color: #4CAF50;
    background: #e8f5e9;
}

body.light-mode .preset-name {
    color: #333;
}

body.light-mode .preset-info-label {
    color: #666;
}

body.light-mode .preset-info-value {
    color: #333;
}

body.light-mode .control-group.section-divider {
    border-bottom-color: #ddd;
}

body.light-mode .beat-section label,
body.light-mode .rhythm-section label {
    color: #555;
}

/* ライトモード - 音楽解析パネル */
body.light-mode .music-analysis-panel {
    background: #f8f8f8;
}

body.light-mode .music-analysis-header {
    border-bottom-color: #ddd;
}

body.light-mode .music-analysis-header h3 {
    color: #333;
}

body.light-mode .file-upload-area {
    background: #ffffff;
    border-color: #ccc;
}

body.light-mode .file-upload-area:hover {
    border-color: #999;
    background: #f8f9fa;
}

body.light-mode .file-upload-area.dragover {
    border-color: #4CAF50;
    background: #e8f5e9;
}

body.light-mode .upload-placeholder {
    color: #777;
}

body.light-mode .upload-hint {
    color: #999;
}

body.light-mode .info-label {
    color: #666;
}

body.light-mode .info-value {
    color: #333;
}

body.light-mode .btn-music-control {
    background: #ffffff;
    color: #4a90e2;
    border-color: #4a90e2;
}

body.light-mode .btn-music-control:hover {
    background: #4a90e2;
    color: white;
}

body.light-mode .btn-music-control.playing {
    background: #e74c3c;
    border-color: #e74c3c;
}

body.light-mode .btn-music-remove {
    background: #ffffff;
    color: #d63031;
    border-color: #ff6b6b;
}

body.light-mode .btn-music-remove:hover {
    background: #ffe5e5;
    color: #c0392b;
}

body.light-mode .analysis-progress {
    background: #ffffff;
}

body.light-mode .progress-bar {
    background: #e0e0e0;
}

body.light-mode .progress-text {
    color: #666;
}

/* 波形表示 */
.waveform-container {
    width: 100%;
    height: 120px;
    background: #2c2c2c;
    border-radius: 8px;
    overflow: hidden;
    margin: 10px 0;
    position: relative;
    cursor: pointer;
}

.waveform-container canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.waveform-playhead {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: #ff6b6b;
    pointer-events: none;
    z-index: 10;
    display: none;
}

.waveform-playhead.playing {
    display: block;
}

.waveform-selection {
    position: absolute;
    top: 0;
    height: 100%;
    background: rgba(255, 152, 0, 0.3);
    border-left: 2px solid #ff9800;
    border-right: 2px solid #ff9800;
    pointer-events: none;
    z-index: 5;
    display: none;
}

.waveform-selection.active {
    display: block;
}

body.light-mode .waveform-container {
    background: #ffffff;
    border: 1px solid #ddd;
}

body.light-mode .waveform-selection {
    background: rgba(255, 152, 0, 0.25);
    border-left-color: #f57c00;
    border-right-color: #f57c00;
}

/* 曲の音量コントロール */
.music-volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.music-volume-control label {
    font-size: 0.9rem;
    color: #ccc;
    white-space: nowrap;
}

#musicVolumeValue {
    font-weight: 600;
    color: #ccc;
    min-width: 40px;
}

body.light-mode .music-volume-control label {
    color: #666;
}

body.light-mode #musicVolumeValue {
    color: #555;
}

/* 再生速度コントロール */
.music-playback-rate-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0;
}

.music-playback-rate-control label {
    font-size: 0.9rem;
    color: #ccc;
    display: flex;
    align-items: center;
    gap: 10px;
}

.playback-rate-input {
    width: 70px;
    padding: 5px 10px;
    font-size: 0.95rem;
    font-weight: 600;
    border: 2px solid #444;
    border-radius: 8px;
    text-align: center;
    background: #2c2c2c;
    color: #f5f5f5;
}

body.light-mode .music-playback-rate-control label {
    color: #666;
}

body.light-mode .playback-rate-input {
    background: #f8f9fa;
    color: #333;
    border-color: #ccc;
}

/* コード進行表示（横スクロール） */
.chord-progression-display {
    display: none; /* 初期状態は非表示 */
    background: #2c2c2c;
    border-radius: 12px;
    padding: 20px;
    margin: 15px 0;
    overflow: hidden; /* スクロールバー非表示 */
    position: relative;
}

.chord-progression-display.active {
    display: block;
}

.chord-bars-container {
    display: flex;
    gap: 0;
    transition: transform 0.5s ease;
}

.chord-bar {
    flex-shrink: 0;
    width: 120px;
    background: #333;
    padding: 20px 15px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: #f5f5f5;
    transition: all 0.3s ease;
    border-right: 2px solid #222;
}

.chord-bar:last-child {
    border-right: none;
}

.chord-bar.active {
    background: #4CAF50;
    color: white;
    transform: scaleY(1.1);
}

.chord-bar-number {
    display: none; /* Bar番号を非表示 */
}

.chord-beats {
    /* シンプル表示 */
}

.chord-beat {
    /* コードテキストのみ表示 */
}

body.light-mode .chord-progression-display {
    background: #f8f8f8;
}

body.light-mode .chord-bar {
    background: #e0e0e0;
    color: #333;
    border-right-color: #ccc;
}

body.light-mode .chord-bar.active {
    background: #4CAF50;
    color: white;
}

