/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #d32f2f;
    --primary-dark: #b71c1c;
    --primary-light: #ef5350;
    --secondary-color: #1976d2;
    --success-color: #388e3c;
    --danger-color: #d32f2f;
    --warning-color: #f57c00;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-primary: #212121;
    --text-secondary: #757575;
    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    
    /* HSK Level Colors */
    --hsk1-color: #4caf50;
    --hsk2-color: #2196f3;
    --hsk3-color: #ff9800;
    --hsk4-color: #f44336;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

body {
    font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    width: 100%;
}

/* Navigation */
.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: var(--spacing-sm) 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
}

.nav-brand {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.nav-brand h1 {
    font-family: 'Noto Sans SC', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.nav-brand span {
    font-size: 0.75rem;
    opacity: 0.9;
    font-weight: 400;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-base);
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: var(--spacing-sm);
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 0.625rem 1rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
    display: block;
    white-space: nowrap;
    font-size: 0.95rem;
}

.nav-menu a:hover,
.nav-menu a.active {
    background-color: rgba(255,255,255,0.2);
    transform: translateY(-1px);
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.user-menu-arrow {
    font-size: 0.7rem;
    transition: transform var(--transition-base);
}

.user-menu:hover .user-menu-arrow,
.user-menu.active .user-menu-arrow {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-base);
    list-style: none;
    padding: 0.5rem 0;
    z-index: 1000;
    margin: 0;
}

.user-menu:hover .user-dropdown,
.user-menu.active .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown li {
    margin: 0;
}

.user-dropdown a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all var(--transition-base);
    font-size: 0.95rem;
}

.user-dropdown a:hover {
    background-color: #f5f5f5;
    color: var(--primary-color);
    padding-left: 1.75rem;
}

.btn-register {
    background-color: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
}

.btn-register:hover {
    background-color: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.4);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: var(--spacing-xl) 0;
    margin-bottom: var(--spacing-xl);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="100" height="100" patternUnits="userSpaceOnUse"><path d="M 100 0 L 0 0 0 100" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.hero-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    font-family: 'Noto Sans SC', sans-serif;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.2rem;
    margin-bottom: var(--spacing-xl);
    opacity: 0.95;
    font-weight: 400;
}

/* HSK Level Cards */
.hsk-levels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-xl);
}

.hsk-level-card {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    text-align: center;
    text-decoration: none;
    color: white;
    transition: all var(--transition-base);
    border: 2px solid rgba(255,255,255,0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
}

.hsk-level-card:hover {
    transform: translateY(-8px) scale(1.02);
    background: rgba(255,255,255,0.25);
    box-shadow: var(--shadow-lg);
}

.hsk-level-card:active {
    transform: translateY(-4px) scale(1);
}

.hsk-level-card.level-1 { border-color: var(--hsk1-color); }
.hsk-level-card.level-2 { border-color: var(--hsk2-color); }
.hsk-level-card.level-3 { border-color: var(--hsk3-color); }
.hsk-level-card.level-4 { border-color: var(--hsk4-color); }

.level-number {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    background: rgba(255,255,255,0.2);
    border: 3px solid rgba(255,255,255,0.3);
    transition: all var(--transition-base);
}

.hsk-level-card:hover .level-number {
    transform: scale(1.1) rotate(5deg);
}

.level-1 .level-number { background: var(--hsk1-color); }
.level-2 .level-number { background: var(--hsk2-color); }
.level-3 .level-number { background: var(--hsk3-color); }
.level-4 .level-number { background: var(--hsk4-color); }

.level-info h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.level-info p {
    opacity: 0.9;
    font-size: 0.9rem;
}

/* Features Section */
.features {
    padding: var(--spacing-xl) 0;
}

.section-title {
    font-size: 2.2rem;
    text-align: center;
    margin-bottom: var(--spacing-xl);
    color: var(--text-primary);
    font-weight: 700;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
}

.feature-card {
    background: var(--card-bg);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: all var(--transition-base);
    text-align: center;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(211, 47, 47, 0.1), transparent);
    transition: left var(--transition-slow);
}

.feature-card:hover::before {
    left: 100%;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
    display: block;
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-sm);
    color: var(--primary-color);
    font-weight: 600;
}

.feature-card p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    line-height: 1.6;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    display: inline-block;
    text-align: center;
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: #616161;
    transform: translateY(-2px);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #2e7d32;
    transform: translateY(-2px);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    min-height: 36px;
    min-width: 36px;
}

/* Vocabulary Section */
.vocabulary-section {
    padding: var(--spacing-lg) 0;
    flex: 1;
}

.page-title {
    font-size: 2.2rem;
    margin-bottom: var(--spacing-lg);
    text-align: center;
    color: var(--text-primary);
    font-weight: 700;
}

.filter-section {
    background: var(--card-bg);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    margin-bottom: var(--spacing-lg);
}

.search-box {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.search-box input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: all var(--transition-base);
    min-height: 44px;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

.level-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: var(--spacing-sm);
}

.level-btn {
    padding: 0.625rem 1rem;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-base);
    font-weight: 500;
    min-height: 44px;
    touch-action: manipulation;
}

.level-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.level-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.results-info {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
}

.vocabulary-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.vocab-card {
    background: var(--card-bg);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    transition: all var(--transition-base);
    border: 1px solid var(--border-color);
    position: relative;
    cursor: pointer;
}

.vocab-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: transform var(--transition-base);
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.vocab-card:hover::after {
    transform: scaleY(1);
}

.vocab-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-light);
}

.vocab-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: var(--spacing-sm);
}

.chinese-char {
    font-family: 'Noto Sans SC', sans-serif;
    font-size: 2rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.2;
}

.vocab-level {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.pinyin {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.meanings {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.pos {
    display: inline-block;
    background: var(--bg-color);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: var(--spacing-lg);
    flex-wrap: wrap;
}

.pagination button {
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-base);
    min-height: 44px;
    min-width: 44px;
    font-size: 0.95rem;
    touch-action: manipulation;
}

.pagination button:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination button.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Flashcard Section */
.flashcard-section {
    padding: var(--spacing-lg) 0;
    flex: 1;
}

.flashcard-controls {
    background: var(--card-bg);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    margin-bottom: var(--spacing-lg);
    display: flex;
    gap: var(--spacing-md);
    align-items: end;
    flex-wrap: wrap;
}

.flashcard-controls select {
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    min-height: 44px;
    transition: all var(--transition-base);
}

.flashcard-controls select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

.flashcard-controls label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.flashcard-container {
    max-width: 600px;
    margin: 0 auto;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: var(--spacing-sm);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    transition: width var(--transition-base);
    width: 0%;
}

.progress-text {
    text-align: center;
    margin-bottom: var(--spacing-lg);
    font-weight: 500;
    color: var(--text-secondary);
}

.flashcard {
    width: 100%;
    height: 400px;
    perspective: 1000px;
    margin-bottom: var(--spacing-lg);
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
}

.flashcard-front {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.flashcard-back {
    background: white;
    color: var(--text-primary);
    transform: rotateY(180deg);
}

.card-content {
    text-align: center;
}

.chinese-char-large {
    font-family: 'Noto Sans SC', sans-serif;
    font-size: 4rem;
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
    line-height: 1.2;
}

.pinyin-text {
    font-size: 1.5rem;
    opacity: 0.9;
    margin-bottom: var(--spacing-sm);
}

.meaning-text {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-top: var(--spacing-sm);
    line-height: 1.5;
}

.pos-text {
    margin-top: var(--spacing-sm);
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.flashcard-actions {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    margin-bottom: var(--spacing-md);
}

.flashcard-stats {
    display: flex;
    justify-content: center;
    gap: var(--spacing-lg);
    background: var(--card-bg);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    min-width: 80px;
}

.stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Quiz Section */
.quiz-section {
    padding: var(--spacing-lg) 0;
    flex: 1;
}

.quiz-setup {
    max-width: 600px;
    margin: 0 auto;
}

.setup-card {
    background: var(--card-bg);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
}

.setup-card h2 {
    margin-bottom: var(--spacing-lg);
    text-align: center;
    color: var(--text-primary);
    font-weight: 600;
}

.setup-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.form-group select,
.form-group input {
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: all var(--transition-base);
    min-height: 44px;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

.quiz-container {
    max-width: 800px;
    margin: 0 auto;
}

.quiz-header {
    background: var(--card-bg);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    margin-bottom: var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.quiz-progress {
    flex: 1;
    min-width: 200px;
}

.quiz-score {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.quiz-question {
    background: var(--card-bg);
    padding: var(--spacing-xl);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.question-text {
    font-size: 2rem;
    font-family: 'Noto Sans SC', sans-serif;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
    line-height: 1.3;
}

.question-pinyin {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
}

.quiz-options {
    display: grid;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.option-btn {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 1.1rem;
    text-align: left;
    min-height: 60px;
    touch-action: manipulation;
}

.option-btn:hover {
    border-color: var(--primary-color);
    background: #fff5f5;
    transform: translateX(4px);
}

.option-btn.correct {
    background: #e8f5e9;
    border-color: var(--success-color);
    color: var(--success-color);
}

.option-btn.incorrect {
    background: #ffebee;
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.quiz-feedback {
    background: var(--card-bg);
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-sm);
    text-align: center;
}

.quiz-feedback.correct {
    background: #e8f5e9;
    color: var(--success-color);
    border-left: 4px solid var(--success-color);
}

.quiz-feedback.incorrect {
    background: #ffebee;
    color: var(--danger-color);
    border-left: 4px solid var(--danger-color);
}

.quiz-actions {
    text-align: center;
}

.quiz-result {
    max-width: 600px;
    margin: 0 auto;
}

.result-card {
    background: var(--card-bg);
    padding: var(--spacing-xl);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    text-align: center;
}

.result-card h2 {
    margin-bottom: var(--spacing-lg);
    color: var(--text-primary);
    font-weight: 600;
}

.result-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.score-circle {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
    font-weight: 700;
    box-shadow: var(--shadow-lg);
}

.score-details {
    display: flex;
    gap: var(--spacing-lg);
    justify-content: center;
    flex-wrap: wrap;
}

.score-details p {
    font-size: 1.1rem;
    font-weight: 500;
}

.result-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    flex-wrap: wrap;
}

/* User Stats Section */
.user-stats {
    padding: var(--spacing-xl) 0;
    background: var(--bg-color);
}

.progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
}

.progress-card {
    background: white;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    transition: all var(--transition-base);
}

.progress-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.progress-card h3 {
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
    font-weight: 600;
}

.progress-bar-container {
    margin-bottom: var(--spacing-sm);
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    transition: width var(--transition-base);
}

.progress-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Exercises Section */
.exercises-section {
    padding: var(--spacing-lg) 0;
    flex: 1;
}

.exercise-container {
    max-width: 900px;
    margin: 0 auto;
}

.exercise-header {
    background: white;
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    margin-bottom: var(--spacing-lg);
}

.exercise-header h2 {
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
    font-weight: 600;
}

.exercise-types {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.exercise-type-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-base);
    font-weight: 500;
    min-height: 44px;
    touch-action: manipulation;
}

.exercise-type-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.exercise-type-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.exercise-content {
    background: white;
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    margin-bottom: var(--spacing-lg);
    min-height: 300px;
}

.exercise-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}

.exercise-stats {
    display: flex;
    justify-content: center;
    gap: var(--spacing-lg);
    background: white;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: var(--spacing-lg) 0;
    text-align: center;
    margin-top: auto;
}

.footer p {
    margin: 0;
    opacity: 0.9;
}

/* Loading Animation */
.loading {
    text-align: center;
    padding: var(--spacing-lg);
    color: var(--text-secondary);
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Alert Messages */
.alert {
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-md);
    animation: fadeIn var(--transition-base);
    border-left: 4px solid;
}

.alert-error {
    background-color: #ffebee;
    color: #c62828;
    border-left-color: #c62828;
}

.alert-success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border-left-color: #2e7d32;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive Design - Mobile First */
@media (max-width: 768px) {
    .container {
        padding: 0 var(--spacing-sm);
    }
    
    /* Mobile Navigation */
    .mobile-menu-toggle {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
        flex-direction: column;
        padding: var(--spacing-md);
        gap: var(--spacing-sm);
        transform: translateX(-100%);
        transition: transform var(--transition-base);
        box-shadow: var(--shadow-lg);
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        z-index: 999;
    }
    
    .nav-menu.active {
        transform: translateX(0);
    }
    
    .nav-menu li {
        width: 100%;
    }
    
    .nav-menu a {
        width: 100%;
        padding: var(--spacing-sm) var(--spacing-md);
        border-radius: var(--radius-sm);
    }
    
    .user-menu {
        width: 100%;
    }
    
    .user-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: rgba(255, 255, 255, 0.1);
        margin-top: var(--spacing-sm);
        border-radius: var(--radius-sm);
    }
    
    .user-dropdown a {
        color: white;
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .user-dropdown a:hover {
        background-color: rgba(255, 255, 255, 0.2);
        padding-left: var(--spacing-md);
    }
    
    /* Hero Section */
    .hero {
        padding: var(--spacing-lg) 0;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: var(--spacing-lg);
    }
    
    .hsk-levels {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }
    
    .hsk-level-card {
        padding: var(--spacing-md);
    }
    
    .level-number {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    /* Features */
    .section-title {
        font-size: 1.8rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    /* Vocabulary */
    .vocabulary-list {
        grid-template-columns: 1fr;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .level-filters {
        justify-content: center;
    }
    
    /* Flashcard */
    .flashcard {
        height: 350px;
    }
    
    .chinese-char-large {
        font-size: 3rem;
    }
    
    .pinyin-text {
        font-size: 1.2rem;
    }
    
    .flashcard-actions {
        flex-direction: column;
    }
    
    .flashcard-actions .btn {
        width: 100%;
    }
    
    .flashcard-stats {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    /* Quiz */
    .quiz-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .quiz-progress {
        width: 100%;
    }
    
    .question-text {
        font-size: 1.5rem;
    }
    
    .question-pinyin {
        font-size: 1.1rem;
    }
    
    .option-btn {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 1rem;
    }
    
    .score-circle {
        width: 150px;
        height: 150px;
        font-size: 2.5rem;
    }
    
    /* Progress */
    .progress-grid {
        grid-template-columns: 1fr;
    }
    
    /* Exercises */
    .exercise-types {
        flex-direction: column;
    }
    
    .exercise-type-btn {
        width: 100%;
    }
    
    .exercise-stats {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    /* Buttons */
    .btn {
        width: 100%;
        max-width: 100%;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .result-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .nav-brand h1 {
        font-size: 1.2rem;
    }
    
    .nav-brand span {
        font-size: 0.65rem;
    }
    
    .hero-title {
        font-size: 1.5rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .chinese-char {
        font-size: 1.5rem;
    }
    
    .chinese-char-large {
        font-size: 2.5rem;
    }
    
    .flashcard {
        height: 300px;
    }
    
    .score-circle {
        width: 120px;
        height: 120px;
        font-size: 2rem;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn:hover,
    .hsk-level-card:hover,
    .feature-card:hover,
    .vocab-card:hover {
        transform: none;
    }
    
    .btn:active,
    .hsk-level-card:active,
    .feature-card:active,
    .vocab-card:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .footer,
    .btn,
    .flashcard-actions,
    .quiz-actions {
        display: none;
    }
    
    body {
        background: white;
    }
}
