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

:root {
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1e40af;
    --success: #10b981;
    --error: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
    font-family: 'Outfit', -apple-system, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
    animation: drift 20s ease-in-out infinite;
}

@keyframes drift {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-5%, -5%); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

@keyframes successPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.paper {
    background: var(--surface);
    border-radius: 16px;
    padding: 48px;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.6s ease-out;
    backdrop-filter: blur(10px);
}

.paper.shake {
    animation: shake 0.4s ease-in-out;
}

.paper.success {
    animation: successPulse 0.6s ease-out;
}

.header {
    text-align: center;
    margin-bottom: 36px;
}

.logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.logo svg {
    width: 32px;
    height: 32px;
    stroke: white;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 300;
}

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

label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
}

input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    outline: none;
    transition: all 0.2s ease;
    background: var(--background);
    letter-spacing: 1px;
}

input[type="text"]:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

input[type="text"].error {
    border-color: var(--error);
    animation: shake 0.05s ease-in-out;
}

.error-message {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--error);
    font-size: 13px;
    font-weight: 500;
    margin-top: 8px;
    opacity: 0;
    transform: translateY(-4px);
    transition: all 0.3s ease;
}

.error-message.show {
    opacity: 1;
    transform: translateY(0);
}

.error-message svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

button {
    width: 100%;
    padding: 14px 24px;
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary-blue-white {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary-blue-white:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn-primary-blue-white:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary-blue-white:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary-green-white {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-primary-green-white:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.btn-secondary-white-black-blue {
    background: var(--background);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-secondary-white-black-blue:hover {
    background: var(--surface);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-secondary-white-black-green {
    background: var(--background);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-secondary-white-black-green:hover {
    background: var(--surface);
    border-color: var(--success);
    color: var(--success);
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.success-view {
    text-align: center;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--success), #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
}

.success-icon svg {
    width: 40px;
    height: 40px;
    stroke: white;
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    animation: checkmark 0.6s ease-out forwards;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
}

@keyframes checkmark {
    to { stroke-dashoffset: 0; }
}

.success-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.success-message {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.6;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hidden {
    display: none;
}

.verification-code-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.verification-code-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    text-align: left;
}

.code-display-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.code-display {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    padding: 12px 16px;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    letter-spacing: 1px;
}

.code-display.disabled {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-copy {
    width: auto;
    padding: 12px 16px;
    background: var(--surface);
    color: var(--text-primary);
    border: 2px solid var(--border);
    font-size: 14px;
}

.btn-copy:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.btn-copy.copied:not(:disabled) {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.btn-copy:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}