body {margin: 0px;}

/* --- 耳コピ能力診断 専用CSS (スコープ化対応版) --- */
#pitch-quiz-app { 
    font-family: 'Helvetica Neue', Arial, sans-serif; 
    text-align: center;  
    padding: 20px 10px; 
    color: #333; 
    border-radius: 8px;
}

#pitch-quiz-app .controls { margin-bottom: 20px; background: white; padding: 15px; border-radius: 12px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); display: inline-block; text-align: left; max-width: 850px; width: 100%; box-sizing: border-box; margin-top: 10px; }
#pitch-quiz-app .control-group { margin: 10px 0; padding-bottom: 10px; border-bottom: 1px dashed #ccc; }
#pitch-quiz-app .control-group:last-child { border-bottom: none; padding-bottom: 0; }
#pitch-quiz-app .note-filter { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 5px; padding: 10px; background: #f9f9f9; border-radius: 6px; }
#pitch-quiz-app .note-filter label { font-size: 14px; display: flex; align-items: center; cursor: pointer; }
#pitch-quiz-app .keyboard-guide { font-size: 12px; color: #666; margin-top: 10px; font-weight: bold; background: #e3f2fd; padding: 8px; border-radius: 6px; text-align: center;}

#pitch-quiz-app button { padding: 10px 15px; cursor: pointer; background-color: #007bff; color: white; border: none; border-radius: 6px; font-weight: bold; transition: 0.2s; margin: 5px; font-size: 14px; touch-action: manipulation; }
#pitch-quiz-app button:hover { background-color: #0056b3; }
#pitch-quiz-app button:disabled { background-color: #b0bec5; cursor: not-allowed; }

#ref-c-btn { background-color: #6c757d !important; }
#copy-btn { background-color: #4caf50 !important; }
#copy-btn:hover { background-color: #388e3c !important; }
#tweet-btn { background-color: #0f1419 !important; color: #ffffff !important; }
#tweet-btn:hover { background-color: #272c30 !important; }
#analyze-btn { background-color: #ff9800 !important; }
#analyze-btn:hover { background-color: #f57c00 !important; }
#fullscreen-btn { display: none; }
#exit-fullscreen-btn { display: none; }
#pitch-quiz-app .input-actions { display: none; }

@media (pointer: coarse) {
    #fullscreen-btn { background-color: #3f51b5 !important; display: block; margin: 0 auto 15px auto; width: 80%; max-width: 300px; font-size: 16px; padding: 12px; }
    #fullscreen-btn { display: block;}
    #pitch-quiz-app .input-actions { margin-top: 10px; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
    #bs-btn { background-color: #607d8b !important; padding: 12px 20px; font-size: 16px;}
    #submit-btn { background-color: #4caf50 !important; padding: 12px 30px; font-size: 16px;}
}

#pitch-quiz-app .preset-box { background: #e3f2fd; padding: 10px; border-radius: 8px; margin-bottom: 10px; border: 2px solid #2196f3; }
#pitch-quiz-app .preset-box select { font-size: 16px; padding: 5px; font-weight: bold; width: 100%; max-width: 100%; box-sizing: border-box; }

#pitch-quiz-app .keyboard-container { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 10px; margin-top: 10px;}
#pitch-quiz-app .keyboard { display: flex; justify-content: center; margin: 0 auto; user-select: none; width: max-content; }
#pitch-quiz-app .key-group { position: relative; }
#pitch-quiz-app .key { cursor: pointer; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 15px; font-size: 12px; font-weight: bold; box-sizing: border-box; border-radius: 0 0 6px 6px; border: 1px solid #333; transition: transform 0.1s, background-color 0.1s; touch-action: manipulation; }
#pitch-quiz-app .key.white { width: 55px; height: 180px; background: white; color: #333; position: relative; z-index: 1; }
#pitch-quiz-app .key.white.active { background: #ffeb3b; transform: translateY(2px); }
#pitch-quiz-app .key.black { width: 36px; height: 110px; background: #263238; color: white; position: absolute; top: 0; left: 37px; z-index: 2; border: 1px solid #000; }
#pitch-quiz-app .key.black.active { background: #f44336; transform: translateY(2px); }

#message { font-size: 20px; font-weight: bold; margin: 10px 0; min-height: 30px; }
#user-input-display { font-size: 28px; letter-spacing: 8px; color: #1976d2; min-height: 45px; background: #fff; display: inline-block; padding: 5px 20px; border-radius: 8px; border: 2px solid #ccc; max-width: 90%; word-wrap: break-word; transition: background-color 0.4s ease, border-color 0.4s ease; }

#pitch-quiz-app .hint { font-size: 13px; color: #777; margin-top: 5px; }
#stats { font-size: 16px; font-weight: bold; color: #d32f2f; margin-top: 10px; }
#pitch-quiz-app .main-btn-group { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; margin-bottom: 10px; }

#pitch-quiz-app .analysis-container { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; }

#pitch-quiz-app table, .modal-active table { border-collapse: collapse; margin: 0 auto; font-size: 13px; }
#pitch-quiz-app th, #pitch-quiz-app td, .modal-active th, .modal-active td { border: 1px solid #ddd; text-align: center; }
#pitch-quiz-app th, .modal-active th { background-color: #f5f5f5; font-weight: bold; }

#pitch-quiz-app .heatmap-table, .modal-active .heatmap-table { table-layout: fixed; margin: 0 auto; }
#pitch-quiz-app .heatmap-table th, #pitch-quiz-app .heatmap-table td, .modal-active .heatmap-table th, .modal-active .heatmap-table td { width: 36px; height: 36px; padding: 0; box-sizing: border-box; vertical-align: middle; }

#pitch-quiz-app .stats-table th, .modal-active .stats-table th { background-color: #e3f2fd; padding: 6px 10px; white-space: nowrap; }
#pitch-quiz-app .stats-table td, .modal-active .stats-table td { padding: 6px 10px; white-space: nowrap; }

#pitch-quiz-app h3, .modal-active h3 { border-bottom: 2px solid #007bff; display: inline-block; padding-bottom: 5px; margin-bottom: 10px; font-size: 16px; }

@media (max-width: 600px) {
    #pitch-quiz-app .key.white { width: 45px; height: 140px; font-size: 11px; padding-bottom: 10px; }
    #pitch-quiz-app .key.black { width: 30px; height: 85px; left: 30px; }
    #pitch-quiz-app .keyboard-guide { font-size: 11px; }
    #user-input-display { font-size: 20px; letter-spacing: 4px; }
    #pitch-quiz-app h1 { font-size: 20px; margin: 5px 0;}
    #fullscreen-btn { width: 95%; }
}

:fullscreen { background-color: #eceff1; overflow-y: auto;}
:-webkit-full-screen { background-color: #eceff1; overflow-y: auto;}

#diagnostic-panel { display: none; background: #fff3e0; border: 3px solid #ff9800; padding: 15px; border-radius: 12px; margin-bottom: 15px; text-align: center; }
#diagnostic-panel h2 { color: #e91e63; margin-top: 0; margin-bottom: 10px; font-size: 18px; }
#diagnostic-panel select { font-size: 18px; padding: 8px; font-weight: bold; width: 95%; max-width: 350px; margin-bottom: 10px; }
#pitch-quiz-app .diag-desc { font-size: 14px; color: #555; font-weight: bold; background: white; padding: 8px; border-radius: 6px; display: inline-block;}

/* =========================================
   スマホ向けレイアウト (画面幅が600px以下)
========================================= */
@media screen and (max-width: 600px) {
    .main-btn-group, .input-actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        width: 100% !important;
        margin-bottom: 15px !important;
    }
    .main-btn-group button, .input-actions button {
        width: 100% !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        padding: 12px 2px !important;
        font-size: 13px !important;
    }
    #play-btn {
        grid-column: 1 / -1 !important; 
        padding: 15px 5px !important;
        font-size: 16px !important;
    }
    .keyboard {
        width: 100% !important;
        margin: 15px auto !important;
    }
    .key-group {
        flex: 1 !important; 
    }
    .key.white {
        width: 100% !important; 
        height: 140px !important; 
        font-size: 10px !important; 
        padding-bottom: 8px !important;
    }
    .key.black {
        width: 60% !important; 
        height: 85px !important; 
        left: 70% !important; 
        font-size: 8px !important;
    }
}

/* =========================================
   📱 ヨコ画面（フルスクリーン）レイアウト
========================================= */
#landscape-layout {
    width: 100vw;
    height: 100vh;
    flex-direction: row;
    padding: 10px 10px 10px 15px;
    box-sizing: border-box;
    gap: 15px;
    background-color: #eceff1;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9990;
    align-items: center;
}

#land-left {
    width: 40%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#land-right {
    width: 60%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

/* ヨコ画面移動時のパーツ微調整 */
#landscape-layout .main-btn-group {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 5px !important;
    margin-bottom: 10px !important;
}
#landscape-layout .main-btn-group button {
    margin: 0 !important;
    padding: 8px 2px !important;
    font-size: 12px !important;
}
#landscape-layout #play-btn {
    grid-column: 1 / -1 !important;
    padding: 12px !important;
    font-size: 15px !important;
}
#landscape-layout .input-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 5px;
}
#landscape-layout .input-actions button {
    width: 45%;
    padding: 10px;
}
#landscape-layout .keyboard-container {
    margin: 0 !important;
    padding: 0 !important;
}
#landscape-layout .keyboard { width: 100% !important; margin: 0 !important; }
#landscape-layout .key.white { height: 75vh !important; }
#landscape-layout .key.black { height: 45vh !important; }
#landscape-layout #user-input-display { font-size: 18px !important; min-height: 35px !important; padding: 2px 10px !important; }
#landscape-layout #stats, #landscape-layout #message { font-size: 14px !important; margin: 5px 0 !important; }

/* =========================================
   📊 レポート専用画面（モーダル）
========================================= */
.modal-hidden { display: none !important; }
.modal-active {
    display: block !important;
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background-color: rgba(245, 245, 245, 0.98);
    z-index: 10000;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
    margin: 0 !important;
    max-width: 100% !important;
}

/* =========================================
   🍞 トースト通知（ポップアップ）
========================================= */
#toast {
    visibility: hidden;
    min-width: 250px;
    background-color: rgba(50, 50, 50, 0.95); /* 黒の半透明 */
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 15px;
    position: fixed;
    z-index: 10001; /* モーダル(10000)よりも手前へ */
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%); /* 中央寄せの魔法 */
    font-size: 15px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s, bottom 0.3s, visibility 0.3s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* クラスが付いた時にフワッと浮き上がる */
#toast.show {
    visibility: visible;
    opacity: 1;
    bottom: 50px; /* 少し上に移動させる */
}