/* style.css */

body {
    margin: 0;
    padding: 0;
    background-color: #ccc;
}

#header {
    text-align: center;
    margin: 20px auto;
}

#header img { height: auto; }

@media (min-width: 768px) { #header img { max-width: 30%; } }
@media (max-width: 767px) { #header img { max-width: 80%; } }

/* スコアエリア */
#scoreArea {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 6px;
    font-size: 16px;
    font-weight: bold;
}

#playerNameDisplay {
    color: #333;
    cursor: pointer;
    font-size: 15px;
}
#playerNameDisplay:hover { text-decoration: underline; }

/* ツールバー */
#toolbar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
#toolbar > button { font-size: 14px; padding: 6px 12px; }

/* メニュードロップダウン */
#menuWrapper {
    position: relative;
}
#menuButton {
    font-size: 14px;
    padding: 6px 12px;
    background: #555;
}
#menuButton:hover { background: #333; }
#menuDropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: white;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
    min-width: 160px;
    overflow: hidden;
}
#menuDropdown button {
    display: block;
    width: 100%;
    text-align: left;
    font-size: 14px;
    padding: 10px 16px;
    background: white;
    color: #333;
    border: none;
    border-bottom: 1px solid #eee;
    border-radius: 0;
    cursor: pointer;
}
#menuDropdown button:last-child { border-bottom: none; }
#menuDropdown button:hover { background: #f0f0f0; }

#comboDisplay {
    min-width: 80px;
    text-align: center;
    font-size: 18px;
    transition: all 0.3s;
}
#comboDisplay.combo-low  { color: #0055cc; }
#comboDisplay.combo-high { color: #cc4400; font-size: 22px; }

#statsDisplay { color: #333; }
#remainDisplay { color: #555; font-size: 14px; }

.container {
    text-align: center;
    margin-bottom: 20px;
}

img {
    max-width: 100%;
    height: auto;
    max-height: 400px;
    transition: max-height 0.3s ease;
}

/* シルエット出現アニメーション */
@keyframes reveal {
    0%   { filter: brightness(0) saturate(0); transform: scale(0.95); }
    60%  { transform: scale(1.05); }
    100% { filter: brightness(1) saturate(1); transform: scale(1); }
}
.reveal { animation: reveal 0.4s ease forwards; }

.hidden { display: none; }
.active img { max-height: none; }

/* ボタン共通 */
button {
    padding: 10px 20px;
    font-size: 20px;
    background-color: #0074ff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}
button:hover    { background-color: #0074ffba; }
button:disabled { background-color: #aaa; cursor: not-allowed; }
button.active   { background-color: #cc4400; }

/* 入力エリア */
#inputRow {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

#answerInput {
    padding: 10px 14px;
    font-size: 20px;
    border: 2px solid #0074ff;
    border-radius: 4px;
    width: 260px;
    outline: none;
    transition: border-color 0.2s;
}
#answerInput:focus    { border-color: #005fcc; }
#answerInput:disabled { background-color: #eee; }

#speechButton { padding: 10px 14px; font-size: 20px; }

/* フィードバック */
#feedbackText {
    margin: 8px 0 0;
    font-size: 18px;
    font-weight: bold;
    min-height: 1.4em;
}
#feedbackText.correct   { color: #009900; }
#feedbackText.incorrect { color: #cc0000; }

/* シェイクアニメーション */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-8px); }
    40%       { transform: translateX(8px); }
    60%       { transform: translateX(-6px); }
    80%       { transform: translateX(6px); }
}
.shake { animation: shake 0.4s ease; }

#detail {
    font-size: 20pt;
    line-height: 1.8;
}

.miss-count { font-size: 14pt; color: #cc0000; }

/* 復習・リセットボタン */
#reviewModeButton { background-color: #28a745; font-size: 16px; padding: 8px 14px; }
#reviewModeButton:hover  { background-color: #218838; }
#reviewModeButton.active { background-color: #cc4400; }
#resetStatsButton { background-color: #888; font-size: 16px; padding: 8px 14px; }
#resetStatsButton:hover { background-color: #666; }

/* モーダル */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.modal.hidden { display: none; }

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 70vh;
    overflow-y: auto;
}
.modal-content h2 { margin: 0 0 16px; text-align: center; }

.weak-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}
.weak-item img { width: 48px; height: 48px; object-fit: contain; }
.weak-item span { flex: 1; font-size: 16px; }
.weak-count { color: #cc0000; font-weight: bold; font-size: 15px; }

.shown-tab-btn { font-size: 14px; padding: 6px 18px; background: #888; border: none; border-radius: 4px; color: white; cursor: pointer; }
.shown-tab-btn.active { background: #0074ff; }

#closeModal {
    display: block;
    margin: 16px auto 0;
    background-color: #888;
}

/* フッター */
footer {
    text-align: center;
    padding: 24px 16px;
    font-size: 13px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}
footer a {
    color: #555;
    text-decoration: none;
}
footer a:hover {
    text-decoration: underline;
}

/* 紙吹雪キャンバス */
#confettiCanvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 200;
}

/* 演出オーバーレイ */
#celebrationOverlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 210;
    opacity: 0;
    transition: opacity 0.4s;
}
#celebrationOverlay.show { opacity: 1; }
#celebrationOverlay.hidden { display: none; }

#celebrationBox {
    background: white;
    border-radius: 16px;
    padding: 40px 32px;
    text-align: center;
    max-width: 360px;
    width: 88%;
    transform: scale(0.8);
    transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
#celebrationOverlay.show #celebrationBox { transform: scale(1); }
#celebrationTitle  { font-size: 28px; font-weight: bold; margin: 0 0 8px; }
#celebrationBody   { font-size: 16px; color: #444; margin: 0 0 24px; line-height: 1.6; }
#celebrationClose  { width: 100%; font-size: 18px; }

/* マイク権限誘導アニメーション */
@keyframes mic-pulse {
    0%, 100% { background-color: #0074ff; transform: scale(1); }
    50%       { background-color: #e63946; transform: scale(1.15); }
}
.mic-prompt { animation: mic-pulse 0.5s ease 4; }
