/* Unlock reveals (UnlockReveal.razor): banners, themes and titles. Rarity sets --unlock-color. */

.sk-unlock {
    --unlock-color: #9db1d8;
    --unlock-light: #e8f0ff;
    position: fixed;
    inset: 0;
    z-index: 1600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px 20px calc(24px + var(--sc-safe-bottom));
    overflow: hidden;
    background: radial-gradient(ellipse 90% 70% at 50% 40%, var(--sc-bg-elevated) 0%, var(--sc-bg) 75%);
    color: var(--sc-text);
    text-align: center;
    animation: sk-loader-in 0.3s ease both;
}

.sk-unlock.rarity-1 { --unlock-color: #5ef0a0; --unlock-light: #d8ffe9; }
.sk-unlock.rarity-2 { --unlock-color: #4fb8ff; --unlock-light: #d6efff; }
.sk-unlock.rarity-3 { --unlock-color: #b38bff; --unlock-light: #efe5ff; }
.sk-unlock.rarity-4 { --unlock-color: #ffc83d; --unlock-light: #fff4cf; }

.sk-unlock-rays {
    position: absolute;
    top: 38%;
    left: 50%;
    width: 160vmax;
    height: 160vmax;
    margin: -80vmax 0 0 -80vmax;
    background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--unlock-color) 22%, transparent) 0deg 8deg, transparent 8deg 20deg);
    mask-image: radial-gradient(circle, #000 0%, transparent 45%);
    animation: sk-spin 24s linear infinite, sk-unlock-rays-in 0.8s var(--sc-ease-out) both;
    pointer-events: none;
}

.sk-unlock-particles {
    position: absolute;
    top: 38%;
    left: 50%;
    pointer-events: none;
}

.sk-unlock-particles span {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--unlock-color);
    box-shadow: 0 0 10px var(--unlock-color);
    opacity: 0;
    animation: sk-unlock-burst 1.4s var(--sc-ease-out) calc(0.45s + var(--d) * 0.08s) both;
}

.sk-unlock-eyebrow {
    position: relative;
    color: var(--unlock-color);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    animation: sk-unlock-drop 0.5s var(--sc-ease-out) 0.1s both;
}

.sk-unlock-piece {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 220px;
    margin: 6px 0;
}

.sk-unlock-name {
    position: relative;
    margin: 4px 0 0;
    font-family: var(--sc-font-display);
    font-size: clamp(26px, 7vw, 34px);
    font-weight: 700;
    text-shadow: 0 0 24px color-mix(in srgb, var(--unlock-color) 60%, transparent);
    animation: sk-unlock-rise 0.5s var(--sc-ease-out) 0.9s both;
}

.sk-unlock-rarity {
    position: relative;
    padding: 3px 12px;
    border: 1px solid var(--unlock-color);
    border-radius: var(--sc-radius-pill);
    color: var(--unlock-color);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    animation: sk-unlock-rise 0.5s var(--sc-ease-out) 1s both;
}

.sk-unlock-description {
    position: relative;
    max-width: 320px;
    margin: 4px 0 0;
    color: var(--sc-text-muted);
    font-size: 14px;
    animation: sk-unlock-rise 0.5s var(--sc-ease-out) 1.1s both;
}

.sk-unlock-actions {
    position: relative;
    display: flex;
    gap: 10px;
    margin-top: 14px;
    animation: sk-unlock-rise 0.5s var(--sc-ease-out) 1.25s both;
}

.sk-unlock-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Banner: a holo card that flips in, wiped on by a scan line, with a sheen that keeps passing */

.sk-unlock-banner {
    position: relative;
    width: min(320px, 82vw);
    aspect-ratio: 3 / 2;
    border: 2px solid var(--unlock-color);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 0 40px color-mix(in srgb, var(--unlock-color) 45%, transparent), var(--sc-shadow-lg);
    animation: sk-unlock-flip 0.9s var(--sc-ease-spring) 0.2s both;
}

.sk-unlock-banner img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    clip-path: inset(0 0 100% 0);
    animation: sk-unlock-wipe 0.8s linear 0.6s both;
}

.sk-unlock-sheen {
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.55) 48%, rgba(127, 248, 219, 0.35) 52%, transparent 70%);
    mix-blend-mode: overlay;
    transform: translateX(-120%);
    animation: sk-unlock-sheen 2.8s ease-in-out 1.3s infinite;
}

/* Theme: the screen repaints from the centre, then a little phone shows the new colours */

.sk-unlock-repaint {
    position: fixed;
    top: 38%;
    left: 50%;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--sc-primary) 0%, var(--sc-azure) 40%, var(--sc-bg) 70%);
    opacity: 0.5;
    animation: sk-unlock-repaint 1.1s var(--sc-ease-out) 0.15s both;
    pointer-events: none;
}

.sk-unlock-phone {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 128px;
    height: 220px;
    padding: 8px;
    border: 3px solid rgba(255, 255, 255, 0.85);
    border-radius: 22px;
    background: var(--sc-bg);
    box-shadow: 0 0 40px rgba(var(--sc-primary-rgb), 0.45), var(--sc-shadow-lg);
    animation: sk-unlock-phone 0.8s var(--sc-ease-spring) 0.55s both;
}

.sk-unlock-phone-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sk-unlock-phone-top span {
    width: 28px;
    height: 10px;
    border-radius: 5px;
    background: var(--sc-gold);
}

.sk-unlock-phone-card {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    border: 1px solid rgba(var(--sc-primary-rgb), 0.35);
    border-radius: 10px;
    background: var(--sc-surface);
}

.sk-unlock-phone-card span {
    height: 7px;
    border-radius: 4px;
    background: var(--sc-surface-3);
}

.sk-unlock-phone-card span:first-child {
    width: 70%;
    background: var(--sc-gradient-primary);
}

.sk-unlock-phone-card.is-short span:first-child {
    width: 45%;
    background: var(--sc-azure);
}

.sk-unlock-phone-tabs {
    display: flex;
    align-items: center;
    justify-content: space-around;
    margin-top: auto;
    padding: 6px 2px 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sk-unlock-phone-tabs i {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--sc-surface-3);
}

.sk-unlock-phone-tabs b {
    width: 22px;
    height: 22px;
    margin-top: -12px;
    border-radius: 50%;
    background: var(--sc-gradient-primary);
    box-shadow: 0 0 10px var(--sc-primary);
}

.sk-unlock-swatches {
    position: absolute;
    right: -46px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sk-unlock-swatches span {
    width: 26px;
    height: 26px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    box-shadow: var(--sc-shadow);
    animation: sk-unlock-pop 0.45s var(--sc-ease-spring) both;
}

.sk-unlock-swatches span:nth-child(1) { animation-delay: 1s; }
.sk-unlock-swatches span:nth-child(2) { animation-delay: 1.1s; }
.sk-unlock-swatches span:nth-child(3) { animation-delay: 1.2s; }
.sk-unlock-swatches span:nth-child(4) { animation-delay: 1.3s; }

/* Title: a badge that stamps down, then fills its rank stars one by one */

.sk-unlock-badge {
    width: 150px;
    height: 175px;
    overflow: visible;
    filter: drop-shadow(0 0 22px color-mix(in srgb, var(--unlock-color) 55%, transparent));
    animation: sk-unlock-stamp 0.7s cubic-bezier(0.5, 0, 0.6, 1.4) 0.25s both;
}

.sk-unlock-ribbon {
    fill: color-mix(in srgb, var(--unlock-color) 70%, #000);
}

.sk-unlock-stars path {
    fill: rgba(0, 0, 0, 0.35);
    transform-box: fill-box;
    transform-origin: center;
}

.sk-unlock-stars path.is-on {
    fill: #fff;
    animation: sk-unlock-star 0.4s var(--sc-ease-spring) calc(0.8s + var(--s) * 0.14s) both;
}

.sk-unlock-rank {
    fill: #fff;
    font-family: var(--sc-font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2em;
}

@keyframes sk-unlock-rays-in { from { opacity: 0; transform: scale(0.6); } }

@keyframes sk-unlock-burst {
    0% { transform: rotate(var(--a)) translateX(0) scale(1.4); opacity: 1; }
    100% { transform: rotate(var(--a)) translateX(150px) scale(0.2); opacity: 0; }
}

@keyframes sk-unlock-drop { from { opacity: 0; transform: translateY(-12px); } }
@keyframes sk-unlock-rise { from { opacity: 0; transform: translateY(12px); } }

@keyframes sk-unlock-flip {
    from { opacity: 0; transform: perspective(700px) rotateY(95deg) scale(0.7); }
}

@keyframes sk-unlock-wipe {
    to { clip-path: inset(0 0 0 0); }
}

@keyframes sk-unlock-sheen {
    0% { transform: translateX(-120%); }
    45%, 100% { transform: translateX(120%); }
}

@keyframes sk-unlock-repaint {
    from { transform: scale(0); opacity: 0.9; }
    to { transform: scale(260); opacity: 0; }
}

@keyframes sk-unlock-phone {
    from { opacity: 0; transform: translateY(40px) rotate(-8deg) scale(0.8); }
}

@keyframes sk-unlock-pop { from { opacity: 0; transform: scale(0); } }

@keyframes sk-unlock-stamp {
    0% { opacity: 0; transform: scale(2.6) rotate(-14deg); }
    70% { opacity: 1; transform: scale(0.92) rotate(2deg); }
    100% { transform: scale(1) rotate(0); }
}

@keyframes sk-unlock-star {
    from { transform: scale(0) rotate(-90deg); }
}

@media (prefers-reduced-motion: reduce) {
    .sk-unlock *,
    .sk-unlock {
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
        animation-iteration-count: 1 !important;
    }
}

/* Theme picker (profile edit) and the theme found on the scan screen */

.theme-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.theme-picker-label {
    color: var(--sc-text-muted);
    font-size: 13px;
    font-weight: 600;
}

.theme-picker-label small {
    margin-left: 6px;
    color: var(--sc-text-faint);
}

.theme-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 8px;
}

/* A tiny screen in the theme's colours: its background, an accent dot and a primary button */
.theme-swatch {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    padding: 0;
    overflow: hidden;
    border: 2px solid var(--sc-line-strong);
    border-radius: 10px;
    background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.1), transparent 60%), var(--a);
    cursor: pointer;
    transition: transform 0.2s var(--sc-ease-spring), border-color 0.2s ease;
}

.theme-swatch:not(.is-locked)::before {
    content: "";
    position: absolute;
    top: 16%;
    left: 16%;
    width: 26%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--c);
}

.theme-swatch > span {
    position: absolute;
    right: 16%;
    bottom: 16%;
    left: 16%;
    height: 22%;
    border-radius: 999px;
    background: var(--b);
    box-shadow: 0 0 8px var(--b);
}

.theme-swatch.rarity-3,
.theme-swatch.rarity-4 {
    box-shadow: 0 0 10px rgba(255, 200, 61, 0.35);
}

.theme-swatch.is-on {
    border-color: #fff;
    transform: scale(1.12);
    box-shadow: 0 0 0 3px var(--sc-primary);
}

.theme-swatch.is-locked {
    background: var(--sc-surface);
    color: var(--sc-text-faint);
    font-size: 13px;
    cursor: default;
}

.scan-theme-card {
    background: linear-gradient(160deg, var(--sc-surface-2), var(--sc-bg));
    border: 1px solid rgba(var(--sc-primary-rgb), 0.5);
}

.scan-theme-swatches {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.scan-theme-swatches span {
    width: 34px;
    height: 34px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 10px;
}

/* Compact theme picker: one row until it's opened */

.theme-picker-head {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--sc-line-strong);
    border-radius: var(--sc-radius);
    background: var(--sc-surface);
    color: var(--sc-text);
    text-align: left;
    cursor: pointer;
}

.theme-picker-head .theme-swatch {
    width: 28px;
    height: 28px;
    flex: none;
}

.theme-picker-head .theme-picker-label {
    flex: 1;
    color: var(--sc-text);
}

.theme-picker-toggle {
    color: var(--sc-primary);
    font-size: 13px;
    font-weight: 700;
}

.theme-picker.is-open .theme-picker-grid {
    margin-top: 8px;
    animation: sk-loader-in 0.25s ease both;
}

/* Title picker */

.title-picker-button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--sc-line-strong);
    border-radius: var(--sc-radius);
    background: var(--sc-surface);
    color: var(--sc-text);
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.title-picker-button > ion-icon:first-child { color: var(--sc-gold); }
.title-picker-chevron { margin-left: auto; color: var(--sc-text-faint); }

.title-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(var(--sc-bg-rgb), 0.7);
    backdrop-filter: blur(4px);
    animation: sk-loader-in 0.2s ease both;
}

.title-sheet {
    display: flex;
    flex-direction: column;
    width: min(560px, 100%);
    max-height: 82dvh;
    border: 1px solid var(--sc-line-strong);
    border-bottom: 0;
    border-radius: var(--sc-radius-lg) var(--sc-radius-lg) 0 0;
    background: var(--sc-bg-elevated);
    box-shadow: var(--sc-shadow-lg);
    animation: title-sheet-up 0.35s var(--sc-ease-out) both;
}

.title-sheet-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--sc-line);
}

.title-sheet-head strong { font-family: var(--sc-font-display); font-size: 20px; }
.title-sheet-head span { flex: 1; color: var(--sc-text-muted); font-size: 13px; }

.title-sheet-body {
    padding: 6px 12px calc(16px + var(--sc-safe-bottom));
    overflow-y: auto;
}

.title-track h4 {
    margin: 12px 4px 6px;
    color: var(--sc-text-muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 6px;
    padding: 9px 12px;
    border: 1px solid var(--sc-line);
    border-radius: var(--sc-radius);
    background: var(--sc-surface);
    color: var(--sc-text);
    text-align: left;
}

.title-row.is-unlocked { cursor: pointer; }
.title-row.is-unlocked:hover { border-color: rgba(var(--sc-primary-rgb), 0.5); }
.title-row.is-worn { border-color: var(--sc-primary); box-shadow: var(--sc-glow-primary); }
.title-row.is-locked { opacity: 0.7; }

.title-row-rank {
    display: flex;
    flex: none;
    width: 58px;
    color: var(--sc-gold);
    font-size: 10px;
}

.title-row.is-locked .title-row-rank { color: var(--sc-text-faint); }

.title-row-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.title-row-text small { color: var(--sc-text-muted); font-size: 12px; }

.title-row-state {
    padding: 3px 10px;
    border-radius: var(--sc-radius-pill);
    background: var(--sc-primary-soft);
    color: var(--sc-primary);
    font-size: 12px;
    font-weight: 700;
}

.title-row-state.is-worn { background: var(--sc-gradient-primary); color: var(--sc-navy); }

.title-row-progress {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    width: 72px;
}

.title-row-progress > span {
    display: block;
    height: 5px;
    border-radius: 3px;
    background: var(--sc-gradient-gold);
    align-self: flex-start;
    box-shadow: 0 0 0 999px transparent;
}

.title-row-progress small { color: var(--sc-text-faint); font-size: 11px; }

@keyframes title-sheet-up { from { transform: translateY(100%); } }

/* The sheet sits above the bottom tab bar, which stays on top of page content */
.title-sheet-backdrop {
    padding-bottom: calc(var(--sc-tabbar-height) + var(--sc-safe-bottom));
}

.title-sheet {
    max-height: calc(82dvh - var(--sc-tabbar-height));
    border-bottom: 1px solid var(--sc-line-strong);
    border-radius: var(--sc-radius-lg);
}
