/* Pinyin Practice - 拼音练习 */
* { margin: 0; padding: 0; box-sizing: border-box; }

.pyp-fullscreen {
    width: 100vw; min-height: 100vh;
    display: flex; flex-direction: column;
    background: linear-gradient(180deg, #F0FDFA, #CCFBF1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    overflow-x: hidden;
}

.pyp-header {
    display: flex; align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #14B8A6, #0D9488);
    color: #fff; position: sticky; top: 0; z-index: 100; min-height: 52px;
}
.back-btn-wrap { position: relative; flex-shrink: 0; }
.back-btn { display: flex; align-items: center; gap: 4px; color: #fff; text-decoration: none; font-size: 14px; padding: 4px 0; }
.back-overlay { display: none; position: absolute; top: -8px; left: -8px; right: -8px; bottom: -8px; cursor: pointer; z-index: 1; }
.back-overlay.active { display: block; }
.pyp-header .title { flex: 1; text-align: center; font-size: 17px; font-weight: 600; }
.header-actions { flex-shrink: 0; display: flex; align-items: center; gap: 8px; }

.points-badge { display: flex; align-items: center; gap: 4px; background: rgba(255,255,255,0.2); padding: 4px 10px; border-radius: 14px; font-size: 13px; color: #FFD700; font-weight: 600; cursor: pointer; }
.points-badge i { font-size: 12px; }
.points-badge.pulse { animation: badgePulse 0.5s ease; }
.points-badge.pulse-big { animation: badgePulseBig 0.6s ease; }
@keyframes badgePulse { 0% { transform: scale(1); } 40% { transform: scale(1.25); background: rgba(255,215,0,0.5); } 100% { transform: scale(1); } }
@keyframes badgePulseBig { 0% { transform: scale(1); } 30% { transform: scale(1.4); background: rgba(255,100,0,0.6); } 100% { transform: scale(1); } }

.pyp-main { flex: 1; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; padding: 16px; animation: fadeIn 0.3s ease; }
.screen.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Menu ===== */
.menu-title { text-align: center; font-size: 28px; font-weight: 800; color: #0F766E; margin-bottom: 4px; }
.menu-desc { text-align: center; font-size: 14px; color: #14B8A6; margin-bottom: 20px; }

.opt-group { max-width: 400px; margin: 0 auto 16px; width: 100%; }
.opt-label { font-size: 13px; color: #6B7280; text-align: center; margin-bottom: 8px; }

/* Mode buttons */
.mode-btns { display: flex; gap: 8px; }
.mode-btn {
    flex: 1; padding: 10px 6px;
    background: #fff; border: 2px solid #99F6E4;
    border-radius: 14px; cursor: pointer;
    transition: all 0.2s; text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    -webkit-tap-highlight-color: transparent;
}
.mode-btn i { font-size: 20px; color: #0D9488; }
.mode-btn span { font-size: 12px; font-weight: 600; color: #0F766E; }
.mode-btn:active { transform: scale(0.96); }
.mode-btn.active { border-color: #14B8A6; background: #F0FDFA; box-shadow: 0 2px 12px rgba(20,184,166,0.25); }

/* Difficulty buttons */
.diff-btns { display: flex; gap: 8px; }
.diff-btn {
    flex: 1; padding: 12px 8px; background: #fff;
    border: 2px solid #99F6E4; border-radius: 14px;
    cursor: pointer; transition: all 0.2s; text-align: center;
    -webkit-tap-highlight-color: transparent;
}
.diff-btn:active { transform: scale(0.96); }
.diff-btn.active { border-color: #14B8A6; background: #F0FDFA; box-shadow: 0 2px 12px rgba(20,184,166,0.25); }
.diff-name { font-size: 15px; font-weight: 700; color: #0F766E; margin-bottom: 4px; }
.diff-desc { font-size: 11px; color: #9CA3AF; line-height: 1.4; }

.menu-action-row {
    display: flex; gap: 12px; justify-content: center;
    margin: 20px auto; max-width: 400px; width: 100%;
}
.learn-btn {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; padding: 14px 24px; flex: 1;
    background: #fff; border: 2px solid #14B8A6; border-radius: 16px;
    color: #0D9488; font-size: 17px; font-weight: 700; cursor: pointer;
}
.learn-btn:active { transform: scale(0.96); }
.start-btn {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; padding: 14px 24px; flex: 1;
    background: linear-gradient(135deg, #14B8A6, #0D9488);
    border: none; border-radius: 16px; color: #fff;
    font-size: 17px; font-weight: 700; cursor: pointer;
    box-shadow: 0 4px 16px rgba(20,184,166,0.3);
}
.start-btn:active { transform: scale(0.96); }

.menu-stats { display: flex; justify-content: center; gap: 24px; margin-bottom: 20px; }
.stat-item { text-align: center; }
.stat-value { font-size: 24px; font-weight: 800; color: #0D9488; }
.stat-label { font-size: 12px; color: #9CA3AF; margin-top: 2px; }

.lottery-entry-btn {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; margin: 0 auto; padding: 12px 28px;
    background: linear-gradient(135deg, #F59E0B, #D97706);
    border: none; border-radius: 24px; color: #fff;
    font-size: 16px; font-weight: 700; cursor: pointer;
    box-shadow: 0 4px 16px rgba(245,158,11,0.3);
}
.lottery-entry-btn:active { transform: scale(0.96); }

/* ===== Learn ===== */
#learnScreen { padding: 0; display: flex; flex-direction: column; }
#learnScreen.hidden { display: none; }
.learn-content {
    flex: 1; overflow-y: auto; padding: 16px;
    -webkit-overflow-scrolling: touch;
}
.learn-section { margin-bottom: 20px; }
.learn-section-title {
    font-size: 16px; font-weight: 700; color: #0F766E;
    margin-bottom: 10px; padding-left: 10px;
    border-left: 4px solid #14B8A6;
}
.learn-table {
    background: #fff; border-radius: 12px; padding: 12px 14px;
    box-shadow: 0 1px 6px rgba(20,184,166,0.08);
    margin-bottom: 10px;
}
.learn-table-label {
    font-size: 12px; color: #9CA3AF; margin-bottom: 6px; font-weight: 600;
}
.learn-items {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.learn-item {
    display: inline-block; padding: 6px 12px;
    background: #F0FDFA; border: 1px solid #99F6E4;
    border-radius: 8px; font-size: 18px; font-weight: 600;
    color: #134E4A; line-height: 1.3;
}
.learn-item.highlight {
    background: #CCFBF1; border-color: #14B8A6;
}
.learn-tip {
    background: #FFFBEB; border: 1px solid #FDE68A;
    border-radius: 10px; padding: 10px 14px;
    font-size: 13px; color: #92400E; line-height: 1.7;
}
.learn-tip-title {
    font-weight: 700; color: #B45309; margin-bottom: 4px;
}
.learn-example {
    font-size: 20px; font-weight: 700; color: #0D9488;
    margin: 4px 0;
}
.learn-footer {
    padding: 12px 16px 20px; display: flex; flex-direction: column; gap: 10px;
    background: linear-gradient(0deg, #F0FDFA 60%, transparent);
}
.learn-footer .start-btn { margin: 0; width: 100%; }
.learn-footer .action-btn { width: 100%; text-align: center; }

/* ===== Game ===== */
.game-progress { margin-bottom: 10px; }
.progress-bar { height: 6px; background: #99F6E4; border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #14B8A6, #0D9488); border-radius: 3px; transition: width 0.3s ease; width: 0; }
.progress-info { display: flex; align-items: center; justify-content: space-between; }
.progress-text { font-size: 12px; color: #9CA3AF; font-weight: 600; }

.streak-badge { display: inline-block; }
.streak-badge span { display: inline-block; background: linear-gradient(135deg, #FF6B35, #F7931E); color: #fff; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 700; animation: streakPop 0.4s ease; }
.streak-badge.hidden { display: none; }
.streak-badge.fire span { background: linear-gradient(135deg, #FF4136, #FF6B35); }
@keyframes streakPop { 0% { transform: scale(0.5); opacity: 0; } 60% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }

/* Question card */
.question-card {
    background: #fff; border-radius: 16px;
    padding: 24px 16px; margin-bottom: 16px;
    box-shadow: 0 2px 12px rgba(20,184,166,0.08);
    text-align: center;
}
.question-text {
    font-size: 22px; font-weight: 700; color: #134E4A;
    line-height: 1.6;
}

/* Options grid - 2x2 */
.options-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 12px; margin-bottom: 12px;
}
.opt-btn {
    padding: 18px 12px; background: #fff;
    border: 2px solid #99F6E4; border-radius: 14px;
    cursor: pointer; transition: all 0.2s;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}
.opt-btn:active:not(.disabled) { transform: scale(0.96); }
.opt-label { font-size: 26px; font-weight: 700; color: #134E4A; }

.opt-btn.disabled { pointer-events: none; opacity: 0.7; }
.opt-btn.correct { border-color: #10B981; background: #D1FAE5; opacity: 1; }
.opt-btn.correct .opt-label { color: #059669; }
.opt-btn.wrong { border-color: #EF4444; background: #FEE2E2; opacity: 1; animation: shake 0.4s ease; }
.opt-btn.wrong .opt-label { color: #DC2626; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

/* Feedback */
.feedback-area {
    text-align: center; padding: 12px 16px;
    background: #fff; border-radius: 14px;
    box-shadow: 0 2px 8px rgba(20,184,166,0.06);
    animation: fadeIn 0.3s ease;
}
.feedback-area.hidden { display: none; }
.feedback-area.fb-correct { border-left: 4px solid #10B981; }
.feedback-area.fb-wrong { border-left: 4px solid #EF4444; }
.feedback-text { font-size: 14px; color: #6B7280; line-height: 1.6; }

/* Points Popup */
.points-popup { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 28px; font-weight: 800; color: #F59E0B; text-shadow: 0 2px 8px rgba(0,0,0,0.15); pointer-events: none; z-index: 200; }
.points-popup.hidden { display: none; }
.points-popup.show { display: block; animation: pointsFly 0.8s ease-out forwards; }
@keyframes pointsFly { 0% { opacity:1; transform: translate(-50%,-50%) scale(0.5); } 30% { opacity:1; transform: translate(-50%,-70%) scale(1.2); } 100% { opacity:0; transform: translate(-50%,-120%) scale(1); } }

/* ===== Complete ===== */
.complete-card { background: #fff; border-radius: 20px; padding: 32px 24px; text-align: center; box-shadow: 0 4px 20px rgba(20,184,166,0.1); max-width: 360px; margin: auto; width: 100%; animation: completeIn 0.5s ease; }
@keyframes completeIn { from { opacity:0; transform: scale(0.9) translateY(20px); } to { opacity:1; transform: scale(1) translateY(0); } }
.complete-icon { font-size: 48px; margin-bottom: 12px; }
.complete-title { font-size: 22px; font-weight: 700; color: #134E4A; margin-bottom: 12px; }
.complete-stars { font-size: 36px; margin-bottom: 16px; letter-spacing: 8px; color: #F59E0B; }
.complete-stars .star-empty { color: #E5E7EB; }
.complete-stats { font-size: 14px; color: #6B7280; line-height: 1.8; margin-bottom: 20px; }
.complete-stats strong { color: #F59E0B; }
.complete-actions { display: flex; flex-direction: column; gap: 10px; }

.action-btn { padding: 14px 24px; font-size: 16px; font-weight: 600; border-radius: 12px; border: 2px solid #99F6E4; background: #fff; color: #0D9488; cursor: pointer; transition: all 0.2s; }
.action-btn:active { transform: scale(0.97); }
.action-btn.primary { background: linear-gradient(135deg, #14B8A6, #0D9488); border-color: transparent; color: #fff; }

/* ===== Lottery ===== */
.lottery-card { background: #fff; border-radius: 20px; padding: 32px 24px; text-align: center; box-shadow: 0 4px 20px rgba(20,184,166,0.1); max-width: 360px; margin: auto; width: 100%; animation: completeIn 0.5s ease; }
.lottery-title { font-size: 24px; font-weight: 700; color: #F59E0B; margin-bottom: 8px; }
.lottery-cost { font-size: 14px; color: #9CA3AF; margin-bottom: 4px; }
.lottery-cost strong { color: #F59E0B; }
.lottery-balance { font-size: 14px; color: #9CA3AF; margin-bottom: 20px; }
.lottery-balance strong { color: #F59E0B; font-size: 18px; }
.lottery-box { width: 120px; height: 120px; margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; }
.lottery-gift { font-size: 72px; line-height: 1; transition: transform 0.3s; }
.lottery-gift.spinning { animation: giftSpin 1.2s cubic-bezier(0.4,0,0.2,1); }
.lottery-gift.opened { animation: giftOpen 0.5s ease forwards; }
@keyframes giftSpin { 0% { transform: scale(1) rotate(0); } 20% { transform: scale(1.1) rotate(-10deg); } 40% { transform: scale(1.15) rotate(10deg); } 60% { transform: scale(1.2) rotate(-8deg); } 80% { transform: scale(1.25) rotate(6deg); } 100% { transform: scale(1.3) rotate(0); } }
@keyframes giftOpen { 0% { transform: scale(1.3); } 50% { transform: scale(1.5); } 100% { transform: scale(1.1); } }
.lottery-result { min-height: 56px; margin-bottom: 16px; opacity: 0; transition: opacity 0.3s; }
.lottery-result.show { opacity: 1; }
.lottery-result .prize-name { font-size: 22px; font-weight: 700; color: #134E4A; margin-bottom: 4px; }
.lottery-result .prize-desc { font-size: 14px; color: #9CA3AF; }
.lottery-draw-btn { margin-bottom: 10px; width: 100%; }
.lottery-draw-btn:disabled { opacity: 0.4; cursor: default; }

/* ===== Responsive ===== */
@media (max-width: 360px) {
    .question-text { font-size: 18px; }
    .opt-label { font-size: 22px; }
    .opt-btn { padding: 14px 8px; }
    .mode-btn { padding: 8px 4px; }
    .mode-btn span { font-size: 11px; }
}
@media (min-width: 500px) {
    .pyp-main { max-width: 480px; margin: 0 auto; width: 100%; }
}
