/* CSSの一番上に追加 */
*, *::before, *::after {
    box-sizing: border-box;
}
body {
    background-color: #0b0e14;
    color: #ffffff;
    font-family: 'Exo 2', sans-serif, "Helvetica Neue", Arial;
    margin: 0;
    overflow-x: hidden;
}

/* --- メニューエリア（左上へ） --- */
/* 全要素のサイズ計算を正しくする（はみ出し防止） */
*, *::before, *::after {
    box-sizing: border-box;
}

/* メニューの左右振り分け */
.top-menu {
    position: fixed;
    top: 15px;
    left: 0;
    width: 100%;
    padding: 0 20px;
    display: flex;
    justify-content: space-between; /* 左と右に分ける */
    align-items: center;
    z-index: 1000;
}

/* パスワード入力の目玉用スタイル */
.password-wrapper {
    position: relative;
    width: 100%;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 12px;
    cursor: pointer;
    color: #94a3b8;
    -webkit-user-select: none;
    user-select: none;
}

.settings-label {
    display: block;
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 8px;
    text-align: left;
}

/* 携帯（スマホ）対応の調整 */
@media (max-width: 480px) {
    h1 { font-size: 1.8rem; }
    .game-container { gap: 15px; padding: 30px 10px; }
    .game-card { width: 100%; max-width: 320px; }
    
    /* スマホでは文字が重ならないよう少し小さく */
    #display-username { font-size: 14px; }
    .lang-btn { padding: 5px 8px; font-size: 12px; }
}

#auth-area {
    display: flex;
    align-items: center;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid #38bdf8;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: 0.3s;
}

.lang-btn:hover {
    background: #38bdf8;
    color: #000;
}

/* --- ヒーローエリア --- */
header {
    height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #1e293b 0%, #0b0e14 100%);
    border-bottom: 1px solid #38bdf866;
}
.hero { text-align: center; }
h1 { font-size: 2.5rem; text-shadow: 0 0 15px #38bdf8; margin-bottom: 10px; }

/* --- ゲームカード一覧 --- */
.game-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 50px 20px;
    flex-wrap: wrap;
}

.game-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 16px;
    padding: 20px;
    width: 280px;
    text-align: center;
    transition: all 0.3s ease;
}

.game-card:hover {
    transform: translateY(-10px);
    border-color: #38bdf8;
    box-shadow: 0 10px 30px rgba(56, 189, 248, 0.2);
}

.card-icon { font-size: 50px; margin-bottom: 10px; }

.play-button {
    display: block;
    background: #38bdf8;
    color: #0b0e14;
    text-decoration: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
    margin-top: 20px;
    transition: 0.2s;
    border: none;
    width: 100%; /* これが原因でpadding分はみ出ていました */
    box-sizing: border-box; /* ★これが必要！paddingを幅の中に含めます */
    cursor: pointer;
    text-align: center; /* aタグの場合に文字を中央に */
}
.play-button:hover { opacity: 0.8; }
.play-button:disabled { background: #334155; color: #94a3b8; cursor: not-allowed; }

/* --- モーダル設定 --- */
.modal {
    display: none;
    position: fixed;
    z-index: 2000; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.modal-content {
    background-color: #161b22;
    margin: 10% auto;
    padding: 30px;
    border: 1px solid #38bdf8;
    width: 90%;
    max-width: 400px;
    border-radius: 15px;
    position: relative;
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.4);
    animation: modalAnim 0.3s ease-out;
}

@keyframes modalAnim {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

.close {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 28px;
    cursor: pointer;
    color: #94a3b8;
}
.close:hover { color: #fff; }

.tab-menu {
    display: flex;
    margin-bottom: 25px;
    border-bottom: 1px solid #30363d;
}
.tab-menu button {
    flex: 1;
    background: none;
    border: none;
    color: #94a3b8;
    padding: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
}
.tab-menu button.active {
    color: #38bdf8;
    border-bottom: 2px solid #38bdf8;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    box-sizing: border-box;
    background: #0b0e14;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #fff;
}
.modal-content input:focus {
    border-color: #38bdf8;
    outline: none;
}