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

body {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow: hidden;
    background-image: url('w.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    position: relative;
    opacity: 1;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 0;
}

@keyframes fadeInCopyright {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.glass-card {
    width: 380px;
    min-height: 480px;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.03) 0%,
        rgba(255, 255, 255, 0.015) 50%,
        rgba(255, 255, 255, 0.025) 100%);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 28px;
    border: 1.5px solid transparent;
    background-clip: padding-box;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 1px rgba(255, 255, 255, 0.2),
        inset 0 -1px 1px rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    padding: 50px 40px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                min-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideUp 0.8s ease;
    z-index: 1;
    margin-top: -80px;
    opacity: 1;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.glass-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.2) 0%,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.02) 50%,
        rgba(255, 255, 255, 0.05) 75%,
        rgba(255, 255, 255, 0.18) 100%);
    border-radius: 28px;
    z-index: -1;
}

.glass-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 0%, 
        rgba(255, 255, 255, 0.06) 0%,
        transparent 60%);
    border-radius: 28px;
    pointer-events: none;
}

.glass-card:hover {
    transform: translateY(-8px);
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.4),
        0 4px 16px rgba(0, 0, 0, 0.3),
        inset 0 2px 2px rgba(255, 255, 255, 0.5),
        inset 0 -2px 2px rgba(255, 255, 255, 0.15);
}



.logo {
    width: 200px;
    height: 80px;
    margin: 0 auto 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.logo-text {
    font-size: 36px;
    font-weight: 400;
    letter-spacing: 2px;
    background: linear-gradient(120deg,
            rgba(255, 255, 255, 0.2) 0%,
            rgba(255, 255, 255, 0.35) 25%,
            rgba(255, 255, 255, 0.6) 50%,
            rgba(255, 255, 255, 0.35) 75%,
            rgba(255, 255, 255, 0.2) 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    font-family: 'Pacifico', cursive;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    animation: logoShine 10s ease-in-out infinite;
}

@keyframes logoShine {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}



@keyframes logoShine {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

h2 {
    font-size: 24px;
    font-weight: 600;
    color: #ffffff;
    text-align: center;
    margin-bottom: 10px;
    letter-spacing: -0.3px;
}

.subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    margin-bottom: 40px;
    line-height: 1.5;
}

.input-group {
    margin-bottom: 24px;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 10px;
    letter-spacing: 0.2px;
}

input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    font-size: 15px;
    color: #ffffff;
    font-family: 'SF Mono', Monaco, monospace;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

input::placeholder {
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.5px;
}

input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow:
        0 0 0 3px rgba(99, 102, 241, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

button {
    width: 100%;
    padding: 14px;
    margin-top: 12px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    z-index: 1;
}

button::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.8), transparent 50%);
    z-index: 1;
}

button:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

button:active {
    transform: translateY(0);
}

.message {
    margin-top: 20px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.96) translateY(-8px);
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0s 0.35s;
}

.message.show {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.5s cubic-bezier(0.34, 1.2, 0.64, 1),
                visibility 0s 0s;
}

.message.error,
.message.success {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
}

.footer {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.45);
}

.footer a {
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.footer a:hover {
    color: #ffffff;
}

button.loading {
    pointer-events: none;
    color: transparent;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transition: none;
    overflow: visible; /* 允許動畫超出按鈕邊界 */
}

button.loading::before,
button.loading::after {
    display: none;
}

button.loading .loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    animation: spinnerBreath 2s ease-in-out infinite;
}

button.loading .loading-spinner::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: rgba(255, 255, 255, 0.9);
    border-right-color: rgba(255, 255, 255, 0.9);
    animation: spinnerRotate 0.8s linear infinite;
    box-sizing: border-box;
}

@keyframes spinnerBreath {

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

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

@keyframes spinnerRotate {
    0% {
        transform: rotate(0deg);
    }

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

.language-dropdown {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: slideUpLang 0.6s ease 0.3s forwards;
}

@keyframes slideUpLang {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.lang-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    font-weight: 500;
    position: absolute;
    white-space: nowrap;
    opacity: 1;
    transform: scale(1);
}



.lang-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.lang-toggle.hiding {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
}

.lang-icon {
    font-size: 16px;
    display: none;
}

.arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
    margin-left: 4px;
}

.lang-toggle.open .arrow {
    transform: rotate(180deg);
}

.lang-menu {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    position: absolute;
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.lang-menu.show {
    opacity: 1;
    transform: scale(1);
    pointer-events: all;
}

.lang-option {
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
}



.lang-option:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
    border-color: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.lang-option.active {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.2);
}

.copyright {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    font-weight: 400;
    letter-spacing: 0.5px;
    opacity: 0;
    animation: fadeInCopyright 0.6s ease 0.5s forwards;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* 右上角說明按鈕 - 液態玻璃 iOS 風格 */
.info-button {
    position: fixed;
    top: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.15),
        inset 0 -1px 2px rgba(255, 255, 255, 0.1),
        0 8px 24px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
    text-decoration: none;
    opacity: 0;
    animation: fadeInButton 0.6s ease 0.4s forwards;
}

@keyframes fadeInButton {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 從右邊滑入動畫（帶煞車回彈效果） */
@keyframes slideInFromRight {
    0% {
        opacity: 0;
        transform: translateX(80px);
    }
    60% {
        opacity: 1;
        transform: translateX(-2px);
    }
    80% {
        transform: translateX(0.5px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.info-button.slide-in-right {
    animation: slideInFromRight 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
    opacity: 1 !important;
}

/* 向右滑出動畫 */
@keyframes slideOutRight {
    0% {
        opacity: 1;
        transform: translateX(0);
    }
    100% {
        opacity: 0;
        transform: translateX(100px);
    }
}

.info-button.slide-out-right {
    animation: slideOutRight 0.4s cubic-bezier(0.4, 0, 1, 1) forwards !important;
    transition: none !important;
}

.info-button:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2),
        inset 0 -1px 2px rgba(255, 255, 255, 0.15),
        0 12px 32px rgba(0, 0, 0, 0.2);
}

.info-button:active {
    transform: translateY(0) scale(0.98);
}

.info-icon {
    font-size: 24px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1;
    transition: color 0.3s ease;
}

.info-button:hover .info-icon {
    color: rgba(255, 255, 255, 1);
}

/* 響應式設計 - 手機端優化 */
@media (max-width: 600px) {
    body {
        /* 保持不可滾動，避免元素重疊 */
        overflow: hidden;
        height: 100vh;
    }

    .glass-card {
        width: calc(100% - 32px);
        max-width: 400px;
        padding: 32px 24px;
        margin-top: -40px;
        min-height: auto;
    }

    .logo {
        width: 140px;
        height: 56px;
        margin-bottom: 20px;
    }

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

    h2 {
        font-size: 21px;
        margin-bottom: 8px;
    }

    .subtitle {
        font-size: 13px;
        margin-bottom: 28px;
    }

    .input-group {
        margin-bottom: 20px;
    }

    label {
        font-size: 12px;
        margin-bottom: 8px;
    }

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

    button {
        padding: 12px;
        font-size: 14px;
        margin-top: 10px;
    }

    .footer {
        margin-top: 24px;
        padding-top: 18px;
        font-size: 12px;
    }

    .message {
        font-size: 12px;
        padding: 10px 14px;
        margin-top: 16px;
    }

    /* 語言切換 - 確保在底部 */
    .language-dropdown {
        position: fixed;
        bottom: 70px;
        left: 50%;
        transform: translateX(-50%);
    }

    .lang-toggle,
    .lang-option {
        padding: 8px 14px;
        font-size: 12px;
    }

    /* 版權信息 - 確保在最底部 */
    .copyright {
        position: fixed;
        bottom: 16px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 10px;
        padding: 0 16px;
        width: calc(100% - 32px);
        text-align: center;
    }

    /* 問號按鈕 - 避開狀態欄 */
    .info-button {
        top: 20px;
        right: 16px;
        width: 40px;
        height: 40px;
    }

    .info-icon {
        font-size: 20px;
    }
}

/* 小屏手機優化 (iPhone SE 等) */
@media (max-width: 375px) {
    .glass-card {
        width: calc(100% - 28px);
        padding: 28px 20px;
        margin-top: -30px;
    }

    .logo {
        width: 120px;
        height: 50px;
        margin-bottom: 16px;
    }

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

    h2 {
        font-size: 19px;
    }

    .subtitle {
        font-size: 12px;
        margin-bottom: 24px;
    }

    input {
        padding: 11px 12px;
        font-size: 13px;
    }

    button {
        padding: 11px;
        font-size: 13px;
    }

    .footer {
        margin-top: 20px;
        padding-top: 16px;
        font-size: 11px;
    }

    .language-dropdown {
        bottom: 65px;
    }

    .lang-toggle,
    .lang-option {
        padding: 7px 12px;
        font-size: 11px;
    }

    .copyright {
        bottom: 14px;
        font-size: 9px;
    }
}

/* 超小屏優化 */
@media (max-width: 360px) and (max-height: 640px) {
    .glass-card {
        padding: 24px 18px;
        margin-top: -20px;
    }

    .logo {
        margin-bottom: 12px;
    }

    h2 {
        font-size: 18px;
        margin-bottom: 6px;
    }

    .subtitle {
        margin-bottom: 20px;
    }

    .input-group {
        margin-bottom: 16px;
    }

    .footer {
        margin-top: 18px;
        padding-top: 14px;
    }

    .language-dropdown {
        bottom: 60px;
    }

    .copyright {
        bottom: 12px;
    }
}

#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}
