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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #228B22 0%, #3CB371 100%);
    height: 100%;
}

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

.container {
    display: flex;
    height: 100%;
    overflow: hidden;
}

.sidebar-toggle {
    position: fixed;
    top: 15px;
    left: 15px;
    width: 50px;
    height: 50px;
    font-size: 24px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: #228B22;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    display: none;
    transition: opacity 0.3s ease;
}

.sidebar-open .sidebar-toggle {
    opacity: 0;
    pointer-events: none;
}

.sidebar-close {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    font-size: 18px;
    border: none;
    border-radius: 50%;
    background: #f5f5f5;
    color: #666;
    cursor: pointer;
}

.sidebar {
    width: 100%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid #eee;
    position: relative;
    height: 100%;
}

.sidebar h3 {
    font-size: 16px;
    color: #228B22;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #228B22;
}

.voice-section {
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.voice-section h3 {
    color: #e91e63;
}

.voice-select {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    border: 2px solid #e91e63;
    border-radius: 12px;
    background: linear-gradient(135deg, #fff5f8 0%, #fff 100%);
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
}

.voice-select:hover {
    border-color: #c2185b;
    box-shadow: 0 2px 8px rgba(233, 30, 99, 0.2);
}

.voice-select:focus {
    outline: none;
    border-color: #c2185b;
    box-shadow: 0 2px 12px rgba(233, 30, 99, 0.3);
}

.search-section {
    padding-bottom: 12px;
}

.word-search {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 2px solid #228B22;
    border-radius: 25px;
    background: #fff;
    color: #333;
    outline: none;
    transition: all 0.3s;
    font-family: inherit;
}

.word-search:focus {
    border-color: #1a7a1a;
    box-shadow: 0 0 0 3px rgba(34, 139, 34, 0.1);
}

.word-search::placeholder {
    color: #999;
}

.category-section {
    margin-bottom: 12px;
}

.category-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-btn {
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid #ddd;
    border-radius: 18px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s;
    color: #666;
}

.category-btn:hover {
    border-color: #228B22;
    color: #228B22;
}

.category-btn.active {
    background: #228B22;
    color: #fff;
    border-color: #228B22;
}

.review-section {
    margin-bottom: 12px;
    padding: 15px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fff8 100%);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(76, 175, 80, 0.1);
}

.review-section h3 {
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 600;
    color: #2d5a27;
    display: flex;
    align-items: center;
    gap: 8px;
}

.review-section h3::before {
    content: '';
    width: 4px;
    height: 16px;
    background: linear-gradient(180deg, #4CAF50, #8BC34A);
    border-radius: 2px;
}

.review-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.review-filter-btn {
    flex: 1;
    min-width: calc(33.33% - 6px);
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.review-filter-btn:hover {
    border-color: #4CAF50;
    color: #4CAF50;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.review-filter-btn.active {
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    color: #fff;
    border-color: #4CAF50;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    transform: translateY(-2px);
}

.review-summary {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 0;
    background: rgba(76, 175, 80, 0.05);
    border-radius: 8px;
}

.review-summary span {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    color: #666;
}

.review-summary span strong {
    font-size: 18px;
    font-weight: 700;
    color: #2d5a27;
}

.word-section {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.word-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.word-btn {
    width: 38px;
    height: 38px;
    font-size: 18px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.word-btn:hover {
    border-color: #228B22;
    transform: scale(1.15);
}

.word-btn.active {
    background: #228B22 !important;
    color: #fff !important;
    border-color: #228B22 !important;
}

.word-btn.learned {
    border-color: #4CAF50;
    background: #e8f5e9;
    color: #1b5e20;
}

.word-btn.learned::after {
    content: '✓';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: #4CAF50;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.word-btn.review {
    border-color: #FF9800;
    background: #fff3e0;
}

.word-btn.reviewed {
    border-color: #4CAF50;
    background: #e8f5e9;
    color: #1b5e20;
}

.word-btn.filtered-highlight {
    border-color: #228B22;
    background: #c8e6c9;
    color: #1b5e20;
    box-shadow: 0 0 10px rgba(34, 139, 34, 0.5);
    transform: scale(1.15);
}

.no-result {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 14px;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 15px;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
}

.word-info {
    text-align: center;
    margin-bottom: 10px;
}

.char-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 8px;
}

.word-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.stroke-hint {
    font-size: 42px;
    font-weight: bold;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.pinyin {
    font-size: 24px;
    color: rgba(255, 255, 255, 0.9);
}

.word-phrase {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 6px;
}

.review-count {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
    font-style: italic;
}

.sentence {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 30px;
    display: inline-block;
}

.speak-btn {
    font-size: 24px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.speak-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.mark-learned-btn,
.mark-review-btn {
    padding: 6px 12px;
    border: 2px solid #ddd;
    border-radius: 20px;
    background: #fff;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    margin-left: 8px;
}

.mark-learned-btn:hover,
.mark-review-btn:hover {
    transform: scale(1.05);
}

.mark-learned-btn.learned {
    background: #4CAF50;
    color: #fff;
    border-color: #4CAF50;
}

.mark-review-btn.reviewed {
    background: #ff9800;
    color: #fff;
    border-color: #ff9800;
}

.writing-area {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 15px;
}

.canvas-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.model-area {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.write-area {
    background: #fffef0;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.canvas-label {
    margin-top: 10px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.stroke-progress {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.stroke-progress-dots {
    display: flex;
    gap: 10px;
}

.stroke-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s;
}

.stroke-dot.active {
    background: #ffd700;
    box-shadow: 0 0 10px #ffd700;
}

.stroke-dot.done {
    background: #4ade80;
}

.instruction {
    text-align: center;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.control-btn {
    padding: 12px 20px;
    font-size: 14px;
    border: none;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.9);
    color: #228B22;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.control-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.control-btn.primary {
    background: #ffd700;
    color: #333;
}

.mode-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 10px 20px;
    font-size: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.mode-btn.active {
    background: #228B22;
    border-color: #228B22;
    color: #fff;
}

.effect-divider {
    color: rgba(255, 255, 255, 0.5);
    font-size: 18px;
}

.effect-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}

.effect-btn {
    padding: 8px 16px;
    font-size: 13px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
}

.effect-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.effect-btn.active {
    background: #1E90FF;
    border-color: #1E90FF;
    color: #fff;
}

.stars {
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 32px;
}

.star {
    opacity: 0.2;
    transition: all 0.3s;
}

.star.active {
    opacity: 1;
    animation: starPop 0.5s ease;
}

@keyframes starPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.5); }
    100% { transform: scale(1); }
}

.celebration {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 1000;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

.celebration.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.celebration-text {
    font-size: 72px;
    font-weight: bold;
    background: linear-gradient(135deg, #FFD700, #FFA500, #FF6B6B, #FF69B4, #FFD700);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 2s ease infinite, celebrationPulse 0.8s ease infinite, textFloat 2s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8)) drop-shadow(0 0 40px rgba(255, 107, 107, 0.6));
    white-space: nowrap;
    position: relative;
}

.celebration-text::before,
.celebration-text::after {
    content: '✨';
    position: absolute;
    font-size: 36px;
    animation: starTwinkle 0.6s ease infinite alternate;
}

.celebration-text::before {
    left: -60px;
    top: 10px;
}

.celebration-text::after {
    right: -60px;
    top: 10px;
    animation-delay: 0.3s;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes celebrationPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8)); }
    50% { transform: scale(1.08); filter: drop-shadow(0 0 30px rgba(255, 215, 0, 1)) drop-shadow(0 0 60px rgba(255, 107, 107, 0.8)); }
}

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

@keyframes starTwinkle {
    0% { transform: scale(0.8) rotate(0deg); opacity: 0.6; }
    100% { transform: scale(1.2) rotate(20deg); opacity: 1; }
}

.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}

.confetti {
    position: absolute;
    top: -30px;
    width: 14px;
    height: 14px;
    animation: confettiFall linear forwards;
    box-shadow: 0 0 10px currentColor, 0 0 20px currentColor;
}

.confetti.shape-star {
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 14px solid currentColor;
    border-radius: 0;
    box-shadow: 0 0 10px currentColor, 0 0 20px currentColor;
}

.confetti.shape-heart {
    width: 14px;
    height: 14px;
    background: currentColor;
    transform: rotate(-45deg);
    box-shadow: 0 0 10px currentColor, 0 0 20px currentColor;
}

.confetti.shape-heart::before,
.confetti.shape-heart::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: inherit;
    border-radius: 50%;
}

.confetti.shape-heart::before {
    top: -7px;
    left: 0;
}

.confetti.shape-heart::after {
    top: 0;
    left: 7px;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg) scale(0.5);
        opacity: 0;
    }
}

.fireworks-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 998;
}

.firework {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 40px currentColor;
}

.firework-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transform-origin: center;
    animation: fireworkParticle 1.2s ease-out forwards;
    box-shadow: 0 0 6px currentColor, 0 0 12px currentColor;
}

@keyframes fireworkExplode {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    30% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

@keyframes fireworkParticle {
    0% {
        transform: rotate(0deg) translateX(0) scale(1);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: rotate(360deg) translateX(100px) scale(0);
        opacity: 0;
    }
}

.sparkle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 997;
}

.sparkle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, #fff 0%, transparent 70%);
    border-radius: 50%;
    animation: sparkleFloat 3s ease-in-out infinite;
    box-shadow: 0 0 10px #FFD700, 0 0 20px #FFA500;
}

@keyframes sparkleFloat {
    0%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.3;
    }
    50% {
        transform: translateY(-30px) scale(1.5);
        opacity: 1;
    }
}

.screen-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(255, 215, 0, 0.4) 50%, transparent 70%);
    pointer-events: none;
    z-index: 1001;
    opacity: 0;
    animation: screenFlash 0.6s ease-out forwards;
}

@keyframes screenFlash {
    0% { opacity: 0; transform: scale(0); }
    30% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0; transform: scale(1.5); }
}

@media (max-width: 800px) {
    .sidebar-toggle {
        display: block;
    }

    .sidebar-close {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        width: 100%;
        z-index: 90;
        transition: left 0.3s ease;
        border-right: 1px solid #eee;
        border-bottom: none;
        box-sizing: border-box;
    }
    
    .sidebar.open {
        left: 0;
    }

    .container {
        flex-direction: column;
        height: 100%;
    }

    .main-content {
        padding-top: 20px;
        height: 100%;
    }

    .writing-area {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .controls {
        gap: 6px;
    }

    .control-btn {
        padding: 10px 16px;
        font-size: 12px;
    }

    .mode-controls {
        gap: 6px;
    }

    .mode-btn {
        padding: 8px 14px;
        font-size: 12px;
    }

    .effect-btn {
        padding: 6px 12px;
        font-size: 11px;
    }

    .celebration-text {
        font-size: 48px;
    }

    .celebration-text::before,
    .celebration-text::after {
        font-size: 24px;
    }

    .celebration-text::before {
        left: -40px;
    }

    .celebration-text::after {
        right: -40px;
    }
}

.rating-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.rating-modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.rating-content {
    background: linear-gradient(135deg, #fff 0%, #f5f5f5 100%);
    border-radius: 24px;
    padding: 30px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

.rating-header {
    text-align: center;
    margin-bottom: 25px;
}

.rating-header h3 {
    font-size: 20px;
    color: #333;
    margin-bottom: 15px;
    border-bottom: none;
}

.rating-char {
    font-size: 64px;
    font-weight: bold;
    color: #228B22;
    display: block;
}

.rating-scale {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.rating-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 10px;
    border: 2px solid #ddd;
    border-radius: 16px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 70px;
}

.rating-btn:hover {
    border-color: #228B22;
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(34, 139, 34, 0.2);
}

.rating-btn:active {
    transform: translateY(-1px);
}

.rating-icon {
    font-size: 32px;
    margin-bottom: 5px;
}

.rating-label {
    font-size: 12px;
    color: #666;
}

.rating-btn.selected,
.rating-btn.selected:hover {
    background: linear-gradient(135deg, #228B22 0%, #3CB371 100%);
    border-color: #228B22;
    color: #fff;
}

.rating-btn.selected .rating-label {
    color: #fff;
}

.rating-tips {
    text-align: center;
    margin-top: 20px;
}

.rating-tips p {
    font-size: 14px;
    color: #888;
}

@media (max-width: 600px) {
    .rating-content {
        padding: 20px;
        margin: 20px;
    }
    
    .rating-scale {
        gap: 10px;
    }
    
    .rating-btn {
        min-width: 55px;
        padding: 12px 8px;
    }
    
    .rating-icon {
        font-size: 24px;
    }
    
    .rating-label {
        font-size: 10px;
    }
}