/* --- Core Layout --- */
:root {
    --blue-500: #3b82f6;
    --slate-900: #0f172a;
    --slate-800: #1e293b;
}

body {
    background: var(--slate-900);
    color: white;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overscroll-behavior: none; /* Stops the "pull-to-refresh" bounce */
}

/* The magic fix for mobile address bars */
/* The magic fix for mobile address bars */
.step-container {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh; /* Fallback */
    height: 100dvh; 
    flex-direction: column;
    overflow: hidden;
}

/* Make ONLY the landing page scrollable */
#step-landing {
    overflow-y: auto;
    overflow-x: hidden;
}

/* When landing page is active, align content to top */
#step-landing.step-active {
    justify-content: flex-start;
}

/* For other steps, center the content */
#step-camera.step-active,
#step-crop.step-active,
#step-gallery.step-active {
    justify-content: center;
}

/* Keep other steps with hidden overflow */
#step-camera, 
#step-crop, 
#step-gallery {
    overflow: hidden;
}

.step-active {
    display: flex;
}

/* --- Camera View --- */
#video-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: black;
}

.shutter-btn {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    border: 4px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.inner-shutter {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: white;
    transition: transform 0.1s ease;
}

.shutter-btn:active .inner-shutter {
    transform: scale(0.9);
}

/* --- Cropping System --- */
#cropArea {
    background: black;
    touch-action: none;
    position: relative;
}

#cropCanvas {
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    max-width: 100%;
    max-height: 100%;
    display: block;
}

.crop-handle {
    position: absolute;
    width: 48px;  /* Large invisible touch target */
    height: 48px;
    transform: translate(-50%, -50%);
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    will-change: transform;
}

.handle-visual {
    width: 18px;
    height: 18px;
    background: white;
    border: 3px solid var(--blue-500);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(0,0,0,0.4);
    pointer-events: none; /* Let touches pass through to the parent handle */
}

/* --- UI Elements --- */
.btn-primary {
    background: var(--blue-500);
    color: white;
    padding: 1.2rem;
    border-radius: 1.25rem;
    font-weight: 700;
    text-align: center;
    transition: background 0.2s;
    user-select: none;
}

.btn-primary:active {
    background: #2563eb;
}

#pagesList {
    scrollbar-width: none; /* Firefox */
}

#pagesList::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Glassmorphism for overlays */
.backdrop-blur-md {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.step-active > div {
    animation: fadeIn 0.3s ease-out forwards;
}