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

body {
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    background: linear-gradient(135deg, #ffe4ec 0%, #ffe0f0 30%, #f0e6ff 70%, #e8f4ff 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.app {
    width: 100%;
    max-width: 480px;
    padding: 16px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 12px;
}

.header h1 {
    font-size: 1.5rem;
    color: #e91e63;
    margin-bottom: 6px;
    text-shadow: 1px 1px 2px rgba(233, 30, 99, 0.2);
}

.sub-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #888;
    padding: 0 4px;
}

.audio-icon {
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
    background: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    font-size: 0.8rem;
}

.audio-icon:hover {
    transform: scale(1.05);
}

.audio-icon.muted {
    opacity: 0.5;
    text-decoration: line-through;
    background: #f5f5f5;
}

.page-info {
    font-size: 0.8rem;
    color: #999;
}

/* Theme Selector */
.theme-selector {
    margin-bottom: 12px;
}

.theme-selector select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #f8bbd0;
    border-radius: 14px;
    font-size: 0.95rem;
    background: #fff;
    color: #555;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e91e63' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.theme-selector select:focus {
    border-color: #e91e63;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
    color: #999;
    font-family: inherit;
}

.tab.active {
    background: linear-gradient(135deg, #ff6b9d, #c44569);
    color: #fff;
    font-weight: 600;
}

.tab:hover:not(.active) {
    background: #fff5f8;
}

/* Flashcard Area */
.flashcard-area {
    perspective: 1200px;
    margin-bottom: 24px;
}

.flashcard {
    width: 100%;
    height: 320px;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 24px;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 10px 40px rgba(233, 30, 99, 0.15);
    padding: 24px;
}

.flashcard-front {
    background: linear-gradient(145deg, #ffffff 0%, #fff5f8 50%, #ffeef5 100%);
    border: 2px solid #ffc1e3;
}

.flashcard-back {
    background: linear-gradient(145deg, #fff0f5 0%, #f8e8ff 50%, #f0e8ff 100%);
    border: 2px solid #e1bee7;
    transform: rotateY(180deg);
}

.category-label {
    position: absolute;
    top: 18px;
    left: 22px;
    font-size: 0.75rem;
    color: #bbb;
    font-weight: 500;
    letter-spacing: 1px;
}

.difficulty-label {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 0.75rem;
    background: linear-gradient(135deg, #ffe4ec, #ffd6e8);
    padding: 3px 12px;
    border-radius: 20px;
    color: #e91e63;
    font-weight: 500;
}

.char-display {
    font-size: 5rem;
    font-weight: 700;
    color: #333;
    line-height: 1.1;
    margin-top: 10px;
}

.char-display.word-mode {
    font-size: 2.2rem;
    text-align: center;
    line-height: 1.4;
    max-width: 100%;
    word-break: break-all;
}

.char-display-back {
    font-size: 3.5rem;
    font-weight: 700;
    color: #555;
    margin-top: -4px;
}

.char-display-back.word-mode {
    font-size: 1.6rem;
    text-align: center;
    line-height: 1.4;
}

.pinyin-display {
    font-size: 1.6rem;
    color: #9c27b0;
    font-weight: 600;
    letter-spacing: 1px;
    text-align: center;
    line-height: 1.3;
}

.pinyin-display.word-mode {
    font-size: 1.1rem;
}

.flip-hint {
    font-size: 0.7rem;
    color: #ccc;
    position: absolute;
    bottom: 16px;
}

.audio-btn {
    position: absolute;
    bottom: 14px;
    right: 18px;
    border: none;
    background: linear-gradient(135deg, #ff6b9d, #c44569);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    padding: 8px 10px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(233, 30, 99, 0.3);
}

.audio-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.4);
}

.audio-btn:active {
    transform: scale(0.95);
}

/* Navigation */
.nav-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.nav-btn {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 16px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    font-family: inherit;
}

.nav-btn:first-child {
    background: #fff;
    color: #888;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.nav-btn:last-child {
    background: linear-gradient(135deg, #ff6b9d, #c44569);
    color: #fff;
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.35);
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.nav-btn:active {
    transform: translateY(0);
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: #f0f0f0;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b9d, #c44569);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.flashcard:not(.flipped):hover {
    animation: pulse 2s infinite;
}

/* Responsive */
@media (max-width: 400px) {
    .app {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.3rem;
    }
    
    .char-display {
        font-size: 4rem;
    }
    
    .char-display.word-mode {
        font-size: 1.8rem;
    }
    
    .flashcard {
        height: 280px;
    }
    
    .pinyin-display {
        font-size: 1.3rem;
    }
}
