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

body {
    font-family: "Segoe UI", "Microsoft JhengHei", sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4ecf7 100%);
    min-height: 100vh;
    color: #2d3748;
    padding: 20px;
}

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

.nav {
    background: #fff;
    padding: 14px 24px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.nav h1 { font-size: 20px; color: #2c5282; }
.nav a {
    color: #4299e1; text-decoration: none;
    margin-left: 18px; font-weight: 500;
}
.nav a:hover { color: #2b6cb0; }

.card {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    margin-bottom: 22px;
}
.card h2 {
    margin-bottom: 16px; color: #2d3748;
    font-size: 18px; padding-bottom: 10px;
    border-bottom: 2px solid #edf2f7;
}

.form-row {
    display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap;
}
.form-row input, .form-row select, .form-row textarea {
    flex: 1; min-width: 140px;
    padding: 10px 12px; border: 1px solid #cbd5e0;
    border-radius: 8px; font-size: 14px; outline: none;
    transition: border .2s;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
    border-color: #4299e1; box-shadow: 0 0 0 3px rgba(66,153,225,0.15);
}
.form-row textarea { min-height: 36px; }

button.btn {
    padding: 10px 20px; border: none;
    background: #4299e1; color: #fff;
    border-radius: 8px; cursor: pointer;
    font-size: 14px; font-weight: 500;
    transition: background .2s;
}
button.btn:hover { background: #2b6cb0; }
button.btn.danger { background: #e53e3e; }
button.btn.danger:hover { background: #c53030; }
button.btn.success { background: #38a169; }
button.btn.success:hover { background: #2f855a; }
button.btn:disabled { background: #a0aec0; cursor: not-allowed; }

table {
    width: 100%; border-collapse: collapse; margin-top: 10px;
}
th, td {
    padding: 10px 12px; text-align: left;
    border-bottom: 1px solid #e2e8f0; font-size: 14px;
}
th { background: #f7fafc; font-weight: 600; color: #4a5568; }
tr:hover td { background: #f7fafc; }

.badge {
    display: inline-block; padding: 3px 10px;
    border-radius: 20px; font-size: 12px; font-weight: 500;
}
.badge-blue { background: #bee3f8; color: #2c5282; }
.badge-green { background: #c6f6d5; color: #22543d; }

.deck-grid {
    display: grid; gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.deck-item {
    background: #fff; border-radius: 12px; padding: 18px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    transition: transform .2s, box-shadow .2s;
    cursor: pointer; border: 2px solid transparent;
}
.deck-item:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.deck-item.selected { border-color: #4299e1; background: #ebf8ff; }
.deck-item label {
    display: flex; align-items: flex-start;
    gap: 10px; cursor: pointer;
}
.deck-item input[type="checkbox"] { margin-top: 4px; transform: scale(1.3); }
.deck-item .deck-name { font-size: 16px; font-weight: 600; color: #2d3748; margin-bottom: 4px; }
.deck-item .deck-desc { font-size: 13px; color: #718096; margin-bottom: 8px; }
.deck-item .deck-count { font-size: 12px; }

.start-area { text-align: center; margin-top: 24px; }
.start-area .btn { font-size: 18px; padding: 14px 40px; }

.flashcard {
    max-width: 560px; margin: 0 auto;
    background: #fff; border-radius: 18px;
    padding: 50px 30px; text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.flashcard .label {
    color: #718096; font-size: 14px; margin-bottom: 10px;
    letter-spacing: 2px; text-transform: uppercase;
}
.flashcard .question {
    font-size: 44px; font-weight: 700;
    color: #2c5282; margin-bottom: 30px;
    line-height: 1.4;
}
.flashcard input[type="text"] {
    width: 100%; padding: 16px 20px;
    font-size: 22px; text-align: center;
    border: 2px solid #cbd5e0;
    border-radius: 12px; outline: none;
    transition: border .2s; margin-bottom: 18px;
}
.flashcard input[type="text"]:focus { border-color: #4299e1; box-shadow: 0 0 0 3px rgba(66,153,225,0.15); }

.result-box {
    margin-top: 22px; padding: 20px;
    border-radius: 12px; text-align: left;
}
.result-box.correct { background: #f0fff4; border: 1px solid #9ae6b4; }
.result-box.wrong { background: #fff5f5; border: 1px solid #feb2b2; }
.result-box .title { font-weight: 700; font-size: 18px; margin-bottom: 10px; }
.result-box.correct .title { color: #2f855a; }
.result-box.wrong .title { color: #c53030; }
.result-box .answers { color: #2d3748; font-size: 15px; }
.result-box .answers .row { padding: 4px 0; }
.result-box .answers strong { display: inline-block; width: 100px; color: #4a5568; }

.progress {
    max-width: 560px; margin: 0 auto 20px;
    display: flex; justify-content: space-between;
    align-items: center; padding: 0 6px; color: #4a5568;
}
.progress-bar {
    max-width: 560px; margin: 0 auto 30px; height: 10px;
    background: #e2e8f0; border-radius: 10px; overflow: hidden;
}
.progress-bar-fill {
    height: 100%; background: linear-gradient(90deg, #4299e1, #667eea);
    transition: width .4s ease;
}

.score-area {
    text-align: center; padding: 30px 20px;
}
.score-area .score { font-size: 72px; font-weight: 800; color: #4299e1; }
.score-area .score-label { font-size: 18px; color: #718096; margin-bottom: 20px; }

.alert {
    padding: 12px 16px; border-radius: 8px;
    margin-bottom: 14px; font-size: 14px;
}
.alert.success { background: #f0fff4; color: #22543d; border: 1px solid #9ae6b4; }
.alert.error { background: #fff5f5; color: #742a2a; border: 1px solid #feb2b2; }
