/* ==========================================================================
   1. 共通リセット & 基本設定
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    background-color: #1a1a2e;
    color: #ffffff;
    overflow-x: hidden;
    height: 100vh;
}

/* 画面上下に3%の隙間を作り、左右中央に寄せるラッパー */
.app-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 100vh;
    padding: 3vh 0; /* 上下3%の固定隙間 */
}

/* メインのゲーム表示領域（PC・タブレット最大1000px、スマホ横幅いっぱい） */
.game-container {
    width: 100%;
    max-width: 1000px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 0 20px;
}

/* コピーライトフッター */
.game-footer {
    width: 100%;
    text-align: center;
    padding-top: 10px;
    color: #6a6a8a;
    font-size: 0.8rem;
}

/* ==========================================================================
   2. 画面レイアウト & コンポーネント共通
   ========================================================================== */
.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 600px;
    animation: fadeIn 0.3s ease-in-out;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 各種ボタンの基本スタイル */
.btn {
    display: block;
    width: 100%;
    max-width: 300px;
    padding: 14px 20px;
    font-size: 1.1rem;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 12px;
}

.btn-primary {
    background: linear-gradient(135deg, #ff416c, #ff4b2b);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 65, 108, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 65, 108, 0.6);
}

.btn-secondary {
    background-color: #0f3460;
    color: white;
    border: 2px solid #1f4068;
}

.btn-secondary:hover {
    background-color: #1f4068;
}

.btn-link {
    background-color: transparent;
    color: #e43f5a;
    border: 2px solid #e43f5a;
}

.btn-link:hover {
    background-color: rgba(228, 63, 90, 0.1);
}
/* 入力グループ設定 */
.input-group {
    width: 100%;
    max-width: 400px;
    margin-bottom: 24px;
    text-align: center;
}

.input-group label {
    display: block;
    font-size: 1rem;
    margin-bottom: 8px;
    color: #e43f5a;
    font-weight: bold;
}

.input-group input[type="text"] {
    width: 100%;
    padding: 12px 20px;
    font-size: 1.1rem;
    border: 2px solid #0f3460;
    border-radius: 8px;
    background-color: #16213e;
    color: white;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input[type="text"]:focus {
    border-color: #ff416c;
}

.input-tip {
    display: block;
    font-size: 0.8rem;
    color: #6a6a8a;
    margin-top: 6px;
}

/* ベスト3ランキングボックス */
.best-ranking-box {
    width: 100%;
    max-width: 400px;
    background-color: #16213e;
    border: 2px solid #0f3460;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.best-ranking-box h3 {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: #f5b041;
}

.best-list {
    list-style: none;
}

.best-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #0f3460;
    font-size: 1.1rem;
}

.best-list li:last-child {
    border-bottom: none;
}

.best-list .medal {
    font-size: 1.3rem;
    width: 30px;
}

.best-list .name {
    flex: 1;
    text-align: left;
    padding-left: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.best-list .score {
    font-weight: bold;
    color: #4cd137;
}

/* ==========================================================================
   3. ゲームプレイ画面 & ステージ
   ========================================================================== */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 500px;
    background-color: #16213e;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 2rem; /* 採点の点数など全体の文字サイズ2倍を維持 */
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* ヘッダー内の各項目を中央揃えにして改行を綺麗に見せる */
.game-header .header-item {
    text-align: center;
    flex: 1;
}

#target-shape-display {
    color: #ff416c;
    font-size: 3rem; /* お題の図形の大きさを拡大維持 */
    margin-top: 5px; /* 改行後の隙間を少し調整 */
    display: inline-block;
}

#game-stage {
    width: 100%;
    max-width: 500px;
    height: 60vh; /* 機種に合わせて高さを動的に確保 */
    min-height: 400px;
    background-color: #0f3460;
    border: 4px solid #1f4068;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

/* 落下する図形のスタイル設定（大きめ表示） */
.falling-shape {
    position: absolute;
    font-size: 5rem;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    left: 50%;
    transform: translateX(-50%);
    animation: fallDown 2s linear forwards; /* 2秒かけて落下に変更 */
}

@keyframes fallDown {
    0% { top: -90px; }
    100% { top: 100%; }
}
/* ==========================================================================
   4. スタート・リザルト共通タイトル ＆ SNSボタン
   ========================================================================== */
.game-title {
    font-size: 2.2rem;
    text-align: center;
    color: #ffffff;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(255, 65, 108, 0.6);
    line-height: 1.2;
}

.game-title .subtitle {
    font-size: 1.2rem;
    color: #e43f5a;
    font-weight: normal;
}

.description-box {
    background-color: rgba(22, 33, 62, 0.7);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    line-height: 1.6;
}

.sns-group {
    width: 100%;
    max-width: 400px;
    margin-top: 20px;
    text-align: center;
    border-top: 1px solid #1f4068;
    padding-top: 15px;
}

.sns-group p {
    font-size: 0.9rem;
    color: #6a6a8a;
    margin-bottom: 10px;
}

.sns-buttons {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.btn-sns {
    flex: 1;
    padding: 10px;
    font-size: 0.9rem;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: white;
    transition: background-color 0.2s;
}

.btn-x { background-color: #000000; }
.btn-x:hover { background-color: #222222; }
.btn-threads { background-color: #000000; border: 1px solid #333333; }
.btn-threads:hover { background-color: #111111; }
.btn-copy { background-color: #4b6584; }
.btn-copy:hover { background-color: #778ca3; }

/* ==========================================================================
   5. 演出・モーダル ＆ ユーティリティ
   ========================================================================== */
#countdown-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(15, 52, 96, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

/* --- style.css 240行目付近（カウントダウン数字のサイズを拡大） --- */
#countdown-text {
    font-size: 8rem; /* カウントダウンの数字のフォントを2倍（4rem→8rem）に拡大 */
    font-weight: bold;
    color: #ff416c;
    animation: scalePulse 0.5s ease-in-out infinite alternate;
}

@keyframes scalePulse {
    from { transform: scale(0.8); }
    to { transform: scale(1.2); }
}

/* 全体ランキング用モーダル */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background-color: #1a1a2e;
    border: 3px solid #0f3460;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.ranking-table th, .ranking-table td {
    padding: 10px;
    border-bottom: 1px solid #0f3460;
}

.ranking-table th { color: #e43f5a; }

/* 汎用非表示クラス */
.hidden { display: none !important; }

/* --- style.css リザルト画面・モーダル調整（追加・上書き分） --- */
/* リザルト画面のテキスト要素をすべて中央揃えにする */
#result-screen {
    text-align: center;
}

/* 「ゲーム終了！」のタイトルサイズ拡大（約2倍） */
#result-screen .screen-title {
    font-size: 3.5rem; 
    margin-bottom: 20px;
    color: #ff416c;
}

/* 「あなたのスコア」のフォントサイズ拡大 */
.result-label {
    font-size: 2rem;
    color: #6a6a8a;
    margin-bottom: 10px;
}

/* スコア（例: -7点）のフォントサイズを倍に拡大 */
.result-score {
    font-size: 5rem; /* 倍以上の大きさに変更 */
    font-weight: bold;
    margin: 20px 0;
}

/* 「この記録をランキングに登録しますか？」等のテキストサイズ拡大 */
#ranking-registration {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center; /* 子要素（ボタンなど）を中央揃えにする */
    text-align: center;
    margin-bottom: 24px;
}

/* 「ランキングに登録する」ボタンを中央に配置 */
#btn-register-ranking {
    margin: 15px auto 0 auto; /* 左右マージンをautoにして中央揃え */
    display: block;
}

/* 「登録名: 魔王サマ」のテキストサイズ拡大 */
.register-name-preview {
    font-size: 2rem;
    color: #f5b041;
}

/* モーダルの閉じるボタンを中央揃えにする */
.modal-content .btn-secondary {
    margin: 15px auto 0 auto; /* 左右マージンをautoにして中央揃え */
    display: block;
}