:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --primary-light: rgba(79, 70, 229, 0.1);
    --background: #0F172A;
    --surface: #1E293B;
    --surface-light: #334155;
    --text: #F1F5F9;
    --text-muted: #94A3B8;
    --success: #10B981;
    --error: #EF4444;
    --radius: 16px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--background);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

/* Language Selector */
.lang-selector {
    position: fixed;
    top: 12px;
    right: 12px;
    background: var(--surface);
    padding: 6px 14px;
    border-radius: 20px;
    z-index: 100;
    font-size: 0.8rem;
}
.lang-selector a { text-decoration: none; color: var(--text-muted); font-weight: 500; }
.lang-selector a.active { color: var(--primary); font-weight: 700; }

/* App Container */
.app-container {
    width: 100%;
    max-width: 440px;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 16px;
}

/* Steps */
.step-container {
    display: none;
    flex-direction: column;
    flex: 1;
    animation: fadeIn 0.3s ease;
}
.step-container.active { display: flex; }

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

/* Step Header */
.step-header {
    text-align: center;
    padding: 20px 0 16px;
}
.step-header h1 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 4px;
}
.step-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Step Indicator Dots */
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}
.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--surface-light);
    transition: all 0.3s ease;
}
.step-dot.active {
    background: var(--primary);
    width: 24px;
    border-radius: 4px;
}
.step-dot.done { background: var(--success); }

/* Camera Wrapper for ID Scan */
.camera-wrapper {
    position: relative;
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    aspect-ratio: 4/3;
    flex-shrink: 0;
}
.camera-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.camera-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
}
.id-card-overlay {
    border: 3px dashed rgba(255, 255, 255, 0.5);
    margin: 8%;
    border-radius: 12px;
}

/* Liveness Circle — Big and centered */
.liveness-circle-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
}
.liveness-circle {
    position: relative;
    width: min(85vw, 360px);
    height: min(85vw, 360px);
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--surface-light);
    box-shadow: 0 0 0 2px var(--primary), 0 0 40px rgba(79, 70, 229, 0.2);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.liveness-circle.active-scan {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary), 0 0 60px rgba(79, 70, 229, 0.3);
}
.liveness-circle.passed {
    border-color: var(--success) !important;
    box-shadow: 0 0 0 3px var(--success), 0 0 60px rgba(16, 185, 129, 0.3) !important;
}
.liveness-circle video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}
.liveness-circle .overlay-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    transform: scaleX(-1);
}

/* Direction Arrows */
.liveness-arrow-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin: 12px 0 8px;
}
.direction-arrow {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    transition: all 0.3s ease;
    padding: 12px;
}
.direction-arrow.active-dir {
    background: var(--primary);
    color: white;
    transform: scale(1.15);
    animation: bounce-arrow 0.8s infinite;
}
.direction-arrow.done-dir {
    background: var(--success);
    color: white;
}
.check-arrow {
    color: var(--success);
}
.check-arrow.active-dir {
    background: var(--success);
    color: white;
    animation: none;
    transform: scale(1.2);
}

@keyframes bounce-arrow {
    0%, 100% { transform: scale(1.15); }
    50% { transform: scale(1.25); }
}

.liveness-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 4px;
}

.liveness-header {
    padding-bottom: 0;
}

/* Capture Controls */
.capture-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 0;
    margin-top: auto;
}

/* Preview */
.preview-container { text-align: center; }
.preview-container img {
    width: 100%;
    border-radius: var(--radius);
    border: 2px solid var(--surface-light);
}

/* Buttons */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-2 { margin-top: 16px; }
.full-width { width: 100%; }

.btn {
    appearance: none;
    border: none;
    padding: 16px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}
.primary-btn {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}
.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}
.primary-btn:active { transform: translateY(0); }

.secondary-btn {
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid var(--surface-light);
}
.secondary-btn:hover {
    background: var(--surface-light);
    color: var(--text);
}

/* Loader */
.loader {
    border: 4px solid var(--surface-light);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: spin 0.8s linear infinite;
    margin: 40px auto 20px;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success / Error */
.success-icon {
    font-size: 4rem;
    color: var(--success);
    margin: 40px 0 16px;
}
.error-icon {
    font-size: 4rem;
    color: var(--error);
    margin: 40px 0 16px;
}

/* Mobile */
@media (max-width: 480px) {
    .app-container { padding: 10px; }
    .liveness-circle { width: min(90vw, 340px); height: min(90vw, 340px); }
    .direction-arrow { width: 48px; height: 48px; padding: 10px; }
    .btn { padding: 14px 20px; }
}

/* Consent Step */
.consent-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}
.consent-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 16px 0;
}
.info-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--surface);
    padding: 14px 16px;
    border-radius: 12px;
}
.info-icon { font-size: 1.4rem; flex-shrink: 0; margin-top: 2px; }
.info-item strong { display: block; margin-bottom: 2px; font-size: 0.9rem; }
.info-item p { color: var(--text-muted); font-size: 0.82rem; line-height: 1.4; }

/* ID Type Selector */
.id-type-label {
    font-size: 0.95rem;
    margin-bottom: 10px;
    text-align: center;
}
.id-type-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.id-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 8px;
    background: var(--surface);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}
.id-type-card input { display: none; }
.id-type-card:hover { border-color: var(--surface-light); }
.id-type-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}
.id-type-icon { font-size: 1.8rem; }
.id-type-name { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; }
.id-type-card.selected .id-type-name { color: var(--text); }

@media (max-width: 380px) {
    .id-type-options { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
    .id-type-card { padding: 12px 4px; }
    .id-type-icon { font-size: 1.4rem; }
}
