:root {
    --primary: #00f2ff;
    --primary-glow: rgba(0, 242, 255, 0.6);
    --bg-dark: #0a0a0a;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-main: #ffffff;
    --font-main: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===========================
   Page 1: QR Generator
   =========================== */
.page-generator .container {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem;
    text-align: center;
}

.page-generator header {
    margin-bottom: 2rem;
}

.page-generator h1 {
    background: linear-gradient(to right, #fff, var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.upload-section {
    margin-bottom: 2rem;
}

input[type="file"] {
    display: none;
}

.custom-file-upload {
    border: 2px solid var(--primary);
    display: inline-block;
    padding: 12px 24px;
    cursor: pointer;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    background: rgba(0, 242, 255, 0.1);
}

.custom-file-upload:hover {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 20px var(--primary-glow);
}

.canvas-container {
    position: relative;
    margin: 0 auto 2rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: none;
    /* Toggled by JS */
}

canvas {
    max-width: 100%;
    /* display block helps remove scrollbars/gaps */
    display: block;
    margin: 0 auto;
}

.controls .btn {
    background: linear-gradient(45deg, var(--primary), #00aaff);
    border: none;
    padding: 15px 30px;
    color: white;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: transform 0.2s;
}

.controls .btn:active {
    transform: scale(0.98);
}

/* ===========================
   Page 2: Memory (AR)
   =========================== */
.page-memory {
    background: #000;
    overflow: hidden;
    /* Prevent scrolling on AR view */
}

#cameraFeed {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
}

.ar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    pointer-events: none;
    /* Let clicks pass through if needed, but we might want interaction */
}

/* Glass Frame */
.memory-frame {
    position: absolute;
    /* Changed from relative to absolute for matrix transform */
    top: 0;
    left: 0;
    width: 200px;
    /* Base size, will be scaled by matrix */
    height: 250px;
    transform-origin: 0 0;
    pointer-events: auto;
    /* transition: transform 0.05s linear; Use visible low latency or no transition */
    will-change: transform;
    display: block;
    backface-visibility: visible;
    -webkit-backface-visibility: visible;
}

.frame-content {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    /* Fallback visible color */
    background: rgba(0, 0, 0, 0.5);
    /* border-radius: 20px; Removed or reduced for cleaner AR alignment at corners */
    border-radius: 0;
    overflow: hidden;
    position: relative;
    /* Glassmorphism */
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 0 40px rgba(0, 242, 255, 0.2);
}

.frame-content img.slide {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 1s ease;
}

.frame-content img.slide.active {
    opacity: 1;
}

/* Neon/Glow Borders */
.frame-border {
    position: absolute;
    inset: -2px;
    /* border-radius: 25px; */
    border: 2px solid var(--primary);
    opacity: 0.8;
    z-index: -1;
    filter: blur(1px);
}

.frame-glow {
    position: absolute;
    inset: 0;
    /* border-radius: 20px; */
    box-shadow: inset 0 0 20px var(--primary-glow);
    z-index: 2;
    pointer-events: none;
}

.ar-hint {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 20px;
    border-radius: 30px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 20;
}

.ar-hint p {
    font-size: 0.9rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.tracking-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--primary), 0 0 20px #fff;
    transform: translate(-50%, -50%);
    /* Center on the point */
    pointer-events: none;
    z-index: 100;
    display: none;
    /* Hidden by default */
}

.controls-overlay {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 50;
}

.icon-btn {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 10px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-family: var(--font-main);
    backdrop-filter: blur(5px);
    transition: all 0.3s;
}

.icon-btn:hover,
.icon-btn.active {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 15px var(--primary-glow);
}

/* Mirror Class */
.mirrored {
    transform: scaleX(-1);
}