/* ===========================================
   Home Page — Black Minimal Landing
   =========================================== */

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

body {
    background: #050505;
    color: #fff;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

html[lang="ja"] body,
html[lang="zh"] body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans CJK SC', 'Noto Sans CJK JP',
        'Hiragino Sans', 'Microsoft YaHei', 'Yu Gothic', sans-serif;
}

/* === CANVAS === */
#smokeCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* === APP CONTAINER === */
#app {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    pointer-events: none;
}

#app * {
    pointer-events: auto;
}

/* === TITLE === */
.landing-title {
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    text-align: center;
    opacity: 0;
    transition: opacity 1.2s ease;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.7) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-title.visible {
    opacity: 1;
}

/* === GREETING === */
.greeting {
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    color: rgba(255,255,255,0.5);
    text-align: center;
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    margin-bottom: 8px;
    font-weight: 300;
    letter-spacing: 0.02em;
}

.greeting.visible {
    opacity: 1;
    transform: translateX(0);
}

/* === HINT === */
.hint {
    font-size: clamp(0.8rem, 1.5vw, 0.95rem);
    color: rgba(255,255,255,0.3);
    text-align: center;
    opacity: 0;
    transition: opacity 0.8s ease;
    margin-bottom: 32px;
}

.hint.visible {
    opacity: 1;
}

/* === AUTH CONTAINER === */
.auth-container {
    width: 100%;
    max-width: 380px;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.auth-container.visible {
    opacity: 1;
}

/* === FORM INPUTS === */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease, background 0.3s ease;
    outline: none;
}

.form-input:focus {
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.09);
}

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

/* === BUTTONS === */
.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: #fff;
    color: #050505;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.15s ease;
    margin-top: 8px;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-link {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 0;
    margin-top: 16px;
    display: block;
    text-align: center;
    width: 100%;
}

.btn-link:hover {
    color: rgba(255,255,255,0.7);
}

/* === OTP === */
.otp-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 24px 0;
}

.otp-digit {
    width: 50px;
    height: 60px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    outline: none;
    transition: border-color 0.3s ease, background 0.3s ease;
    caret-color: transparent;
}

.otp-digit:focus {
    border-color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
}

.otp-digit.filled {
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
}

.otp-info {
    text-align: center;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.35);
    margin-bottom: 20px;
    line-height: 1.5;
}

.otp-info strong {
    color: rgba(255,255,255,0.6);
    font-weight: 500;
}

/* === ERROR / SUCCESS MESSAGES === */
.msg {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: none;
    text-align: center;
    line-height: 1.4;
}

.msg.error {
    display: block;
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.msg.success {
    display: block;
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* === USER VIEW (Authenticated) === */
.user-view {
    text-align: center;
    max-width: 380px;
    width: 100%;
}

.user-email {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.5);
    margin-bottom: 24px;
}

.user-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-left: 8px;
}

.user-badge.tester {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.user-badge.stable {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* === DOWNLOAD BUTTON === */
.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.4s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-download::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(236,72,153,0.3), rgba(16,185,129,0.3));
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
    filter: blur(8px);
}

.btn-download:hover {
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(99,102,241,0.15);
}

.btn-download:hover::before {
    opacity: 1;
}

.btn-download svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.btn-logout {
    background: none;
    border: none;
    color: rgba(255,255,255,0.25);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    margin-top: 32px;
    padding: 8px 16px;
    transition: color 0.3s ease;
}

.btn-logout:hover {
    color: rgba(255,255,255,0.5);
}

/* === RESEND LINK === */
.resend-row {
    text-align: center;
    margin-top: 12px;
}

.resend-link {
    background: none;
    border: none;
    color: rgba(255,255,255,0.3);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 0;
}

.resend-link:hover {
    color: rgba(255,255,255,0.6);
}

.resend-link:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

/* === LOADING SPINNER === */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(5,5,5,0.2);
    border-top-color: #050505;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

.spinner.light {
    border-color: rgba(255,255,255,0.2);
    border-top-color: #fff;
}

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

/* === HIDDEN STATE === */
.hidden {
    display: none !important;
}

/* === RESPONSIVE === */
@media (max-width: 480px) {
    #app {
        padding: 32px 16px;
    }

    .otp-digit {
        width: 42px;
        height: 52px;
        font-size: 1.3rem;
    }

    .otp-container {
        gap: 7px;
    }

    .btn-download {
        padding: 14px 24px;
        font-size: 0.9rem;
    }
}

@media (max-height: 700px) {
    #app {
        padding: 20px 24px;
    }

    .landing-title {
        margin-bottom: 8px;
    }

    .greeting {
        margin-bottom: 4px;
    }

    .hint {
        margin-bottom: 20px;
    }
}
