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

body {
    min-height: 100vh;
    min-height: 100dvh;
    background: linear-gradient(160deg, #164e63 0%, #0369a1 40%, #0891b2 75%, #22d3ee 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding: 24px 16px;
    overflow-x: hidden;
}

/* Subtle animated background blobs */
body::before, body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
}
body::before {
    width: 400px; height: 400px;
    background: #67e8f9;
    top: -100px; right: -100px;
    animation: drift 12s ease-in-out infinite alternate;
}
body::after {
    width: 300px; height: 300px;
    background: #93c5fd;
    bottom: -80px; left: -80px;
    animation: drift 10s ease-in-out infinite alternate-reverse;
}
@keyframes drift { from { transform: translate(0,0); } to { transform: translate(30px, 20px); } }

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

/* App branding */
.app-brand {
    text-align: center;
    color: white;
}
.app-icon {
    width: auto;
    max-width: 260px;
    height: auto;
    margin-bottom: 8px;
    filter: drop-shadow(0 4px 16px rgba(0,0,0,0.25));
}
.app-name {
    display: none;
}
.app-tagline {
    display: none;
}

/* Login card */
.login-card {
    width: 100%;
    background: white;
    border-radius: 24px;
    padding: 28px 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25), 0 1px 0 rgba(255,255,255,0.1) inset;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 20px;
    text-align: center;
}

/* Form elements */
.form-group { margin-bottom: 14px; }
.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    color: #111827;
    background: #f9fafb;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    -webkit-appearance: none;
}
.form-input:focus {
    border-color: #0891b2;
    box-shadow: 0 0 0 3px rgba(8,145,178,0.15);
    background: white;
}
.form-input::placeholder { color: #9ca3af; }

.token-input {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 10px;
    padding: 12px 14px;
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #0891b2, #0369a1);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    margin-top: 6px;
    -webkit-tap-highlight-color: transparent;
}
.btn-primary:active { transform: scale(0.98); opacity: 0.9; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
    width: 100%;
    padding: 12px;
    background: white;
    color: #6b7280;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    margin-top: 8px;
    -webkit-tap-highlight-color: transparent;
}
.btn-secondary:hover { background: #f9fafb; border-color: #d1d5db; }

/* Hint text */
.hint-text {
    font-size: 0.78rem;
    color: #6b7280;
    margin-top: 8px;
    text-align: center;
}

/* Step sections */
.step { }
.step.hidden { display: none; }

/* Email sent hint */
.sent-hint {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    font-size: 0.82rem;
    color: #166534;
    margin-bottom: 14px;
}

/* Message box */
.message-box {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-top: 12px;
    display: none;
}
.message-box.success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.message-box.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.message-box.show { display: block; }

/* Divider */
.divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0;
    color: #d1d5db;
    font-size: 0.75rem;
}
.divider::before, .divider::after {
    content: ''; flex: 1; height: 1px; background: #e5e7eb;
}

/* Waiting list button */
.btn-waiting-list {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: #0891b2;
    border: 1.5px solid #bae6fd;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.btn-waiting-list:hover { background: #f0f9ff; }

/* Apply for access link */
.apply-link {
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.65);
    margin-top: -8px;
}
.apply-link a { color: rgba(255,255,255,0.9); text-decoration: underline; }

/* Waiting list modal */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
}
.modal-overlay.show { display: flex; }
.modal-sheet {
    background: white;
    border-radius: 24px;
    padding: 24px;
    width: 100%;
    max-width: 440px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    -webkit-overflow-scrolling: touch;
}
.modal-close {
    position: absolute;
    top: 16px; right: 16px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    width: 32px; height: 32px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #6b7280;
    font-size: 14px;
    transition: background 0.15s;
}
.modal-close:hover { background: #e5e7eb; }
.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 16px;
    text-align: center;
}

.eligibility-box {
    background: #f0f9ff;
    border: 1.5px solid #bae6fd;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 14px;
}
.eligibility-box h4 {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0c4a6e;
    margin-bottom: 8px;
}
.eligibility-box ul {
    font-size: 0.78rem;
    color: #374151;
    padding-left: 16px;
    line-height: 1.8;
}
.eligibility-box .warning {
    font-size: 0.75rem;
    color: #b91c1c;
    font-weight: 600;
    margin-top: 8px;
}

.legal-box {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 14px;
    padding: 14px;
    max-height: 180px;
    overflow-y: auto;
    font-size: 0.75rem;
    color: #374151;
    line-height: 1.6;
    margin-bottom: 14px;
    -webkit-overflow-scrolling: touch;
}
.legal-box h4 { font-size: 0.82rem; font-weight: 700; color: #92400e; margin-bottom: 8px; }
.legal-box p { margin-bottom: 6px; }
.legal-box a { color: #2563eb; }

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 14px;
    cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
    width: 16px; height: 16px;
    margin-top: 2px;
    accent-color: #0891b2;
    flex-shrink: 0;
    cursor: pointer;
}
.checkbox-row span { font-size: 0.8rem; color: #374151; line-height: 1.4; }

/* PWA install banner */
.install-banner {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 16px;
    padding: 12px 18px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 100;
    min-width: 280px;
    max-width: 340px;
    animation: slide-up 0.3s ease;
}
.install-banner.hidden { display: none !important; }
@keyframes slide-up { from { transform: translateX(-50%) translateY(20px); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }
.install-banner img { width: 36px; height: 36px; border-radius: 8px; }
.install-banner-text { flex: 1; font-size: 0.82rem; color: #111827; }
.install-banner-text strong { display: block; font-weight: 600; }
.install-banner-text span { color: #6b7280; font-size: 0.75rem; }
.btn-install {
    background: linear-gradient(135deg, #0891b2, #0369a1);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.btn-dismiss-install {
    background: none; border: none; color: #9ca3af; cursor: pointer; font-size: 18px; line-height: 1; padding: 0 4px;
}

/* iOS-specific install banner — arrow points down toward Safari toolbar */
.install-banner-ios {
    bottom: auto;
    top: auto;
    bottom: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    max-width: 320px;
    padding: 14px 16px 12px;
}
.install-banner-ios .install-banner-text span {
    font-size: 0.8rem;
    line-height: 1.5;
}
.install-banner-ios .ios-share-icon {
    font-size: 1rem;
    vertical-align: middle;
    color: #0891b2;
    font-style: normal;
}
.install-banner-ios em {
    font-style: normal;
    font-weight: 600;
}
/* Arrow pointing down toward the iOS Safari share bar */
.install-banner-ios::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border: 10px solid transparent;
    border-top-color: white;
    border-bottom: none;
}
.install-banner-ios .install-banner-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.install-banner-ios .btn-dismiss-install {
    position: absolute;
    top: 8px;
    right: 8px;
}

/* Android fallback banner — same layout as iOS */
.install-banner-android {
    bottom: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    max-width: 320px;
    padding: 14px 16px 12px;
    position: fixed;
}
.install-banner-android .install-banner-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.install-banner-android .install-banner-text span {
    font-size: 0.8rem;
    line-height: 1.5;
}
.install-banner-android .android-menu-icon {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0891b2;
    vertical-align: middle;
}
.install-banner-android em {
    font-style: normal;
    font-weight: 600;
}
.install-banner-android .btn-dismiss-install {
    position: absolute;
    top: 8px;
    right: 8px;
}
