/* Sudoku - 数独 */
* { margin: 0; padding: 0; box-sizing: border-box; }

.sdk-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;
}

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

.sdk-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: #4338CA; margin-bottom: 4px; }
.menu-desc { text-align: center; font-size: 14px; color: #7C3AED; 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; }

.diff-btns { display: flex; gap: 8px; }
.diff-btn {
    flex: 1;
    padding: 16px 8px;
    background: #fff;
    border: 2px solid #E0E7FF;
    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: #6366F1; background: #EEF2FF; box-shadow: 0 2px 12px rgba(99,102,241,0.2); }
.diff-name { font-size: 20px; font-weight: 800; color: #4338CA; margin-bottom: 4px; }
.diff-desc { font-size: 12px; color: #9CA3AF; }

.start-btn { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 20px auto; padding: 14px 48px; background: linear-gradient(135deg, #6366F1, #8B5CF6); border: none; border-radius: 16px; color: #fff; font-size: 18px; font-weight: 700; cursor: pointer; box-shadow: 0 4px 16px rgba(99,102,241,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: #6366F1; }
.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); }

/* ===== Game Top ===== */
.game-top {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.timer-display {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 600;
    color: #6366F1;
}

.game-spacer { flex: 1; }

.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; }
@keyframes streakPop { 0% { transform: scale(0.5); opacity: 0; } 60% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }

/* ===== Grid ===== */
.grid-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

.sdk-grid {
    display: grid;
    border: 2.5px solid #4338CA;
    border-radius: 6px;
    overflow: hidden;
    aspect-ratio: 1;
    max-width: 360px;
    width: 100%;
}

.sdk-grid.size-4 { grid-template-columns: repeat(4, 1fr); }
.sdk-grid.size-6 { grid-template-columns: repeat(6, 1fr); }
.sdk-grid.size-9 { grid-template-columns: repeat(9, 1fr); }

.sdk-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0.5px solid #C7D2FE;
    cursor: pointer;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    background: #fff;
    font-weight: 700;
    color: #1E1B4B;
}

/* Box borders */
.sdk-cell.bl { border-left: 2px solid #4338CA; }
.sdk-cell.bt { border-top: 2px solid #4338CA; }

/* Cell sizes by grid */
.size-4 .sdk-cell { font-size: 28px; }
.size-6 .sdk-cell { font-size: 22px; }
.size-9 .sdk-cell { font-size: 18px; }

/* Cell states */
.sdk-cell.highlighted { background: #EEF2FF; }
.sdk-cell.same-number { background: #DBEAFE; }
.sdk-cell.selected { background: #FEF3C7; }

.sdk-cell.given { background-color: #F1F5F9; }
.sdk-cell.given.highlighted { background-color: #E2E8F0; }
.sdk-cell.given.same-number { background-color: #D4E0EE; }
.sdk-cell.given.selected { background-color: #FDE68A; }

.sdk-cell.user-filled .cell-val { color: #4F46E5; }
.sdk-cell.hint-cell .cell-val { color: #7C3AED; }
.sdk-cell.error .cell-val { color: #DC2626; }

.sdk-cell.completed-flash {
    animation: cellFlash 0.6s ease;
}
@keyframes cellFlash {
    0% { background: #fff; } 50% { background: #D1FAE5; } 100% { background: #fff; }
}

/* Notes mini-grid */
.cell-notes {
    display: grid;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-items: center;
    padding: 1px;
}
.cell-notes span {
    line-height: 1;
    color: #6B7280;
    font-weight: 400;
}

.size-4 .cell-notes { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); }
.size-4 .cell-notes span { font-size: 13px; }

.size-6 .cell-notes { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); }
.size-6 .cell-notes span { font-size: 10px; }

.size-9 .cell-notes { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); }
.size-9 .cell-notes span { font-size: 8px; }

/* ===== Action Bar ===== */
.action-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.act-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 14px;
    background: #fff;
    border: 1.5px solid #E0E7FF;
    border-radius: 12px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    color: #6366F1;
    font-size: 18px;
    transition: all 0.15s;
}
.act-btn span {
    font-size: 10px;
    color: #9CA3AF;
    font-weight: 600;
}
.act-btn:active { transform: scale(0.93); background: #EEF2FF; }
.act-btn.active { background: #EEF2FF; border-color: #6366F1; }
.act-btn.active span { color: #6366F1; }

/* ===== Number Pad ===== */
.num-pad {
    display: flex;
    justify-content: center;
    gap: 6px;
    max-width: 360px;
    width: 100%;
    margin: 0 auto;
}

.num-btn {
    flex: 1;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    background: #fff;
    border: 2px solid #C7D2FE;
    border-radius: 10px;
    color: #4338CA;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.1s;
}
.num-btn:active { transform: scale(0.92); background: #EEF2FF; }
.num-btn.completed { opacity: 0.2; }

/* 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(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-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 #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-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(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: #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) {
    .sdk-grid { max-width: 300px; }
    .size-9 .sdk-cell { font-size: 15px; }
    .num-btn { font-size: 18px; height: 42px; }
    .act-btn { padding: 6px 10px; font-size: 16px; }
}

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