/**
 * 喜报弹窗 - 《脑壳裂了》玩家突破 10 万
 * 仅首页加载。配色沿用官网 ink/gold 体系。
 */

/* ═══════════ OVERLAY ═══════════ */
.nkl-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483100; /* 高于聊天浮窗，弹窗打开时独占焦点 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(6, 9, 18, 0.66);
    -webkit-backdrop-filter: blur(7px) saturate(120%);
    backdrop-filter: blur(7px) saturate(120%);
    opacity: 0;
    transition: opacity 0.35s ease;
    overflow: hidden;
}
.nkl-overlay[hidden] { display: none; }
.nkl-overlay.is-open { opacity: 1; }
.nkl-overlay.is-closing { opacity: 0; }

/* ═══════════ CARD ═══════════ */
.nkl-card {
    position: relative;
    z-index: 2; /* 压在彩带层之上，保证二维码可读 */
    width: min(430px, 100%);
    max-height: calc(100vh - 2.5rem);
    overflow-y: auto;
    border-radius: 18px;
    padding: 2.4rem 2rem 2rem;
    text-align: center;
    background:
        radial-gradient(120% 60% at 50% -10%, rgba(196, 149, 58, 0.16), transparent 60%),
        linear-gradient(168deg, #131a30 0%, #0a0e1a 62%);
    border: 1px solid rgba(196, 149, 58, 0.38);
    box-shadow:
        0 34px 90px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.09);
    transform: translateY(26px) scale(0.94);
    opacity: 0;
    transition:
        transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.4s ease;
    will-change: transform;
}
.nkl-overlay.is-open .nkl-card {
    transform: none;
    opacity: 1;
}

/* 内圈金色细线，喜报的"画框"感 */
.nkl-card::before {
    content: "";
    position: absolute;
    inset: 9px;
    border-radius: 12px;
    border: 1px solid rgba(196, 149, 58, 0.2);
    pointer-events: none;
}

/* ═══════════ 头部 ═══════════ */
.nkl-kicker {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    color: hsl(var(--gold-soft));
    border: 1px solid rgba(196, 149, 58, 0.35);
    border-radius: 999px;
    padding: 0.28rem 0.95rem;
    padding-right: calc(0.95rem - 0.14em); /* 抵消末字符 letter-spacing 拖尾，保证胶囊内视觉居中 */
    margin-bottom: 1.15rem;
}

.nkl-title {
    font-family: var(--font-headline);
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: 0.42em;
    margin-left: 0.42em; /* 居中时只抵消一半拖尾间距，补偿量 = 完整 letter-spacing */
    line-height: 1.15;
    color: hsl(var(--gold));
    text-shadow: 0 0 24px rgba(196, 149, 58, 0.35);
}

.nkl-number {
    font-family: var(--font-headline);
    font-variant-numeric: tabular-nums;
    font-size: clamp(2.3rem, 8vw, 3rem);
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.1;
    color: hsl(var(--foreground));
    margin-top: 1.1rem;
}
.nkl-number .nkl-plus {
    color: hsl(var(--gold));
    font-size: 0.62em;
    vertical-align: 0.28em;
    margin-left: 0.06em;
}

.nkl-milestone {
    font-size: 0.95rem;
    color: hsl(var(--hero-sub));
    margin-top: 0.35rem;
}

/* 分隔花纹 */
.nkl-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    margin: 1.3rem auto 1.15rem;
    max-width: 220px;
}
.nkl-rule::before,
.nkl-rule::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(196, 149, 58, 0.5));
}
.nkl-rule::after {
    background: linear-gradient(90deg, rgba(196, 149, 58, 0.5), transparent);
}
.nkl-rule i {
    width: 6px;
    height: 6px;
    background: hsl(var(--gold));
    transform: rotate(45deg);
    border-radius: 1px;
}

.nkl-line {
    font-size: 0.92rem;
    line-height: 1.8;
    color: hsl(var(--hero-sub));
    margin-bottom: 1.5rem;
}
.nkl-line strong {
    color: hsl(var(--foreground));
    font-weight: 600;
}

/* ═══════════ 印章 ═══════════ */
.nkl-seal {
    position: absolute;
    top: 22px;
    right: 24px;
    width: 58px;
    height: 58px;
    border: 2px solid rgba(196, 149, 58, 0.75);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    transform: rotate(14deg);
    color: hsl(var(--gold));
    box-shadow: inset 0 0 0 3px rgba(196, 149, 58, 0.14);
    opacity: 0;
    animation: nkl-stamp 0.45s cubic-bezier(0.16, 1, 0.3, 1) 0.75s forwards;
}
.nkl-seal b {
    font-family: var(--font-headline);
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
}
.nkl-seal span {
    font-size: 0.56rem;
    letter-spacing: 0.14em;
    line-height: 1;
}
@keyframes nkl-stamp {
    from { opacity: 0; transform: rotate(14deg) scale(1.9); }
    70%  { opacity: 1; transform: rotate(14deg) scale(0.94); }
    to   { opacity: 1; transform: rotate(14deg) scale(1); }
}

/* ═══════════ 二维码 ═══════════ */
.nkl-qr-figure {
    display: inline-block;
    background: #f5f3ee;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.35);
}
.nkl-qr-figure img {
    width: 148px;
    height: 148px;
    border-radius: 6px;
    display: block;
}
.nkl-qr-caption {
    font-size: 0.8rem;
    color: hsl(var(--hero-sub));
    margin: 0.7rem 0 1.4rem;
    letter-spacing: 0.05em;
}

/* ═══════════ 按钮 ═══════════ */
.nkl-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.nkl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.78rem 1.4rem;
    border-radius: 999px;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, background 0.25s ease;
}
.nkl-btn-primary {
    background: hsl(var(--gold));
    color: #14100a;
    box-shadow: 0 10px 26px rgba(196, 149, 58, 0.28);
}
.nkl-btn-primary:hover {
    background: hsl(var(--gold-soft));
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(196, 149, 58, 0.38);
}
.nkl-btn-primary:active { transform: translateY(0); }
.nkl-btn-primary svg { flex-shrink: 0; }

.nkl-btn-ghost {
    background: transparent;
    color: hsl(var(--hero-sub));
    border: 1px solid rgba(208, 213, 228, 0.18);
}
.nkl-btn-ghost:hover {
    color: hsl(var(--foreground));
    border-color: rgba(208, 213, 228, 0.4);
}

/* ═══════════ 关闭 ═══════════ */
.nkl-close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: hsl(var(--hero-sub));
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}
.nkl-close:hover {
    color: hsl(var(--foreground));
    background: rgba(255, 255, 255, 0.07);
}

/* ═══════════ 彩带 ═══════════ */
.nkl-confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3; /* 在卡片之上飘过，JS 跑完即清空，不长期遮挡内容 */
}
.nkl-confetti i {
    position: absolute;
    top: -12px;
    width: 7px;
    height: 12px;
    border-radius: 2px;
    opacity: 0;
    animation: nkl-fall linear forwards;
}
.nkl-confetti i.nkl-coin {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
@keyframes nkl-fall {
    0%   { opacity: 0; transform: translate3d(0, 0, 0) rotate(0deg); }
    8%   { opacity: 1; }
    100% { opacity: 0; transform: translate3d(var(--nkl-dx, 0px), var(--nkl-dy, 105vh), 0) rotate(var(--nkl-rz, 540deg)); }
}

/* ═══════════ 入场级联 ═══════════ */
.nkl-overlay.is-open .nkl-kicker,
.nkl-overlay.is-open .nkl-title,
.nkl-overlay.is-open .nkl-number,
.nkl-overlay.is-open .nkl-milestone,
.nkl-overlay.is-open .nkl-rule,
.nkl-overlay.is-open .nkl-line,
.nkl-overlay.is-open .nkl-qr,
.nkl-overlay.is-open .nkl-actions {
    animation: nkl-rise 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.nkl-overlay.is-open .nkl-title    { animation-delay: 0.10s; }
.nkl-overlay.is-open .nkl-number   { animation-delay: 0.18s; }
.nkl-overlay.is-open .nkl-milestone{ animation-delay: 0.24s; }
.nkl-overlay.is-open .nkl-rule     { animation-delay: 0.30s; }
.nkl-overlay.is-open .nkl-line     { animation-delay: 0.36s; }
.nkl-overlay.is-open .nkl-qr       { animation-delay: 0.44s; }
.nkl-overlay.is-open .nkl-actions  { animation-delay: 0.54s; }
@keyframes nkl-rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

/* ═══════════ 动效降级 ═══════════ */
@media (prefers-reduced-motion: reduce) {
    .nkl-card,
    .nkl-overlay .nkl-card { transition: opacity 0.25s ease; transform: none; }
    .nkl-seal { animation: none; opacity: 1; }
    .nkl-overlay.is-open .nkl-kicker,
    .nkl-overlay.is-open .nkl-title,
    .nkl-overlay.is-open .nkl-number,
    .nkl-overlay.is-open .nkl-milestone,
    .nkl-overlay.is-open .nkl-rule,
    .nkl-overlay.is-open .nkl-line,
    .nkl-overlay.is-open .nkl-qr,
    .nkl-overlay.is-open .nkl-actions { animation: none; }
    .nkl-confetti { display: none; }
    .nkl-btn { transition: none; }
}

/* ═══════════ 窄屏 ═══════════ */
@media (max-width: 420px) {
    .nkl-card { padding: 2.2rem 1.3rem 1.6rem; }
    .nkl-title { font-size: 2.15rem; }
    .nkl-seal { width: 48px; height: 48px; top: 20px; right: 16px; }
    .nkl-seal b { font-size: 0.8rem; }
    .nkl-seal span { font-size: 0.5rem; }
    .nkl-qr-figure img { width: 132px; height: 132px; }
}
@media (max-width: 360px) {
    /* 极窄屏：印章再缩一档，避免压到顶部胶囊 */
    .nkl-seal { width: 42px; height: 42px; top: 16px; right: 10px; }
}
