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

body {
    font-family: 'Microsoft JhengHei', 'PingFang TC', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    color: white;
    margin-bottom: 20px;
    font-size: 1.8rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.hidden {
    display: none !important;
}

/* 表單樣式 */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: bold;
}

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

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

/* 按鈕樣式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-right: 10px;
    margin-bottom: 10px;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #555;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.message {
    margin-top: 10px;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
}

.message.success {
    background: #d4edda;
    color: #155724;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
}

/* 遊戲區樣式 */
.game-header {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.player-info, .game-stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.card {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 2rem;
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.card:hover:not(.flipped):not(.matched) {
    transform: scale(1.05);
}

.card.flipped {
    background: white;
    color: #333;
    border: 2px solid #667eea;
}

.card.matched {
    background: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
    cursor: default;
}

.card .symbol {
    font-size: 2.5rem;
}

.card .name {
    font-size: 0.7rem;
    text-align: center;
    padding: 5px;
    word-break: break-word;
}

.card.flipped .symbol,
.card.matched .symbol {
    display: none;
}

.card:not(.flipped):not(.matched) .name {
    display: none;
}

/* 排行榜樣式 */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #ddd;
}

.leaderboard-table th {
    background: #f8f9fa;
    font-weight: bold;
    color: #555;
}

.leaderboard-table tr:nth-child(1) td {
    background: #ffd700;
    font-weight: bold;
}

.leaderboard-table tr:nth-child(2) td {
    background: #c0c0c0;
    font-weight: bold;
}

.leaderboard-table tr:nth-child(3) td {
    background: #cd7f32;
    font-weight: bold;
}

.leaderboard-table tr:hover {
    background: #f5f5f5;
}

/* 響應式設計 */
@media (max-width: 480px) {
    h1 {
        font-size: 1.4rem;
    }
    
    .card {
        font-size: 1.5rem;
    }
    
    .card .symbol {
        font-size: 1.8rem;
    }
    
    .game-header {
        flex-direction: column;
        gap: 10px;
    }
}
