:root {
    color-scheme: dark;
    --page-bg: #090909;
    --surface: #151515;
    --text: #ffffff;
    --muted: rgba(255, 255, 255, 0.7);
    --line: rgba(255, 255, 255, 0.12);
    --accent: #ff3567;
    --accent-deep: #ef164e;
    --glass: rgba(15, 15, 15, 0.66);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    min-height: 100%;
    margin: 0;
    background: var(--page-bg);
}

body {
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
    overflow: hidden;
    overscroll-behavior: none;
}

button {
    font: inherit;
}

.app-shell {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 620px;
    margin: 0 auto;
    overflow: hidden;
    background: #111;
    isolation: isolate;
}

.ambient {
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 15% 8%, rgba(255, 255, 255, 0.12), transparent 29%),
        radial-gradient(circle at 90% 90%, rgba(239, 22, 78, 0.18), transparent 35%),
        #111;
}

.stage,
.guest-card {
    position: absolute;
    inset: 0;
}

.guest-card {
    overflow: hidden;
    background: #181818;
    touch-action: pan-y;
    cursor: grab;
    transition: transform 320ms cubic-bezier(0.2, 0.78, 0.2, 1), opacity 320ms ease;
    will-change: transform, opacity;
}

.guest-card.is-dragging {
    cursor: grabbing;
    transition: none;
}

.guest-card.is-leaving-left {
    transform: translate3d(-105%, 0, 0) rotate(-3deg);
    opacity: 0;
}

.guest-card.is-leaving-right {
    transform: translate3d(105%, 0, 0) rotate(3deg);
    opacity: 0;
}

.guest-card.is-entering {
    animation: card-enter 360ms cubic-bezier(0.16, 0.84, 0.3, 1);
}

@keyframes card-enter {
    from {
        opacity: 0.55;
        transform: scale(1.025);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.photo-wrap,
.guest-photo,
.photo-placeholder,
.photo-shade {
    position: absolute;
    inset: 0;
}

.guest-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 28%;
    user-select: none;
    pointer-events: none;
}

.photo-placeholder {
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.12), transparent 46%),
        linear-gradient(160deg, #4d4039, #1d1c1b 65%, #0c0c0c);
}

.photo-placeholder::after {
    content: "缘";
    position: absolute;
    top: 26%;
    left: 50%;
    width: 132px;
    height: 132px;
    margin-left: -66px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.18);
    font-family: "STSong", "SimSun", serif;
    font-size: 70px;
    line-height: 130px;
    text-align: center;
}

.photo-shade {
    background:
        linear-gradient(to bottom, rgba(0, 0, 0, 0.2) 0%, transparent 18%, transparent 43%, rgba(4, 4, 4, 0.58) 63%, rgba(7, 7, 7, 0.98) 100%),
        linear-gradient(to right, rgba(0, 0, 0, 0.12), transparent 35%, transparent 70%, rgba(0, 0, 0, 0.08));
    pointer-events: none;
}

.top-actions {
    position: absolute;
    top: calc(14px + var(--safe-top));
    left: 0;
    right: 0;
    z-index: 6;
    height: 38px;
    pointer-events: none;
}

.swipe-hint {
    position: absolute;
    top: 0;
    left: 50%;
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    gap: 10px;
    padding: 5px 15px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.86);
    background: rgba(20, 20, 20, 0.58);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: 12px;
    letter-spacing: 0.02em;
    transform: translateX(-50%);
    white-space: nowrap;
}

.swipe-hint span {
    color: rgba(255, 255, 255, 0.48);
    font-size: 19px;
    line-height: 1;
}

.share-button {
    position: absolute;
    top: 0;
    right: 15px;
    width: 38px;
    height: 38px;
    padding: 9px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    color: #fff;
    background: rgba(13, 13, 13, 0.48);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    pointer-events: auto;
}

.share-button:active {
    transform: scale(0.94);
}

.share-button svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.share-button path {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
}

.profile-layer {
    position: absolute;
    right: 18px;
    bottom: calc(102px + var(--safe-bottom));
    left: 18px;
    z-index: 4;
}

.ai-notice {
    position: absolute;
    bottom: calc(74px + var(--safe-bottom));
    left: 50%;
    z-index: 5;
    display: block;
    width: max-content;
    max-width: calc(100% - 36px);
    margin: 0;
    padding: 6px 11px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.84);
    background: rgba(9, 9, 9, 0.6);
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
    font-size: 11px;
    line-height: 1.4;
    text-align: center;
    transform: translateX(-50%);
}

.identity-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 9px;
    white-space: nowrap;
}

.guest-name {
    margin: 0;
    font-family: "STSong", "Songti SC", "SimSun", serif;
    font-size: clamp(32px, 9vw, 43px);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.04em;
    text-shadow: 0 3px 18px rgba(0, 0, 0, 0.35);
}

.age-pill {
    display: inline-flex;
    align-items: center;
    align-self: center;
    height: 30px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 7px;
    color: #fff;
    background: #5f3543;
    font-size: 15px;
    font-weight: 600;
}

.guest-code {
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
}

.tags {
    display: flex;
    min-height: 32px;
    flex-wrap: wrap;
    gap: 8px;
    margin: 6px 0 15px;
}

.tag {
    display: inline-flex;
    max-width: 100%;
    min-height: 32px;
    align-items: center;
    padding: 5px 11px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 7px;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(23, 23, 23, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-size: 12px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-height: 72px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(21, 21, 21, 0.69);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.stat {
    position: relative;
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.stat + .stat::before {
    content: "";
    position: absolute;
    top: 18px;
    bottom: 18px;
    left: 0;
    width: 1px;
    background: var(--line);
}

.stat strong {
    overflow: hidden;
    max-width: 100%;
    padding: 0 5px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat span {
    color: rgba(255, 255, 255, 0.64);
    font-size: 10px;
}

.bottom-actions {
    position: absolute;
    right: 22px;
    bottom: calc(17px + var(--safe-bottom));
    left: 22px;
    z-index: 7;
}

.contact-button {
    width: 100%;
    height: 52px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(100deg, #ff4c76, var(--accent-deep));
    box-shadow: 0 10px 32px rgba(239, 22, 78, 0.3);
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.08em;
    transition: transform 150ms ease, filter 150ms ease;
}

.contact-button:active {
    transform: scale(0.98);
    filter: brightness(0.94);
}

.quota-indicator {
    position: absolute;
    top: calc(61px + var(--safe-top));
    right: 16px;
    z-index: 5;
    padding: 5px 9px;
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.64);
    background: rgba(0, 0, 0, 0.35);
    font-size: 10px;
}

.toast {
    position: absolute;
    top: 52%;
    left: 50%;
    z-index: 120;
    max-width: 82%;
    padding: 10px 15px;
    border-radius: 8px;
    opacity: 0;
    color: #fff;
    background: rgba(0, 0, 0, 0.8);
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.96);
    transition: opacity 180ms ease, transform 180ms ease;
    font-size: 13px;
    text-align: center;
}

.toast.is-visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.loading-card {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    color: rgba(255, 255, 255, 0.58);
    background: #171717;
    font-size: 12px;
}

.loading-orbit {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top-color: rgba(255, 255, 255, 0.84);
    border-radius: 50%;
    animation: spin 850ms linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.no-guest {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 38px 140px;
    text-align: center;
    background:
        radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.1), transparent 28%),
        linear-gradient(160deg, #302722, #111);
}

.no-guest-mark {
    width: 104px;
    height: 104px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.45);
    font-family: "STSong", "SimSun", serif;
    font-size: 52px;
    line-height: 102px;
}

.no-guest h1 {
    margin: 0 0 10px;
    font-family: "STSong", "Songti SC", "SimSun", serif;
    font-size: 25px;
}

.no-guest p {
    max-width: 320px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.8;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.66);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fade-in 180ms ease;
}

.modal-backdrop[hidden] {
    display: none;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    position: relative;
    width: min(100%, 360px);
    padding: 29px 24px 22px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    background:
        radial-gradient(circle at 50% 0, rgba(255, 255, 255, 0.08), transparent 40%),
        #171717;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.52);
    text-align: center;
    animation: modal-in 260ms cubic-bezier(0.16, 0.84, 0.3, 1);
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 13px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.55);
    background: transparent;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.06);
}

.modal-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 16px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.82);
    font-family: "STSong", "SimSun", serif;
    font-size: 25px;
    line-height: 51px;
}

.modal h2 {
    margin: 0 0 12px;
    font-family: "STSong", "Songti SC", "SimSun", serif;
    font-size: 23px;
}

.modal p {
    margin: 0 0 23px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 14px;
    line-height: 1.85;
    white-space: pre-wrap;
}

.modal-primary,
.modal-secondary {
    width: 100%;
    height: 46px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
}

.modal-primary {
    border: 0;
    color: #fff;
    background: linear-gradient(100deg, #ff4c76, var(--accent-deep));
}

.modal-secondary {
    margin-top: 9px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.82);
    background: transparent;
}

.modal-secondary[hidden] {
    display: none;
}

[hidden] {
    display: none !important;
}

@media (max-height: 700px) {
    .profile-layer {
        bottom: calc(91px + var(--safe-bottom));
    }

    .guest-name {
        font-size: 32px;
    }

    .tags {
        margin-bottom: 10px;
    }

    .stat {
        min-height: 64px;
    }
}

@media (min-width: 900px) {
    body {
        background:
            radial-gradient(circle at 50% 15%, #33272a, transparent 42%),
            #080808;
    }

    .app-shell {
        width: min(100%, 520px);
        box-shadow: 0 0 80px rgba(0, 0, 0, 0.65);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
