/* ===== リセット & 基本設定 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* カラーシステム */
    --primary-color: #FF6B6B;
    --secondary-color: #4ECDC4;
    --accent-color: #FFE66D;
    --bg-color: #FFF8F0;
    --text-color: #2F4858;
    --correct-color: #77DD77;
    --wrong-color: #FF6961;
    --disabled-color: #CCCCCC;
    
    /* フォントサイズ */
    --font-large: 24px;
    --font-medium: 20px;
    --font-small: 16px;
    --font-xsmall: 14px;
    
    /* スペーシング */
    --space-large: 20px;
    --space-medium: 15px;
    --space-small: 10px;
}

body {
    font-family: 'UD Shin Maru Go Regular', 'Arial Rounded MT Bold', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: var(--space-medium);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* ===== ゲームコンテナ ===== */
#game-container {
    width: 100%;
    max-width: 380px;
    min-height: 600px;
    max-height: 90vh;
    background-color: white;
    border-radius: 25px;
    padding: var(--space-large);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ===== スタート画面 ===== */
#start-screen {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s;
}

#start-screen h1 {
    color: var(--primary-color);
    font-size: 36px;
    margin-bottom: var(--space-large);
    text-align: center;
}

.start-button {
    background-color: var(--primary-color);
    color: white;
    padding: var(--space-medium) var(--space-large);
    border-radius: 50px;
    font-size: 24px;
    border: none;
    width: 80%;
    max-width: 250px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transition: all 0.3s;
    animation: pulse 2s infinite;
    touch-action: manipulation;
}

.start-button:hover {
    transform: scale(1.05);
    background-color: #E55A5A;
}

/* ===== クイズ画面 ===== */
#quiz-screen {
    flex: 1;
    display: none;
    flex-direction: column;
    height: 100%;
}

.hidden {
    display: none;
}

/* 上部コントロールバー */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-small) 0;
    position: sticky;
    top: 0;
    background: white;
    z-index: 100;
}

/* ===== 問題エリア ===== */
#question-area {
    font-size: var(--font-large);
    margin: var(--space-medium) 0;
    color: var(--primary-color);
    font-weight: bold;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-small);
    text-align: center;
    line-height: 1.4;
}

/* ===== 選択肢エリア ===== */
#options-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-small);
    margin-bottom: var(--space-small);
    min-height: 0;
    overflow-y: auto;
    padding: var(--space-small) 0;
    scrollbar-width: none;
}

#options-area::-webkit-scrollbar {
    display: none;
}

.option-item {
    list-style: none;
}

.option {
    background: var(--secondary-color);
    color: white;
    padding: var(--space-medium);
    border-radius: 50px;
    font-size: var(--font-medium);
    transition: all 0.3s;
    border: none;
    width: 100%;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    display: block;
    touch-action: manipulation;
}

.option:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.option:disabled {
    background: var(--disabled-color);
    cursor: not-allowed;
    transform: none;
}

/* ===== 結果表示 ===== */
#result-area {
    font-size: var(--font-large);
    margin: var(--space-small) 0;
    min-height: 60px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 var(--space-small);
}

.correct {
    color: var(--correct-color);
    animation: correct 0.6s;
}

.wrong {
    color: var(--wrong-color);
    animation: wrong 0.4s;
}

/* ===== ボタングループ ===== */
.button-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-small);
    margin-top: var(--space-medium);
}

#next-btn, #restart-btn {
    background: var(--primary-color);
    color: white;
    padding: var(--space-medium) var(--space-large);
    border-radius: 50px;
    font-size: var(--font-medium);
    border: none;
    width: 100%;
    max-width: 250px;
    margin: 0 auto;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

#next-btn:hover, #restart-btn:hover {
    background: #E55A5A;
    transform: scale(1.03);
}

#restart-btn {
    background: var(--accent-color);
    color: var(--text-color);
    display: none;
}

/* ===== 連続正解カウンター ===== */
#combo-counter {
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: all 0.3s;
}

/* 5問ごとのエフェクト */
.combo-tier-1 { background-color: #FF6B6B !important; box-shadow: 0 0 15px #FF6B6B; }
.combo-tier-2 { background-color: #FFE66D !important; box-shadow: 0 0 20px #FFE66D; animation: comboPulse 0.4s infinite; }
.combo-tier-3 { background-color: #4ECDC4 !important; box-shadow: 0 0 25px #4ECDC4; animation: comboPulse 0.3s infinite; }
.combo-tier-4 { background-color: #9C6BFF !important; box-shadow: 0 0 30px #9C6BFF; animation: comboPulse 0.2s infinite; }
.combo-tier-max {
    background: linear-gradient(45deg, #FF6B6B, #FFE66D, #4ECDC4, #9C6BFF) !important;
    box-shadow: 0 0 40px rgba(156, 107, 255, 0.8);
    animation: rainbowBg 2s infinite, comboPulse 0.5s infinite;
}

/* ===== 言語切替ボタン ===== */
#language-switch {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: var(--space-small) var(--space-medium);
    border-radius: 20px;
    font-size: var(--font-small);
    cursor: pointer;
    transition: all 0.3s;
}

#language-switch:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

/* ===== アニメーション ===== */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes correct {
    0% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes wrong {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

@keyframes comboPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes rainbowBg {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

/* ===== 言語切り替え ===== */
.lang-en, .is-english .lang-ja {
    display: none;
}

.is-english .lang-en, .lang-ja {
    display: inline;
}

/* ===== レスポンシブ対応 ===== */
@media (max-width: 480px) {
    :root {
        --font-large: 22px;
        --font-medium: 18px;
        --space-large: 20px;
    }
    
    #game-container {
        padding: var(--space-medium);
    }
    
    .start-button {
        font-size: 22px;
        padding: var(--space-medium);
    }
    
    #question-area {
        font-size: 20px;
        margin: 15px 0;
    }
    
    .option {
        padding: 12px;
        font-size: 16px;
    }
}

@media (max-width: 350px) {
    :root {
        --font-large: 20px;
        --font-medium: 16px;
    }
    
    #combo-counter {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    #language-switch {
        font-size: var(--font-xsmall);
    }
}

/* ==== コンボエフェクト修正版 ==== */
/* ==== シンプルなコンボエフェクト ==== */
/* ===== コンボ表示（文字のみ100%保証）===== */
/* ===== コンボ表示スタイル ===== */
.combo-effect {
    position: absolute;
    top: 30%;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 100;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
    border-radius: 50px;
    overflow: hidden;
  }
  
  .combo-text {
    font-weight: 900;
    font-size: clamp(32px, 5vw, 48px);
    line-height: 1;
    display: inline-block;
    white-space: nowrap;
    padding: 0.3em 0.8em;
    border-radius: inherit;
    /* アニメーション */
    animation: 
      comboScale 0.8s ease-out,
      comboFade 1s ease-out;
    transform-origin: center;
    /* テキストシャドウ */
    text-shadow: 
      0 0 5px rgba(0,0,0,0.3),
      0 0 2px rgba(255,255,255,0.8);
  }
  
  /* コンボレベル別スタイル */
  .combo-tier-1 {
    background-color: #FFE66D; /* 黄色 */
  }
  .combo-tier-1 .combo-text {
    color: #2F4858; /* 黄色背景に映える濃い青灰色 */
  }
  
  .combo-tier-2 {
    background-color: #4ECDC4; /* 水色 */
  }
  .combo-tier-2 .combo-text {
    color: #5D4037; /* 水色背景に映える濃い茶色 */
  }
  
  .combo-tier-3 {
    background-color: #9C6BFF; /* 紫 */
  }
  .combo-tier-3 .combo-text {
    color: #FFE66D; /* 紫背景に映える黄色 */
  }
  
  .combo-tier-4 {
    background-color: #FF6B6B; /* 赤 */
  }
  .combo-tier-4 .combo-text {
    color: #004D40; /* 赤背景に映える深緑 */
  }
  
  .combo-tier-max {
    background: linear-gradient(45deg, 
      #FF6B6B, #FFE66D, #4ECDC4, #9C6BFF);
    background-size: 300% 300%;
  }
  .combo-tier-max .combo-text {
    color: #FFFFFF; /* グラデ背景には白文字 */
    animation: 
      comboScale 0.8s ease-out,
      comboFade 1s ease-out,
      comboBgScroll 3s linear infinite;
  }
  
  /* アニメーション */
  @keyframes comboScale {
    0% { transform: scale(0.2); }
    60% { transform: scale(1.1); }
    80% { transform: scale(0.95); }
    100% { transform: scale(1); }
  }
  
  @keyframes comboFade {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
  }
  
  @keyframes comboBgScroll {
    100% { background-position: 100% 100%; }
  }

/* .confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    opacity: 0;
    animation: confettiFall 1.5s ease-out;
} */

@keyframes confettiFall {
    0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
    100% { transform: translate(var(--tx, 100px), 150px) rotate(360deg) scale(0); opacity: 0; }
}

/* 最大コンボ時の特別エフェクト
.combo-tier-max .confetti {
    width: 12px;
    height: 12px;
    animation: maxConfetti 2s ease-out;
}

@keyframes maxConfetti {
    0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
    100% { transform: translate(var(--tx, 150px), 200px) rotate(720deg) scale(0); opacity: 0; }
} */