:root {
    --bg-color: #0b0e14;
    --card-bg: rgba(16, 22, 36, 0.6);
    --card-border: rgba(91, 193, 254, 0.3);
    --text-main: #f0f4f8;
    --text-muted: #8b9bb4;
    --accent-gold: #e2c98a;
    --accent-gold-glow: rgba(226, 201, 138, 0.6);
    --accent-blue: #5bc1fe;
    --accent-blue-glow: rgba(91, 193, 254, 0.5);

    --font-sans: 'Noto Sans SC', sans-serif;
    --font-heading: 'Orbitron', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* --- 星空背景与星云 Canvas & CSS --- */
#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2;
    pointer-events: none;
}

/* 深空星云背景特效 */
body::before,
body::after {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200vw;
    height: 200vh;
    z-index: 1;
    pointer-events: none;
    opacity: 0.6;
    background-repeat: no-repeat;
    background-blend-mode: screen;
}

/* 紫蓝色星云 */
body::before {
    background-image:
        radial-gradient(circle at 30% 70%, rgba(91, 193, 254, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 70% 30%, rgba(138, 43, 226, 0.1) 0%, transparent 50%);
    animation: nebulaDrift1 40s linear infinite alternate;
}

/* 暗金色星云斑块 */
body::after {
    background-image:
        radial-gradient(ellipse at 50% 50%, rgba(226, 201, 138, 0.08) 0%, transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(91, 193, 254, 0.1) 0%, transparent 40%);
    animation: nebulaDrift2 50s linear infinite alternate-reverse;
}

@keyframes nebulaDrift1 {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }

    100% {
        transform: translate(-5%, -5%) scale(1.2) rotate(5deg);
    }
}

@keyframes nebulaDrift2 {
    0% {
        transform: translate(0, 0) scale(1.1) rotate(0deg);
    }

    100% {
        transform: translate(5%, 5%) scale(1) rotate(-5deg);
    }
}

/* --- 加载动画 (Warp Jump) --- */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-color);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease-out, visibility 0.8s;
}

.warp-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    perspective: 1000px;
}

.warp-lines {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200vw;
    height: 200vh;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, transparent 20%, var(--bg-color) 70%),
        conic-gradient(from 0deg at 50% 50%,
            transparent 10%, rgba(91, 193, 254, 0.1) 20%, transparent 30%,
            rgba(226, 201, 138, 0.1) 40%, transparent 50%,
            rgba(91, 193, 254, 0.2) 60%, transparent 70%,
            rgba(226, 201, 138, 0.2) 80%, transparent 90%);
    animation: warpSpin 3s linear infinite;
}

.warp-center-light {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 15vw;
    height: 15vw;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
    filter: blur(30px);
    animation: pulseLight 2s ease-in-out infinite alternate;
}

@keyframes warpSpin {
    from {
        transform: translate(-50%, -50%) rotate(0deg) scale(1);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg) scale(2);
    }
}

@keyframes pulseLight {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.5;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
}

.loading-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.loading-icon {
    position: relative;
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
}

.icon-ring {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid rgba(91, 193, 254, 0.2);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.icon-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--accent-gold);
    font-size: 24px;
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-text {
    font-family: var(--font-heading);
    letter-spacing: 2px;
    color: var(--accent-blue);
    text-transform: uppercase;
    font-size: 14px;
    margin-bottom: 15px;
    text-shadow: 0 0 10px var(--accent-blue-glow);
}

.dots {
    animation: blink 1.5s infinite steps(4, end);
}

.progress-bar-container {
    width: 200px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 auto;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: var(--accent-gold);
    box-shadow: 0 0 10px var(--accent-gold-glow);
    animation: progressLoad 2.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(0.8);
    }

    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

@keyframes blink {

    0%,
    100% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }
}

@keyframes progressLoad {
    0% {
        width: 0%;
    }

    40% {
        width: 40%;
    }

    70% {
        width: 60%;
    }

    100% {
        width: 100%;
    }
}

/* --- 主页面布局 --- */
#main-content {
    position: relative;
    z-index: 10;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 1s ease-in;
    padding: 16px;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
}

#main-content.hidden {
    opacity: 0;
    pointer-events: none;
}

.card-wrapper {
    perspective: 1200px;
    /* For 3D tilt effect */
    width: 100%;
    max-width: 420px;
}

.invite-card {
    position: relative;
    width: 100%;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 24px 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5),
        inset 0 0 20px rgba(91, 193, 254, 0.1);
    transform-style: preserve-3d;
    transition: transform 0.1s;
    overflow: hidden;
}

/* 边缘高光层 */
.invite-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 16px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(226, 201, 138, 0.4) 0%, transparent 40%, transparent 60%, rgba(91, 193, 254, 0.4) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* 光泽扫过效果 (镭射全息反光) */
.card-glare {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 16px;
    background: linear-gradient(115deg,
            transparent 10%,
            rgba(91, 193, 254, 0.4) 30%,
            rgba(226, 201, 138, 0.5) 45%,
            rgba(215, 120, 255, 0.4) 55%,
            rgba(91, 193, 254, 0.4) 70%,
            transparent 90%);
    background-size: 300% 300%;
    background-position: 50% 50%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    mix-blend-mode: color-dodge;
}

/* --- Card Header --- */
.card-header {
    text-align: center;
    margin-bottom: 20px;
    transform: translateZ(30px);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.star-icon {
    color: var(--accent-gold);
    font-size: 18px;
    text-shadow: 0 0 10px var(--accent-gold-glow);
}

/* 品牌 Logo */
.hsr-brand-logo {
    width: 180px;
    max-width: 70%;
    filter: drop-shadow(0 0 8px rgba(91, 193, 254, 0.5));
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 16px;
    letter-spacing: 4px;
    color: #fff;
}

.title-cn {
    font-size: 22px;
    font-weight: 500;
    color: var(--accent-gold);
    text-shadow: 0 0 15px rgba(226, 201, 138, 0.3);
    letter-spacing: 2px;
}

.header-line {
    margin-top: 15px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(91, 193, 254, 0.5), transparent);
    position: relative;
}

.line-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20%;
    height: 2px;
    background: var(--accent-blue);
    box-shadow: 0 0 10px var(--accent-blue-glow);
    border-radius: 50%;
}

/* --- Form Styles --- */
.form-container {
    transform: translateZ(20px);
}

.form-group {
    margin-bottom: 16px;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.input-wrapper {
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

input,
select {
    width: 100%;
    background: transparent;
    border: none;
    color: #fff;
    padding: 12px 15px;
    font-size: 15px;
    font-family: var(--font-sans);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

select option {
    background: #111;
    color: #fff;
}

/* 赛博朋克风格的装饰线 */
.cyber-decor {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 10px;
    height: 10px;
    border-bottom: 2px solid var(--accent-gold);
    border-left: 2px solid var(--accent-gold);
    opacity: 0.5;
    transition: 0.3s;
}

.input-wrapper:focus-within .cyber-decor {
    opacity: 1;
    box-shadow: -2px 2px 5px var(--accent-gold-glow);
}

.focus-border {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background: var(--accent-blue);
    transition: width 0.4s ease;
    box-shadow: 0 0 10px var(--accent-blue-glow);
}

.input-wrapper:focus-within .focus-border {
    width: 100%;
}

/* Select specific styling */
.select-wrapper {
    position: relative;
}

.select-arrow {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 10px;
    pointer-events: none;
    transition: 0.3s;
}

.select-wrapper:focus-within .select-arrow {
    color: var(--accent-blue);
    transform: translateY(-50%) rotate(180deg);
}

/* --- Submit Button --- */
.submit-wrapper {
    margin-top: 24px;
    transform: translateZ(30px);
}

.submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, rgba(226, 201, 138, 0.1), rgba(226, 201, 138, 0.3));
    border: 1px solid var(--accent-gold);
    border-radius: 4px;
    color: var(--accent-gold);
    font-family: var(--font-heading);
    font-size: 15px;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    text-shadow: 0 0 5px rgba(226, 201, 138, 0.5);
    box-shadow: 0 0 15px rgba(226, 201, 138, 0.1);
}

.submit-btn:hover,
.submit-btn:active {
    background: rgba(226, 201, 138, 0.2);
    box-shadow: 0 0 20px rgba(226, 201, 138, 0.3), inset 0 0 10px rgba(226, 201, 138, 0.2);
    color: #fff;
    text-shadow: 0 0 10px #fff;
}

.btn-text {
    position: relative;
    z-index: 2;
}

.btn-glare {
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: skewX(-25deg);
    animation: btnGlowSweep 3s infinite;
}

@keyframes btnGlowSweep {
    0% {
        left: -100%;
    }

    20% {
        left: 200%;
    }

    100% {
        left: 200%;
    }
}

/* --- Card Footer --- */
.card-footer {
    margin-top: 16px;
    text-align: center;
    transform: translateZ(10px);
}

.slogan {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.barcode {
    display: flex;
    justify-content: center;
    gap: 2px;
    height: 15px;
    opacity: 0.3;
}

.bar {
    background: #fff;
}

.bar.thin {
    width: 1px;
}

.bar.medium {
    width: 3px;
}

.bar.thick {
    width: 5px;
}

/* 响应式调整 (主要针对小屏手机) */
@media (max-height: 750px) {
    .invite-card {
        padding: 18px 16px;
    }

    .card-header {
        margin-bottom: 14px;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .submit-wrapper {
        margin-top: 18px;
    }

    .logo-text {
        font-size: 14px;
    }

    .title-cn {
        font-size: 18px;
    }

    .card-footer {
        margin-top: 12px;
    }

    .header-line {
        margin-top: 10px;
    }

    input,
    select {
        padding: 10px 12px;
        font-size: 14px;
    }

    .submit-btn {
        padding: 12px;
        font-size: 13px;
    }

    .hsr-brand-logo {
        width: 140px;
    }
}

@media (max-height: 600px) {
    .invite-card {
        padding: 14px 14px;
    }

    .card-header {
        margin-bottom: 10px;
    }

    .form-group {
        margin-bottom: 8px;
    }

    .form-group label {
        font-size: 10px;
        margin-bottom: 4px;
    }

    .submit-wrapper {
        margin-top: 12px;
    }

    .title-cn {
        font-size: 16px;
    }

    .card-footer {
        margin-top: 8px;
    }

    .slogan {
        font-size: 9px;
        margin-bottom: 8px;
    }

    input,
    select {
        padding: 8px 10px;
        font-size: 13px;
    }

    .hsr-brand-logo {
        width: 120px;
    }
}

/* --- Toast 提示 --- */
.toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(20, 0, 0, 0.85);
    border: 1px solid rgba(255, 50, 50, 0.6);
    box-shadow: 0 5px 20px rgba(255, 0, 0, 0.4);
    color: #ffcccc;
    padding: 12px 24px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 99999;
    font-size: 14px;
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* --- 成功动画屏 (列车) --- */
#success-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 1s;
}

#success-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

/* 速度线 */
.speed-lines-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.5s;
}

.speed-line {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(91, 193, 254, 0.8), #fff);
    border-radius: 50%;
    animation: speedDash 0.8s linear infinite;
}

@keyframes speedDash {
    0% {
        transform: translateX(100vw);
    }

    100% {
        transform: translateX(-100vw);
    }
}

/* 列车 */
.express-train {
    position: absolute;
    width: 600px;
    height: 160px;
    transform: translateX(-150vw);
    /* 初始在左侧远处 */
}

/* 欢迎文本 */
.welcome-text {
    position: absolute;
    text-align: center;
    top: 60%;
    opacity: 0;
    transform: translateY(20px);
    transition: all 1s ease 0.5s;
    text-shadow: 0 0 15px rgba(226, 201, 138, 0.5);
}

.wt-line1 {
    font-family: var(--font-heading);
    font-size: 28px;
    color: var(--accent-gold);
    margin-bottom: 10px;
    letter-spacing: 5px;
}

.wt-line2 {
    font-size: 16px;
    color: var(--accent-blue);
    letter-spacing: 2px;
}

/* 卡片飞入列车的关键帧 */
@keyframes cardFlyIntoTrain {
    0% {
        transform: perspective(1000px) scale(1) translate(0, 0);
        opacity: 1;
    }

    100% {
        transform: perspective(1000px) scale(0) translate(-300px, 0);
        opacity: 0;
    }
}

/* 列车驶向远方的关键帧 */
@keyframes trainDepart {
    0% {
        transform: translateX(-100vw) scale(1.5);
    }

    40% {
        transform: translateX(-10%) scale(1.2);
    }

    70% {
        transform: translateX(20%) scale(1);
    }

    100% {
        transform: translateX(150vw) scale(0.8);
    }
}

/* --- Footer --- */
.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding: 0 10px;
}

.icp-text {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.2);
    letter-spacing: 1px;
}