* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --purple: #7c3aed;
    --purple-light: #a855f7;
    --purple-dark: #5b21b6;
    --red: #ef4444;
    --green: #22c55e;
    --yellow: #eab308;
    --bg: #0f0f1a;
    --surface: #1a1a2e;
    --card: #ffffff;
    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.55);
    --border: rgba(255, 255, 255, 0.1);
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: "Noto Sans KR", -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
}

#root {
    width: 100%;
    height: 100%;
}

/* ==================== CONTAINER ==================== */
.container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ==================== GAME SCREEN ==================== */
.game-screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.game-header {
    background: linear-gradient(135deg, var(--purple-dark) 0%, var(--purple) 60%, var(--purple-light) 100%);
    padding: 44px 24px 28px;
    color: white;
}

.game-logo {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: -0.5px;
    margin-bottom: 16px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.stage-badge {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.overall-progress {
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.overall-progress-fill {
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.game-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    gap: 20px;
    overflow: hidden;
}

.stage-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    text-align: center;
}

.stage-number {
    font-size: 12px;
    font-weight: 700;
    color: var(--purple-light);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.stage-name {
    font-size: 22px;
    font-weight: 900;
    color: white;
    margin-bottom: 10px;
}

.stage-desc {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

.ad-waiting-box {
    width: 100%;
    max-width: 400px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.ad-waiting-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.ad-waiting-text {
    font-size: 14px;
    color: rgba(239, 68, 68, 0.8);
    font-weight: 500;
}

.btn-watch-ad {
    width: 100%;
    max-width: 400px;
    padding: 18px;
    background: linear-gradient(135deg, var(--purple), var(--purple-light));
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 17px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
}

.btn-watch-ad:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(124, 58, 237, 0.5);
}

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

/* ==================== AD SCREEN ==================== */
.ad-screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    overflow: hidden;
}

.ad-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 44px 20px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.ad-stage-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--purple-light);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.ad-stage-name {
    font-size: 18px;
    font-weight: 900;
    color: white;
}

.ad-desc-badge {
    background: linear-gradient(135deg, var(--purple), var(--purple-light));
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
}

.ad-instruction {
    background: rgba(124, 58, 237, 0.08);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.4;
    flex-shrink: 0;
}

.ad-body {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ==================== STAGE CONTENT ==================== */
.stage-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    gap: 16px;
    text-align: center;
}

.stage-hint {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    max-width: 300px;
}

.stage-hint-big {
    font-size: 18px;
    font-weight: 700;
    color: white;
    line-height: 1.4;
}

.countdown-big {
    font-size: 72px;
    font-weight: 900;
    color: white;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 40px rgba(124, 58, 237, 0.6);
}

.countdown-small {
    font-size: 16px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ==================== BUTTONS ==================== */
.bottom-buttons {
    padding: 20px 24px;
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-shrink: 0;
}

.btn-skip {
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--purple), var(--purple-light));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s, opacity 0.2s;
    min-width: 120px;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35);
}

.btn-skip:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.5);
}

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

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

.btn-watch {
    padding: 14px 28px;
    background: rgba(239, 68, 68, 0.12);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.12s;
    min-width: 120px;
}

.btn-watch:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-hold {
    padding: 20px 40px;
    font-size: 18px;
    border-radius: 16px;
    user-select: none;
    -webkit-user-select: none;
}

.floating-btn {
    position: fixed;
    width: 100px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    min-width: 0;
    border-radius: 10px;
    z-index: 100;
    font-size: 15px;
}

/* ==================== STAGE 3: TAP ==================== */
.tap-progress {
    width: 100%;
    max-width: 280px;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.tap-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--purple), var(--purple-light));
    border-radius: 6px;
    transition: width 0.15s ease;
}

.tap-count {
    font-size: 36px;
    font-weight: 900;
    color: white;
    font-variant-numeric: tabular-nums;
}

/* ==================== STAGE 5: TIMING ==================== */
.timing-bar-wrap {
    width: 100%;
    max-width: 320px;
    height: 48px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
}

.timing-zone {
    position: absolute;
    left: 35%;
    width: 30%;
    height: 100%;
    background: rgba(34, 197, 94, 0.25);
    border-left: 2px solid rgba(34, 197, 94, 0.6);
    border-right: 2px solid rgba(34, 197, 94, 0.6);
}

.timing-indicator {
    position: absolute;
    top: 4px;
    bottom: 4px;
    width: 10px;
    background: white;
    border-radius: 5px;
    transform: translateX(-50%);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.timing-hint {
    font-size: 13px;
    color: rgba(34, 197, 94, 0.8);
    font-weight: 600;
}

/* ==================== STAGE 6: LABEL ==================== */
.label-hint {
    font-size: 18px;
    font-weight: 700;
    color: white;
}

/* ==================== STAGE 7: MIRROR ==================== */
.mirror-hint {
    font-size: 18px;
    font-weight: 700;
    color: white;
}

/* ==================== STAGE 8: SIMON ==================== */
.simon-info {
    font-size: 18px;
    font-weight: 700;
    color: white;
    margin-bottom: 4px;
}

/* ==================== STAGE 9: DRAG ZONE ==================== */
.drop-zone {
    position: fixed;
    border: 2px dashed rgba(34, 197, 94, 0.5);
    border-radius: 14px;
    background: rgba(34, 197, 94, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
    z-index: 50;
}

.drop-zone.zone-active {
    background: rgba(34, 197, 94, 0.2);
    border-color: var(--green);
    box-shadow: 0 0 24px rgba(34, 197, 94, 0.3);
}

.drop-zone-label {
    font-size: 16px;
    font-weight: 700;
    color: rgba(34, 197, 94, 0.7);
}

.drop-zone.zone-active .drop-zone-label {
    color: var(--green);
}

/* ==================== STAGE 10: BOSS HITS ==================== */
.boss-countdown {
    font-size: 64px;
    font-weight: 900;
    color: white;
    transition: color 0.3s;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 30px currentColor;
}

.boss-hits {
    font-size: 28px;
    font-weight: 700;
    color: var(--purple-light);
}

/* ==================== STAGE 14: HOLD ==================== */
.hold-progress-wrap {
    width: 100%;
    max-width: 280px;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.hold-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green), #16a34a);
    border-radius: 6px;
    transition: width 0.1s linear;
}

/* ==================== STAGE 17: TOS ==================== */
.tos-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px 20px;
    gap: 12px;
    overflow: hidden;
}

.tos-title {
    font-size: 18px;
    font-weight: 700;
    color: white;
    text-align: center;
    flex-shrink: 0;
}

.tos-scroll-area {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    overflow-y: auto;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.7;
    max-height: 240px;
}

.tos-scroll-area p {
    margin-bottom: 12px;
}

.tos-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.tos-check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.tos-check-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--purple);
    flex-shrink: 0;
}

/* ==================== STAGE 18: POPUPS ==================== */
.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 24px;
}

.popup-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px 24px;
    width: 100%;
    max-width: 340px;
    text-align: center;
}

.popup-title {
    font-size: 20px;
    font-weight: 900;
    color: white;
    margin-bottom: 12px;
}

.popup-msg {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 20px;
}

.popup-btns {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ==================== STAGE 19: PASSWORD ==================== */
.pwd-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    gap: 20px;
}

.pwd-hint {
    font-size: 16px;
    color: var(--text-muted);
    text-align: center;
}

.pwd-hint strong {
    color: var(--purple-light);
    font-size: 22px;
    letter-spacing: 4px;
}

.pwd-slots {
    display: flex;
    gap: 12px;
}

.pwd-slot {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 900;
    color: white;
    font-variant-numeric: tabular-nums;
}

.pwd-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 300px;
}

.pwd-btn {
    aspect-ratio: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 18px;
    font-weight: 700;
    color: white;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.12s;
}

.pwd-btn:hover {
    background: rgba(124, 58, 237, 0.2);
    border-color: var(--purple);
}

.pwd-btn:active {
    background: rgba(124, 58, 237, 0.4);
    transform: scale(0.95);
}

/* ==================== FORCED AD SCREEN ==================== */
.forced-ad-screen {
    position: fixed;
    inset: 0;
    background: #000;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.forced-ad-header {
    padding: 44px 16px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.forced-ad-badge {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.forced-ad-stage {
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
}

.forced-ad-video {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.forced-ad-content {
    text-align: center;
    color: white;
    padding: 24px;
}

.forced-ad-icon {
    font-size: 72px;
    margin-bottom: 20px;
    display: block;
}

.forced-ad-brand {
    font-size: 26px;
    font-weight: 900;
    margin-bottom: 10px;
}

.forced-ad-slogan {
    font-size: 15px;
    opacity: 0.7;
    margin-bottom: 20px;
}

.forced-ad-cta {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: default;
}

.forced-ad-skip-area {
    position: absolute;
    bottom: 16px;
    right: 16px;
}

.forced-skip-btn {
    background: rgba(0, 0, 0, 0.75);
    color: rgba(255, 255, 255, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    border-radius: 4px;
    cursor: not-allowed;
    white-space: nowrap;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

.forced-skip-btn.ready {
    color: white;
    border-color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    background: rgba(0, 0, 0, 0.85);
}

.forced-skip-btn.ready:hover {
    background: rgba(255, 255, 255, 0.1);
}

.forced-ad-bottom {
    padding: 0 0 8px;
}

.forced-ad-progress {
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
}

.forced-ad-progress-fill {
    height: 100%;
    background: var(--red);
}

.forced-ad-footer {
    padding: 8px 16px 20px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 12px;
    text-align: center;
}

/* ==================== COMPLETE SCREEN ==================== */
.complete-screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    gap: 16px;
    text-align: center;
    background: var(--bg);
}

.complete-emoji {
    font-size: 80px;
    margin-bottom: 8px;
}

.complete-title {
    font-size: 28px;
    font-weight: 900;
    color: white;
}

.complete-sub {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* ==================== ANIMATIONS ==================== */
@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4); }
    70% { box-shadow: 0 0 0 16px rgba(124, 58, 237, 0); }
    100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0); }
}

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

.shake {
    animation: shake 0.3s ease;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

/* ==================== SCROLLBAR ==================== */
.tos-scroll-area::-webkit-scrollbar {
    width: 4px;
}
.tos-scroll-area::-webkit-scrollbar-track {
    background: transparent;
}
.tos-scroll-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 400px) {
    .game-header {
        padding: 36px 16px 22px;
    }
    .game-logo {
        font-size: 17px;
    }
    .game-body {
        padding: 16px;
    }
    .bottom-buttons {
        padding: 16px;
    }
    .pwd-grid {
        max-width: 260px;
    }
    .countdown-big {
        font-size: 56px;
    }
}
