html, body {
    margin: 0;
    padding: 0;
    overflow-y: auto;   /* ← スワイプで上下移動できる */
}

body {
    background: #000;
    color: #fff;
    font-family: system-ui, sans-serif;
    width: 100vw;
    height: auto;       /* ← 画面高さを固定しない */
    display: flex;
    justify-content: center;
    align-items: flex-start; /* ★上寄せに変更 */
}

/* ゲーム全体の枠（高さ350pxに最適化） */
#game-root {
    width: 92vw;          /* ← 画面幅に合わせる */
    max-width: 900px;     /* ← ただし最大900pxまで */
    
    height: auto;         /* ← 高さ固定を解除 */
    max-height: none;

    background: #000;
    display: flex;
    flex-direction: column;

    overflow-y: auto;     /* ← スワイプ可能にする */
}


/* タイトル画面・ゲーム画面共通 */
#title-screen,
#game-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* タイトル画面 */
#title-screen {
    align-items: center;
    justify-content: center;
}

#game-title {
    font-size: 28px;
    text-align: center;
    margin-top: 6px;
}

#subtitle {
    margin-top: 4px;
    font-size: 18px;
    color: #ff3333;
}

#title-touch {
    margin-top: 40px;
    font-size: 18px;
    color: #66ccff;
}

#top-link{
    margin-top: 100px;
}

/* ステータスバー */
#status-bar {
    height: 32px;
    font-size: 16px;
    padding: 2px 4px;
    box-sizing: border-box;
    border-bottom: 1px solid #444;
    white-space: nowrap;
}

/* ステータス下の余白（1行） */
#status-space {
    height: 20px;
}

/* ゲームグリッド（横18 × 縦10） */
#grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(18, 1fr);
    grid-template-rows: repeat(10, 1fr);
    font-size: 5.0vw; /* スマホ向け最適化 */
}

/* PC向けフォントサイズ固定 */
@media (min-width: 900px) {
    #grid {
        font-size: 26px;
    }
}

/* グリッドセル */
.cell {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
}

/* ダイアログ */
#dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

#dialog-box {
    background: #222;
    color: #fff;
    padding: 16px 20px;
    border-radius: 8px;
    min-width: 240px;
    text-align: center;
    box-shadow: 0 0 10px #000;
    font-size: 24px;
}

#dialog-close {
    margin-top: 20px;
    padding: 6px 12px;
    background: #444;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 18px;
}

/* 縦向き時の警告画面 */
#rotate-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    font-size: 48px;
    text-align: center;
}

/* スマホ縦向き時はゲーム非表示 */
@media screen and (orientation: portrait) {
    #game-root {
        display: none;
    }
    #rotate-overlay {
        display: flex;
    }
}


