/* ==================== */
/* リセットとベース設定 */
/* ==================== */

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

:root {
    /* ライトモードのカラー */
    --bg-color: #f0f4f8;
    --surface-color: #ffffff;
    --primary-color: #2196F3;
    --primary-hover: #1976D2;
    --secondary-color: #607D8B;
    --secondary-hover: #455A64;
    --danger-color: #f44336;
    --danger-hover: #d32f2f;
    --warning-color: #FF9800;
    --warning-hover: #F57C00;
    --success-color: #4CAF50;
    --text-color: #263238;
    --text-light: #546E7A;
    --border-color: #CFD8DC;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.15);

    /* カードカラー */
    --card-red: #e74c3c;
    --card-black: #2c3e50;
}

[data-theme="dark"] {
    --bg-color: #1a1a2e;
    --surface-color: #16213e;
    --primary-color: #3498db;
    --primary-hover: #2980b9;
    --secondary-color: #34495e;
    --secondary-hover: #2c3e50;
    --text-color: #ecf0f1;
    --text-light: #95a5a6;
    --border-color: #34495e;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.3s ease, color 0.3s ease;
}

/* ==================== */
/* 画面切り替え */
/* ==================== */

.screen {
    display: none;
    width: 100%;
    max-width: 1200px;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

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

.container {
    background: var(--surface-color);
    border-radius: 20px;
    padding: 40px 30px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

/* ==================== */
/* メインメニュー */
/* ==================== */

.game-title {
    font-size: 3rem;
    margin-bottom: 40px;
    color: var(--primary-color);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ==================== */
/* ボタンスタイル */
/* ==================== */

.btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: var(--shadow);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-hover);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: var(--warning-hover);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-install {
    background: var(--success-color);
    color: white;
}

.install-prompt {
    margin-top: 30px;
}

/* ==================== */
/* ルール画面 */
/* ==================== */

.rules-content {
    text-align: left;
    margin: 30px 0;
}

.rules-content h3 {
    color: var(--primary-color);
    margin: 20px 0 10px 0;
    font-size: 1.3rem;
}

.rules-content ul {
    margin-left: 20px;
    line-height: 1.8;
}

.rules-content p {
    line-height: 1.8;
    color: var(--text-light);
}

/* ==================== */
/* 設定画面 */
/* ==================== */

.settings-content {
    margin: 30px 0;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin-bottom: 15px;
    background: var(--bg-color);
    border-radius: 12px;
    border: 2px solid var(--border-color);
}

.setting-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1.1rem;
}

.setting-icon {
    font-size: 1.5rem;
}

/* トグルスイッチ */
.toggle-switch {
    position: relative;
    width: 60px;
    height: 30px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: 0.4s;
    border-radius: 30px;
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

.toggle-switch input:checked + .slider {
    background-color: var(--primary-color);
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(30px);
}

/* 言語選択 */
.language-select {
    padding: 10px 15px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-color);
    color: var(--text-color);
    cursor: pointer;
}

/* ==================== */
/* ゲーム画面 */
/* ==================== */

#game-screen {
    max-width: 1200px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: var(--surface-color);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.score-display {
    font-size: 1.2rem;
    font-weight: 600;
}

.game-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

/* プレイヤーエリア */
.player-area {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.player-area h3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.score-badge {
    background: var(--primary-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 1.1rem;
}

/* 手札 */
.hand {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 120px;
    justify-content: center;
    align-items: center;
}

/* カード */
.card {
    width: 80px;
    height: 110px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px;
    font-weight: bold;
    font-size: 1.2rem;
    position: relative;
    animation: dealCard 0.3s ease;
}

@keyframes dealCard {
    from {
        opacity: 0;
        transform: translateY(-20px) rotate(-5deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
}

.card.red {
    color: var(--card-red);
}

.card.black {
    color: var(--card-black);
}

.card-value {
    font-size: 1.5rem;
}

.card-suit {
    font-size: 2rem;
    text-align: center;
}

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

.card.back::after {
    content: "🎴";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
}

/* ゲーム情報 */
.game-info {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
}

.deck-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.deck-icon {
    font-size: 2rem;
}

.deck-count {
    font-size: 1.1rem;
    font-weight: 600;
}

.game-message {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary-color);
    padding: 10px;
}

/* ゲームアクション */
.game-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.game-actions .btn {
    flex: 1;
    max-width: 250px;
}

/* ==================== */
/* レスポンシブデザイン */
/* ==================== */

@media (max-width: 768px) {
    .game-title {
        font-size: 2rem;
    }

    .container {
        padding: 30px 20px;
    }

    .btn {
        font-size: 1rem;
        padding: 12px 24px;
    }

    .card {
        width: 65px;
        height: 90px;
        padding: 8px;
    }

    .card-value {
        font-size: 1.2rem;
    }

    .card-suit {
        font-size: 1.5rem;
    }

    .game-actions {
        flex-direction: column;
    }

    .game-actions .btn {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 1.8rem;
    }

    .setting-item {
        padding: 15px;
    }

    .setting-item label {
        font-size: 1rem;
    }
}
