/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4f46e5;
    --primary-dark: #3730a3;
    --secondary-color: #f59e0b;
    --accent-color: #10b981;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
}

/* 导航栏 */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.nav-brand i {
    font-size: 1.5rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
    border-radius: 1px;
}

.nav-toggle {
    display: none;
    cursor: pointer;
    font-size: 1.25rem;
}

/* 主要内容 */
.main {
    margin-top: 80px;
    min-height: calc(100vh - 80px);
}

.section {
    display: none;
    padding: 2rem 0;
}

.section.active {
    display: block;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-primary);
}

/* 首页英雄区域 */
.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    padding: 4rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.hero-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* 浮动卡片 */
.floating-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

.card-content h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.word-display {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.japanese {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.romaji {
    font-size: 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

.meaning {
    font-size: 1.25rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* 课程网格 */
.lesson-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.lesson-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.lesson-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.lesson-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.lesson-icon i {
    font-size: 1.5rem;
    color: white;
}

.lesson-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.lesson-card p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.lesson-progress {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transition: width 0.3s ease;
}

/* 练习模式 */
.practice-modes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.practice-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

.practice-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.practice-card i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.practice-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.practice-card p {
    color: var(--text-secondary);
}

/* 词典搜索 */
.dictionary-search {
    margin-bottom: 2rem;
}

.search-box {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.search-box input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    font-size: 1rem;
    outline: none;
}

.search-box button {
    padding: 1rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.search-box button:hover {
    background: var(--primary-dark);
}

.dictionary-results {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.no-results {
    text-align: center;
    color: var(--text-secondary);
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* 进度概览 */
.progress-overview {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
    align-items: start;
}

.progress-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.progress-circle {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto;
}

.progress-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-circle path:first-child {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 3;
}

.progress-circle path:last-child {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 3;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 0.3s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.progress-percentage {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.stat-item {
    background: white;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.close {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 2rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }
    
    .nav-toggle {
        display: block;
    }
    
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-stats {
        justify-content: center;
    }
    
    .progress-overview {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .progress-stats {
        grid-template-columns: 1fr;
    }
    
    .lesson-grid {
        grid-template-columns: 1fr;
    }
    
    .practice-modes {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .nav {
        padding: 1rem;
    }
    
    .hero {
        padding: 2rem 1rem;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .floating-card {
        padding: 1.5rem;
    }
    
    .japanese {
        font-size: 1.5rem;
    }
}

/* 手写练习样式 */
.writing-practice {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.writing-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.character-type-selector {
    display: flex;
    gap: 0.5rem;
}

.character-type-selector .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.character-type-selector .btn.active {
    background: var(--primary-color);
    color: white;
}

.character-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.character-selector select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.writing-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.target-character {
    text-align: center;
    margin-bottom: 1rem;
}

.target-character span:first-child {
    font-size: 4rem;
    font-family: 'Noto Sans JP', sans-serif;
    color: var(--primary-color);
    display: block;
}

.target-character span:last-child {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-style: italic;
}

.canvas-container {
    position: relative;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: white;
}

#writingCanvas {
    display: block;
    cursor: crosshair;
    touch-action: none;
}

.canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.grid-lines {
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(229, 231, 235, 0.3) 1px, transparent 1px),
        linear-gradient(90deg, rgba(229, 231, 235, 0.3) 1px, transparent 1px);
    background-size: 50px 50px;
}

.writing-controls-bottom {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.writing-controls-bottom .btn {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

.writing-instructions {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin-top: 1rem;
}

.writing-instructions h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.writing-instructions ul {
    list-style-type: disc;
    padding-left: 1.5rem;
    color: var(--text-secondary);
}

.writing-instructions li {
    margin-bottom: 0.5rem;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

@media (max-width: 768px) {
    .writing-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .character-selector {
        justify-content: center;
    }
    
    .target-character span:first-child {
        font-size: 3rem;
    }
    
    #writingCanvas {
        width: 250px;
        height: 250px;
    }
    
    .writing-controls-bottom {
        flex-direction: column;
        align-items: center;
    }
}

/* 动漫听力练习样式 */
.anime-listening {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.anime-video-container {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.anime-video {
    position: relative;
    width: 100%;
    height: 400px;
    background: var(--bg-tertiary);
}

.anime-video video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: black;
}

.anime-video iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.video-info {
    padding: 1.5rem;
}

.video-info h4 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.video-info p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.video-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.duration,
.quality {
    color: var(--text-secondary);
    font-size: 0.875rem;
    background: var(--bg-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
}

.video-controls {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.video-controls .btn {
    flex: 1;
    min-width: 120px;
}

.vocabulary-preview {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.vocabulary-preview strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.5rem;
}

.vocabulary-preview span {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.listening-instructions {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin-top: 1rem;
}

.listening-instructions h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.listening-instructions ul {
    list-style-type: disc;
    padding-left: 1.5rem;
    color: var(--text-secondary);
}

.listening-instructions li {
    margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
    .anime-video {
        height: 250px;
    }
    
    .video-info h4 {
        font-size: 1.25rem;
    }
}
