/* Idiom Crush - 成语消消乐 */
* { margin: 0; padding: 0; box-sizing: border-box; }

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

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

.ic-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); }
}

/* Main */
.ic-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); }
}

/* Level Select */
.menu-title {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: #4338CA;
    margin-bottom: 20px;
}

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

.level-card {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 14px;
    cursor: pointer;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
    transition: all 0.2s;
    position: relative;
}

.level-card:active:not(.locked) { transform: scale(0.94); }

.level-card .level-num {
    font-size: 22px;
    font-weight: 800;
    color: #6366F1;
}

.level-card .level-stars {
    font-size: 10px;
    color: #F59E0B;
    margin-top: 2px;
    letter-spacing: 1px;
}

.level-card .level-stars .star-empty { color: #D1D5DB; }

.level-card.locked {
    background: #F3F4F6;
    cursor: default;
}

.level-card.locked .level-num {
    color: #D1D5DB;
}

.level-card.locked::after {
    content: '\F470';
    font-family: 'bootstrap-icons';
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 10px;
    color: #D1D5DB;
}

.level-card.current {
    border-color: #6366F1;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.25);
}

/* Game Screen */
.game-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 0 4px;
}

.game-timer {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 16px;
    font-weight: 700;
    color: #6366F1;
}

.game-timer.urgent { color: #EF4444; animation: timerUrgent 0.5s ease infinite alternate; }

@keyframes timerUrgent {
    from { opacity: 1; }
    to { opacity: 0.5; }
}

.game-level {
    font-size: 15px;
    font-weight: 600;
    color: #4338CA;
}

.game-found {
    font-size: 14px;
    color: #7C3AED;
    font-weight: 600;
}

/* Streak Badge */
.streak-badge {
    text-align: center;
    margin-bottom: 8px;
}

.streak-badge span {
    display: inline-block;
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    color: #fff;
    padding: 3px 12px;
    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; }
}

/* Character Grid */
.char-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 340px;
    margin: 0 auto 16px;
    width: 100%;
}

.char-tile {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 14px;
    font-size: 32px;
    font-weight: 700;
    color: #1E1B4B;
    cursor: pointer;
    border: 3px solid #E0E7FF;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.08);
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    position: relative;
}

.char-tile:active:not(.removed):not(.selected) {
    transform: scale(0.93);
}

.char-tile.selected {
    background: #FEF3C7;
    border-color: #F59E0B;
    box-shadow: 0 2px 12px rgba(245, 158, 11, 0.3);
}

.char-tile.selected .tile-order {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 11px;
    color: #D97706;
    font-weight: 800;
}

.char-tile.correct {
    background: #D1FAE5;
    border-color: #10B981;
    color: #065F46;
    animation: tileCorrect 0.5s ease forwards;
}

.char-tile.wrong {
    animation: tileShake 0.4s ease;
    border-color: #EF4444;
    background: #FEE2E2;
}

.char-tile.removed {
    opacity: 0;
    transform: scale(0.3);
    pointer-events: none;
    transition: all 0.4s ease;
}

.char-tile.hint-glow {
    animation: hintGlow 1.5s ease;
    border-color: #8B5CF6;
    box-shadow: 0 0 16px rgba(139, 92, 246, 0.5);
}

@keyframes tileCorrect {
    0% { transform: scale(1); }
    30% { transform: scale(1.1); }
    100% { transform: scale(0.3); opacity: 0; }
}

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

@keyframes hintGlow {
    0%, 100% { box-shadow: 0 0 0 rgba(139, 92, 246, 0); border-color: #E0E7FF; }
    30%, 70% { box-shadow: 0 0 20px rgba(139, 92, 246, 0.6); border-color: #8B5CF6; }
}

/* Selection Bar */
.selection-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 14px;
}

.selection-label {
    font-size: 14px;
    color: #6B7280;
}

.selection-slots {
    display: flex;
    gap: 6px;
}

.slot {
    width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: #1E1B4B;
    background: #fff;
    border: 2px solid #E0E7FF;
    border-radius: 8px;
}

.slot.empty {
    color: #D1D5DB;
    border-style: dashed;
}

.slot.filled {
    border-color: #F59E0B;
    background: #FEF3C7;
}

/* Game Actions */
.game-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.game-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    background: #fff;
    border: 2px solid #C7D2FE;
    border-radius: 12px;
    color: #6366F1;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* 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); }
}

/* Idiom flash when correct */
.idiom-flash {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    font-weight: 800;
    color: #10B981;
    text-shadow: 0 2px 12px rgba(16, 185, 129, 0.3);
    pointer-events: none;
    z-index: 200;
    animation: idiomFlash 0.8s ease-out forwards;
    letter-spacing: 4px;
}

@keyframes idiomFlash {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    60% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -60%) scale(1); }
}

/* Complete/Fail Screen */
.complete-card {
    background: #fff;
    border-radius: 20px;
    padding: 32px 24px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 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: #1E1B4B;
    margin-bottom: 12px;
}

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

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

.complete-idioms {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.complete-idioms .idiom-tag {
    padding: 4px 12px;
    background: #EEF2FF;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #4338CA;
}

.complete-stats {
    font-size: 14px;
    color: #6B7280;
    line-height: 1.8;
    margin-bottom: 20px;
}

.complete-stats strong { color: #F59E0B; }

.fail-idioms {
    margin: 16px 0;
    font-size: 14px;
    color: #6B7280;
    line-height: 2;
}

.fail-idioms .missed {
    color: #EF4444;
    font-weight: 600;
}

.fail-idioms .found {
    color: #10B981;
    font-weight: 600;
    text-decoration: line-through;
    opacity: 0.6;
}

.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 #C7D2FE;
    background: #fff;
    color: #6366F1;
    cursor: pointer;
    transition: all 0.2s;
}

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

.action-btn.primary {
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    border-color: transparent;
    color: #fff;
}

/* Lottery */
.lottery-entry-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 24px auto 0;
    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); }

.lottery-card {
    background: #fff;
    border-radius: 20px;
    padding: 32px 24px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 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(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: #1E1B4B; 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) {
    .char-tile { font-size: 26px; border-radius: 10px; }
    .char-grid { gap: 8px; }
    .slot { width: 32px; height: 32px; line-height: 32px; font-size: 18px; }
}

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