/* style.css */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a90d9;
    --primary-dark: #357abd;
    --success-color: #27ae60;
    --success-dark: #1e8449;
    --danger-color: #e74c3c;
    --danger-dark: #c0392b;
    --warning-color: #f39c12;
    --warning-dark: #d68910;
    --gray-light: #ecf0f1;
    --gray: #95a5a6;
    --gray-dark: #7f8c8d;
    --text-color: #2c3e50;
    --bg-color: #f5f6fa;
    --card-bg: #ffffff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

html, body {
    height: 100vh;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

#app {
    height: 100vh;
    overflow: hidden;
}

/* スクリーン管理 */
.screen {
    display: none;
    height: 100vh;
    overflow: hidden;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* ロビー・パスワード・役割選択画面は従来通りスクロール可能 */
#lobby-screen.active,
#password-screen.active,
#role-screen.active {
    display: block;
    overflow-y: auto;
    padding: 20px;
}

/* 司会者・プレイヤー画面はフレックスレイアウト */
#master-screen.active,
#player-screen.active {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

/* 見出し */
h1 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-align: center;
}

h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--gray-dark);
}

/* セクション */
.section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

/* フォーム */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--gray-light);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ボタン */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--gray-light);
    color: var(--text-color);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--gray);
    color: white;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: var(--success-dark);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: var(--danger-dark);
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background-color: var(--warning-dark);
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.2rem;
    width: 100%;
    margin-bottom: 10px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-group {
    display: flex;
    gap: 10px;
}

.btn-group .btn {
    flex: 1;
}

/* 役割選択ボタン */
.role-buttons {
    margin: 20px 0;
}

.btn-master {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-master:hover:not(:disabled) {
    opacity: 0.9;
}

.btn-player {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-player:hover:not(:disabled) {
    opacity: 0.9;
}

/* 部屋一覧 */
.room-list {
    margin-top: 15px;
}

.room-item {
    background: var(--gray-light);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.room-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.room-item-info h3 {
    font-size: 1rem;
    margin-bottom: 3px;
}

.room-item-info p {
    font-size: 0.85rem;
    color: var(--gray-dark);
}

.room-item-arrow {
    font-size: 1.5rem;
    color: var(--gray);
}

/* ヘッダー */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header h1 {
    margin: 0;
    font-size: 1.3rem;
    flex: 1;
    text-align: left;
}

/* ゲーム情報 */
.game-info {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.game-info span {
    font-weight: 600;
}

/* 司会者コントロール */
.master-controls {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.judge-controls {
    margin: 20px 0;
}

.judge-controls.hidden {
    display: none;
}

.buzzed-player {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--danger-color);
}

/* 早押しボタン */
.buzz-section {
    text-align: center;
    margin-bottom: 20px;
}

.buzz-button {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(145deg, #e74c3c, #c0392b);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(231, 76, 60, 0.4);
    transition: all 0.1s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.buzz-button:disabled {
    background: linear-gradient(145deg, #bdc3c7, #95a5a6);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    cursor: not-allowed;
}

.buzz-button:not(:disabled):hover {
    transform: scale(1.02);
}

.buzz-button:not(:disabled):active {
    transform: scale(0.95);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

.buzz-icon {
    font-size: 3rem;
    margin-bottom: 5px;
}

.buzz-status {
    margin-top: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    min-height: 30px;
}

.buzz-status.success {
    color: var(--success-color);
}

.buzz-status.waiting {
    color: var(--warning-color);
}

.buzz-status.error {
    color: var(--danger-color);
}

/* スコア表示 */
.my-score {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: 600;
}

.my-score span {
    font-size: 2rem;
}

/* 参加者リスト */
.participants-section,
.scores-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.participants-list,
.scores-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.participant-item,
.score-item {
    background: var(--gray-light);
    border-radius: 8px;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.participant-item.master {
    background: linear-gradient(135deg, #667eea20 0%, #764ba220 100%);
    border: 2px solid #667eea;
}

.score-item.rank-1 {
    background: linear-gradient(135deg, #f1c40f20 0%, #f39c1220 100%);
    border: 2px solid #f1c40f;
}

.score-item.rank-2 {
    background: linear-gradient(135deg, #bdc3c720 0%, #95a5a620 100%);
    border: 2px solid #bdc3c7;
}

.score-item.rank-3 {
    background: linear-gradient(135deg, #cd6133 0%, #cd613320 100%);
    border: 2px solid #cd6133;
}

.participant-name,
.score-name {
    font-weight: 600;
}

.participant-badge {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-left: 8px;
}

.score-value {
    font-weight: 700;
    font-size: 1.1rem;
}

.score-rank {
    font-size: 1.2rem;
    margin-right: 10px;
}

/* 通知 */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-color);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    z-index: 1000;
    animation: slideDown 0.3s ease;
}

.notification.hidden {
    display: none;
}

.notification.success {
    background: var(--success-color);
}

.notification.error {
    background: var(--danger-color);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ステータステキスト */
.status-text {
    text-align: center;
    color: var(--gray-dark);
    margin-top: 15px;
    font-size: 0.9rem;
}

.room-name-display {
    text-align: center;
    font-size: 1.1rem;
    color: var(--gray-dark);
    margin-bottom: 20px;
}

/* ローディング */
.loading {
    text-align: center;
    color: var(--gray);
    padding: 20px;
}

/* レスポンシブ */
@media (max-width: 480px) {
    .screen {
        padding: 15px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .buzz-button {
        width: 180px;
        height: 180px;
    }

    .btn-large {
        padding: 14px 28px;
        font-size: 1.1rem;
    }
}

/* フェーズ表示 */
.phase-active { color: var(--primary-color); }
.phase-judging { color: var(--danger-color); }

/* 新UIスタイル */

/* トップツールバー */
.top-toolbar {
    background: var(--card-bg);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    flex-shrink: 0;
    height: 60px;
}

.top-toolbar h1 {
    margin: 0;
    font-size: 1.3rem;
}

.toolbar-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* 司会者レイアウト */
.master-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 20px;
    padding: 20px;
    overflow: hidden;
}

.player-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 20px;
    padding: 20px;
    overflow: hidden;
}

/* 左サイドバー */
.left-sidebar {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

/* 設定パネル */
.settings-panel {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.settings-panel h3 {
    margin: 0 0 15px 0;
    font-size: 1rem;
    color: var(--text-color);
}

.settings-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-content-readonly {
    font-size: 0.9rem;
    color: var(--gray-dark);
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.setting-item label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
}

.setting-input {
    padding: 8px;
    border: 2px solid var(--gray-light);
    border-radius: 6px;
    font-size: 0.9rem;
}

.setting-number {
    width: 60px;
    padding: 6px;
    border: 2px solid var(--gray-light);
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

/* アクティビティログ */
.activity-log {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.activity-log h3 {
    margin: 0 0 15px 0;
    font-size: 1rem;
    color: var(--text-color);
}

.activity-log-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
}

.activity-item {
    padding: 10px;
    border-left: 3px solid var(--primary-color);
    background: var(--gray-light);
    border-radius: 4px;
    font-size: 0.85rem;
}

.activity-item .timestamp {
    color: var(--gray);
    font-size: 0.75rem;
    margin-right: 8px;
}

.activity-item .message {
    color: var(--text-color);
}

/* 中央エリア */
.center-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.center-area-player {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}


/* プレイヤーカードグリッド */
.player-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 10px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* プレイヤーカード */
.player-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.2s;
    cursor: move;
}

.player-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Sortable用スタイル */
.sortable-ghost {
    opacity: 0.4;
    background: var(--gray-light);
}

.sortable-drag {
    opacity: 0.8;
}

.player-card.winner {
    border: 3px solid gold;
    background: linear-gradient(135deg, #fff9e6 0%, #ffffff 100%);
}

.player-card.eliminated {
    opacity: 0.5;
    background: #f0f0f0;
}

/* 早押し成功したプレイヤーのカードをハイライト */
.player-card.buzzed {
    border: 3px solid #4a90d9;
    box-shadow: 0 4px 15px rgba(74, 144, 217, 0.3);
}

.player-card .player-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-color);
}

.score-display {
    display: flex;
    justify-content: space-around;
    gap: 15px;
    margin-top: 10px;
}

.score-item-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.score-symbol {
    font-size: 2rem;
}

.score-symbol.correct {
    color: #27ae60;
}

.score-symbol.incorrect {
    color: #e74c3c;
}

.score-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
}

/* コンパクトスコア表示 */
.score-display-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.8rem;
    font-weight: 700;
}

.score-number {
    font-size: 1.8rem;
    font-weight: 700;
}

.score-number.correct {
    color: #27ae60;
}

.score-number.incorrect {
    color: #e74c3c;
}

.score-separator {
    color: var(--gray);
    font-size: 1.5rem;
}


/* 下部コントロール */
.bottom-controls {
    background: var(--card-bg);
    padding: 20px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    max-height: 280px;
    overflow-y: auto;
}

.bottom-controls-player {
    background: var(--card-bg);
    padding: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.controls-row {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.controls-row:last-child {
    margin-bottom: 0;
}

.judge-row {
    background: var(--gray-light);
    padding: 15px;
    border-radius: 8px;
}

.main-judge-row {
    gap: 15px;
}

.main-judge-row .btn {
    flex: 1;
    padding: 12px 24px;
}

.secondary-controls {
    justify-content: center;
}


/* 新しい早押しボタン */
.buzz-button-new {
    padding: 12px 24px;
    border-radius: 8px;
    background: linear-gradient(145deg, #e74c3c, #c0392b);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(231, 76, 60, 0.4);
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.buzz-button-new:disabled {
    background: linear-gradient(145deg, #bdc3c7, #95a5a6);
    cursor: not-allowed;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.buzz-button-new:not(:disabled):hover {
    background: linear-gradient(145deg, #c0392b, #a93226);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.5);
}

.buzz-button-new:not(:disabled):active {
    transform: scale(0.98);
}

/* プレイヤー画面の参加者一覧グリッド */
.player-cards-grid-player {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 10px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* レスポンシブ調整 */
@media (max-width: 1024px) {
    .master-layout,
    .player-layout {
        flex-direction: column;
        height: auto;
    }

    .left-sidebar {
        width: 100%;
    }

    .player-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .buzz-button-new {
        width: 250px;
        height: 250px;
    }
}

@media (max-width: 768px) {
    .controls-row {
        flex-wrap: wrap;
    }

    .player-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }

    .buzz-button-new {
        width: 200px;
        height: 200px;
    }

    .buzz-button-new .buzz-icon {
        font-size: 3rem;
    }

    .buzz-button-new .buzz-text {
        font-size: 1.4rem;
    }
}

/* ロール変更ボタン */
.btn-warning {
    background-color: #f39c12;
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background-color: #e67e22;
}

.btn-success {
    background-color: #27ae60;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #229954;
}

.btn-small {
    padding: 6px 12px;
    font-size: 14px;
    margin-left: 8px;
}

#player-to-master-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ツールバー右側のボタングループ */
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* チャットスペース（機能4） */
.chat-space {
    background: var(--card-bg);
    padding: 15px 20px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    height: 200px;
    overflow-y: auto;
}

.chat-space h3 {
    margin: 0 0 15px 0;
    font-size: 1rem;
    color: var(--text-color);
}

.chat-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-item {
    padding: 8px 12px;
    border-left: 3px solid var(--primary-color);
    background: var(--gray-light);
    border-radius: 4px;
    font-size: 0.85rem;
}

.chat-item .timestamp {
    color: var(--gray);
    font-size: 0.75rem;
    margin-right: 8px;
}

.chat-item .message {
    color: var(--text-color);
}

/* 早押し順バッジ */
.player-card {
    position: relative; /* バッジの配置用 */
}

.buzz-order-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.75);
    padding: 4px 10px;
    border-radius: 6px;
    z-index: 10;
}

.buzz-order-num {
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
}

.buzz-time-diff {
    color: #f39c12;
    font-size: 0.8rem;
    font-weight: 600;
}

/* 2番手以降のカード（黄色枠） */
.player-card.waiting {
    border: 3px solid #f39c12;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.35);
}

/* 左サイドバーのレイアウト */
.left-sidebar {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
}

/* ルールパネル */
.rules-panel {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 15px;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}

.rules-panel h3 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    color: var(--text-color);
}

.rules-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rule-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.rule-label {
    font-weight: 600;
    color: var(--gray);
}

/* チャットパネル */
.chat-panel {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 15px;
    box-shadow: var(--shadow);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-panel h3 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    color: var(--text-color);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 12px;
    padding: 10px;
    background: var(--gray-light);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-message {
    background: white;
    padding: 10px 12px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chat-message.chat-me {
    background: #e3f2fd;
    border-left: 3px solid var(--primary-color);
}

.chat-message.system-message {
    background: #f5f5f5;
    padding: 6px 10px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--gray);
    border-left: none;
}

.system-message .system-text {
    font-style: italic;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.chat-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-color);
}

.chat-time {
    font-size: 0.75rem;
    color: var(--gray);
}

.chat-text {
    font-size: 0.9rem;
    word-wrap: break-word;
    line-height: 1.4;
}

.chat-input-area {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.chat-input-area input {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--gray-light);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.chat-input-area input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 設定パネル（折りたたみ式） */
.settings-panel-collapsible {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}

.settings-panel-collapsible summary {
    cursor: pointer;
    font-weight: 600;
    padding: 12px 15px;
    background: var(--gray-light);
    border-radius: 12px;
    user-select: none;
    transition: background-color 0.2s;
}

.settings-panel-collapsible summary:hover {
    background: #d0d0d0;
}

.settings-panel-collapsible[open] summary {
    border-radius: 12px 12px 0 0;
}

.settings-panel-collapsible .settings-content {
    padding: 15px;
}

/* ゲームパッドキーコンフィグモーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--gray-light);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.btn-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
    padding: 0;
    width: 40px;
    height: 40px;
    line-height: 1;
}

.btn-close:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-body h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.modal-description {
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.gamepad-status {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 20px;
    padding: 10px;
    background: var(--gray-light);
    border-radius: 6px;
    text-align: center;
}

.config-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px;
    background: var(--gray-light);
    border-radius: 8px;
}

.config-item label {
    font-weight: 600;
    min-width: 120px;
}

.config-input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--gray-border);
    border-radius: 6px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.config-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.config-input.listening {
    border-color: var(--success-color);
    background: #e8f5e9;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(76, 175, 80, 0);
    }
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--gray-light);
    display: flex;
    justify-content: flex-end;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .left-sidebar {
        width: 250px;
    }

    .chat-panel {
        min-height: 250px;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .config-item {
        flex-wrap: wrap;
    }

    .config-item label {
        min-width: 100%;
    }
}