/* The Trainer Journey: Patch's mission card at the top of a new trainer's Badge (MissionCard.razor), and the
   full-screen unlock reveal when a section opens (FeatureUnlock.razor). Phone first. */

/* ---------- Mission card ---------- */
.mission {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(var(--sc-primary-rgb), 0.45);
    border-radius: var(--sc-radius-lg);
    background:
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px),
        linear-gradient(135deg, rgba(var(--sc-primary-rgb), 0.18), var(--sc-surface) 70%);
    color: var(--sc-text);
    animation: mission-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.mission-patch { width: 52px; }

.mission-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.mission-eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgb(var(--sc-primary-rgb));
}

.mission-goal { font-family: 'Fredoka', sans-serif; font-size: 1.05rem; font-weight: 600; line-height: 1.2; }

.mission-bar {
    display: block;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.mission-bar > span {
    display: block;
    height: 100%;
    min-width: 6px;
    border-radius: inherit;
    background: linear-gradient(90deg, rgb(var(--sc-primary-rgb)), var(--sc-gold));
    transition: width 0.6s ease;
}

.mission-next { display: flex; align-items: center; gap: 4px; font-size: 0.78rem; color: var(--sc-text-muted, rgba(255, 255, 255, 0.65)); }

.mission-secret {
    font-family: monospace;
    letter-spacing: 0.1em;
    color: var(--sc-gold);
    animation: mission-glitch 2.4s steps(1) infinite;
}

.mission-go { min-width: 56px; padding-inline: 14px; }

@keyframes mission-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

@keyframes mission-glitch {
    0%, 86%, 100% { transform: none; text-shadow: none; }
    88% { transform: translateX(-2px); text-shadow: 2px 0 rgba(255, 60, 120, 0.8), -2px 0 rgba(60, 220, 255, 0.8); }
    92% { transform: translateX(2px); text-shadow: -2px 0 rgba(255, 60, 120, 0.8), 2px 0 rgba(60, 220, 255, 0.8); }
}

/* ---------- Unlock reveal ---------- */
.unlock-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: max(24px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
    background:
        radial-gradient(circle at 50% 35%, rgba(var(--sc-primary-rgb), 0.28), transparent 60%),
        rgba(4, 8, 20, 0.92);
    color: var(--sc-text);
    animation: unlock-fade 0.3s ease both;
    overflow-y: auto;
}

.unlock-stage { display: flex; flex-direction: column; align-items: center; text-align: center; }

.unlock-tile {
    position: relative;
    display: grid;
    place-items: center;
    width: 132px;
    height: 132px;
    border-radius: 28px;
    border: 2px solid rgba(var(--sc-primary-rgb), 0.6);
    background: linear-gradient(160deg, rgba(var(--sc-primary-rgb), 0.3), var(--sc-surface) 80%);
    animation: unlock-drop 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}

.unlock-icon { font-size: 60px; line-height: 0; color: var(--sc-text); transition: filter 0.4s ease, opacity 0.4s ease; }

.unlock-tile.is-locked .unlock-icon,
.unlock-tile.is-breaking .unlock-icon {
    opacity: 0.35;
    filter: blur(2px) grayscale(1);
    animation: unlock-static 0.25s steps(2) infinite;
}

.unlock-rays {
    position: absolute;
    inset: -60px;
    border-radius: 50%;
    background: repeating-conic-gradient(from 0deg, rgba(255, 214, 102, 0.35) 0 8deg, transparent 8deg 24deg);
    opacity: 0;
    pointer-events: none;
    -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%);
    mask: radial-gradient(circle, #000 30%, transparent 70%);
}

.unlock-tile.is-resolved {
    border-color: var(--sc-gold);
    box-shadow: 0 0 40px rgba(255, 214, 102, 0.45);
    animation: unlock-pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.4) both;
}

.unlock-tile.is-resolved .unlock-rays { opacity: 1; animation: unlock-spin 9s linear infinite, unlock-fade 0.6s ease both; }

.unlock-padlock {
    position: absolute;
    right: -10px;
    bottom: -10px;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--sc-surface-2, #1b2238);
    border: 2px solid rgba(255, 255, 255, 0.25);
    font-size: 24px;
}

.unlock-padlock i {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 1px;
    background: var(--sc-gold);
    opacity: 0;
}

.unlock-tile.is-breaking .unlock-padlock { animation: unlock-shake 0.35s ease-in-out 2; }
.unlock-tile.is-breaking .unlock-padlock ion-icon { animation: unlock-burst 0.25s ease-in 0.45s forwards; }
.unlock-tile.is-breaking .unlock-padlock i { animation: unlock-shard 0.5s ease-out 0.45s forwards; }

.unlock-eyebrow {
    margin: 22px 0 2px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--sc-gold);
}

.unlock-title { margin: 0; font-family: 'Fredoka', sans-serif; font-size: 1.8rem; font-weight: 700; }

.unlock-talk {
    display: grid;
    gap: 16px;
    width: 100%;
    max-width: 440px;
    animation: unlock-rise 0.4s ease both;
}

.unlock-actions { display: flex; gap: 10px; justify-content: center; }
.unlock-actions .btn { min-width: 120px; }

@keyframes unlock-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes unlock-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes unlock-drop { from { opacity: 0; transform: translateY(-80px) scale(0.8); } to { opacity: 1; transform: none; } }
@keyframes unlock-pop { 0% { transform: scale(1); } 40% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes unlock-spin { to { transform: rotate(360deg); } }
@keyframes unlock-static { 50% { transform: translateX(2px); } }
@keyframes unlock-shake { 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }
@keyframes unlock-burst { to { transform: scale(1.6); opacity: 0; } }
@keyframes unlock-shard {
    from { opacity: 1; transform: rotate(var(--a)) translateY(0); }
    to { opacity: 0; transform: rotate(var(--a)) translateY(-46px) rotate(120deg); }
}

@media (prefers-reduced-motion: reduce) {
    .mission, .mission-secret, .unlock-overlay, .unlock-tile, .unlock-talk,
    .unlock-tile.is-resolved .unlock-rays, .unlock-icon { animation: none !important; }
}
