:root {
    --apple-blue: #0a84ff;
    --apple-blue-hover: #409cff;
    --apple-blue-active: #0070d8;
    --text-primary: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-light: #86868b;
    --bg-dark: #000000;
    --card-bg: #1c1c1e;
    --card-bg-light: #2c2c2e;
    --border-color: #38383a;
    --input-bg: #1c1c1e;
    --input-focus: rgba(10, 132, 255, 0.4);
    --success-color: #30d158;
    --error-color: #ff453a;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: radial-gradient(ellipse at center, #2d2d2d 0%, #1a1a1a 50%, #000000 100%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

header {
    padding: 0;
    background: transparent;
    position: relative;
}

.header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    position: relative;
    z-index: 100;
}

.icloud-logo {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.125rem;
    font-weight: 500;
}

.icloud-logo-icon {
    display: inline-flex;
    align-items: center;
    width: 20px;
    height: 20px;
}

.icloud-logo-icon svg {
    width: 100%;
    height: 100%;
    fill: #ffffff;
}

.logo-section {
    padding: 2rem 2rem 1rem;
    text-align: center;
}

.logo-container {
    display: inline-block;
    position: relative;
    width: 160px;
    height: 160px;
    margin-bottom: 1rem;
}

.logo-dots-svg {
    width: 100%;
    height: 100%;
    animation: rotate 20s linear infinite;
}

.logo-apple-svg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.auth-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 1rem 2rem;
}

.auth-card {
    background: rgba(28, 28, 30, 0.75);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 460px;
    padding: 3rem 2.5rem 3.5rem;
    position: relative;
    animation: fadeIn 0.4s ease;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-group { margin-bottom: 1.5rem; }

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.2px;
}

.input-wrapper { position: relative; }

.form-input {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1.0625rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
}

.form-input::placeholder { color: #6e6e73; }
.form-input:hover { border-color: #48484a; }
.form-input:focus { border-color: var(--border-color); background: var(--card-bg-light); box-shadow: 0 0 0 3px var(--input-focus); }
.form-input:disabled { background: var(--input-bg); opacity: 0.5; cursor: not-allowed; }
.form-input.error { border-color: var(--error-color); }

.btn {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1.0625rem;
    font-weight: 500;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    letter-spacing: -0.2px;
}

.btn-primary { background: var(--apple-blue); color: #ffffff; }
.btn-primary:hover { background: var(--apple-blue-hover); }
.btn-primary:active { background: var(--apple-blue-active); transform: scale(0.98); }
.btn-primary:disabled { background: #48484a; cursor: not-allowed; opacity: 0.5; }

.auth-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    text-align: center;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    text-align: center;
    line-height: 1.6;
}

.message-box {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    font-size: 0.9375rem;
    display: none;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-box.visible { display: block; }
.message-box.success { background: rgba(48, 209, 88, 0.15); color: var(--success-color); border: 1px solid rgba(48, 209, 88, 0.3); }
.message-box.error { background: rgba(255, 69, 58, 0.15); color: var(--error-color); border: 1px solid rgba(255, 69, 58, 0.3); }

footer {
    padding: 2rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-links { display: flex; gap: 2rem; flex-wrap: wrap; }
.footer-link { color: var(--text-secondary); text-decoration: none; transition: color 0.2s ease; white-space: nowrap; }
.footer-link:hover { color: var(--text-primary); }

.btn.loading { position: relative; color: transparent; }
.btn.loading::after {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    top: 50%; left: 50%; margin-left: -10px; margin-top: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* OTP */
.otp-container { display: flex; gap: 0.75rem; justify-content: center; margin: 2rem 0; }
.otp-input {
    width: 50px; height: 60px; text-align: center; font-size: 1.5rem; font-weight: 600;
    border: 1px solid var(--border-color); border-radius: 12px; background: var(--input-bg); color: var(--text-primary);
    transition: all 0.2s ease; outline: none;
}
.otp-input:hover { border-color: #48484a; }
.otp-input:focus { border-color: var(--apple-blue); background: var(--card-bg-light); box-shadow: 0 0 0 3px var(--input-focus); }
.otp-input.error { border-color: var(--error-color); animation: shake 0.3s ease; }

@keyframes shake { 0%,100%{transform:translateX(0)}25%{transform:translateX(-5px)}75%{transform:translateX(5px)} }

.step-indicator { display: flex; justify-content: center; gap: 0.5rem; margin-bottom: 2rem; }
.step-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-color); transition: all 0.3s ease; }
.step-dot.active { background: var(--apple-blue); width: 24px; border-radius: 4px; }
.step-dot.completed { background: var(--success-color); }

/* Welcome */
.welcome-container { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem; text-align: center; }
.welcome-logo { width: 200px; height: 200px; margin-bottom: 2rem; position: relative; }
.welcome-title { font-size: 3rem; font-weight: 700; color: var(--text-primary); margin-bottom: 1rem; letter-spacing: -1px; }
.welcome-subtitle { font-size: 1.25rem; color: var(--text-secondary); margin-bottom: 3rem; max-width: 600px; line-height: 1.6; }
.welcome-btn { padding: 1.25rem 3rem; font-size: 1.125rem; }

.auth-link { display: block; text-align: center; color: var(--apple-blue); text-decoration: none; font-size: 0.9375rem; margin-top: 1.25rem; transition: color 0.2s ease; }
.auth-link:hover { color: var(--apple-blue-hover); }

@media (max-width: 768px) {
    .auth-card { padding: 2rem 1.5rem; border-radius: 0; box-shadow: none; }
    .welcome-title { font-size: 2rem; }
    .welcome-subtitle { font-size: 1rem; }
    .otp-input { width: 40px; height: 50px; font-size: 1.25rem; }
    .otp-container { gap: 0.5rem; }
}

@media (max-width: 480px) {
    .auth-card { padding: 1.5rem 1rem; }
    .welcome-logo { width: 150px; height: 150px; }
    .otp-input { width: 35px; height: 45px; font-size: 1.125rem; }
    .otp-container { gap: 0.375rem; }
}


