/* ==========================================
   超ギタートレーニング（超ギタトレ） - メインCSS
   ========================================== */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f1f5f9;
    margin: 0;
    padding: 10px 10px 24px 10px;
    color: #1e293b;
    line-height: 1.6;
}

.card {
    background: #ffffff;
    max-width: 860px;
    margin: 0 auto 14px auto;
    padding: 20px 22px;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* ==========================================
   ★ 広告スペース スタイル ★
   ========================================== */
.ad-container {
    max-width: 860px;
    margin: 0 auto 14px auto;
    text-align: center;
}
.ad-placeholder {
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    color: #64748b;
    font-size: 12px;
    padding: 12px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s ease;
}
.ad-placeholder:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}
.ad-badge {
    font-size: 10px;
    background: #f1f5f9;
    color: #94a3b8;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}
.ad-text {
    font-weight: 600;
    color: #94a3b8;
}
.top-ad { margin: 0 auto 12px auto; }
.top-ad .ad-placeholder { min-height: 52px; }
.bottom-ad .ad-placeholder { min-height: 90px; }

.modal-inline-ad {
    width: 100%;
    max-width: 450px;
    background: #ffffff;
    border: 1px dashed #86efac;
    padding: 8px 12px;
    border-radius: 8px;
    text-align: center;
    box-sizing: border-box;
}
.modal-ad-text { margin: 4px 0 0 0; font-size: 11px; color: #475569; }

/* ==========================================
   ★ 統合ヘッダー・ダッシュボード ★
   ========================================== */
.hero-dashboard-card {
    padding: 18px 20px 14px 20px;
    margin-bottom: 14px;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.dashboard-header-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.dashboard-title-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.app-title {
    font-size: 24px;
    margin: 0;
    color: #0f172a;
    font-weight: 900;
    letter-spacing: -0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.app-brand-badge {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 11px;
    border-radius: 20px;
    letter-spacing: 0.8px;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: inline-block;
    transform: translateY(-1px);
    transition: transform 0.2s ease;
}
.app-brand-badge:hover { transform: translateY(-2px) scale(1.05); }

.dashboard-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    width: 100%;
    flex-wrap: wrap;
}

.dashboard-details {
    flex: 1;
    min-width: 160px;
    max-width: 320px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    transition: all 0.2s ease;
    padding: 0;
    overflow: hidden;
}
.dashboard-details[open] {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
    max-width: 100%;
    flex: 1 1 100%;
}

.dashboard-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    user-select: none;
}
.dashboard-summary::-webkit-details-marker { display: none; }
.dashboard-summary:hover { color: #2563eb; }
.dash-arrow { font-size: 10px; color: #94a3b8; transition: transform 0.2s ease; }
.dashboard-details[open] .dash-arrow { transform: rotate(180deg); }

.dashboard-panel {
    padding: 12px 14px;
    border-top: 1px solid #e2e8f0;
    text-align: left;
    font-size: 12px;
}

.about-panel { color: #475569; line-height: 1.6; }
.about-panel p { margin: 0 0 6px 0; }
.about-points { margin: 0; padding-left: 18px; font-size: 11px; color: #64748b; }
.about-points li { margin-bottom: 4px; }

.tuner-panel { text-align: center; }
.tuner-note-desc { font-size: 12px; color: #64748b; margin: 0 0 10px 0; }

.tuner-buttons-container { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.sub-btn {
    background: #ffffff; border: 1px solid #cbd5e1; color: #475569; padding: 6px 12px;
    border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 600; transition: 0.15s;
}
.sub-btn:hover { background: #f1f5f9; color: #1e293b; }
.tuner-string-btn.active { background: #10b981 !important; color: white !important; border-color: #059669 !important; }

.tuner-hud-compact {
    background: #0f172a; color: white; border-radius: 10px; padding: 12px 16px;
    border: 1px solid #10b981; max-width: 380px; margin: 0 auto;
}
.tuner-target-label { font-size: 12px; color: #94a3b8; font-weight: bold; }
.tuner-status-text { font-size: 16px; font-weight: bold; color: #fbbf24; margin: 6px 0; }
.tuner-meter-track { background: #334155; height: 14px; border-radius: 7px; position: relative; overflow: hidden; max-width: 280px; margin: 8px auto; }
.tuner-meter-pointer { background: #10b981; width: 6px; height: 100%; position: absolute; left: 50%; transform: translateX(-50%); transition: left 0.1s ease; }
.tuner-center-mark { border-left: 2px dashed #ffffff; height: 100%; position: absolute; left: 50%; transform: translateX(-50%); opacity: 0.5; }
.tuner-hz-display { font-size: 12px; color: #94a3b8; }

/* ==========================================
   ステージ一覧カード
   ========================================== */
.stages-container-card { padding: 22px 24px; }
.stages-header { text-align: center; margin-bottom: 18px; border-bottom: 1px solid #e2e8f0; padding-bottom: 14px; }
.stages-header-title-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.stages-title { margin: 0; font-size: 20px; color: #0f172a; font-weight: 800; }
.stages-count-badge { background: #e0f2fe; color: #0284c7; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.stages-desc { margin: 6px auto 0 auto; max-width: 600px; font-size: 13px; color: #64748b; }

.exercise-grid { display: flex; flex-direction: column; gap: 12px; }
.exercise-card {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 16px 18px; border-radius: 12px; border: 2px solid #e2e8f0; background: #ffffff;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.exercise-card-available { cursor: pointer; border-color: #cbd5e1; }
.exercise-card-available:hover { border-color: #3b82f6; background: #f8faff; transform: translateY(-2px); box-shadow: 0 6px 18px rgba(59, 130, 246, 0.12); }
.exercise-card-available:active { transform: translateY(0); }
.exercise-card-locked { opacity: 0.65; background: #f8fafc; border-style: dashed; cursor: not-allowed; }

.ex-card-content { flex: 1; }
.ex-badge-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.ex-badge { background: #3b82f6; color: white; font-size: 11px; font-weight: bold; padding: 2px 7px; border-radius: 5px; }
.badge-muted { background: #94a3b8; }
.bars-badge { background: #8b5cf6; color: white; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px; }
.bpm-badge { background: #f59e0b; color: white; font-size: 11px; font-weight: bold; padding: 2px 7px; border-radius: 5px; }
.badge-tag { background: #f1f5f9; color: #475569; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 5px; border: 1px solid #e2e8f0; }
.badge-tag-muted { background: #f1f5f9; color: #94a3b8; }
.badge-coming { background: #fef3c7; color: #d97706; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px; }

.ex-title { margin: 0 0 4px 0; font-size: 16px; color: #0f172a; font-weight: 700; }
.ex-desc { margin: 0; font-size: 12px; color: #64748b; line-height: 1.4; }
.ex-card-action { flex-shrink: 0; }
.ex-start-btn {
    background: #2563eb; color: white; border: none; padding: 10px 18px; border-radius: 8px;
    font-size: 13px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
    transition: 0.15s ease; white-space: nowrap;
}
.exercise-card-available:hover .ex-start-btn { background: #1d4ed8; transform: scale(1.04); }
.locked-label { font-size: 12px; font-weight: 700; color: #94a3b8; background: #e2e8f0; padding: 6px 14px; border-radius: 6px; }

/* ==========================================
   ★ 練習ポップアップモーダル ★
   ========================================== */
.practice-modal { padding: 10px; }
.practice-modal-content {
    max-width: 840px;
    width: 95%;
    max-height: 92vh;
    padding: 16px 20px;
    border-radius: 16px;
    overflow-y: auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    position: relative;
}

.practice-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}
.modal-header-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.practice-modal-title { margin: 0; font-size: 16px; color: #0f172a; font-weight: 800; }
.app-badge {
    background: #3b82f6; color: white; font-size: 12px; font-weight: 800;
    padding: 3px 9px; border-radius: 6px; letter-spacing: 0.5px;
}

/* ★ ビジュアルメトロノームバー（中央揃え & 右端固定） */
.visual-metronome-compact {
    position: relative;
    background: #0f172a;
    border: 2px solid #334155;
    border-radius: 10px;
    padding: 6px 14px;
    color: white;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.visual-metronome-compact.beat-flash { border-color: #ef4444; box-shadow: 0 0 16px rgba(56, 189, 248, 0.35); }
.visual-metronome-compact.accent-flash { border-color: #ef4444; box-shadow: 0 0 20px rgba(239, 68, 68, 0.5); }
.visual-metronome-compact.recording { border-color: #ef4444; }

/* 中央メトロノームグループ */
.metro-center-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.metro-phase-badge {
    font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 6px;
    letter-spacing: 0.5px; text-transform: uppercase; white-space: nowrap;
    min-width: 65px; text-align: center; background: #334155; color: #cbd5e1;
}
.metro-phase-badge.count-in { background: #0284c7; color: white; }
.metro-phase-badge.rec { background: #ef4444; color: white; animation: recBlink 1s infinite alternate; }
@keyframes recBlink { 0% { opacity: 1; box-shadow: 0 0 8px #ef4444; } 100% { opacity: 0.5; box-shadow: none; } }
.metro-phase-badge.finished { background: #10b981; color: white; }

.metro-count-chip {
    min-width: 30px; height: 30px; border-radius: 8px; background: #1e293b; border: 1px solid #475569;
    display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 900;
    color: #38bdf8; transition: transform 0.05s ease;
}
.metro-count-chip.accent { color: #f87171; border-color: #ef4444; }
.metro-count-chip.finished { color: #10b981; border-color: #10b981; }
.metro-count-chip.pulse { animation: metroChipPulse 0.25s ease-out; }
@keyframes metroChipPulse { 0% { transform: scale(0.8); } 50% { transform: scale(1.15); } 100% { transform: scale(1.0); } }

.beat-dots-container { display: flex; gap: 8px; align-items: center; }
.beat-dot {
    width: 24px; height: 24px; border-radius: 50%; background: #1e293b; border: 1px solid #475569;
    display: flex; align-items: center; justify-content: center; transition: all 0.1s ease;
}
.beat-dot .dot-num { font-size: 11px; font-weight: 800; color: #64748b; }

.beat-dot.active {
    background: #38bdf8; border-color: #7dd3fc;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.9); transform: scale(1.12);
}
.beat-dot.active .dot-num { color: #0f172a; }
.beat-dot.active.accent { background: #ef4444; border-color: #fca5a5; box-shadow: 0 0 14px rgba(239, 68, 68, 1); transform: scale(1.16); }
.beat-dot.active.accent .dot-num { color: #ffffff; }

/* 🔊 右端固定 音量スライダー */
.metro-vol-container {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    background: #1e293b;
    border: 1px solid #334155;
    padding: 3px 8px;
    border-radius: 8px;
    z-index: 5;
}
.metro-vol-icon {
    font-size: 13px;
    cursor: default;
    user-select: none;
    line-height: 1;
}
.metro-vol-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 65px;
    height: 5px;
    background: #475569;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    margin: 0;
    transition: background 0.15s;
}
.metro-vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #38bdf8;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(56, 189, 248, 0.7);
    transition: transform 0.1s;
}
.metro-vol-slider::-webkit-slider-thumb:hover {
    transform: scale(1.25);
    background: #7dd3fc;
}
.metro-vol-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #38bdf8;
    border: none;
    cursor: pointer;
}
.metro-vol-label {
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    min-width: 28px;
    text-align: right;
    user-select: none;
}

/* ==========================================
   ③ TAB譜面エリア（横オートスクロール特化）
   ========================================== */
.score-wrapper {
    position: relative;
    background: #ffffff;
    min-height: 180px;
    height: 230px;
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 10px;
    border: 2px solid #e2e8f0;
    overflow-x: auto;
    overflow-y: hidden;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.03);
    scroll-behavior: auto;
    user-select: none;
    width: 100%;
    box-sizing: border-box;
}

.score-wrapper::-webkit-scrollbar {
    height: 6px;
}
.score-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}
.score-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.score-wrapper::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

#alphaTab {
    display: block;
    width: 100%;
    min-height: 180px;
    height: 100%;
    position: relative;
    z-index: 2;
}

/* 小節全体の控えめな背景ハイライト（色を薄くし、少し右へ8pxシフト） */
.score-bar-highlight {
    position: absolute;
    z-index: 1;
    background: rgba(250, 204, 21, 0.05);
    transform: translateX(8px);
    border-radius: 4px;
    pointer-events: none;
}

/* ④ 録音結果プレイヤーカード */
.record-result-card {
    background: #f0fdf4;
    border: 2px solid #86efac;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    animation: fadeInSlide 0.3s ease;
    text-align: center;
}
@keyframes fadeInSlide { 0% { opacity: 0; transform: translateY(-8px); } 100% { opacity: 1; transform: translateY(0); } }
.record-result-header { display: flex; align-items: center; justify-content: center; gap: 8px; }
.rec-icon { font-size: 24px; line-height: 1; }
.record-result-title { margin: 0; font-size: 14px; color: #166534; font-weight: 800; }
.record-result-desc { margin: 2px 0 0 0; font-size: 11px; color: #15803d; }
.record-audio-player { width: 100%; max-width: 450px; height: 38px; border-radius: 8px; outline: none; }

/* ⑤ 攻略ガイド */
.guide-details {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 14px;
    margin-bottom: 12px;
    text-align: left;
}
.guide-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    color: #2563eb;
    user-select: none;
}
.guide-summary::-webkit-details-marker { display: none; }
.guide-arrow { font-size: 11px; transition: transform 0.2s ease; }
.guide-details[open] .guide-arrow { transform: rotate(180deg); }
.guide-body {
    margin-top: 8px;
    font-size: 12px;
    color: #334155;
    line-height: 1.6;
    border-top: 1px solid #e2e8f0;
    padding-top: 8px;
}
.knowledge-item { background: #ffffff; padding: 8px 10px; border-radius: 6px; border: 1px solid #e2e8f0; }
.knowledge-item h4 { margin: 0 0 4px 0; color: #1e293b; font-size: 12px; }
.faq-list { margin: 0; padding-left: 18px; font-size: 11px; color: #475569; }
.faq-list li { margin-bottom: 4px; }

/* ⑥ 最下部スタートボタン */
.modal-footer-action {
    position: sticky;
    bottom: -16px;
    margin: 4px -20px -16px -20px;
    padding: 10px 20px 16px 20px;
    background: linear-gradient(to top, #ffffff 88%, rgba(255, 255, 255, 0) 100%);
    z-index: 25;
}
.wide-start-btn {
    width: 100%;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
    font-size: 16px;
    padding: 13px 18px;
    border-radius: 10px;
    background-color: #10b981;
    color: white;
    font-weight: 800;
    letter-spacing: 0.5px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}
.wide-start-btn:hover { background-color: #059669; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4); }
.wide-start-btn:active { transform: translateY(1px); }
.wide-start-btn.btn-stop { background-color: #ef4444 !important; box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35) !important; }
.wide-start-btn.btn-stop:hover { background-color: #dc2626 !important; }

/* ==========================================
   フッター & 汎用モーダル
   ========================================== */
.footer { text-align: center; padding: 20px 12px 35px 12px; font-size: 12px; color: #64748b; }
.footer-links { display: flex; justify-content: center; align-items: center; gap: 12px; margin-bottom: 8px; }
.footer-link { background: none; border: none; color: #2563eb; cursor: pointer; font-size: 12px; text-decoration: underline; padding: 0; }
.footer-sep { color: #cbd5e1; }
.copyright { margin: 0; font-size: 11px; color: #94a3b8; }

.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.75); display: flex; align-items: center; justify-content: center;
    z-index: 100; backdrop-filter: blur(4px);
}
.modal-content {
    background: white; padding: 24px; border-radius: 16px; text-align: left;
    max-width: 520px; width: 90%; position: relative; max-height: 85vh; overflow-y: auto;
}
.close-x-btn {
    background: #f1f5f9; border: none; font-size: 15px; color: #64748b;
    cursor: pointer; width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; transition: 0.15s; flex-shrink: 0;
}
.close-x-btn:hover { background: #e2e8f0; color: #0f172a; }

.info-title { font-size: 18px; margin-top: 0; color: #0f172a; border-bottom: 2px solid #e2e8f0; padding-bottom: 8px; text-align: center; }
.info-body { font-size: 13px; color: #334155; line-height: 1.7; }

.hidden { display: none !important; }
button { touch-action: manipulation; }

/* 📱 スマホ対応レスポンシブ最適化（案A: 1行キープ・スリム化） */
@media (max-width: 600px) {
    body { padding: 6px 4px 16px 4px; }
    .card { padding: 14px 10px; }
    .hero-dashboard-card { padding: 14px 12px 10px 12px; }
    .stages-container-card { padding: 14px 10px; }

    .app-title { font-size: 20px; }
    
    .dashboard-actions { flex-direction: row; gap: 8px; }
    .dashboard-details { min-width: 130px; }
    .dashboard-summary { font-size: 12px; padding: 8px 10px; }

    .exercise-card { flex-direction: column; align-items: center; text-align: center; padding: 12px 10px; gap: 10px; }
    .ex-badge-row { justify-content: center; }
    .ex-card-action { width: 100%; }
    .ex-start-btn { width: 100%; padding: 11px; font-size: 13px; }

    .practice-modal-content { padding: 12px 12px; width: 98%; max-height: 96vh; }
    .practice-modal-title { font-size: 14px; }
    .modal-footer-action { margin: 4px -12px -12px -12px; padding: 8px 12px 12px 12px; }
    .wide-start-btn { font-size: 15px; padding: 12px 14px; }

    /* 1行でスリムに中央メトロノーム＋右端固定音量バーを収める設定 */
    .visual-metronome-compact { padding: 4px 6px; min-height: 40px; }
    .metro-center-group { gap: 6px; }
    .metro-phase-badge { font-size: 9px; padding: 2px 4px; min-width: 48px; }
    .metro-count-chip { min-width: 22px; height: 22px; font-size: 12px; }
    .beat-dots-container { gap: 4px; }
    .beat-dot { width: 18px; height: 18px; }
    .beat-dot .dot-num { font-size: 9px; }
    
    .metro-vol-container { right: 6px; padding: 2px 5px; gap: 3px; }
    .metro-vol-slider { width: 42px; }
    .metro-vol-label { font-size: 9px; min-width: 22px; }

    .score-wrapper { min-height: 175px; height: 185px; padding: 8px 6px; }
}