/* Registered custom property so the DXPass ring-draw sweep (--p, in Collection.razor) can animate.
   Must live in plain CSS: Razor parses "<number>" inside a .razor <style> block as an HTML tag. */
@property --p {
    syntax: "<number>";
    inherits: false;
    initial-value: 0;
}

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--theme-page-bg);
    background-image: radial-gradient(circle at 18% -5%, rgba(var(--theme-page-glow-primary-rgb), .07), transparent 42%),
                      radial-gradient(circle at 92% 8%, rgba(var(--theme-page-glow-secondary-rgb), .08), transparent 38%);
    background-attachment: fixed;
}

h1:focus {
    outline: none;
}

h1, h2, h3 {
    color: var(--theme-primary-deep);
}

a, .btn-link {
    color: var(--theme-link);
}

.btn-primary {
    color: #fff;
    background-image: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-accent) 100%);
    background-color: var(--theme-primary);
    border: none;
}

    .btn-primary:hover, .btn-primary:focus {
        color: #fff;
        filter: brightness(1.08);
    }

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 .1rem white, 0 0 0 .25rem var(--theme-focus-ring);
}

.form-check-input:checked {
    background-color: var(--theme-accent);
    border-color: var(--theme-accent);
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3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Y1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: var(--theme-accent);
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: var(--theme-accent-strong);
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ============ Account gate (black theme: logged-out + unactivated) ============ */
.gate-screen {
    position: fixed; inset: 0; z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    background: var(--theme-gate-bg);
    background-image: radial-gradient(circle at 50% 18%, rgba(var(--theme-primary-rgb), .18), transparent 55%),
                      radial-gradient(circle at 80% 95%, rgba(var(--theme-accent-rgb), .10), transparent 50%);
    color: #ece7f5; padding: 1.5rem;
}
.gate-screen-loading { background: var(--theme-gate-bg); background-image: none; }

.gate-card {
    width: 100%; max-width: 360px;
    background: var(--theme-gate-surface);
    border: 1px solid rgba(var(--theme-primary-rgb), .22); border-radius: 16px;
    padding: 2.2rem 1.8rem; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
    display: flex; flex-direction: column; backdrop-filter: blur(6px);
}

.gate-title { font-size: 1.5rem; font-weight: 700; text-align: center; letter-spacing: 0.04em; margin-bottom: 1.4rem; color: var(--theme-gate-text); }
.gate-greeting { font-size: 1.35rem; font-weight: 700; margin-bottom: 0.3rem; color: var(--theme-gate-text); }
.gate-sub { color: var(--theme-gate-muted); font-size: 0.92rem; margin-bottom: 1.2rem; }

.gate-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.2rem; }
.gate-tab { flex: 1; padding: 0.5rem; border: none; border-radius: 9px; cursor: pointer;
    background: transparent; color: var(--theme-gate-muted); font-size: 0.98rem; border-bottom: 2px solid transparent; transition: all .18s; }
.gate-tab.active { color: #fff; border-bottom-color: var(--theme-accent-strong); }

.gate-input { width: 100%; margin-bottom: 0.8rem; padding: 0.7rem 0.9rem;
    background: rgba(8, 5, 14, 0.6); color: #f0ecf7; border: 1px solid rgba(var(--theme-primary-rgb), .28);
    border-radius: 10px; font-size: 0.98rem; outline: none; transition: border-color .18s, box-shadow .18s; }
.gate-input::placeholder { color: #6f6488; }
.gate-input:focus { border-color: var(--theme-accent-strong); box-shadow: 0 0 0 3px rgba(var(--theme-accent-strong-rgb), .2); }

/* The bound email shown on the forced-verification screen (read-only). */
.gate-verify-email { margin: 0.2rem 0 0.9rem; padding: 0.55rem 0.9rem; text-align: center;
    background: rgba(var(--theme-primary-rgb), .22); border: 1px solid rgba(var(--theme-primary-rgb), .28);
    border-radius: 10px; color: #e7def5; font-size: 0.98rem; word-break: break-all; }

/* Email verification code: input + "发送验证码" button on one row. */
.gate-coderow { display: flex; gap: 0.5rem; align-items: stretch; margin-bottom: 0.8rem; }
.gate-coderow .gate-input-code { flex: 1; margin-bottom: 0; }
.gate-codebtn { flex: 0 0 auto; white-space: nowrap; padding: 0 0.9rem; cursor: pointer; border-radius: 10px;
    border: 1px solid rgba(var(--theme-primary-rgb), .4); background: rgba(var(--theme-primary-rgb), .35); color: #e7def5;
    font-size: 0.86rem; transition: filter .18s, opacity .18s; }
.gate-codebtn:hover:not(:disabled) { filter: brightness(1.2); }
.gate-codebtn:disabled { opacity: 0.55; cursor: default; }

.gate-btn { width: 100%; margin-top: 0.4rem; padding: 0.72rem; cursor: pointer; border: none; border-radius: 10px;
    color: #fff; font-size: 1rem; font-weight: 600; background-image: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-accent) 100%);
    transition: filter .18s, transform .1s; }
.gate-btn:hover:not(:disabled) { filter: brightness(1.12); }
.gate-btn:active:not(:disabled) { transform: translateY(1px); }
.gate-btn:disabled { opacity: 0.6; cursor: default; }

.gate-link { margin-top: 0.9rem; background: none; border: none; cursor: pointer;
    color: #8d82a8; font-size: 0.86rem; align-self: center; text-decoration: underline; }
.gate-link:hover { color: var(--theme-accent-strong); }

.gate-error { background: rgba(190, 60, 60, 0.16); border: 1px solid rgba(220, 90, 90, 0.4); color: #ffb4b4;
    border-radius: 8px; padding: 0.5rem 0.7rem; font-size: 0.88rem; margin-bottom: 0.7rem; }
.gate-ok { background: rgba(90, 180, 110, 0.14); border: 1px solid rgba(110, 200, 130, 0.4); color: #b9efc4;
    border-radius: 8px; padding: 0.5rem 0.7rem; font-size: 0.88rem; margin-bottom: 0.7rem; }

.gate-localcards { list-style: none; padding: 0; margin: 0 0 1rem; }
.gate-localcards li { background: rgba(8, 5, 14, 0.5); border: 1px solid rgba(var(--theme-primary-rgb), .2);
    border-radius: 8px; padding: 0.45rem 0.7rem; margin-bottom: 0.4rem; font-family: monospace;
    color: #cfc6e3; font-size: 0.86rem; word-break: break-all; }

/* ============ Activation reveal animation (black blooms into galaxy) ============ */
.gate-reveal { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center;
    background: var(--theme-gate-bg); overflow: hidden; }
.gate-reveal::before { content: ""; position: absolute; inset: 0;
    background-image: radial-gradient(circle at 50% 42%, rgba(var(--theme-primary-rgb), .55), transparent 60%),
                      radial-gradient(circle at 50% 100%, rgba(var(--theme-accent-rgb), .40), transparent 55%),
                      linear-gradient(160deg, var(--theme-sidebar-start) 0%, var(--theme-primary-deep) 55%, var(--theme-sidebar-middle) 100%);
    opacity: 0; animation: revealBloom 1.6s ease-out forwards; }
.gate-reveal-inner { position: relative; text-align: center; }
.gate-reveal-text { color: #fff; font-size: 1.7rem; font-weight: 700; letter-spacing: 0.06em;
    text-shadow: 0 2px 18px rgba(var(--theme-accent-strong-rgb), .7);
    opacity: 0; transform: translateY(14px); animation: revealText 0.9s 0.85s ease-out forwards; }
@keyframes revealBloom { from { opacity: 0; } to { opacity: 1; } }
@keyframes revealText { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

/* ============ Full interface entrance ============ */
/* fill-mode "backwards" (not "both"): after the entrance the transform reverts to none, so it
   doesn't become a containing block that would trap position:fixed modals (e.g. 乐曲数据 详情弹窗). */
.app-enter { animation: appEnter 0.7s ease-out backwards; }
@keyframes appEnter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
/* ============ Score rank colors (shared by 游玩记录 / 乐曲数据) ============ */
.diff-chip,
.chart-kind-badge {
    display: inline-flex;
    /* Chart-kind tags are standalone components. Reset positioning here so Bootstrap's
       one-pixel .badge offset can never pull them away from difficulty tags. */
    position: static;
    flex: 0 0 auto;
    align-self: center;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 1.4rem;
    padding: 0 .5rem;
    border: 1px solid transparent;
    border-radius: .45rem;
    font-size: .72rem;
    font-weight: 400;
    /* Let the browser build a normal text line box, then center that box through flex layout.
       This avoids per-font baseline offsets and keeps all tag sizes on the same geometry. */
    line-height: normal;
    vertical-align: middle;
    white-space: nowrap;
}

.chart-kind-badge {
    min-width: 3rem;
}

.rank { font-weight: 800; letter-spacing: -0.02em; }
.rk-d   { color: #9aa0a6; }                /* D  灰 */
.rk-c   { color: #22bb5b; }                /* C  绿 */
.rk-b   { color: #2b8de0; }                /* B/BB/BBB 蓝 */
.rk-a   { color: #e8404a; }                /* A/AA/AAA 红 */
.rk-s   { color: #ff8c1a; }                /* S/S+ 橙 */
.rk-ss  { color: #f0b400; }                /* SS/SS+ 金 */
.rk-sss { font-weight: 800;                /* SSS/SSS+ 彩虹 */
    background: linear-gradient(90deg, #ff5a5a, #ffb300, #3ddc84, #2b8de0, #b15cff);
    -webkit-background-clip: text; background-clip: text; color: transparent; }

/* DX-score stars shown next to a DX score in score lists */
.dx-mini { font-size: 0.72rem; color: #d4a017; letter-spacing: 0.04em; white-space: nowrap; }

/* ============ Mobile / small-screen adaptations ============ */
/* Utility: collapse a (secondary) column/element on phones. !important so it beats the per-component
   <style> blocks that are injected after app.css in source order. */
@media (max-width: 640px) {
    .mob-hide { display: none !important; }

    .content { padding-top: 0.75rem; }
    main .top-row.auth { padding-left: 1rem !important; padding-right: 1rem !important; }
    .user-greeting { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* Keep wide tables from breaking the page; momentum-scroll the overflow instead. */
    .table-responsive { -webkit-overflow-scrolling: touch; }

    h1 { font-size: 1.6rem; }
}

/* ============ DX-score stars (maimai-style sparkles) ============ */
.dxs { display: inline-flex; align-items: center; gap: 1px; vertical-align: middle; line-height: 1; }
.dxs-star { width: 1.05em; height: 1.05em; filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.dxs-none { color: #b8c0c8; }
.dxs-compact .dxs-wrap { position: relative; display: inline-block; line-height: 0; }
.dxs-compact .dxs-star { width: 1.5em; height: 1.5em; }
.dxs-compact .dxs-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 0.72em; font-weight: 800; text-shadow: 0 1px 1px rgba(0,0,0,.45);
    transform: translateY(-3%); }
