@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");

/* ---------- Reset & Global Styles ---------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    font-family: "Poppins", sans-serif;
    position: relative;
    overflow: hidden;
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 背景の浮遊パーティクル */
body::before, body::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
}

body::before {
    background: radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.2) 100%);
    opacity: 0.7;
    animation: pulse 15s infinite alternate;
}

body::after {
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 5%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 5%),
        radial-gradient(circle at 40% 80%, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 5%),
        radial-gradient(circle at 70% 50%, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 5%);
    animation: floatingLights 20s infinite linear;
}

@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.5); }
}

@keyframes floatingLights {
    0% { background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%; }
    100% { background-position: 100% 100%, 100% 100%, 100% 100%, 100% 100%; }
}

/* ---------- Game Container ---------- */
.container {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 248, 225, 0.9));
    font-size: 1.8rem;
    font-weight: 600;
    padding: 2rem;
    border-radius: 20px;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3), 
                inset 0 0 20px rgba(255, 255, 255, 0.5);
    position: relative;
    animation: glow 8s infinite alternate;
    border: 2px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 80%);
    animation: containerShine 15s infinite linear;
}

@keyframes containerShine {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes float {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(0.5deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes glow {
    0% { box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 152, 0, 0.1); }
    100% { box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3), 0 0 40px rgba(255, 87, 34, 0.3); }
}

/* ---------- Timer ---------- */
.timer {
    position: absolute;
    top: 1rem;
    left: 3rem;
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    background: rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    border-left: 3px solid #ff9800;
    transition: all 0.3s ease;
}

/* タイマーが10秒以下になったら点滅アニメーション */
.timer.warning {
    color: #d32f2f;
    animation: timerPulse 1s infinite;
}

@keyframes timerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); background: rgba(255, 152, 0, 0.2); }
}

/* ---------- Instruction & Score ---------- */
.instruction {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 1.2rem;
    color: #444;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.Score,
.Score + .Score {
    text-align: right;
    font-size: 1.3rem;
    font-weight: 700;
    padding: 0.7rem 1.2rem;
    border-radius: 12px;
    margin-bottom: 0.8rem;
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1), 
                inset 0 0 5px rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.Score::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(45deg);
    animation: scoreShine 6s infinite linear;
    z-index: -1;
}

@keyframes scoreShine {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

#scoreDisplay {
    color: #2196F3;
    border-left: 4px solid #2196F3;
    animation: scoreGlow 4s infinite alternate;
}

@keyframes scoreGlow {
    0% { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1), 0 0 5px rgba(33, 150, 243, 0.3); }
    100% { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1), 0 0 15px rgba(33, 150, 243, 0.6); }
}

#comboDisplay {
    color: #FF5722;
    border-left: 4px solid #FF5722;
    animation: comboGlow 2s infinite alternate;
}

@keyframes comboGlow {
    0% { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1), 0 0 5px rgba(255, 87, 34, 0.3); }
    100% { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1), 0 0 15px rgba(255, 87, 34, 0.6); }
}

/* コンボ数に応じた色変化 */
#comboDisplay.combo-5 {
    color: #2196F3;
    border-left: 4px solid #2196F3;
    animation: combo5Glow 2s infinite alternate;
}

@keyframes combo5Glow {
    0% { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1), 0 0 5px rgba(33, 150, 243, 0.3); }
    100% { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1), 0 0 15px rgba(33, 150, 243, 0.6); }
}

#comboDisplay.combo-10 {
    color: #4CAF50;
    border-left: 4px solid #4CAF50;
    animation: combo10Glow 2s infinite alternate;
}

@keyframes combo10Glow {
    0% { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1), 0 0 5px rgba(76, 175, 80, 0.3); }
    100% { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1), 0 0 15px rgba(76, 175, 80, 0.6); }
}

#comboDisplay.combo-20 {
    color: #FFC107;
    border-left: 4px solid #FFC107;
    animation: combo20Glow 1s infinite alternate;
}

@keyframes combo20Glow {
    0% { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1), 0 0 5px rgba(255, 193, 7, 0.3); }
    100% { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1), 0 0 20px rgba(255, 193, 7, 0.8); }
}

/* ---------- Progress Bar ---------- */
#problemProgressContainer {
    width: 100%;
    height: 15px;
    background: rgba(224, 224, 224, 0.3);
    border-radius: 15px;
    overflow: hidden;
    margin: 1.5rem 0;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
    position: relative;
}

#problemProgressContainer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(90deg, 
            rgba(255, 255, 255, 0.1) 0%, 
            rgba(255, 255, 255, 0.2) 20%, 
            rgba(255, 255, 255, 0.1) 40%, 
            rgba(255, 255, 255, 0.2) 60%, 
            rgba(255, 255, 255, 0.1) 80%, 
            rgba(255, 255, 255, 0.2) 100%);
    background-size: 200% 100%;
    animation: progressShine 3s linear infinite;
    z-index: 1;
}

@keyframes progressShine {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

#problemProgress {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #ff9800, #ff5722, #e91e63);
    background-size: 200% 100%;
    transition: width 0.05s linear;
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.7);
    position: relative;
    z-index: 2;
    animation: progressGradient 2s ease infinite;
}

@keyframes progressGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#problemProgress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.4) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(0, 0, 0, 0.1) 100%
    );
    z-index: 3;
}

/* プログレスバーが80%以上の場合の警告スタイル */
#problemProgress.warning {
    background: linear-gradient(90deg, #ff5722, #f44336, #d32f2f);
    box-shadow: 0 0 20px rgba(244, 67, 54, 0.8);
    animation: warningPulse 0.5s infinite alternate;
}

@keyframes warningPulse {
    0% { box-shadow: 0 0 15px rgba(244, 67, 54, 0.7); }
    100% { box-shadow: 0 0 25px rgba(244, 67, 54, 0.9); }
}

/* ---------- Display Areas ---------- */
.type_display,
.type_answer {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1.2rem;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1), 
                inset 0 0 10px rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.5);
    position: relative;
    overflow: hidden;
}

.type_display::before,
.type_answer::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: linear-gradient(45deg, 
        rgba(255, 255, 255, 0) 0%, 
        rgba(255, 255, 255, 0.1) 50%, 
        rgba(255, 255, 255, 0) 100%);
    z-index: -1;
    animation: displayGlow 8s infinite linear;
}

@keyframes displayGlow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.type_display {
    font-size: 1.8rem;
    color: #333;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    animation: displayPulse 5s infinite alternate;
}

@keyframes displayPulse {
    0% { box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1), inset 0 0 10px rgba(255, 255, 255, 0.3); }
    100% { box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1), inset 0 0 20px rgba(255, 152, 0, 0.2); }
}

/* 正解文字のハイライト */
.correct {
    color: #2E7D32;
    font-weight: bold;
    text-shadow: 0 0 2px rgba(76, 175, 80, 0.3);
}

/* 自動入力される文字（スペース、アポストロフィー）のスタイル */
.auto-input {
    color: #9C27B0;
    font-weight: bold;
    text-shadow: 0 0 2px rgba(156, 39, 176, 0.3);
    position: relative;
}

.auto-input::after {
    content: '⚡';
    position: absolute;
    font-size: 0.7em;
    top: -0.8em;
    right: -0.5em;
    color: #FFC107;
    text-shadow: 0 0 3px rgba(255, 193, 7, 0.5);
}

/* アニメーション関連のスタイル */
/* 正解文字のフラッシュアニメーション */
@keyframes correctFlash {
    0% { text-shadow: 0 0 5px rgba(255, 255, 255, 0.8); }
    50% { text-shadow: 0 0 15px rgba(255, 215, 0, 0.8); }
    100% { text-shadow: 0 0 5px rgba(255, 255, 255, 0); }
}

.correct-flash {
    animation: correctFlash 0.5s ease-out;
}

/* コンボカウンターアニメーション */
@keyframes comboPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.5); }
    100% { transform: scale(1); }
}

.combo-pulse {
    animation: comboPulse 0.3s ease-out;
}

/* コンフェッティ用スタイル */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #f00;
    opacity: 0;
    transform: translateY(0) rotate(0deg);
    z-index: 1000;
}

@keyframes confettiFall {
    0% { transform: translateY(-50px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}


/* タイピング問題の答え表示（フォント等設定） */
.type_answer {
    color: #aaa;
    font-family: "Courier New", Courier, monospace;
}

.type_answer span {
    display: inline-block;
    min-width: 1ch;
    margin-right: 0.2em;
}

/* ---------- 隠しインプット ---------- */
.type_input {
    position: absolute;
    left: -9999px;
}

/* ---------- モーダルダイアログ ---------- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(135deg, #fff, #f5f5f5);
    margin: 5% auto;
    padding: 2rem;
    border: none;
    width: 90%;
    max-width: 800px;
    font-size: 2rem;
    text-align: center;
    border-radius: 15px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2),
                0 0 20px rgba(255, 152, 0, 0.3),
                0 0 40px rgba(255, 87, 34, 0.2);
    animation: modalSlideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow-y: auto;
    max-height: 90vh;
    transform-style: preserve-3d;
    perspective: 1000px;
}

@keyframes modalSlideIn {
    from { transform: translateY(-50px) scale(0.9); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #ff9800, #ff5722);
    animation: gradientShift 3s infinite linear;
    background-size: 200% 100%;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.close {
    color: #777;
    float: right;
    font-size: 2.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1;
    position: relative;
    z-index: 10;
}

.close:hover {
    color: #ff5722;
    transform: rotate(90deg) scale(1.2);
    text-shadow: 0 0 10px rgba(255, 87, 34, 0.5);
}

#modalMessage {
    margin: 1.5rem 0;
    line-height: 1.6;
    color: #333;
    font-weight: 600;
    position: relative;
    z-index: 5;
}

/* 結果発表用のスタイル */
.result-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #ff5722;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    position: relative;
    display: inline-block;
}

.result-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #ff9800, transparent);
}

.game-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 1rem 0;
    color: #3f51b5;
    text-shadow: 0 1px 3px rgba(63, 81, 181, 0.3);
    position: relative;
    display: inline-block;
}

.game-title::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #3f51b5, transparent);
}

.result-score {
    font-size: 4rem;
    font-weight: 800;
    margin: 1.5rem 0;
    color: #2196F3;
    text-shadow: 0 0 10px rgba(33, 150, 243, 0.3);
    transition: all 0.3s ease;
}

.score-highlight {
    animation: scoreHighlight 1s ease-out;
    color: #FFC107;
    text-shadow: 0 0 20px rgba(255, 193, 7, 0.6);
}

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

.result-message {
    font-size: 1.8rem;
    margin: 1rem 0;
    color: #4CAF50;
}

.result-char {
    display: inline-block;
    animation: charPop 0.5s ease-out forwards;
    opacity: 0;
    transform: translateY(20px) scale(0.8);
}

@keyframes charPop {
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 花火アニメーション */
.firework {
    position: fixed;
    width: var(--firework-size, 80px);
    height: var(--firework-size, 80px);
    border-radius: 50%;
    background-color: transparent;
    z-index: 999;
    pointer-events: none;
    animation: fireworkPop 0.5s ease-out forwards;
}

@keyframes fireworkPop {
    0% { transform: scale(0.1); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; background-color: var(--firework-color, white); }
    100% { transform: scale(1); opacity: 0; background-color: transparent; }
}

.firework-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: particleFly var(--duration, 1s) ease-out forwards;
}

@keyframes particleFly {
    0% { 
        transform: translate(-50%, -50%) scale(1); 
        opacity: 1; 
    }
    100% { 
        transform: 
            translate(
                calc(-50% + cos(var(--angle, 0rad)) * var(--distance, 50px)), 
                calc(-50% + sin(var(--angle, 0rad)) * var(--distance, 50px))
            ) 
            scale(0.1); 
        opacity: 0; 
    }
}

/* 背景エフェクト */
.result-background {
    animation: resultBgPulse 10s infinite alternate !important;
}

@keyframes resultBgPulse {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

.light-particle {
    position: fixed;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0) 70%);
    pointer-events: none;
    z-index: -1;
    opacity: 0;
    animation: lightPulse 5s ease-in-out infinite;
}

@keyframes lightPulse {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1); opacity: 0.3; }
    100% { transform: scale(0.8); opacity: 0; }
}

/* トロフィーアイコン */
.trophy-icon {
    font-size: 3rem;
    color: gold;
    margin-bottom: 1rem;
    display: inline-block;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    animation: trophyWiggle 1s ease-in-out infinite alternate;
}

@keyframes trophyWiggle {
    0% { transform: rotate(-5deg); }
    100% { transform: rotate(5deg); }
}

/* リトライボタンの強化 */
.retryBtn.enhanced {
    background: linear-gradient(45deg, #ff9800, #ff5722);
    padding: 1rem 2.5rem;
    font-size: 1.8rem;
    border-radius: 50px;
    transform: translateY(0);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 5px 15px rgba(255, 87, 34, 0.3);
    position: relative;
    overflow: hidden;
    margin-top: 2rem;
}

.retryBtn.enhanced:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(255, 87, 34, 0.4);
    background: linear-gradient(45deg, #ff5722, #e91e63);
}

.retryBtn.enhanced::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(45deg);
    animation: buttonShine 3s infinite;
    z-index: 1;
}

@keyframes buttonShine {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

/* ---------- 追加: 指用キーボード ---------- */

/* コンテナ */
#fingerKeyboardContainer {
    margin-top: 1rem;
    text-align: center;
}

/* キーボード本体 */
.fingerKeyboard {
    display: inline-block;
    background: linear-gradient(to bottom, #fff8e1, #ffe0b2);
    border: 2px solid rgba(255, 204, 128, 0.5);
    padding: 0.5rem;
    border-radius: 15px;
    margin-bottom: 1rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15), 
                inset 0 0 10px rgba(255, 255, 255, 0.5);
    transform-style: preserve-3d;
    perspective: 500px;
    animation: keyboardFloat 8s ease-in-out infinite;
}

@keyframes keyboardFloat {
    0%, 100% { transform: translateY(0) rotateX(0); }
    50% { transform: translateY(-5px) rotateX(2deg); }
}

/* キーボードの各行 */
.fingerKeyboardRow {
    display: flex;
    justify-content: center;
    margin-bottom: 0.4rem;
}

/* 各キーのデザイン */
.fingerKey {
    position: relative;
    border: 2px solid rgba(255, 204, 128, 0.7);
    border-radius: 10px;
    width: 42px;
    height: 42px;
    margin: 0.25rem;
    font-size: 1.1rem;
    font-weight: 600;
    background: linear-gradient(135deg, #ffe0b2, #ffcc80);
    transition: all 0.2s ease;
    text-transform: uppercase;
    color: #5d4037;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.1);
    transform: translateZ(0);
}

.fingerKey:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15);
}

.fingerKey.active {
    background: linear-gradient(135deg, #ff7043, #ff5722);
    border-color: #d84315;
    color: #fff;
    box-shadow: 0 0 15px rgba(255, 112, 67, 0.5);
    animation: activeKeyPulse 1.5s infinite;
}

@keyframes activeKeyPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 112, 67, 0.5); }
    50% { box-shadow: 0 0 20px rgba(255, 112, 67, 0.8); }
}

.fingerKey.incorrect {
    background: linear-gradient(135deg, #d32f2f, #b71c1c);
    border-color: #7f0000;
    color: #fff;
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
    transform: translate3d(0, 0, 0);
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
    40%, 60% { transform: translate3d(3px, 0, 0); }
}

.fingerKey.correct-pressed {
    background: linear-gradient(135deg, #66bb6a, #43a047);
    border-color: #2E7D32;
    color: #fff;
    animation: keyPulse 0.5s ease-out;
}

@keyframes keyPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(76, 175, 80, 0.7); }
    50% { transform: scale(1.3); box-shadow: 0 0 20px rgba(76, 175, 80, 0.9); }
    100% { transform: scale(1); box-shadow: 0 0 0 rgba(76, 175, 80, 0); }
}

/* ---------- 指の図形 ---------- */

/* 指を並べる行 */
.fingerRow {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    margin-top: 0.8rem;
    transform: translateX(10px);
}

/* 両手の間のスペース */
.fingerSpacer {
    width: 40px;
}

/* 指の図形 */
.fingerShape {
    width: 40px;
    background: linear-gradient(to bottom, #e0e0e0, #bdbdbd);
    border-radius: 10px;
    margin: 0 0.2rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.fingerShape::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0));
    border-radius: 10px 10px 0 0;
}

.fingerShape.active {
    background: linear-gradient(to bottom, #ff7043, #ff5722);
    box-shadow: 0 0 15px rgba(255, 87, 34, 0.5);
    transform: translateY(-3px);
    animation: fingerPulse 1.5s infinite;
}

@keyframes fingerPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 87, 34, 0.5); }
    50% { box-shadow: 0 0 20px rgba(255, 87, 34, 0.8); }
}

/* 指の長さ（手の種類に合わせて調整） */
.fingerShape[data-finger="left-middle"],
.fingerShape[data-finger="right-middle"] {
    height: 75px;
}

.fingerShape[data-finger="left-ring"],
.fingerShape[data-finger="right-ring"] {
    height: 60px;
}

.fingerShape[data-finger="left-index"],
.fingerShape[data-finger="right-index"] {
    height: 50px;
}

.fingerShape[data-finger="left-pinky"],
.fingerShape[data-finger="right-pinky"] {
    height: 40px;
}

/* ---------- 追加: タイトル固定とゲームカード上寄せ ---------- */

/* ヘッダー：タイトルを画面上部に固定 */
.menu-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    text-align: center;
    padding: 1rem 0;
    background: rgba(255, 255, 255, 0.8); /* 背景を薄くして見やすく */
    z-index: 10;
}

/* main-content：ヘッダー分の高さ分の余白を確保し、カードは上寄せで配置 */
.main-content {
    width: 100%;
    padding: 80px 0 2rem 0; /* ヘッダーの高さ分（調整可） */
    display: flex;
    justify-content: center;
    /* align-itemsは指定せず、コンテンツは上から自然に表示される */
}

/* カード一覧を横並びで中央配置 */
.game-cards-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    max-width: 1200px;
}

/* 個別のカード（ブログ風のカード） */
.game-card {
    background-color: #fff8e1;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    width: 300px; /* 小さめのサイズ */
}

/* アイキャッチ画像 */
.game-card-image {
    width: 100%;
    height: auto;
    display: block;
}

/* カード内テキストとボタン */
.game-card-content {
    padding: 1.5rem;
}

.game-card-content p {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 1.5rem;
}

.game-card-content button {
    font-size: 2rem;
    padding: 1rem 2rem;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    background-color: #ff9800;
    color: #fff;
    transition: background 0.3s;
}

.game-card-content button:hover {
    background-color: #e68900;
}

/* リトライボタンのスタイル */
.retryBtn {
    display: block;
    margin: 1.5rem auto;
    padding: 0.8rem 2rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
    background-color: #ff5722;
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.retryBtn:hover {
    background-color: #e64a19;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.retryBtn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* リトライボタンのキラキラエフェクト */
.retryBtn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(60deg, rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 80%);
    transform: rotate(45deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%) rotate(45deg); }
    20%, 100% { transform: translateX(100%) rotate(45deg); }
}

.footer {
    text-align: center;
    margin-top: 4rem;
    padding: 2rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    width: 100%;
  }
