/* Poetry Fill - 古诗词填空闯关 */
* { margin: 0; padding: 0; box-sizing: border-box; }

.poetry-fullscreen {
    width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #FDF6EC;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    overflow-x: hidden;
}

/* Header */
.poetry-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #8B4513, #A0522D);
    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;
}

.poetry-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;
    justify-content: flex-end;
}

.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: pointsBadgePulse 0.5s ease;
}

.points-badge.pulse-big {
    animation: pointsBadgePulseBig 0.6s ease;
}

@keyframes pointsBadgePulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.25); background: rgba(255,215,0,0.5); }
    100% { transform: scale(1); }
}

@keyframes pointsBadgePulseBig {
    0% { transform: scale(1); }
    30% { transform: scale(1.4); background: rgba(255,100,0,0.6); }
    100% { transform: scale(1); }
}

.header-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    padding: 4px 8px;
    cursor: pointer;
    opacity: 0.9;
}

.header-btn:active { opacity: 0.6; }

/* Main */
.poetry-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px 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 Screen */
.menu-title {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: #5D3A1A;
    margin-bottom: 24px;
}

.grade-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

.grade-card {
    background: #fff;
    border-radius: 16px;
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.1);
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.grade-card:active {
    transform: scale(0.96);
}

.grade-card .grade-num {
    font-size: 32px;
    font-weight: 800;
    color: #8B4513;
    line-height: 1.2;
}

.grade-card .grade-label {
    font-size: 14px;
    color: #8B6914;
    margin-top: 4px;
}

.grade-card .grade-progress {
    font-size: 12px;
    color: #A08060;
    margin-top: 8px;
}

.grade-card .grade-stars {
    margin-top: 6px;
    font-size: 14px;
    color: #DAA520;
}

/* Semester Screen */
.semester-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 400px;
    margin: 0 auto 20px;
    width: 100%;
}

.semester-card {
    background: #fff;
    border-radius: 16px;
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.1);
    transition: all 0.2s;
}

.semester-card:active {
    transform: scale(0.96);
}

.semester-card .semester-name {
    font-size: 24px;
    font-weight: 700;
    color: #8B4513;
}

.semester-card .semester-info {
    font-size: 13px;
    color: #A08060;
    margin-top: 8px;
}

.semester-card .semester-stars {
    margin-top: 8px;
    font-size: 16px;
    color: #DAA520;
}

.back-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 auto;
    padding: 10px 24px;
    background: none;
    border: 1px solid #C4A882;
    border-radius: 20px;
    color: #8B6914;
    font-size: 14px;
    cursor: pointer;
}

.back-menu-btn:active { opacity: 0.6; }

/* Game Screen */
.game-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: #E8DDD0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #DAA520, #F5A623);
    border-radius: 4px;
    transition: width 0.4s ease;
    width: 0;
}

.progress-text {
    font-size: 13px;
    color: #8B6914;
    white-space: nowrap;
    min-width: 36px;
    text-align: right;
}

.poem-card {
    background: #fff;
    border-radius: 16px;
    padding: 24px 20px;
    box-shadow: 0 2px 12px rgba(139, 69, 19, 0.08);
    margin-bottom: 16px;
    position: relative;
}

.poem-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #DAA520, #8B4513, #DAA520);
    border-radius: 16px 16px 0 0;
}

.poem-title {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: #2C1810;
    margin-bottom: 6px;
}

.poem-author {
    text-align: center;
    font-size: 13px;
    color: #A08060;
    margin-bottom: 20px;
}

.poem-lines {
    text-align: center;
    line-height: 2.2;
    font-size: 20px;
    color: #2C1810;
    letter-spacing: 2px;
}

.poem-lines .line {
    white-space: nowrap;
}

.poem-char {
    display: inline;
}

.poem-blank {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    border-bottom: 2px solid #DAA520;
    margin: 0 1px;
    vertical-align: baseline;
    position: relative;
    color: transparent;
    font-size: 20px;
    transition: all 0.3s;
}

.poem-blank.current {
    background: rgba(218, 165, 32, 0.12);
    border-bottom-color: #F5A623;
    border-radius: 4px;
    animation: blankPulse 1.5s ease-in-out infinite;
}

.poem-blank.filled {
    color: #4CAF50;
    border-bottom-color: #4CAF50;
    font-weight: 700;
}

.poem-blank.filled-wrong {
    color: #F44336;
    border-bottom-color: #F44336;
}

@keyframes blankPulse {
    0%, 100% { background: rgba(218, 165, 32, 0.08); }
    50% { background: rgba(218, 165, 32, 0.2); }
}

.blank-hint {
    text-align: center;
    font-size: 14px;
    color: #A08060;
    margin-bottom: 12px;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 320px;
    margin: 0 auto;
    width: 100%;
}

.option-btn {
    padding: 16px 12px;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    background: #fff;
    border: 2px solid #E8DDD0;
    border-radius: 14px;
    color: #2C1810;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.option-btn:active:not(.disabled) {
    transform: scale(0.95);
}

.option-btn.correct {
    background: #E8F5E9;
    border-color: #4CAF50;
    color: #2E7D32;
    animation: optionCorrect 0.4s ease;
}

.option-btn.wrong {
    background: #FFEBEE;
    border-color: #F44336;
    color: #C62828;
    animation: optionShake 0.4s ease;
}

.option-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
}

@keyframes optionCorrect {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

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

/* Streak Badge */
.streak-badge {
    display: inline-block;
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    color: #fff;
    padding: 4px 14px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
    animation: streakPop 0.4s ease;
}

.streak-badge.hidden { display: none; }

.streak-badge.fire {
    background: linear-gradient(135deg, #FF4136, #FF6B35);
    animation: streakFire 0.6s ease;
}

@keyframes streakPop {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes streakFire {
    0% { transform: scale(0.5) rotate(-5deg); }
    50% { transform: scale(1.2) rotate(3deg); }
    100% { transform: scale(1) rotate(0); }
}

/* Points Popup */
.points-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    font-weight: 800;
    color: #F5A623;
    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); }
}

/* Lottery Entry Button */
.lottery-entry-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 24px auto 0;
    padding: 12px 28px;
    background: linear-gradient(135deg, #F5A623, #DAA520);
    border: none;
    border-radius: 24px;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(218, 165, 32, 0.3);
    transition: all 0.2s;
}

.lottery-entry-btn:active { transform: scale(0.96); }

/* Lottery Screen */
.lottery-card {
    background: #fff;
    border-radius: 20px;
    padding: 32px 24px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(139, 69, 19, 0.1);
    max-width: 360px;
    margin: auto;
    width: 100%;
    animation: completeIn 0.5s ease;
}

.lottery-title {
    font-size: 24px;
    font-weight: 700;
    color: #DAA520;
    margin-bottom: 8px;
}

.lottery-cost {
    font-size: 14px;
    color: #A08060;
    margin-bottom: 4px;
}

.lottery-cost strong { color: #DAA520; }

.lottery-balance {
    font-size: 14px;
    color: #A08060;
    margin-bottom: 20px;
}

.lottery-balance strong { color: #DAA520; 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(0deg); }
    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(0deg); }
}

@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: #2C1810;
    margin-bottom: 4px;
}

.lottery-result .prize-desc {
    font-size: 14px;
    color: #A08060;
}

.lottery-draw-btn {
    margin-bottom: 10px;
    width: 100%;
}

.lottery-draw-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.lottery-back-btn {
    width: 100%;
}

/* Complete Screen */
.complete-card {
    background: #fff;
    border-radius: 20px;
    padding: 36px 24px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(139, 69, 19, 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: #2C1810;
    margin-bottom: 12px;
}

.complete-stars {
    font-size: 36px;
    margin-bottom: 16px;
    letter-spacing: 8px;
    color: #DAA520;
}

.complete-stars .star-empty {
    color: #E8DDD0;
}

.complete-stats {
    font-size: 15px;
    color: #5D3A1A;
    line-height: 1.8;
    margin-bottom: 24px;
}

.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 #C4A882;
    background: #fff;
    color: #8B4513;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:active { transform: scale(0.97); }

.action-btn.primary {
    background: linear-gradient(135deg, #DAA520, #F5A623);
    border-color: transparent;
    color: #fff;
}

/* Transition between poems */
.poem-card.transitioning {
    animation: poemTransition 0.5s ease;
}

@keyframes poemTransition {
    0% { opacity: 1; transform: translateX(0); }
    40% { opacity: 0; transform: translateX(-30px); }
    60% { opacity: 0; transform: translateX(30px); }
    100% { opacity: 1; transform: translateX(0); }
}

/* Responsive */
@media (max-width: 360px) {
    .poem-lines { font-size: 18px; }
    .poem-blank { width: 24px; height: 24px; line-height: 24px; font-size: 18px; }
    .option-btn { font-size: 22px; padding: 14px 10px; }
    .grade-card .grade-num { font-size: 28px; }
}

@media (min-width: 500px) {
    .poetry-main { max-width: 480px; margin: 0 auto; width: 100%; }
}
