/* ==========================================================================
   sanshin/challenge.css - スコアチャレンジ専用スタイルシート
   ========================================================================== */

body.portal-body,
body.practice-body {
    background: var(--bg-gradient, linear-gradient(135deg, #0b132b 0%, #1c2541 50%, #0f172a 100%)) !important;
    color: var(--text-primary, #f8fafc) !important;
    font-family: var(--font-noto, 'Noto Sans JP', sans-serif);
    min-height: 100vh;
    padding-top: 90px;
    padding-bottom: 3rem;
}

/* 三線入門ホームへ戻るボタンの見やすいデザイン調整 */
a.back-home-link,
a.back-home-link:visited {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 99px;
    padding: 0.55rem 1.25rem;
    color: #ffffff !important;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

a.back-home-link:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: var(--accent-gold, #f59e0b);
    color: #fbbf24 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.3);
}

/* チャレンジ全体のコンテナ幅設定 */
.practice-container {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 1rem;
    box-sizing: border-box;
}

/* 3カラムグリッドレイアウト (左右260px固定、中央1fr可変拡大) */
.challenge-layout {
    display: grid;
    grid-template-columns: 260px 1fr 260px;
    gap: 1.25rem;
    align-items: start;
    width: 100%;
    margin-top: 1rem;
}

@media (max-width: 1023px) {
    .challenge-layout {
        grid-template-columns: 1fr;
    }
}

/* 事前準備カード (左カラム最上部) */
.prep-guide-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.95));
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 14px;
    padding: 0.85rem 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.prep-guide-card:hover,
.prep-guide-card.active-prep {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(30, 41, 59, 0.95));
    border-color: var(--accent-gold, #f59e0b);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(245, 158, 11, 0.35);
}

.prep-badge {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 99px;
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-gold, #f59e0b);
}

.prep-title {
    font-size: 1rem;
    font-weight: 800;
    color: #ffffff;
    margin-top: 6px;
}

/* 楽曲選択パネル (左カラム) */
.song-list-panel {
    background: var(--glass-bg, rgba(15, 23, 42, 0.6));
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
    border-radius: 16px;
    padding: 1.25rem;
    backdrop-filter: blur(16px);
}

.song-list-header {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--accent-gold, #f59e0b);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.song-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    margin-bottom: 0.65rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.song-item:hover {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.4);
    transform: translateX(4px);
}

.song-item.active {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(217, 119, 6, 0.35));
    border-color: var(--accent-gold, #f59e0b);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2);
}

.song-title-wrap {
    display: flex;
    flex-direction: column;
}

.song-name {
    font-weight: 800;
    font-size: 0.95rem;
    color: #fff;
}

.song-meta {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 2px;
}

.song-difficulty {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 99px;
    font-weight: 700;
}

.diff-intro {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
}

.diff-easy {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.diff-normal {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.diff-hard {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* ちんだみステップボックス (練習ページと統一されたプレミアムカードUI) */
.chindami-step-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 1rem 0.75rem;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.chindami-step-box.active-step,
.chindami-step-box.active {
    background: rgba(245, 158, 11, 0.14);
    border-color: #f59e0b;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.35);
    transform: translateY(-3px);
}

.chindami-step-box.completed-step,
.chindami-step-box.ok {
    background: rgba(16, 185, 129, 0.14);
    border-color: #10b981;
    color: #34d399;
}

.chindami-step-box .step-label,
.chindami-step-box .string-tag {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.65rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    display: inline-block;
    transition: all 0.3s ease;
}

.chindami-step-box.active-step .step-label,
.chindami-step-box.active .step-label,
.chindami-step-box.active-step .string-tag,
.chindami-step-box.active .string-tag {
    background: #f59e0b;
    color: #0f172a;
}

.chindami-step-box.completed-step .step-label,
.chindami-step-box.ok .step-label,
.chindami-step-box.completed-step .string-tag,
.chindami-step-box.ok .string-tag {
    background: #10b981;
    color: #ffffff;
}

.chindami-step-box .step-note-name,
.chindami-step-box .target-pitch-text {
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffffff;
}

.chindami-step-box .step-target-hz {
    font-size: 0.8rem;
    color: #94a3b8;
}

.chindami-step-box .step-status-text,
.chindami-step-box .pitch-status-icon {
    font-size: 0.8rem;
    font-weight: bold;
    color: #f59e0b;
}

/* 太鼓の達人風 横スクロールゲームエリア (中央カラム) */
.game-area-card {
    background: var(--glass-bg, rgba(15, 23, 42, 0.7));
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
    border-radius: 20px;
    padding: 0.5rem 1.5rem;
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* スコア & コンボ表示ヘッダー */
.game-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.score-display-box {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 900;
    color: #fbbf24;
    text-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.combo-display-box {
    text-align: right;
}

.combo-num {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 900;
    color: #38bdf8;
}

.combo-text {
    font-size: 0.7rem;
    font-weight: 800;
    color: #94a3b8;
    letter-spacing: 0.1em;
}

/* 太鼓の達人風ノーツレーン */
.taiko-lane-wrap {
    position: relative;
    width: 100%;
    height: 140px;
    background: linear-gradient(90deg, #0f172a 0%, #1e293b 100%);
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
    margin: 1rem 0;
    overflow: hidden;
}

/* 判定ライン (左端) */
.judge-line {
    position: absolute;
    top: 50%;
    left: 80px;
    transform: translateY(-50%);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 4px solid var(--accent-gold, #f59e0b);
    background: rgba(245, 158, 11, 0.15);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.5), inset 0 0 10px rgba(245, 158, 11, 0.3);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.judge-line::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 140px;
    background: rgba(245, 158, 11, 0.6);
    box-shadow: 0 0 8px #f59e0b;
}

/* 工工四ノーツバッジ */
.taiko-note {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: radial-gradient(circle, #f59e0b 0%, #d97706 100%);
    border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 900;
    color: #fff;
    z-index: 5;
    user-select: none;
    transition: transform 0.05s ease;
}

.taiko-note.note-break {
    background: radial-gradient(circle, #64748b 0%, #334155 100%);
    border-color: #94a3b8;
    font-size: 1rem;
}

/* 半拍（青丸）ノーツの専用デザイン */
.taiko-note.note-half {
    width: 44px;
    height: 44px;
    background: radial-gradient(circle, #0284c7 0%, #0369a1 100%);
    border: 3px solid #38bdf8;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.6);
    font-size: 1.15rem;
}

/* カウントダウンノーツ (３, ２, １) のゴールドバッジデザイン */
.taiko-note.note-countdown {
    background: radial-gradient(circle, #fbbf24 0%, #d97706 100%);
    border: 3px solid #fef08a;
    box-shadow: 0 0 18px rgba(251, 191, 36, 0.85);
    color: #ffffff;
    font-weight: 900;
    font-size: 1.35rem;
}

/* オリジナル演奏完了トーストメッセージ (2秒で自動消失) */
.result-toast-card {
    position: fixed;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
    border: 2px solid var(--accent-gold, #f59e0b);
    border-radius: 20px;
    padding: 1.5rem 2.5rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(245, 158, 11, 0.3);
    backdrop-filter: blur(16px);
    z-index: 1500;
    text-align: center;
    pointer-events: none;
    animation: toastPop 2.0s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.result-toast-title {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--accent-gold, #f59e0b);
    margin-bottom: 0.5rem;
}

.result-toast-body {
    font-size: 1.1rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.5;
}

@keyframes toastPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -40%) scale(0.8);
    }

    15% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.05);
    }

    25% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.0);
    }

    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.0);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -60%) scale(0.9);
    }
}

/* 演奏前 3・2・1 カウントダウン演出 */
.countdown-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Outfit', 'Noto Sans JP', sans-serif;
    font-size: 5.5rem;
    font-weight: 900;
    color: #fbbf24;
    text-shadow: 0 0 35px rgba(251, 191, 36, 0.9), 0 0 70px rgba(245, 158, 11, 0.6);
    z-index: 100;
    pointer-events: none;
    animation: countPop 0.85s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.countdown-overlay.count-start {
    color: #34d399;
    font-size: 4.2rem;
    text-shadow: 0 0 40px rgba(52, 211, 153, 0.9), 0 0 80px rgba(16, 185, 129, 0.6);
}

@keyframes countPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2.2);
    }

    25% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.0);
    }

    75% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.0);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.6);
    }
}

/* 判定ポップアップテキスト (PERFECT, GREAT, MISS) */
.hit-judge-popup {
    position: absolute;
    left: 80px;
    top: 15px;
    transform: translateX(-50%);
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 900;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 20;
    animation: judgePop 0.5s ease-out forwards;
}

.judge-perfect {
    color: #f59e0b;
    text-shadow: 0 0 15px #f59e0b;
}

.judge-great {
    color: #38bdf8;
    text-shadow: 0 0 15px #38bdf8;
}

.judge-good {
    color: #34d399;
    text-shadow: 0 0 15px #34d399;
}

.judge-miss {
    color: #94a3b8;
    text-shadow: 0 0 5px #000;
}

@keyframes judgePop {
    0% {
        opacity: 0;
        transform: translate(-50%, 10px) scale(0.6);
    }

    50% {
        opacity: 1;
        transform: translate(-50%, -10px) scale(1.2);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -25px) scale(1);
    }
}

/* ランキングパネル (右カラム) */
.ranking-panel {
    background: var(--glass-bg, rgba(15, 23, 42, 0.6));
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
    border-radius: 16px;
    padding: 1.25rem;
    backdrop-filter: blur(16px);
}

.ranking-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--accent-gold, #f59e0b);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ranking-item {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.ranking-item.my-rank {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.4);
}

.rank-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-weight: 900;
    font-size: 1.15rem;
    color: #94a3b8;
    line-height: 1;
}

.rank-1 {
    font-size: 1.4rem;
}

.rank-2 {
    font-size: 1.35rem;
}

.rank-3 {
    font-size: 1.3rem;
}

.rank-user {
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 0.5rem;
}

.rank-score {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    color: #fbbf24;
    font-size: 0.95rem;
}

/* ログイン限定保護オーバーレイ */
.login-protection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-protection-card {
    background: #1e293b;
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    text-align: center;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.login-protection-card h3 {
    font-size: 1.4rem;
    color: var(--accent-gold, #f59e0b);
    margin-bottom: 1rem;
}