* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Meiryo', sans-serif;
    background: #f5f5dc;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

/* ページ全体のラッパー（広告エリア + コンテンツエリア） */
.page-wrapper {
    position: relative;
    min-height: 100vh;
    padding: 20px;
}

/* コンテンツエリア */
.content-area {
    position: absolute;
    left: 50%;
    top: 20px;
    transform: translateX(calc(-50% + 200px));
    max-width: 1300px;
    width: 100%;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* オンライン対戦ゲームページの横幅を縮小 */
.container {
    max-width: 533px;
}

.game-board {
    max-width: 100%;
}

.back-button-container {
    width: 100%;
    max-width: 100%;
    margin-bottom: 20px;
    transform: translateX(100px);
}

#back-to-title {
    background: linear-gradient(135deg, #4A90E2, #357ABD);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(74, 144, 226, 0.3);
}

#back-to-title:hover {
    background: linear-gradient(135deg, #357ABD, #2868A8);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(74, 144, 226, 0.4);
}

.online-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    flex: 1;
    min-width: 0;
    width: 100%;
}

.online-title {
    text-align: center;
    color: #667eea;
    font-size: 2.5rem;
    margin-bottom: 40px;
}

/* ユーザーセクション */
.user-section {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.user-info-container {
    display: flex;
    gap: 20px;
    flex: 1;
    align-items: flex-end;
}

.input-group {
    flex: 1;
    max-width: 300px;
}

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

.input-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.rating-display-group {
    display: flex;
    flex-direction: column;
    min-width: 100px;
}

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

.rating-value {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 3px 10px rgba(255, 215, 0, 0.4);
    border: 2px solid #FFD700;
}

.create-room-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    white-space: nowrap;
}

.create-room-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.ranking-button {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
    white-space: nowrap;
}

.ranking-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.6);
}

.confirm-username-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 11px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    white-space: nowrap;
    margin-left: 10px;
}

.confirm-username-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

/* ロビー全体のラッパー（白枠とチャットを横並び） */
.lobby-wrapper {
    display: flex;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    margin: 0;
    align-items: flex-start;
}

/* 部屋一覧セクション */
.room-list-section {
    width: 100%;
}

/* ロビーチャットコンテナ */
.lobby-chat-container {
    width: 380px;
    min-width: 380px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: 600px;
}

.lobby-chat-container .chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lobby-chat-container .chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: bold;
}

.lobby-chat-container .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ロビーチャットメッセージバブル */
.lobby-chat-container .chat-message {
    padding: 10px 15px;
    border-radius: 10px;
    max-width: 80%;
    animation: fadeIn 0.3s ease;
    word-wrap: break-word;
}

.lobby-chat-container .chat-message.my-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    align-self: flex-end;
    margin-left: auto;
}

.lobby-chat-container .chat-message.other-message {
    background: #e9ecef;
    color: #333;
    align-self: flex-start;
}

.lobby-chat-container .chat-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 0.85rem;
}

.lobby-chat-container .chat-message-username {
    font-weight: bold;
}

.lobby-chat-container .chat-message.my-message .chat-message-username,
.lobby-chat-container .chat-message.my-message .chat-message-time {
    color: rgba(255, 255, 255, 0.9);
}

.lobby-chat-container .chat-message.other-message .chat-message-username {
    color: #667eea;
}

.lobby-chat-container .chat-message-time {
    font-size: 0.75rem;
    opacity: 0.8;
}

.lobby-chat-container .chat-message-content {
    font-size: 0.95rem;
    line-height: 1.4;
}

.lobby-chat-container .chat-input-container {
    padding: 15px;
    background: white;
    border-radius: 0 0 15px 15px;
    display: flex;
    gap: 10px;
    border-top: 1px solid #e0e0e0;
}

.lobby-chat-container .chat-input-container input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s;
}

.lobby-chat-container .chat-input-container input:focus {
    border-color: #667eea;
}

.lobby-chat-container .chat-input-container button {
    padding: 10px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.lobby-chat-container .chat-input-container button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* レスポンシブ対応 */
@media (max-width: 1400px) {
    .page-wrapper {
        padding: 20px;
    }

    .content-area {
        position: relative;
        left: auto;
        top: auto;
        right: auto;
        max-width: 100%;
        margin-left: 150px;
    }
}

@media (max-width: 1200px) {
    .lobby-wrapper {
        flex-direction: column;
    }

    .lobby-chat-container {
        width: 100%;
        min-width: 100%;
        height: 400px;
    }
}

.room-list-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.room-table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.room-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.room-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.room-table th {
    padding: 15px 10px;
    text-align: center;
    font-weight: bold;
    font-size: 0.95rem;
    white-space: nowrap;
}

/* 対局者1と2のカラム幅を広げる */
.room-table th:nth-child(1),
.room-table th:nth-child(2) {
    width: 18%;
    min-width: 140px;
}

.room-table td:nth-child(1),
.room-table td:nth-child(2) {
    width: 18%;
    min-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: background-color 0.2s ease;
}

.room-table tbody tr:hover {
    background-color: #f8f9fa;
}

.room-table tbody tr:last-child {
    border-bottom: none;
}

.room-table td {
    padding: 12px 10px;
    text-align: center;
    font-size: 0.9rem;
}

.room-table tbody tr.empty-room {
    background-color: #fafafa;
}

.room-table tbody tr.empty-room:hover {
    background-color: #fafafa;
}

.room-table tbody tr.empty-room td {
    color: #ccc;
}

.no-rooms {
    text-align: center;
    color: #999;
    font-size: 1rem;
    padding: 40px 0;
}

/* ボタンスタイル */
.join-button {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.join-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.spectate-button {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.spectate-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
}

/* ページネーション */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
}

.pagination-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.pagination-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.pagination-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.page-info {
    color: #666;
    font-size: 0.95rem;
    font-weight: bold;
}

/* 部屋作成パネル */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.create-room-dialog {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px 15px 0 0;
}

.dialog-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.dialog-header .close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2em;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.dialog-header .close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.dialog-content {
    padding: 30px;
}

.setting-group {
    margin-bottom: 20px;
}

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

.setting-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.setting-group select:focus {
    outline: none;
    border-color: #667eea;
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding: 20px 30px;
    border-top: 1px solid #e0e0e0;
}

.cancel-button {
    background: #999;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cancel-button:hover {
    background: #777;
    transform: translateY(-2px);
}

.confirm-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.confirm-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

/* 待機画面 */
.waiting-message {
    background-color: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 3px solid #667eea;
    max-width: 600px;
}

.waiting-message h2 {
    font-size: 2em;
    color: #667eea;
    margin-bottom: 15px;
}

.waiting-message p {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.room-settings {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
}

.room-settings h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    text-align: left;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: white;
    border-radius: 6px;
}

.setting-label {
    color: #666;
    font-weight: bold;
}

.setting-value {
    color: #333;
}

/* 対局開始ボタン */
.game-start-button-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 500;
}

.game-start-button {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 20px 50px;
    border-radius: 12px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.4);
}

.game-start-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(76, 175, 80, 0.6);
}

/* 後手プレイヤーの盤面回転 */
.gote-view .game-board {
    display: flex;
    flex-direction: column-reverse;
}

.gote-view .shogi-board {
    transform: rotate(180deg);
}

.gote-view .shogi-board .cell {
    transform: rotate(180deg);
}

/* 後手プレイヤーの視点では、駒の向きを調整 */
.gote-view .shogi-board .piece.gote {
    transform: rotate(0deg); /* 後手の駒の回転を打ち消す */
}

.gote-view .shogi-board .piece.sente {
    transform: rotate(180deg); /* 先手の駒を回転 */
}

/* 後手プレイヤーの視点でも、持ち駒は常に正常な向きで表示 */
.gote-view .captured-piece.gote {
    transform: rotate(0deg);
}

.gote-view .captured-piece.sente {
    transform: rotate(0deg); /* 先手の持ち駒も正常な向き */
}

/* 後手プレイヤーのタイマー表示を上下反転 */
.gote-view .timer-container.online-mode .timer-display {
    display: flex;
    flex-direction: column-reverse;
}

/* 対局開始確認ダイアログ */
.game-start-confirm-dialog {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.game-start-confirm-dialog h3 {
    color: #333;
    font-size: 1.3rem;
    margin-bottom: 30px;
    line-height: 1.6;
}

.game-start-confirm-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.game-start-yes-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.game-start-yes-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
}

.game-start-no-btn {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.4);
}

.game-start-no-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.6);
}

/* レスポンシブデザイン */
@media (max-width: 1200px) {
    .online-container {
        max-width: 95%;
    }

    .room-table th,
    .room-table td {
        padding: 10px 5px;
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    .online-container {
        padding: 20px;
    }

    .online-title {
        font-size: 2rem;
    }

    .user-section {
        flex-direction: column;
        align-items: stretch;
    }

    .user-info-container {
        flex-direction: column;
        gap: 15px;
    }

    .input-group {
        max-width: 100%;
    }

    .rating-display-group {
        min-width: 100%;
    }

    .create-room-button {
        width: 100%;
    }

    .room-table th,
    .room-table td {
        padding: 8px 4px;
        font-size: 0.8rem;
    }

    .join-button,
    .spectate-button {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .pagination {
        flex-direction: column;
        gap: 10px;
    }

    .pagination-button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .back-button-container {
        max-width: 100%;
    }

    .online-title {
        font-size: 1.6rem;
    }

    .room-table th,
    .room-table td {
        padding: 6px 3px;
        font-size: 0.75rem;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .waiting-message {
        padding: 30px 20px;
    }

    .create-room-dialog {
        padding: 20px;
    }

    .dialog-header,
    .dialog-content,
    .dialog-footer {
        padding: 15px 20px;
    }
}

/* ランキングダイアログ */
.ranking-dialog {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.stats-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 10px;
}

.stat-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stat-label {
    display: block;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    color: #333;
    font-size: 1.4rem;
    font-weight: bold;
}

.ranking-table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.ranking-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ranking-table th {
    padding: 15px 10px;
    text-align: center;
    font-weight: bold;
    font-size: 0.95rem;
}

.ranking-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: background-color 0.2s ease;
}

.ranking-table tbody tr:hover {
    background-color: #f8f9fa;
}

.ranking-table tbody tr:last-child {
    border-bottom: none;
}

.ranking-table td {
    padding: 12px 10px;
    text-align: center;
    font-size: 0.9rem;
}

.ranking-table .my-rank {
    background-color: #fff9c4;
    font-weight: bold;
}

.ranking-table .my-rank:hover {
    background-color: #fff59d;
}

/* チャット機能 */
.game-container-wrapper {
    display: flex;
    gap: 20px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    transform: translateX(100px);
}

.chat-container {
    width: 350px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    max-height: 800px;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 15px 15px 0 0;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    padding: 10px 15px;
    border-radius: 10px;
    max-width: 80%;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

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

.chat-message.my-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    align-self: flex-end;
    margin-left: auto;
}

.chat-message.other-message {
    background: white;
    color: #333;
    align-self: flex-start;
    border: 1px solid #ddd;
}

.chat-message .message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 0.85rem;
    opacity: 0.8;
}

.chat-message .username {
    font-weight: bold;
}

.chat-message .timestamp {
    font-size: 0.75rem;
}

.chat-message .message-text {
    font-size: 0.95rem;
    line-height: 1.4;
}

.chat-input-container {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: white;
    border-top: 1px solid #ddd;
    border-radius: 0 0 15px 15px;
}

.chat-input-container input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.3s ease;
}

.chat-input-container input:focus {
    outline: none;
    border-color: #667eea;
}

.chat-input-container button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.chat-input-container button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chat-input-container button:active {
    transform: translateY(0);
}

/* チャット無効時のメッセージ */
.chat-disabled-message {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .stats-section {
        grid-template-columns: 1fr;
    }

    .ranking-button {
        width: 100%;
        margin-top: 10px;
    }

    .game-container-wrapper {
        flex-direction: column;
    }

    .chat-container {
        width: 100%;
        height: 400px;
        max-height: 400px;
    }
}
