/* ==========================================================================
   JORNADA AR - DESIGN SYSTEM & STYLESHEET
   ========================================================================== */

:root {
    --bg-primary: #060e1d;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-emerald: #00ff99;
    --accent-cyan: #00f0ff;
    --accent-gold: #ffb703;
    --glass-bg: rgba(15, 23, 42, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: rgba(0, 0, 0, 0.35);
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-primary);
    font-family: var(--font-body);
    color: var(--text-primary);
    position: relative;
}

/* ==========================================================================
   CAMERA VIEWPORT
   ========================================================================== */
#camera {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    background-color: #000;
}

/* ==========================================================================
   SCREEN STATE MANAGEMENT
   ========================================================================== */
.screen {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: flex-start; /* Aligns to top when scrolling is active */
    align-items: center;
    z-index: 10;
    padding: 24px;
    overflow-y: auto; /* Allow vertical scrolling if card height overflows */
    -webkit-overflow-scrolling: touch; /* Smooth kinetic scrolling for iOS devices */
}

.screen.active {
    display: flex;
}

/* ==========================================================================
   GLASSMORPHIC CARDS
   ========================================================================== */
.glass-card {
    margin: auto 0; /* Vertically centers when there's space, but starts at top when overflowing so nothing is cut off */
    width: 100%;
    max-width: 420px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 36px 28px;
    box-shadow: 0 15px 35px var(--glass-shadow);
    text-align: center;
    color: var(--text-primary);
    animation: fadeInScale 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.5px;
}

h1 {
    font-size: 36px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #ffffff 30%, var(--accent-cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: 28px;
    margin-bottom: 8px;
}

p {
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.subtitle {
    font-size: 15px;
    margin-bottom: 24px;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
button, .btn-glow {
    border: 0;
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    outline: none;
}

.btn-glow {
    width: 100%;
    padding: 18px 32px;
    border-radius: 40px;
    font-size: 16px;
    color: #060e1d;
    background: var(--accent-emerald);
    box-shadow: 0 0 20px rgba(0, 255, 153, 0.4);
}

.btn-glow:active {
    transform: scale(0.97);
    box-shadow: 0 0 8px rgba(0, 255, 153, 0.2);
}

.btn-glow:disabled {
    background: #1e293b;
    color: #64748b;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================================================
   LOGO & ICON ANIMATIONS
   ========================================================================== */
.logo-container {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid rgba(0, 240, 255, 0.25);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 28px auto;
    position: relative;
}

.pulse-icon {
    font-size: 42px;
    animation: iconFloat 3s ease-in-out infinite;
}

.logo-container::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1px solid rgba(0, 240, 255, 0.15);
    animation: pulseBorder 2s linear infinite;
}

/* ==========================================================================
   JOURNEY SELECTION SCREEN CARD CARDS
   ========================================================================== */
.journey-options {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 28px;
    width: 100%;
}

.journey-card {
    cursor: pointer;
    width: 100%;
    display: block;
}

.journey-card input[type="radio"] {
    display: none;
}

.card-content {
    display: flex;
    align-items: center;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    padding: 16px 20px;
    text-align: left;
    transition: all 0.25s ease;
}

.journey-card:hover .card-content {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
}

.journey-card input[type="radio"]:checked + .card-content {
    background: rgba(0, 240, 255, 0.08);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.15);
}

.journey-card .icon {
    font-size: 28px;
    margin-right: 18px;
    background: rgba(255, 255, 255, 0.04);
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.journey-card .text h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 2px;
}

.journey-card .text p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 0;
}

/* ==========================================================================
   CAMERA LOADING OVERLAY
   ========================================================================== */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 14, 29, 0.95);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.overlay.active {
    display: flex;
}

.spinner-container {
    text-align: center;
    max-width: 300px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(0, 240, 255, 0.15);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    margin: 0 auto 24px auto;
    animation: rotateSpinner 1s linear infinite;
}

#permission-text {
    font-size: 16px;
    color: var(--text-secondary);
}

/* ==========================================================================
   GAME HUD
   ========================================================================== */
.hud {
    position: absolute;
    top: 24px;
    left: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    z-index: 20;
}

#status-bar {
    align-self: center;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 12px 24px;
    border-radius: 30px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

#signal-meter {
    align-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: rgba(6, 14, 29, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 8px 16px;
    border-radius: 16px;
    border: 1px solid rgba(0, 240, 255, 0.2);
    transition: opacity 0.3s ease;
}

#signal-meter.hidden {
    opacity: 0;
}

#signal-text {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
}

.signal-bar-bg {
    width: 120px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

#signal-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-emerald));
    transition: width 0.15s ease-out;
}

/* ==========================================================================
   SUBMARINE RADAR SEARCH VIEW
   ========================================================================== */
#radar-container {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 250px;
    height: 250px;
    z-index: 15;
    pointer-events: none;
    display: none;
}

#radar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(0, 255, 153, 0.4);
    position: relative;
    overflow: hidden;
    background: rgba(0, 255, 153, 0.02);
}

#radar::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle, transparent 35%, rgba(0, 255, 153, 0.04) 70%, rgba(0, 255, 153, 0.08) 100%);
}

/* Radar scanning sweep */
#radar::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50%;
    height: 50%;
    background: linear-gradient(45deg, rgba(0, 255, 153, 0.25) 0%, transparent 80%);
    transform-origin: 0% 0%;
    animation: sweep 2.5s linear infinite;
}

/* Concentric grid lines */
#radar-container::before {
    content: '';
    position: absolute;
    inset: 40px;
    border-radius: 50%;
    border: 1px dashed rgba(0, 255, 153, 0.2);
    z-index: 1;
}

#radar-container::after {
    content: '';
    position: absolute;
    inset: 80px;
    border-radius: 50%;
    border: 1px solid rgba(0, 255, 153, 0.15);
    z-index: 1;
}

/* Pulsing outer boundary */
.radar-ping {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 1px solid rgba(0, 255, 153, 0.3);
    animation: radarPulse 2s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
    pointer-events: none;
}

@keyframes sweep {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes radarPulse {
    0% { transform: scale(0.9); opacity: 1; }
    100% { transform: scale(1.2); opacity: 0; }
}

/* ==========================================================================
   3D ARTIFACT VIEWPORT (MODEL VIEWER)
   ========================================================================== */
#artifact-viewer {
    position: fixed;
    left: 50%;
    top: 45%;
    width: 340px;
    height: 340px;
    transform: translate(-50%, -50%) scale(0.7);
    opacity: 0;
    pointer-events: none;
    z-index: 12;
    cursor: pointer;
    /* Neon glow behind the 3D model */
    filter: drop-shadow(0 0 35px rgba(0, 255, 153, 0.35));
    transition: transform 0.1s ease-out, opacity 0.3s ease-out; /* Smooth dynamic panning drift and opacity transition */
}

/* ==========================================================================
   DYNAMIC BOTTOM MESSAGE BOX
   ========================================================================== */
#message-box {
    position: fixed;
    bottom: 30px;
    left: 20px;
    right: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 18px 24px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 20;
    pointer-events: none;
    animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ==========================================================================
   INVENTORY BAR (HUD RIGHT SIDE)
   ========================================================================== */
#inventory {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    max-width: 90%;
    background: rgba(6, 14, 29, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 20;
    pointer-events: none;
}

#inventory h4 {
    font-size: 10px;
    color: var(--accent-cyan);
    font-weight: 800;
    letter-spacing: 0.8px;
    margin-bottom: 0;
    margin-right: 4px;
    white-space: nowrap;
}

#slots-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.slot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(30, 41, 59, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.slot.ok {
    border-color: var(--accent-cyan);
    background: rgba(0, 240, 255, 0.15);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
    animation: slotUnlock 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ==========================================================================
   VIDEO STATE STYLING
   ========================================================================== */
#screen-video {
    background: #000;
    padding: 0;
    z-index: 200;
}

#video-player {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==========================================================================
   FORM & INPUTS
   ========================================================================== */
#screen-lead {
    background: linear-gradient(135deg, #020617 0%, #0f172a 100%);
    z-index: 300;
}

.success-timing {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.success-timing strong {
    color: var(--accent-cyan);
    font-family: var(--font-heading);
    font-weight: 700;
}

#lead-form {
    text-align: left;
    width: 100%;
}

.input-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 18px;
    position: relative;
}

.input-group label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    padding-left: 4px;
}

.input-group input {
    width: 100%;
    background: rgba(30, 41, 59, 0.5);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 16px 20px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 16px;
    outline: none;
    transition: all 0.25s ease;
}

.input-group input:focus {
    border-color: var(--accent-cyan);
    background: rgba(30, 41, 59, 0.7);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.1);
}

.input-group.invalid input {
    border-color: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.1);
}

.input-group .error-msg {
    display: none;
    font-size: 12px;
    color: #ef4444;
    margin-top: 4px;
    padding-left: 4px;
}

.input-group.invalid .error-msg {
    display: block;
}

/* ==========================================================================
   FINISHED SCREEN
   ========================================================================== */
#screen-finished {
    background: linear-gradient(135deg, #020617 0%, #0f172a 100%);
    z-index: 310;
}

.success-card {
    max-width: 360px;
}

.trophy-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 24px;
    animation: iconFloat 4s ease-in-out infinite;
}

.footer-brand {
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 36px;
}

/* ==========================================================================
   KEYFRAME ANIMATIONS
   ========================================================================== */
@keyframes rotateSpinner {
    to { transform: rotate(360deg); }
}

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

@keyframes iconFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes pulseBorder {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.08); opacity: 0.3; }
    100% { transform: scale(1.15); opacity: 0; }
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

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

@keyframes slotUnlock {
    0% { transform: scale(0.6); opacity: 0; }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

.animate-pop {
    animation: fadeInScale 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ==========================================================================
   ONBOARDING TUTORIAL STEPS
   ========================================================================== */
.onboarding-steps {
    margin: 20px 0;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    text-align: left;
}

.onboarding-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

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

.onboarding-step p {
    margin: 0;
    font-size: 13px;
    color: #cbd5e1;
    line-height: 1.4;
}

.onboarding-step p strong {
    color: var(--accent-cyan);
}

.step-num {
    background: var(--accent-cyan);
    color: #060e1d;
    font-weight: 800;
    font-size: 12px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ==========================================================================
   CHECKBOX GROUP (TERMS OF USE)
   ========================================================================== */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0;
    text-align: left;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent-cyan);
    cursor: pointer;
    flex-shrink: 0;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
}

.checkbox-group label {
    font-size: 13px;
    color: #cbd5e1;
    cursor: pointer;
    user-select: none;
    line-height: 1.4;
}

.checkbox-group label a {
    color: var(--accent-cyan);
    text-decoration: underline;
    font-weight: 600;
    pointer-events: auto; /* Allow clicking the link! */
}

/* ==========================================================================
   TERMS OF USE MODAL (FLOATING POPUP)
   ========================================================================== */
.modal-terms {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 9, 20, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999; /* Higher than everything else! */
    padding: 24px;
    transition: opacity 0.3s ease;
}

.modal-terms.hidden {
    display: none !important;
}

.modal-terms .modal-content {
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.modal-terms h3 {
    font-family: var(--font-heading);
    color: var(--accent-cyan);
    margin-top: 0;
    margin-bottom: 16px;
    text-align: center;
    font-size: 20px;
}

.modal-body-text {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.6;
    overflow-y: auto;
    margin-bottom: 24px;
    padding-right: 8px;
}

.modal-body-text p {
    margin-top: 0;
    margin-bottom: 14px;
}

.modal-body-text strong {
    color: var(--text-primary);
}
