/* First-visit site intro + tap-to-play pandas / stamps */

html.nihao-intro-pending,
html.nihao-intro-open { overflow: hidden; }
html.nihao-intro-pending .page { visibility: hidden; }

.nihao-intro {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 18px 14px 22px;
    background:
        radial-gradient(circle at 18% 12%, rgba(131,215,202,.38), transparent 34%),
        radial-gradient(circle at 86% 18%, rgba(253,120,153,.28), transparent 32%),
        linear-gradient(165deg, #002933 0%, #064552 48%, #0a5c5a 100%);
    color: #fff;
}
.nihao-intro[hidden] { display: none !important; }
.nihao-intro-card {
    position: relative;
    width: min(440px, 100%);
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 28px 22px 22px;
    border-radius: 28px;
    background: linear-gradient(165deg, #fffdf8, #e8f8f5);
    color: #002933;
    text-align: center;
    box-shadow: 0 30px 70px -24px rgba(0,41,51,.75);
}
.nihao-intro-skip {
    position: absolute;
    top: 14px;
    right: 14px;
    min-height: 34px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: #f1f6f6;
    color: #4f6970;
    font: inherit;
    font-size: .78rem;
    font-weight: 800;
    cursor: pointer;
}
.nihao-intro-kicker {
    margin: 8px 0 0;
    color: #83d7ca;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .18em;
}
.nihao-intro h2 {
    margin: 4px 0 0;
    font-family: "Noto Serif HK", "Noto Serif TC", serif;
    font-size: 1.7rem;
    font-weight: 600;
    line-height: 1.2;
}
.nihao-intro-copy {
    margin: 0;
    max-width: 320px;
    color: #4f6970;
    font-size: .9rem;
    line-height: 1.55;
}
.nihao-intro-dots {
    display: flex;
    gap: 6px;
    margin: 4px 0 2px;
}
.nihao-intro-dots i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #cfe7e8;
}
.nihao-intro-dots i.is-on { background: #83d7ca; }

.nihao-intro-gift {
    position: relative;
    width: 230px;
    height: 250px;
    margin: 2px auto 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    perspective: 780px;
}
.nihao-intro-gift:focus-visible {
    outline: 3px solid rgba(131,215,202,.55);
    outline-offset: 6px;
    border-radius: 18px;
}
.nihao-intro-scene {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transform-origin: 50% 70%;
    animation: nihao-intro-idle 2.8s ease-in-out infinite;
}
.nihao-intro-shadow {
    position: absolute;
    left: 48px;
    right: 48px;
    bottom: 26px;
    height: 16px;
    border-radius: 50%;
    background: rgba(0,41,51,.2);
    filter: blur(5px);
}
.nihao-intro-box {
    position: absolute;
    left: 51px;
    width: 128px;
    bottom: 42px;
    height: 94px;
    overflow: hidden;
    border-radius: 8px 8px 14px 14px;
    background: linear-gradient(90deg, #5fb8ab 0%, #83d7ca 46%, #63b9ac 100%);
    box-shadow: inset 10px 0 0 rgba(255,255,255,.16), inset -12px 0 0 rgba(0,41,51,.1), 0 14px 18px -12px rgba(0,41,51,.45);
}
.nihao-intro-inner {
    position: absolute;
    left: 10px;
    right: 10px;
    top: 8px;
    height: 30px;
    border-radius: 7px;
    background: #fff6e8;
    box-shadow: inset 0 -6px 0 rgba(253,120,153,.12);
}
.nihao-intro-ribbon-v {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 22px;
    background: linear-gradient(90deg, #e56b88, #fd7899 50%, #e56b88);
    transform: translateX(-50%);
}
.nihao-intro-lid {
    position: absolute;
    left: 40px;
    width: 150px;
    bottom: 122px;
    height: 44px;
    z-index: 3;
    transform-origin: 18px 100%;
    transform-style: preserve-3d;
    transition: transform .75s cubic-bezier(.16,.84,.18,1);
}
.nihao-intro-lid-face {
    display: block;
    height: 100%;
    border-radius: 11px 11px 6px 6px;
    background: linear-gradient(180deg, #fff, #fff3e4);
    box-shadow: 0 7px 0 #ead7bf, 0 16px 18px -14px rgba(0,41,51,.4);
}
.nihao-intro-ribbon-h {
    position: absolute;
    left: 0;
    right: 0;
    top: 13px;
    height: 18px;
    background: linear-gradient(180deg, #ff92ac, #fd7899 60%, #e56b88);
}
.nihao-intro-bow {
    position: absolute;
    left: 50%;
    top: -18px;
    width: 58px;
    height: 30px;
    transform: translateX(-50%);
}
.nihao-intro-bow::before,
.nihao-intro-bow::after {
    content: "";
    position: absolute;
    top: 4px;
    width: 28px;
    height: 22px;
    border-radius: 50% 50% 48% 48%;
    background: radial-gradient(circle at 50% 40%, #ffc1d1, #fd7899 70%);
}
.nihao-intro-bow::before { left: 0; transform: rotate(-28deg); }
.nihao-intro-bow::after { right: 0; transform: rotate(28deg); }
.nihao-intro-prize {
    position: absolute;
    left: 50%;
    bottom: 54px;
    z-index: 4;
    width: 150px;
    margin: 0;
    opacity: 0;
    transform: translateX(-50%) translateY(18px) scale(.2);
    pointer-events: none;
}
.nihao-intro-prize img {
    width: 150px;
    height: 150px;
    object-fit: contain;
    filter: drop-shadow(0 12px 16px rgba(0,41,51,.28));
}
.nihao-intro-confetti {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    overflow: visible;
}
.nihao-intro-confetti i {
    position: absolute;
    top: 42%;
    width: 8px;
    height: 11px;
    border-radius: 2px;
    opacity: 0;
}
.nihao-intro-gift.is-shake .nihao-intro-scene { animation: nihao-intro-shake .45s ease-in-out; }
.nihao-intro-gift.is-open .nihao-intro-scene { animation: none; }
.nihao-intro-gift.is-open .nihao-intro-lid { transform: translate(-22px, -10px) rotate(-38deg); }
.nihao-intro-gift.is-reveal .nihao-intro-prize { animation: nihao-intro-pop .7s cubic-bezier(.18,1.35,.28,1) forwards; }
.nihao-intro-gift.is-reveal .nihao-intro-confetti i {
    animation-name: nihao-intro-confetti;
    animation-timing-function: ease-out;
    animation-fill-mode: forwards;
}

.nihao-intro-scene-panel { width: 100%; }
.nihao-intro-scene-panel[hidden] { display: none !important; }
.nihao-intro.is-box .nihao-intro-scene-box,
.nihao-intro.is-stamps .nihao-intro-scene-stamps,
.nihao-intro.is-go .nihao-intro-scene-go { display: grid; justify-items: center; gap: 8px; }

.nihao-intro-stamps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    margin-top: 6px;
}
.nihao-intro-stamp {
    display: grid;
    justify-items: center;
    gap: 4px;
    min-height: 148px;
    padding: 12px 8px 10px;
    border: 1px dashed #b9e1e3;
    border-radius: 18px;
    background: #fff;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.nihao-intro-stamp img { width: 72px; height: 72px; object-fit: contain; }
.nihao-intro-stamp strong { font-size: .82rem; line-height: 1.25; }
.nihao-intro-stamp span { color: #4f6970; font-size: .7rem; font-weight: 700; }
.nihao-intro-stamp:hover,
.nihao-intro-stamp:focus-visible {
    transform: translateY(-3px);
    border-color: #83d7ca;
    outline: none;
}
.nihao-intro-stamp.is-on {
    border-style: solid;
    border-color: #83d7ca;
    background: #f4fffc;
    box-shadow: 0 10px 22px -18px rgba(23,111,105,.8);
    animation: nihao-intro-stamp-hit .42s cubic-bezier(.18,1.3,.28,1);
}
.nihao-intro-stamp.is-on::after {
    content: "蓋印";
    display: inline-block;
    margin-top: 2px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #83d7ca;
    color: #002933;
    font-size: .62rem;
    font-weight: 800;
}

.nihao-intro-go-panda {
    width: 168px;
    height: auto;
    margin: 4px 0 2px;
    filter: drop-shadow(0 12px 16px rgba(0,41,51,.18));
}
.nihao-intro-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    width: 100%;
}
.nihao-intro-actions a,
.nihao-intro-actions button.nihao-intro-enter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    border: 0;
    border-radius: 999px;
    background: #83d7ca;
    color: #fff;
    font: inherit;
    font-size: .82rem;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}
.nihao-intro-actions a.secondary,
.nihao-intro-actions button.secondary {
    background: #fff;
    color: #002933;
    border: 1px solid rgba(0,41,51,.14);
}

.nihao-mascot.is-playful,
.hero-panda.is-playful {
    pointer-events: auto;
    cursor: pointer;
    user-select: none;
}
.hero-panda.is-wave,
.nihao-mascot.is-wave {
    animation: nihao-mascot-wave .7s cubic-bezier(.18,1.3,.28,1);
}
.hero-panda.is-spark,
.nihao-mascot.is-spark { position: relative; }

.step.is-playful {
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}
.step.is-playful:hover { transform: translateY(-4px); }
.step.is-stamped {
    position: relative;
    box-shadow: 0 16px 28px -22px rgba(23,111,105,.55);
}
.step.is-stamped::after {
    content: "✓";
    position: absolute;
    top: 14px;
    right: 16px;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #83d7ca;
    color: #002933;
    font-size: .9rem;
    font-weight: 800;
    animation: nihao-intro-stamp-hit .42s cubic-bezier(.18,1.3,.28,1);
}

@keyframes nihao-intro-idle {
    0%, 100% { transform: rotate(-3deg) translateY(0); }
    50% { transform: rotate(3deg) translateY(-5px); }
}
@keyframes nihao-intro-shake {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(-11deg) translateX(-5px); }
    40% { transform: rotate(10deg) translateX(5px); }
    60% { transform: rotate(-8deg); }
    80% { transform: rotate(7deg); }
}
@keyframes nihao-intro-pop {
    0% { opacity: 0; transform: translateX(-50%) translateY(22px) scale(.18); }
    70% { opacity: 1; transform: translateX(-50%) translateY(-78px) scale(1.08); }
    100% { opacity: 1; transform: translateX(-50%) translateY(-70px) scale(1); }
}
@keyframes nihao-intro-confetti {
    0% { opacity: 1; transform: translate(0, 0) rotate(0); }
    100% { opacity: 0; transform: translate(var(--dx, 12px), -130px) rotate(210deg); }
}
@keyframes nihao-intro-stamp-hit {
    0% { transform: scale(.72) rotate(-8deg); }
    70% { transform: scale(1.08) rotate(3deg); }
    100% { transform: scale(1) rotate(0); }
}
@keyframes nihao-mascot-wave {
    0% { transform: rotate(0) translateY(0); }
    25% { transform: rotate(-9deg) translateY(-8px); }
    55% { transform: rotate(8deg) translateY(-4px); }
    100% { transform: rotate(0) translateY(0); }
}

@media (max-width: 620px) {
    .nihao-intro-stamps { grid-template-columns: 1fr; }
    .nihao-intro-stamp { grid-template-columns: 64px minmax(0, 1fr); justify-items: start; min-height: 0; text-align: left; align-items: center; }
    .nihao-intro-stamp img { width: 56px; height: 56px; }
}
@media (prefers-reduced-motion: reduce) {
    .nihao-intro-scene,
    .nihao-intro-gift.is-shake .nihao-intro-scene,
    .nihao-intro-gift.is-reveal .nihao-intro-prize,
    .hero-panda.is-wave,
    .nihao-mascot.is-wave,
    .nihao-intro-stamp.is-on,
    .step.is-stamped::after { animation: none; }
    .nihao-intro-gift.is-open .nihao-intro-lid { transition: none; }
    .nihao-intro-gift.is-reveal .nihao-intro-prize {
        opacity: 1;
        transform: translateX(-50%) translateY(-70px) scale(1);
    }
}
