/* ====================================================
   Link Dots — Premium Design System v2.0
   Designer Persona: Full Professional Overhaul
   ==================================================== */

/* ── 1. CSS Variables (Design Tokens) ─────────────── */
:root {
    --bg-color:        #080e1a;
    --card-bg:         rgba(16, 26, 48, 0.85);
    --card-border:     rgba(56, 189, 248, 0.12);
    --accent-primary:  #38bdf8;
    --accent-glow:     rgba(56, 189, 248, 0.25);
    --accent-purple:   #818cf8;
    --text-primary:    #f0f6ff;
    --text-secondary:  #7c8fa8;
    --text-muted:      #4a5a70;
    --success:         #4ade80;
    --shadow-card:     0 4px 24px rgba(0,0,0,0.5), 0 1px 4px rgba(0,0,0,0.3);
    --shadow-glow:     0 0 40px rgba(56, 189, 248, 0.08);
    --radius-card:     20px;
    --radius-btn:      12px;
    --radius-sm:       8px;
    --font-main:       'Outfit', -apple-system, sans-serif;
    --transition:      all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── 2. Reset & Base ───────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ── 3. Background Layer ───────────────────────────── */
#bg-layer {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 60% at 10% 0%, rgba(56, 189, 248, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 90% 90%, rgba(129, 140, 248, 0.10) 0%, transparent 60%),
        linear-gradient(180deg, #080e1a 0%, #0b1629 100%);
}

/* ── 4. Layout Wrapper ─────────────────────────────── */
#app-wrapper {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 16px 12px 40px;
    gap: 16px;
}

/* ── 5. Game Container Card ────────────────────────── */
.app-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card), var(--shadow-glow);
    overflow: hidden;
    padding: 0;
}

/* ── 6. Game Header ────────────────────────────────── */
header {
    padding: 22px 20px 16px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

h1#game-title {
    font-size: 2.8rem;
    font-weight: 900;
    letter-spacing: 8px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #fff 0%, #38bdf8 40%, #818cf8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 18px;
    filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.4));
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.3)); }
    to   { filter: drop-shadow(0 0 20px rgba(56, 189, 248, 0.6)); }
}

.stats-container {
    display: flex;
    justify-content: center;
    gap: 0;
    background: rgba(8, 14, 26, 0.6);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: var(--radius-btn);
    overflow: hidden;
}

.stat-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 8px;
    border-right: 1px solid rgba(255,255,255,0.06);
}

.stat-item:last-child {
    border-right: none;
}

.stat-item .label {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 3px;
}

.stat-item .value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent-primary);
    line-height: 1;
}

/* ── 7. Ad Placeholder ─────────────────────────────── */
.ad-placeholder-slim {
    width: 100%;
    height: 80px;
    background: rgba(8, 14, 26, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ad-placeholder-slim iframe {
    width: 100%;
    height: 80px;
    border: none;
    display: block;
    background: transparent;
}

/* ── 8. Game Board ─────────────────────────────────── */
#game-board-container {
    width: 100%;
    max-width: min(100%, 75vh);
    aspect-ratio: 1 / 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(4, 10, 20, 0.5);
    margin: 0 auto;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    cursor: crosshair;
}

/* ── 9. Victory Overlay ────────────────────────────── */
#victory-overlay {
    position: absolute;
    inset: 0;
    background: rgba(8, 14, 26, 0.93);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.overlay-content {
    text-align: center;
    animation: scaleUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleUp {
    from { transform: scale(0.6); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.overlay-content h2 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--success);
    letter-spacing: 2px;
    margin-bottom: 6px;
    text-shadow: 0 0 30px rgba(74, 222, 128, 0.4);
}

#victory-stats {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.stars-container {
    margin-bottom: 18px;
}

.star {
    font-size: 2.2rem;
    color: rgba(255,255,255,0.1);
    margin: 0 4px;
}

.star.active {
    color: #fbbf24;
    text-shadow: 0 0 24px rgba(251, 191, 36, 0.7);
    animation: starPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes starPop {
    0%   { transform: scale(0); }
    70%  { transform: scale(1.3); }
    100% { transform: scale(1); }
}

#next-level-btn {
    padding: 12px 32px;
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-main);
    background: linear-gradient(135deg, #4ade80, #22c55e);
    border: none;
    border-radius: 50px;
    color: #052e16;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 20px rgba(74, 222, 128, 0.35);
}

#next-level-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 28px rgba(74, 222, 128, 0.5);
}

/* ── 10. Game Controls Bar ─────────────────────────── */
.game-controls {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(6, 12, 24, 0.6);
    border-top: 1px solid rgba(255,255,255,0.05);
    gap: 8px;
    flex-wrap: nowrap;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
}

.icon-btn:hover {
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.3);
    color: var(--accent-primary);
    transform: translateY(-1px);
}

.icon-btn svg {
    width: 18px;
    height: 18px;
}

.level-selector {
    display: flex;
    gap: 6px;
    align-items: center;
    flex: 1;
    justify-content: center;
    min-width: 0;
}

.nav-btn {
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.2);
    color: var(--accent-primary);
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-family: var(--font-main);
    font-size: 0.82rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.nav-btn:hover {
    background: rgba(56, 189, 248, 0.18);
    border-color: rgba(56, 189, 248, 0.4);
}

select.nav-btn {
    flex: 1;
    min-width: 0;
    max-width: 160px;
    appearance: none;
    -webkit-appearance: none;
    text-align: center;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%2338bdf8'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
    cursor: pointer;
    outline: none;
}

/* ── 11. Utility ───────────────────────────────────── */
.hidden {
    display: none !important;
}

.shake {
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* ── 12. Site Footer ───────────────────────────────── */
.site-footer {
    width: 100%;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 32px 24px 40px;
    box-sizing: border-box;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px 24px;
    margin-bottom: 28px;
}

.footer-section h3 {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(56, 189, 248, 0.15);
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-section ul li a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 400;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.footer-section ul li a::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: var(--transition);
    flex-shrink: 0;
}

.footer-section ul li a:hover {
    color: var(--accent-primary);
}

.footer-section ul li a:hover::before {
    background: var(--accent-primary);
    box-shadow: 0 0 6px var(--accent-primary);
}

.footer-section p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.7;
    margin-bottom: 4px;
}

.footer-section p strong {
    color: var(--text-primary);
    font-weight: 500;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

/* ── 13. Responsive (Mobile) ───────────────────────── */
@media (max-width: 480px) {
    #app-wrapper {
        padding: 16px 12px 80px;
        gap: 16px;
    }

    h1#game-title {
        font-size: 1.5rem;
        letter-spacing: 5px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .nav-btn {
        font-size: 0.75rem;
        padding: 0 8px;
    }

    select.nav-btn {
        max-width: 130px;
    }

    .icon-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }
}

/* ── 14. Virtual Cursor (Stealth Simulation) ──────── */
#virtual-cursor {
    position: fixed;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: transform 0.2s ease, width 0.2s ease, height 0.2s ease;
}

#virtual-cursor.dragging {
    width: 26px;
    height: 26px;
    background: rgba(255, 255, 255, 0.45);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.8);
    transform: translate(-50%, -50%) scale(0.85);
}

/* 펄스 효과 제거 (일반 사용자가 눈치채지 못하게) */
#virtual-cursor::after {
    display: none;
}

/* ── 15. Scrollbar Styling ─────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.2);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(56, 189, 248, 0.4);
}
