:root {
    --color-bg: #E3E7E4;
    /* Default pastel, overridden by JS */
    --color-text: #1F1F1F;
    --color-surface: #FFFFFF;
    --elevation: 0 8px 24px rgba(0, 0, 0, 0.08);
    /* Soft shadow */
    --font-primary: 'Google Sans', 'Roboto', sans-serif;
    --transition-speed: 0.4s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-primary);
}

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    transition: background-color 1s ease;
}

#app-container {
    width: 100%;
    max-width: 480px;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Global Header */
.global-header {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    display: flex;
    justify-content: center;
    z-index: 1000;
    pointer-events: none;
}

.logo-pill {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 10px 24px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    color: var(--color-text);
    pointer-events: auto;
}

/* View State Management - Circular Swipe */
.view-state {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    /* Circular Reveal Logic */
    clip-path: circle(0% at 50% 50%);
    opacity: 0;
    pointer-events: none;

    /* Slower, dramatic easing */
    transition: clip-path 1.2s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.6s ease;
    z-index: 1;
}

.view-state.active {
    clip-path: circle(150% at 50% 50%);
    opacity: 1;
    pointer-events: all;
    z-index: 10;
}

.hidden {
    display: none;
}

/* Animations */
@keyframes pop {
    0% {
        transform: scale(0.8);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Radar (Scanning) */
.radar-container {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 32px;
}

.radar-icon {
    width: 80px;
    height: 80px;
    background: var(--color-surface);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: var(--elevation);
    z-index: 2;
    color: var(--color-text);
}

.radar-icon span {
    font-size: 40px;
}

.radar-circle {
    position: absolute;
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    animation: pulse 3s infinite cubic-bezier(0.4, 0, 0.6, 1);
    z-index: 1;
}

.delay-1 {
    animation-delay: 1s;
}

.delay-2 {
    animation-delay: 2s;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }

    100% {
        transform: scale(3.5);
        opacity: 0;
    }
}

.status-text {
    font-weight: 500;
    font-size: 1.1rem;
    opacity: 0.7;
    text-align: center;
}

/* Cards (Connected / Staged) */
.card {
    background: var(--color-surface);
    padding: 48px 32px;
    border-radius: 32px;
    box-shadow: var(--elevation);
    text-align: center;
    width: 90%;
    cursor: pointer;

    transform-style: preserve-3d;
    transform: perspective(1000px);
    transition: transform 0.1s ease-out;
}

.card:active {
    transition: transform 0.2s;
    transform: perspective(1000px) scale(0.98);
}

.card-icon,
.file-icon {
    margin-bottom: 16px;
    color: var(--color-text);
}

.card-icon span,
.file-icon span {
    font-size: 48px;
    opacity: 0.8;
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.card h3 {
    font-size: 1.2rem;
    margin-bottom: 24px;
    opacity: 0.9;
}

.card p {
    font-size: 1rem;
    opacity: 0.5;
}

/* Buttons */
.pill-btn {
    background: var(--color-text);
    color: var(--color-surface);
    border: none;
    padding: 16px 32px;
    border-radius: 99px;
    font-size: 1rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;

    /* Lift button slightly in 3D space to avoid clipping/glitching */
    transform: translateZ(10px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.pill-btn:hover {
    opacity: 0.95;
    transform: translateZ(12px) scale(1.02);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.pill-btn:active {
    transform: translateZ(8px) scale(0.98);
}

/* Progress */
.progress-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 24px auto;
    /* Center it */
}

.progress-ring__circle {
    stroke-dasharray: 327;
    /* 2 * PI * 52 ~= 326.7 */
    stroke-dashoffset: calc(327 - (327 * var(--progress, 0)) / 100);
    transition: stroke-dashoffset 0.1s linear;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    stroke-linecap: round;
}

.progress-icon {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Help System */
.fixed-top-right {
    position: fixed;
    top: 24px;
    right: 32px;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    color: var(--color-text);
}

.fixed-top-right:hover {
    transform: scale(1.1);
    background: #fff;
}

.fixed-top-right span {
    font-size: 24px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-card {
    background: #fff;
    border-radius: 24px;
    padding: 32px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.icon-btn-small {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    color: var(--color-text);
    display: flex;
    transition: background 0.2s;
}

.icon-btn-small:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Help Steps */
.help-step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.help-step:last-child {
    margin-bottom: 0;
}

.step-icon {
    background: var(--color-surface);
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    color: var(--color-text);
}

.step-text h4 {
    margin: 0 0 4px 0;
    font-size: 1.1rem;
}

.step-text p {
    margin: 0;
    font-size: 0.95rem;
    opacity: 0.6;
    line-height: 1.4;
}