/* 미니게임: 키워드 닌자 — Daily Challenge */
#minigame-view { padding: 0; }

#mg-stage {
    position: relative;
    width: 100%;
    height: calc(100vh - 64px);
    min-height: 480px;
    overflow: hidden;
    background:
        radial-gradient(1200px 600px at 50% -10%, rgba(99,102,241,0.18), transparent 60%),
        radial-gradient(900px 500px at 90% 110%, rgba(168,85,247,0.14), transparent 60%),
        var(--bg, #09090b);
    touch-action: manipulation;
    user-select: none;
}

#mg-canvas { position: absolute; inset: 0; display: block; }

/* ---- HUD ---- */
#mg-hud {
    position: absolute; top: 0; left: 0; right: 0;
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 1rem 1.25rem; pointer-events: none; z-index: 3;
}
.mg-hud-left { display: flex; flex-direction: column; line-height: 1; }
.mg-score { font-size: 2rem; font-weight: 800; color: var(--text-primary, #f4f4f5); font-variant-numeric: tabular-nums; }
.mg-score-label { font-size: 0.65rem; letter-spacing: 0.15em; color: var(--text-muted, #71717a); margin-top: 2px; }
.mg-combo {
    font-size: 1.1rem; font-weight: 800;
    background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    animation: mg-combo-pop 0.25s ease;
}
@keyframes mg-combo-pop { from { transform: scale(1.4); } to { transform: scale(1); } }
.mg-hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.mg-lives { font-size: 1.25rem; letter-spacing: 2px; }
.mg-misses { font-size: 0.72rem; font-weight: 700; color: var(--text-muted, #8b8b94); }

/* ---- Masked headline + context ---- */
.mg-top {
    position: absolute; top: 76px; left: 50%; transform: translateX(-50%);
    width: min(720px, 90%); z-index: 2; pointer-events: none; text-align: center;
}
.mg-headline {
    text-align: center; pointer-events: none;
    font-size: clamp(1.1rem, 3.2vw, 1.9rem); font-weight: 700; line-height: 1.6;
    color: var(--text-secondary, #a1a1aa);
    text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
.mg-context {
    margin-top: 0.75rem; font-size: clamp(0.78rem, 2vw, 0.92rem); line-height: 1.65;
    color: var(--text-muted, #8b8b94);
    background: rgba(24,24,27,0.6); border: 1px solid var(--border-light, #27272a);
    border-radius: 10px; padding: 0.65rem 0.9rem; backdrop-filter: blur(4px);
    text-align: left;
}
.mg-headline .mg-word { color: var(--text-secondary, #a1a1aa); }
.mg-headline .mg-slot {
    color: transparent; border-bottom: 2px dashed rgba(168,85,247,0.7);
    padding: 0 4px; letter-spacing: 2px; border-radius: 2px;
}
.mg-headline .mg-slot-filled {
    color: #f4f4f5; border-bottom: 2px solid transparent;
    background: linear-gradient(135deg, rgba(99,102,241,0.35), rgba(236,72,153,0.35));
    padding: 0 6px; border-radius: 6px; letter-spacing: normal;
    animation: mg-reveal 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes mg-reveal { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---- Overlays (start / game over) ---- */
.mg-overlay {
    position: absolute; inset: 0; z-index: 5;
    display: flex; align-items: center; justify-content: center;
    background: rgba(9,9,11,0.72); backdrop-filter: blur(8px);
    padding: 1.5rem;
}
.mg-panel {
    width: min(440px, 100%);
    background: var(--surface, #18181b);
    border: 1px solid var(--border-light, #27272a);
    border-radius: 18px; padding: 2rem 1.75rem; text-align: center;
    box-shadow: 0 24px 64px rgba(0,0,0,0.55);
    max-height: 90%; overflow-y: auto;
}
.mg-logo { font-size: 1.9rem; font-weight: 800; color: #f4f4f5; }
.mg-subtitle {
    font-size: 0.85rem; font-weight: 700; letter-spacing: 0.08em; margin-top: 4px;
    background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.mg-howto { font-size: 0.85rem; color: var(--text-secondary, #a1a1aa); margin: 1rem 0 1.25rem; line-height: 1.6; }
.mg-howto b { color: #f4f4f5; }

.mg-lang-toggle { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; }
.mg-lang-btn {
    flex: 1; padding: 0.6rem; border-radius: 10px; cursor: pointer;
    background: var(--surface-hover, #27272a); color: var(--text-secondary, #a1a1aa);
    border: 1px solid var(--border-light, #27272a); font-size: 0.9rem; font-weight: 600;
    transition: all 0.15s ease;
}
.mg-lang-btn.active { background: rgba(99,102,241,0.18); color: #f4f4f5; border-color: rgba(99,102,241,0.6); }

.mg-btn {
    border: none; border-radius: 10px; cursor: pointer; font-size: 0.95rem; font-weight: 700;
    padding: 0.8rem 1.25rem; transition: transform 0.12s ease, filter 0.15s ease;
}
.mg-btn:hover { filter: brightness(1.08); }
.mg-btn:active { transform: translateY(1px); }
.mg-btn:disabled { opacity: 0.6; cursor: default; }
.mg-btn-primary { width: 100%; color: #fff; background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899); }
.mg-btn-ghost { background: var(--surface-hover, #27272a); color: var(--text-primary, #f4f4f5); border: 1px solid var(--border-light, #3f3f46); }
.mg-loading { margin-top: 0.75rem; font-size: 0.85rem; color: var(--text-muted, #71717a); }

/* ---- Game over ---- */
.mg-gameover-title { font-size: 1.5rem; font-weight: 800; color: #f4f4f5; }
.mg-final-score { margin: 0.75rem 0; }
#mg-final-score-num { font-size: 3rem; font-weight: 800; color: #f4f4f5; font-variant-numeric: tabular-nums;
    background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.mg-final-score-label { font-size: 1rem; color: var(--text-muted, #71717a); margin-left: 4px; }
.mg-best { font-size: 0.8rem; color: var(--text-muted, #71717a); min-height: 1em; }

.mg-article-card {
    text-align: left; background: var(--bg, #09090b); border: 1px solid var(--border-light, #27272a);
    border-radius: 12px; padding: 1rem; margin: 1rem 0;
}
.mg-article-title { font-size: 0.95rem; font-weight: 700; color: #f4f4f5; line-height: 1.4; }
.mg-article-snippet { font-size: 0.82rem; color: var(--text-secondary, #a1a1aa); margin-top: 0.5rem; line-height: 1.6; }
.mg-article-link { display: inline-block; margin-top: 0.75rem; font-size: 0.82rem; font-weight: 600; color: var(--primary, #3b82f6); text-decoration: none; }
.mg-article-link:hover { text-decoration: underline; }

.mg-cta-row { display: flex; flex-direction: column; gap: 0.6rem; }

/* ---- Leaderboard ---- */
.mg-leaderboard { margin-top: 1.5rem; text-align: left; }
.mg-lb-title { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; color: var(--text-muted, #71717a); margin-bottom: 0.5rem; text-transform: uppercase; }
.mg-lb-empty { font-size: 0.82rem; color: var(--text-muted, #71717a); }
.mg-lb-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0.5rem; border-radius: 8px; font-size: 0.85rem; }
.mg-lb-row.mg-lb-me { background: rgba(99,102,241,0.15); }
.mg-lb-rank { width: 1.8rem; text-align: center; }
.mg-lb-name { flex: 1; color: var(--text-primary, #f4f4f5); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-lb-score { font-weight: 700; color: var(--text-primary, #f4f4f5); font-variant-numeric: tabular-nums; }

@media (max-width: 480px) {
    #mg-stage { height: calc(100vh - 56px); }
    .mg-top { top: 60px; }
    .mg-score { font-size: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    .mg-combo, .mg-slot-filled { animation: none; }
}
