:root {
    --primary: #3b82f6;
    --primary-dark: #1e40af;
    --secondary: #22c55e;
    --secondary-dark: #15803d;
    --accent: #fde68a;
    --accent-dark: #fbbf24;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --bg: #f8fafc;
    --surface: #fff;
    --text: #22223b;
    --muted: #64748b;
    --border: #e5e7eb;
    --shadow: 0 4px 24px 0 rgba(30,41,59,0.08);
    --radius: 1rem;
    --radius-sm: 0.5rem;
    --radius-xs: 0.3rem;
    --transition: 0.2s cubic-bezier(.4,0,.2,1);
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-size: 16px;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 2rem;
    padding-left: 1rem;
    padding-right: 1rem;
}

.w-full { width: 100%; }
.max-w-3xl { max-width: 48rem; }
.bg-white { background: var(--surface); }
.p-6 { padding: 1.5rem; }
.sm\:p-8 { padding: 2rem; }
.rounded-xl { border-radius: var(--radius); }
.shadow-2xl { box-shadow: var(--shadow); }

header {
    margin-bottom: 2rem;
    text-align: center;
}
.text-4xl { font-size: 2.25rem; }
.font-bold { font-weight: 700; }
.text-sky-600 { color: var(--primary-dark); }
.text-slate-600 { color: var(--muted); }
.mt-2 { margin-top: 0.5rem; }

nav {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}
nav button {
    background: var(--secondary);
    color: #fff;
    font-weight: 600;
    padding: 0.5rem 1.5rem;
    border-radius: var(--radius-sm);
    border: none;
    box-shadow: 0 2px 8px 0 rgba(34,197,94,0.08);
    transition: background var(--transition), transform var(--transition);
    cursor: pointer;
    font-size: 1rem;
}
nav button:hover, nav button.active {
    background: var(--secondary-dark);
    transform: translateY(-2px) scale(1.03);
}

section {
    margin-bottom: 2rem;
}

#flashcardContainer {
    background: #f1f5f9;
    padding: 2rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 12px 0 rgba(30,41,59,0.08);
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.flashcard-field {
    margin-bottom: 1.5rem;
}
.flashcard-field:last-child {
    margin-bottom: 0;
}
.flashcard-field input {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 0.5rem 1rem;
    font-size: 1.1rem;
    width: 80%;
    margin: 0.5rem auto 0 auto;
    display: block;
    background: #fff;
    color: var(--text);
    transition: border var(--transition), box-shadow var(--transition);
}
.flashcard-field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px #bae6fd;
    outline: none;
}

.hanzi {
    font-size: 3rem;
    font-family: 'KaiTi', 'SimSun', serif;
    color: var(--primary-dark);
    margin: 0.5rem 0;
    letter-spacing: 0.05em;
}
td.hanzi {
    font-size: 2rem !important;
    color: var(--primary-dark);
}

.text-xl { font-size: 1.25rem; }
.text-center { text-align: center; }
.text-sky-600 { color: var(--primary-dark); }
.text-emerald-700 { color: var(--secondary-dark); }
.text-slate-500 { color: var(--muted); }
.text-yellow-600 { color: var(--accent-dark); }
.text-red-500 { color: var(--danger); }
.bg-yellow-100 { background: var(--accent); }
.bg-red-50 { background: var(--danger-bg); }
.bg-sky-50 { background: #f1f5f9; }
.bg-emerald-50 { background: #e0fbe5; }
.bg-white { background: #fff; }

.rounded-lg { border-radius: var(--radius-sm); }
.shadow-md { box-shadow: 0 2px 8px 0 rgba(30,41,59,0.08); }

.flashcard-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    margin-bottom: 1rem;
}
.flashcard-actions button {
    flex: 1 1 0;
    min-width: 120px;
    padding: 0.7rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-xs);
    box-shadow: 0 2px 8px 0 rgba(30,41,59,0.06);
    cursor: pointer;
    transition: background var(--transition), color var(--transition), transform var(--transition);
    background: var(--primary);
    color: #fff;
}
.flashcard-actions button:hover {
    background: var(--primary-dark);
    color: #fff;
    transform: translateY(-2px) scale(1.03);
}
#revealAnswerBtn {
    background: var(--accent-dark);
    color: #fff;
}
#revealAnswerBtn:hover {
    background: var(--accent);
    color: var(--text);
}
#nextFlashcardBtn {
    background: var(--secondary-dark);
    color: #fff;
}
#nextFlashcardBtn:hover {
    background: var(--secondary);
    color: #fff;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: 0 2px 8px 0 rgba(16,185,129,0.08);
}
th, td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
th {
    background: #f1f5f9;
    color: var(--secondary-dark);
    font-size: 1rem;
    font-weight: 600;
}
tr:last-child td {
    border-bottom: none;
}
tbody tr:hover {
    background: #f0fdf4;
    transition: background var(--transition);
}

footer {
    text-align: center;
    font-size: 0.95rem;
    color: var(--muted);
    margin-top: 3rem;
    margin-bottom: 2rem;
}

.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0; top: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.4);
}
.modal-content {
    background: #fff;
    margin: 10% auto;
    padding: 2rem;
    border: 1px solid var(--border);
    width: 90%;
    max-width: 420px;
    border-radius: var(--radius-sm);
    text-align: center;
    box-shadow: var(--shadow);
}
.modal-close-button {
    background: var(--primary-dark);
    color: #fff;
    padding: 0.6rem 2rem;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    margin-top: 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    transition: background var(--transition);
}
.modal-close-button:hover {
    background: var(--primary);
}

#vocabTableContainer {
}

@media (max-width: 600px) {
    .max-w-3xl { max-width: 100%; }
    .p-6, .sm\:p-8 { padding: 1rem; }
    .hanzi { font-size: 2rem; }
    td.hanzi { font-size: 1.2rem !important; }
    th, td { padding: 0.5rem; }
    #flashcardContainer { padding: 1rem; }
    .flashcard-actions { flex-direction: column; gap: 0.5rem; }
}
