:root {
    --primary: #4a6cf7;
    --primary-dark: #3a5bef;
    --success: #2e7d32;
    --error: #c62828;
    --warning: #ed6c02;
    --info: #0288d1;
    --light: #f5f7ff;
    --dark: #2d3748;
    --gray: #718096;
    --light-gray: #e2e8f0;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8fafc;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 30px;
}

header h1 {
    font-size: 1.5rem;
    color: var(--primary);
    margin: 15px 0;
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 10px 0;
}

nav a {
    color: var(--dark);
    text-decoration: none;
    padding: 5px 10px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

nav a:hover {
    background: var(--light);
    color: var(--primary);
}

.user-info {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 15px;
}

.logout-btn {
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
    padding: 5px 10px;
    border-radius: var(--border-radius);
}

.logout-btn:hover {
    background: rgba(231, 76, 60, 0.1);
}

main {
    min-height: calc(100vh - 200px);
}

footer {
    background: var(--dark);
    color: white;
    padding: 20px 0;
    margin-top: 40px;
}

footer p {
    text-align: center;
    opacity: 0.8;
}

.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 25px;
    margin-bottom: 25px;
}

h2 {
    color: var(--dark);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--light-gray);
}

h3 {
    color: var(--primary);
    margin-bottom: 15px;
}

.alert {
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.alert.success {
    background: rgba(46, 125, 50, 0.1);
    color: var(--success);
    border: 1px solid rgba(46, 125, 50, 0.3);
}

.alert.error {
    background: rgba(198, 40, 40, 0.1);
    color: var(--error);
    border: 1px solid rgba(198, 40, 40, 0.3);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--dark);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

form {
    margin-top: 15px;
}

input, textarea, select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.2);
}

.btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 10px 20px;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.85rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--light);
}

.btn-danger {
    background: var(--error);
}

.btn-danger:hover {
    background: #b71c1c;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

table th, table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--light-gray);
}

table th {
    background: var(--light);
    font-weight: 600;
    color: var(--dark);
}

table tr:hover {
    background: rgba(74, 108, 247, 0.03);
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 500;
}

.level-1 { background: #e8f5e9; color: #2e7d32; }
.level-2 { background: #e3f2fd; color: #0288d1; }
.level-3 { background: #f3e5f5; color: #7b1fa2; }
.level-4 { background: #fff8e1; color: #ed6c02; }
.level-5 { background: #ffebee; color: #b71c1c; }

/* 游戏页面样式 */
.game-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 25px;
    margin-bottom: 25px;
}

.instructions {
    background: var(--light);
    border-left: 4px solid var(--primary);
    padding: 15px;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    margin-bottom: 20px;
}

.game-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat-item {
    background: var(--light);
    padding: 10px 15px;
    border-radius: var(--border-radius);
    display: flex;
    gap: 8px;
}

.stat-label {
    font-weight: 600;
    color: var(--gray);
}

.stat-value {
    font-weight: bold;
    color: var(--dark);
}

.matching-game {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.words-column, .meanings-column {
    flex: 1;
    min-width: 300px;
    background: var(--light);
    border-radius: var(--border-radius);
    padding: 15px;
}

.words-column h3, .meanings-column h3 {
    text-align: center;
    margin-bottom: 15px;
    color: var(--primary);
}

.word-item, .meaning-item {
    padding: 12px;
    margin: 8px 0;
    background: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.word-item:hover, .meaning-item:hover {
    background: var(--light);
    transform: translateX(5px);
}

.word-item.selected, .meaning-item.selected {
    background: var(--primary);
    color: white;
    transform: scale(1.03);
}

.word-item.matched {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 3px solid #2e7d32;
}

.meaning-item.matched {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 3px solid #2e7d32;
}

.result-message {
    text-align: center;
    padding: 25px;
    margin-top: 20px;
    background: #e8f5e9;
    border-radius: var(--border-radius);
    border: 1px solid #2e7d32;
}

.highlight {
    font-weight: bold;
    color: var(--primary);
    font-size: 1.2em;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    position: relative;
    animation: modalOpen 0.3s;
}

@keyframes modalOpen {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
    transition: var(--transition);
}

.close:hover {
    color: var(--error);
    transform: rotate(90deg);
}

.modal h3 {
    margin-top: 0;
    padding: 15px 20px;
    border-bottom: 1px solid var(--light-gray);
}

/* 登录页面样式 */
.login-page {
    background: linear-gradient(135deg, #4a6cf7 0%, #6a89ff 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    padding: 30px;
    animation: loginBox 0.5s;
}

@keyframes loginBox {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-box h2 {
    text-align: center;
    margin-bottom: 25px;
    color: var(--primary);
    font-size: 2rem;
}
