/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    overflow: hidden;
    background-color: #000000;
    font-family: 'Poppins', sans-serif;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    color: #c9a464;
}

canvas {
    display: block;
}

/* ===== LANGUAGE TOGGLE ===== */
#lang-toggle {
    position: fixed;
    top: 20px;
    right: 25px;
    z-index: 9000;
    display: flex;
    align-items: center;
    background: rgba(20, 12, 5, 0.5);
    border: 1px solid rgba(201, 164, 100, 0.3);
    border-radius: 30px;
    padding: 4px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    -webkit-tap-highlight-color: transparent;
}

#lang-pill-bg {
    position: absolute;
    left: 4px;
    width: 38px;
    height: 26px;
    background: rgba(201, 164, 100, 0.15);
    border: 1px solid rgba(201, 164, 100, 0.5);
    border-radius: 20px;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1;
}

.lang-btn {
    position: relative;
    z-index: 2;
    background: transparent;
    border: none;
    margin: 0;
    padding: 0;
    width: 38px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.4);
    font-family: 'Poppins', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1px;
    cursor: pointer;
    transition: color 0.3s ease;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.lang-btn.active {
    color: #c9a464;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(201, 164, 100, 0.8);
}

.lang-btn:hover {
    color: #c9a464;
}

/* ===== DEMO BANNER ===== */
#demo-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9998;
    background: linear-gradient(90deg, rgba(201, 164, 100, 0.15), rgba(201, 164, 100, 0.25), rgba(201, 164, 100, 0.15));
    border-bottom: 1px solid rgba(201, 164, 100, 0.3);
    text-align: center;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 500;
    color: #c9a464;
    letter-spacing: 1.5px;
    display: none;
    backdrop-filter: blur(4px);
    animation: demoPulse 2s ease-in-out infinite;
}

#demo-banner.visible {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

@keyframes demoPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* ===== RIPPLE EFFECTS ===== */
#ripple-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9997;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(201, 164, 100, 0.35);
    transform: scale(0);
    animation: rippleAnim 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes rippleAnim {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ===== CONFETTI ===== */
#confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9996;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -20px;
    font-size: 18px;
    animation: confettiFall linear forwards;
    pointer-events: none;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }

    80% {
        opacity: 1;
    }

    100% {
        transform: translateY(105vh) rotate(720deg) scale(0.6);
        opacity: 0;
    }
}

/* ===== LOADING SCREEN ===== */
#loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(224, 191, 184, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(201, 164, 100, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(180, 100, 90, 0.08) 0%, transparent 60%),
        #000000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    font-weight: 200;
    letter-spacing: 2px;
    z-index: 2000;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    overflow: hidden;
}

#loading.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Ambient loading particles */
#loading::before,
#loading::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(224, 191, 184, 0.6);
    box-shadow:
        0 0 10px rgba(224, 191, 184, 0.4),
        0 0 20px rgba(201, 164, 100, 0.2);
    animation: floatParticle 6s ease-in-out infinite;
}

#loading::before {
    top: 15%;
    left: 20%;
    animation-delay: 0s;
}

#loading::after {
    bottom: 25%;
    right: 18%;
    animation-delay: 2s;
    width: 6px;
    height: 6px;
}

@keyframes floatParticle {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.6;
    }

    25% {
        transform: translate(40px, -30px) scale(1.2);
        opacity: 1;
    }

    50% {
        transform: translate(-20px, -60px) scale(0.9);
        opacity: 0.7;
    }

    75% {
        transform: translate(30px, 30px) scale(1.1);
        opacity: 0.9;
    }
}

#loading-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    animation: loadingFadeIn 0.8s ease-out;
}

@keyframes loadingFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#loading-logo-wrap {
    position: relative;
    width: 110px;
    height: 110px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#loading-logo {
    width: 90px;
    height: 90px;
    object-fit: contain;
    filter: drop-shadow(0 0 14px rgba(201, 164, 100, 0.55));
    z-index: 2;
    position: relative;
}

@keyframes loadingLogoPulse {
    0% {
        transform: scale(1);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.08);
        opacity: 1;
        filter: drop-shadow(0 0 22px rgba(201, 164, 100, 0.85));
    }

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

/* Rotating golden ring behind logo */
#loading-glow {
    position: absolute;
    inset: -18px;
    border-radius: 50%;
    background:
        radial-gradient(circle, rgba(201, 164, 100, 0.25) 0%, transparent 70%),
        conic-gradient(from 0deg,
            transparent 0%,
            rgba(224, 191, 184, 0.6) 25%,
            transparent 50%,
            rgba(201, 164, 100, 0.4) 75%,
            transparent 100%);
    animation: loadingRingRotate 4s linear infinite, loadingGlowPulse 2.5s ease-in-out infinite;
    filter: blur(2px);
    z-index: 1;
}

@keyframes loadingRingRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes loadingGlowPulse {

    0%,
    100% {
        transform: scale(0.9) rotate(0deg);
        opacity: 0.55;
    }

    50% {
        transform: scale(1.15) rotate(180deg);
        opacity: 1;
    }
}

#loading-title {
    font-family: 'Playfair Display', serif;
    font-size: 26px;
    font-weight: 600;
    font-style: italic;
    color: #c9a464;
    letter-spacing: 3px;
    margin-bottom: 6px;
    text-shadow: 0 2px 12px rgba(201, 164, 100, 0.4);
}

#loading-tagline {
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 300;
    color: rgba(201, 164, 100, 0.6);
    letter-spacing: 1px;
    margin-bottom: 24px;
}

#loading-progress-bar {
    width: 200px;
    height: 3px;
    background: rgba(201, 164, 100, 0.15);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 14px;
}

#loading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #c9a464, #e0bfb8, #c9a464);
    background-size: 200% 100%;
    animation: progressShimmer 1.5s ease-in-out infinite;
    border-radius: 3px;
    transition: width 0.4s ease;
    width: 0%;
}

@keyframes progressShimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

#loading-status {
    font-size: 11px;
    font-weight: 400;
    color: rgba(201, 164, 100, 0.7);
    letter-spacing: 1px;
    margin-bottom: 18px;
    min-height: 16px;
    transition: opacity 0.3s;
}

#loading-steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
}

.loading-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: rgba(201, 164, 100, 0.45);
    transition: color 0.4s ease;
}

.loading-step.done {
    color: #c9a464;
}

.loading-step.active {
    color: rgba(201, 164, 100, 0.85);
}

.step-icon {
    font-size: 13px;
    transition: all 0.3s ease;
    display: inline-block;
}

.loading-step.done .step-icon {
    content: '✓';
}

.loading-step.active .step-icon {
    animation: stepPulse 0.8s ease-in-out infinite;
}

@keyframes stepPulse {

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

    50% {
        transform: scale(1.3);
    }
}

/* ===== ERROR OVERLAY ===== */
#error-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#error-overlay.visible {
    display: flex;
}

#error-card {
    background: rgba(30, 15, 5, 0.95);
    border: 1px solid rgba(201, 164, 100, 0.3);
    border-radius: 20px;
    padding: 30px 24px;
    max-width: 320px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: errorCardIn 0.4s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}

@keyframes errorCardIn {
    from {
        transform: scale(0.8) translateY(20px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

#error-icon {
    font-size: 42px;
    margin-bottom: 12px;
    animation: errorShake 0.5s ease-in-out;
}

@keyframes errorShake {

    0%,
    100% {
        transform: rotate(0deg);
    }

    20% {
        transform: rotate(-10deg);
    }

    40% {
        transform: rotate(10deg);
    }

    60% {
        transform: rotate(-5deg);
    }

    80% {
        transform: rotate(5deg);
    }
}

#error-card h3 {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    font-weight: 600;
    font-style: italic;
    color: #c9a464;
    margin: 0 0 10px;
}

#error-card p {
    font-size: 13px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 20px;
    line-height: 1.6;
}

#error-retry-btn {
    background: linear-gradient(135deg, #c9a464, #b08040);
    border: none;
    border-radius: 50px;
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 28px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(201, 164, 100, 0.35);
    transition: transform 0.2s, opacity 0.2s;
}

#error-retry-btn:active {
    transform: scale(0.95);
    opacity: 0.85;
}

/* ===== UI PELACAK TANGAN ===== */
#main-hand-ui {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
}

#ui-layer {
    position: absolute;
    bottom: 10vh;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    text-align: center;
    width: 100%;
    margin: 0;
    padding: 0;
}

#ui-layer h1 {
    display: none;
}

#ui-layer p.tagline {
    display: none;
}

/* ===== GESTURE GUIDE PANEL ===== */
#gesture-guide-panel {
    position: absolute;
    top: 60px;
    left: 14px;
    background: rgba(20, 12, 5, 0.82);
    border: 1px solid rgba(201, 164, 100, 0.2);
    border-radius: 16px;
    padding: 14px 14px 12px;
    max-width: 220px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#gesture-guide-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 10px;
    font-weight: 600;
    color: rgba(201, 164, 100, 0.6);
    letter-spacing: 1px;
    text-transform: uppercase;
}

#gesture-step-counter {
    font-size: 11px;
    font-weight: 700;
    color: #c9a464;
}

#gesture-cards-container {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

#gesture-cards-container::-webkit-scrollbar {
    display: none;
}

.gesture-card {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    background: rgba(201, 164, 100, 0.08);
    border: 1.5px solid rgba(201, 164, 100, 0.15);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: all 0.3s ease;
    padding: 4px;
}

.gesture-card.active {
    background: rgba(201, 164, 100, 0.2);
    border-color: rgba(201, 164, 100, 0.6);
    box-shadow: 0 0 12px rgba(201, 164, 100, 0.3);
    transform: scale(1.08);
}

.gesture-card.done {
    background: rgba(100, 200, 150, 0.15);
    border-color: rgba(100, 200, 150, 0.4);
}

.gesture-card .gc-icon {
    font-size: 22px;
    line-height: 1;
}

.gesture-card .gc-label {
    font-size: 9px;
    font-weight: 500;
    color: rgba(201, 164, 100, 0.7);
}

.gesture-card.active .gc-label {
    color: #c9a464;
}

.gesture-card.done .gc-label {
    color: rgba(100, 200, 150, 0.9);
}

#gesture-progress-bar {
    margin-top: 10px;
    height: 3px;
    background: rgba(201, 164, 100, 0.12);
    border-radius: 3px;
    overflow: hidden;
}

#gesture-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #c9a464, #e0bfb8);
    border-radius: 3px;
    transition: width 0.5s cubic-bezier(0.34, 1.2, 0.64, 1);
    width: 0%;
}

#gesture-current-hint {
    margin-top: 8px;
    font-size: 11px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    gap: 6px;
}

#gesture-hint-name {
    color: #c9a464;
    font-weight: 600;
    font-size: 12px;
}

/* ===== GESTURE DETECTION FEEDBACK ===== */
#gesture-detection-feedback {
    position: fixed;
    bottom: 24px;
    right: 18px;
    z-index: 200;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

#gesture-detection-feedback.visible {
    display: flex;
}

#gdf-ring {
    position: absolute;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 2px solid rgba(201, 164, 100, 0.1);
    animation: gdfRingPulse 2s ease-in-out infinite;
}

@keyframes gdfRingPulse {

    0%,
    100% {
        transform: scale(0.9);
        opacity: 0.3;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.7;
    }
}

#gdf-status {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

#gdf-icon {
    font-size: 36px;
    filter: drop-shadow(0 0 8px rgba(201, 164, 100, 0.5));
    transition: all 0.3s ease;
}

#gdf-icon.detecting {
    animation: gdfIconBounce 0.4s ease-in-out;
}

@keyframes gdfIconBounce {

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

    50% {
        transform: scale(1.2);
    }
}

#gdf-icon.match {
    filter: drop-shadow(0 0 14px rgba(100, 220, 150, 0.7));
    animation: gdfMatchPop 0.5s cubic-bezier(0.34, 1.5, 0.64, 1);
}

@keyframes gdfMatchPop {
    0% {
        transform: scale(0.6);
    }

    70% {
        transform: scale(1.3);
    }

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

#gdf-text {
    font-size: 10px;
    font-weight: 500;
    color: rgba(201, 164, 100, 0.7);
    letter-spacing: 0.5px;
}

#gdf-text.match {
    color: rgba(100, 220, 150, 0.9);
}

#gdf-progress-ring {
    position: relative;
    width: 60px;
    height: 60px;
}

#gdf-progress-ring svg {
    transform: rotate(-90deg);
    width: 60px;
    height: 60px;
}

.gdf-track {
    fill: none;
    stroke: rgba(201, 164, 100, 0.1);
    stroke-width: 4;
}

.gdf-progress {
    fill: none;
    stroke: #c9a464;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 163.36;
    stroke-dashoffset: 163.36;
    transition: stroke-dashoffset 0.3s ease, stroke 0.3s ease;
}

.gdf-progress.match {
    stroke: #64dc96;
}

#gdf-count {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 700;
    color: #c9a464;
}

/* ===== STATUS BAR ===== */
#status-bar {
    position: absolute;
    top: 14px;
    left: 14px;
    background: rgba(20, 12, 5, 0.7);
    border: 1px solid rgba(201, 164, 100, 0.2);
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 12px;
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: border-color 0.3s;
    display: none !important;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ffaa00;
    box-shadow: 0 0 8px currentColor;
    transition: all 0.3s;
}

.dot.active {
    background-color: #64dc96;
    box-shadow: 0 0 10px rgba(100, 220, 150, 0.6);
}

.dot.error {
    background-color: #ff4466;
    box-shadow: 0 0 10px rgba(255, 68, 102, 0.6);
    animation: dotErrorPulse 0.5s ease-in-out;
}

@keyframes dotErrorPulse {

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

    50% {
        transform: scale(1.5);
    }
}

#start-btn {
    background: #c9a464;
    color: #3a2008;
    border: none;
    padding: 6px 12px;
    border-radius: 15px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.8rem;
    transition: opacity 0.2s;
    font-family: 'Poppins', sans-serif;
    pointer-events: auto;
}

#start-btn:active {
    opacity: 0.7;
}

/* ===== ENVELOPE / MESSAGE UI ===== */
#envelope-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    background: radial-gradient(circle at center, #1f1b24 0%, #0a0a0f 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease-out;
}

#envelope-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

#envelope-container {
    position: relative;
    width: 320px;
    height: 220px;
    perspective: 1200px;
    margin-top: 50px;
}

.envelope {
    position: relative;
    width: 100%;
    height: 100%;
    background: #fdf5f6;
    /* Pastel back */
    border-radius: 4px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), inset 0 0 40px rgba(0, 0, 0, 0.02);
    z-index: 1;
}

.envelope::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    border-top: 110px solid transparent;
    border-bottom: 110px solid transparent;
    border-left: 160px solid #fadce1;
    /* Pastel left flap */
    z-index: 2;
}

.envelope::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    border-top: 110px solid transparent;
    border-bottom: 110px solid transparent;
    border-right: 160px solid #fadce1;
    /* Pastel right flap */
    z-index: 2;
}

.pocket {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    border-left: 160px solid transparent;
    border-right: 160px solid transparent;
    border-bottom: 120px solid #f7ccd3;
    /* Pastel bottom pocket */
    z-index: 6;
    border-radius: 0 0 4px 4px;
}

.top-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    border-left: 160px solid transparent;
    border-right: 160px solid transparent;
    border-top: 130px solid #f4bec7;
    /* Pastel top flap */
    z-index: 7;
    transform-origin: top;
    transform: rotateX(0deg);
    border-radius: 4px 4px 0 0;
    filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.15));
}

.wax-seal {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: #9b2226;
    border-radius: 50%;
    z-index: 7;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3), inset 0 0 10px rgba(80, 10, 10, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid #5a0000;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 0 0 rgba(155, 34, 38, 0.7), inset 0 0 10px rgba(80, 10, 10, 0.8);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.05);
        box-shadow: 0 0 15px 10px rgba(155, 34, 38, 0), inset 0 0 15px rgba(80, 10, 10, 0.9);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 0 0 rgba(155, 34, 38, 0), inset 0 0 10px rgba(80, 10, 10, 0.8);
    }
}

.wax-seal:active {
    transform: translate(-50%, -50%) scale(0.95);
}

.seal-inner {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 1px dashed rgba(255, 255, 255, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
}

.seal-inner img {
    width: 30px;
    height: auto;
    filter: brightness(1.5) sepia(1);
    opacity: 0.8;
}

#envelope-hint {
    margin-top: 40px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    opacity: 0.7;
    letter-spacing: 0.5px;
}

.letter {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 300px;
    height: 200px;
    background: #fffefb;
    border-radius: 4px;
    z-index: 1;
    /* Behind flaps */
    padding: 25px 20px;
    box-sizing: border-box;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    background-image: repeating-linear-gradient(transparent, transparent 24px, rgba(200, 180, 150, 0.1) 24px, rgba(200, 180, 150, 0.1) 25px);
    display: flex;
    flex-direction: column;
    color: #4a3b32;
    transform: translateY(0);
    cursor: pointer;
}

.letter-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    opacity: 0;
}

.letter-body {
    flex: 1;
    overflow-y: auto;
    color: #5c3d1e;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px 20px;
}

.part-intro {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 16px;
    font-weight: 600;
    color: #634324;
    text-align: left;
    width: 100%;
    margin-bottom: 20px !important;
    line-height: 1.4;
}

.part-body {
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.7;
    color: #4a3b3d;
    text-align: center;
    margin-bottom: 20px !important;
}

.part-body strong {
    font-weight: 600;
    color: #634324;
}

.part-outro {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 15px;
    font-weight: 600;
    color: #634324;
    text-align: right;
    width: 100%;
    margin-top: 10px;
}

.letter-body p {
    margin: 0 0 12px 0;
}

.letter-tap-hint {
    opacity: 0;
    text-align: center;
    font-size: 11px;
    color: #a5886d;
    font-family: 'Poppins', sans-serif;
    margin-bottom: 5px;
    animation: text-pulse 2s infinite;
    pointer-events: none;
}

@keyframes text-pulse {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(2px);
        color: #c0a894;
    }
}

.letter-footer {
    margin-top: auto;
    text-align: right;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
    padding-top: 10px;
}

#btn-read-next {
    background: #c9a464;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 12px;
    box-shadow: 0 4px 10px rgba(201, 164, 100, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    transition: transform 0.2s;
    position: relative;
    overflow: hidden;
}

#btn-read-next::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: rotate(45deg) translateX(-100%);
    animation: goldShimmer 3.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    pointer-events: none;
}

#btn-read-next:active {
    transform: scale(0.95);
}

@keyframes goldShimmer {
    0% {
        transform: translateX(-100%) rotate(45deg);
    }

    100% {
        transform: translateX(200%) rotate(45deg);
    }
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(155, 34, 38, 0.3), inset 0 0 10px rgba(80, 10, 10, 0.8);
    }

    50% {
        box-shadow: 0 0 25px rgba(155, 34, 38, 0.7), inset 0 0 15px rgba(80, 10, 10, 0.9);
    }
}

/* ===== TOMBOL LEWATI PESAN ===== */
#main-start-btn {
    display: inline-block;
    margin-top: 0;
    margin-bottom: 10px;
    border: none;
    background: #c9a464;
    color: #fff;
    box-shadow: 0 4px 15px rgba(201, 164, 100, 0.4);
    text-transform: uppercase;
    font-weight: 600;
    font-size: 11px;
    padding: 12px 24px;
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.75rem, 2.5vw, 0.85rem);
    border-radius: 30px;
    letter-spacing: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    z-index: 2;
    transition: all 0.3s ease;
}

#main-start-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: rotate(45deg) translateX(-100%);
    animation: goldShimmer 3.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    pointer-events: none;
}

#main-start-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--rx, 50%) var(--ry, 50%), rgba(255, 255, 255, 0.3) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
}

#main-start-btn:active::after {
    opacity: 1;
}

#main-start-btn:active {
    transform: scale(0.96);
}

#main-start-btn.rippled {
    animation: btnRipple 0.5s ease-out;
}

@keyframes btnRipple {
    0% {
        box-shadow: 0 4px 15px rgba(201, 164, 100, 0.4);
    }

    50% {
        box-shadow: 0 4px 25px rgba(201, 164, 100, 0.7), 0 0 40px rgba(201, 164, 100, 0.3);
    }

    100% {
        box-shadow: 0 4px 15px rgba(201, 164, 100, 0.4);
    }
}

/* ===== UI PEMINDAI AR ===== */
#mindar-overlay-container {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
}

#mindar-overlay-container.active {
    display: block;
}

#ar-scene-target-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: none;
    background: transparent;
    color: white;
    pointer-events: none;
}

.tutorial-logo-container {
    position: relative;
    width: 140px;
    height: auto;
    min-height: 140px;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: pulseLogo 3.0s ease-in-out infinite;
    z-index: 2;
}

.tutorial-logo {
    width: 100%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
}

@keyframes pulseLogo {

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

    50% {
        transform: scale(1.06);
    }
}

#tutorial-scan-halo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin-top: 0 !important;
}

.scan-line-logo {
    position: absolute;
    top: 0%;
    left: 0%;
    right: 0%;
    height: 3px;
    background: #c9a464;
    box-shadow: 0 0 15px #c9a464;
    animation: scanUpDownLogo 2.5s ease-in-out infinite;
    border-radius: 50%;
    z-index: 2;
}

@keyframes scanUpDownLogo {
    0% {
        top: 0%;
        opacity: 0;
    }

    15% {
        opacity: 1;
    }

    50% {
        top: 100%;
    }

    85% {
        opacity: 1;
    }

    100% {
        top: 0%;
        opacity: 0;
    }
}

.tutorial-text {
    position: absolute;
    top: calc(50% + 150px);
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    width: 90%;
    z-index: 2;
}

.tutorial-text h3 {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: 21px;
    margin: 0 0 10px 0;
    letter-spacing: 1px;
    color: #fff;
}

.tutorial-text p {
    font-family: 'Poppins', sans-serif;
    font-weight: 300;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    line-height: 1.7;
}

/* Gesture Tutorial Mini */
#gesture-tutorial-mini {
    margin-top: 24px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 12px 16px;
    text-align: center;
}

#gtm-header {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 10px;
}

#gtm-gestures {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.gtm-gesture {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.gtm-icon {
    font-size: 26px;
    line-height: 1;
}

.gtm-gesture span {
    font-size: 9px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
}

@media (max-width: 600px) {
    #card-text-wrapper {
        width: 90%;
    }

    #message-card h3 {
        font-size: 26px;
        margin-bottom: 20px;
    }

    #message-card p {
        font-size: 14px;
    }

    .magic-button {
        font-size: 14px;
        padding: 12px 24px;
    }

    #gesture-guide-panel {
        max-width: 180px;
    }

    #gesture-detection-feedback {
        bottom: 16px;
        right: 12px;
    }
}

/* ===== MASKOT AR OVERLAY ===== */
#ar-mascot-stage {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    pointer-events: none;
}

#ar-mascot-stage.active {
    display: block;
}

#ar-mascot-stage.preview-mode {
    background: radial-gradient(ellipse at center 70%, rgba(120, 50, 40, 0.6) 0%, rgba(10, 8, 14, 0.97) 100%);
    pointer-events: auto;
}

#mascot-wrap {
    position: absolute;
    bottom: 22%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
}

#mascot-img {
    width: clamp(100px, 28vw, 140px);
    filter: drop-shadow(0 12px 28px rgba(240, 180, 160, 0.55));
    animation: mascotIdle 3.2s ease-in-out infinite;
    cursor: pointer;
    transition: transform 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
}

#mascot-img:active {
    transform: scale(0.92);
}

@keyframes mascotBounce {
    0%, 100% {
        transform: translateY(0) scale(1, 1) rotate(0deg);
    }
    30% {
        transform: translateY(-12px) scale(0.96, 1.05) rotate(-3deg);
    }
    50% {
        transform: translateY(-16px) scale(0.98, 1.02) rotate(2deg);
    }
    70% {
        transform: translateY(-6px) scale(1.02, 0.98) rotate(-1deg);
    }
}

@keyframes mascotIdle {

    0%,
    100% {
        transform: translateY(0px) rotate(-1deg);
    }

    30% {
        transform: translateY(-8px) rotate(0.5deg);
    }

    60% {
        transform: translateY(-4px) rotate(-0.5deg);
    }
}

#mascot-heart-btn {
    position: absolute;
    top: 52%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(34px, 9vw, 44px);
    height: clamp(34px, 9vw, 44px);
    background: radial-gradient(circle at 40% 35%, #fff9f0, #ffcdb2);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(16px, 4.5vw, 22px);
    box-shadow: 0 0 0 0 rgba(255, 180, 140, 0.7);
    animation: heartPulse 2s ease-in-out infinite;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease;
    z-index: 2;
}

#mascot-heart-btn:active {
    transform: translate(-50%, -50%) scale(0.88);
}

@keyframes heartPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 180, 140, 0.7), 0 0 14px 4px rgba(255, 210, 180, 0.4);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(255, 180, 140, 0), 0 0 22px 8px rgba(255, 210, 180, 0.6);
    }
}

/* Speech Bubble */
#speech-bubble {
    position: absolute;
    bottom: calc(100% + 14px);
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    width: clamp(200px, 72vw, 290px);
    background: rgba(255, 250, 248, 0.97);
    border-radius: 20px;
    padding: 14px 18px 12px;
    box-shadow: 0 8px 32px rgba(200, 140, 120, 0.22), 0 2px 8px rgba(0, 0, 0, 0.08);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
}

#speech-bubble.show {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
}

#speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 11px solid rgba(255, 250, 248, 0.97);
}

#bubble-slide-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(13px, 3.8vw, 16px);
    font-weight: 600;
    font-style: italic;
    color: #c07060;
    margin: 0 0 6px;
    line-height: 1.3;
}

#bubble-slide-body {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(11px, 3.2vw, 13px);
    font-weight: 400;
    color: #5a4040;
    line-height: 1.6;
    margin: 0 0 10px;
}

#bubble-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

#bubble-prev-btn,
#bubble-next-btn {
    background: none;
    border: none;
    font-family: 'Poppins', sans-serif;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    color: rgba(160, 100, 100, 0.7);
    transition: color 0.2s, transform 0.15s;
    -webkit-tap-highlight-color: transparent;
}

#bubble-prev-btn:hover {
    color: #c07060;
}

#bubble-next-btn {
    background: linear-gradient(135deg, #f4a99a, #e07060);
    border-radius: 50px;
    padding: 6px 16px;
    color: #fff;
}

#bubble-next-btn:active {
    transform: scale(0.92);
}

#bubble-prev-btn:active {
    transform: scale(0.9);
}

#bubble-replay-btn {
    background: rgba(201, 164, 100, 0.1);
    border: 1px solid rgba(201, 164, 100, 0.25);
    border-radius: 50px;
    padding: 5px 14px;
    color: rgba(150, 110, 80, 0.8);
    font-family: 'Poppins', sans-serif;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

#bubble-replay-btn:hover {
    background: rgba(201, 164, 100, 0.2);
    color: rgba(150, 110, 80, 1);
}

#bubble-replay-btn:active {
    transform: scale(0.95);
}

/* Video Panel */
#video-panel {
    position: absolute;
    top: 6%;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    width: clamp(200px, 78vw, 340px);
    background: rgba(15, 12, 18, 0.92);
    border: 1.5px solid rgba(240, 190, 170, 0.3);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.34, 1.2, 0.64, 1);
}

#video-panel.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

#video-panel.show::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    animation: videoPanelBlurIn 0.45s ease forwards;
}

@keyframes videoPanelBlurIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

#video-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#video-panel-header span {
    font-family: 'Poppins', sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: rgba(240, 190, 170, 0.9);
    letter-spacing: 0.5px;
}

#video-panel-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

#video-mute-btn,
#video-fullscreen-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 4px;
    transition: color 0.2s, transform 0.15s;
    -webkit-tap-highlight-color: transparent;
}

#video-mute-btn:active,
#video-fullscreen-btn:active {
    transform: scale(0.88);
}

#video-panel-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
    -webkit-tap-highlight-color: transparent;
}

#video-panel video {
    width: 100%;
    display: block;
    aspect-ratio: 16/9;
    background: #000;
}

/* Deco Particles */
.deco-particle {
    position: absolute;
    pointer-events: none;
    font-size: clamp(12px, 3.5vw, 18px);
    animation: decoFloat linear infinite;
    opacity: 0;
    user-select: none;
}

@keyframes decoFloat {
    0% {
        transform: translateY(0) rotate(0deg) scale(0.8);
        opacity: 0;
    }

    10% {
        opacity: 0.7;
    }

    85% {
        opacity: 0.5;
    }

    100% {
        transform: translateY(-65vh) rotate(360deg) scale(1.1);
        opacity: 0;
    }
}

@keyframes mascotEntrance {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(40px) scale(0.7);
    }

    70% {
        transform: translateX(-50%) translateY(-6px) scale(1.04);
    }

    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

#mascot-wrap {
    opacity: 0;
}

#mascot-wrap.entered {
    animation: mascotEntrance 0.7s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}

#mascot-tap-hint {
    margin-top: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.5px;
    animation: hintBlink 2s ease-in-out infinite;
}

@keyframes hintBlink {

    0%,
    100% {
        opacity: 0.55
    }

    50% {
        opacity: 0.2
    }
}

#mascot-tap-hint.hidden {
    display: none;
}

#preview-mascot-btn {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.12);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: 50px;
    padding: 8px 18px 8px 10px;
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.3px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s, transform 0.15s;
    white-space: nowrap;
}

#preview-mascot-btn:active {
    transform: translateX(-50%) scale(0.93);
}

#preview-mascot-btn img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(240, 160, 140, 0.5));
    animation: mascotBtnBob 2s ease-in-out infinite;
}

@keyframes mascotBtnBob {

    0%,
    100% {
        transform: translateY(0)
    }

    50% {
        transform: translateY(-3px)
    }
}

#preview-close-btn {
    position: absolute;
    top: 18px;
    right: 18px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto;
}

#ar-mascot-stage.preview-mode #preview-close-btn {
    display: flex;
}

#preview-label {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Poppins', sans-serif;
    font-size: 10px;
    font-weight: 500;
    color: rgba(255, 200, 180, 0.5);
    letter-spacing: 2px;
    text-transform: uppercase;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s;
    white-space: nowrap;
}

#ar-mascot-stage.preview-mode #preview-label {
    opacity: 1;
}

/* ===== ADMIN CONTROLS - REDESAIN ===== */
#admin-controls {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    background: rgba(10, 8, 5, 0.95);
    color: white;
    padding: 0;
    display: none;
    flex-direction: column;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(201, 164, 100, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

#admin-controls.visible {
    display: flex;
}

#admin-controls.visible~#ar-mascot-stage,
#admin-controls.visible~#envelope-overlay,
#admin-controls.visible~#tutorial-overlay {
    display: none !important;
}

#admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(201, 164, 100, 0.1);
    background: rgba(201, 164, 100, 0.05);
}

#admin-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    letter-spacing: 1px;
    color: rgba(201, 164, 100, 0.8);
    text-transform: uppercase;
    font-weight: 600;
}

#btn-toggle-admin {
    background: rgba(201, 164, 100, 0.15) !important;
    border: 1px solid rgba(201, 164, 100, 0.25) !important;
    font-size: 11px !important;
    padding: 5px 12px !important;
    color: #c9a464 !important;
}

#admin-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Admin Preview */
#admin-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

#admin-preview-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(201, 164, 100, 0.4);
}

#admin-video-preview {
    position: relative;
    width: 320px;
    height: 180px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(201, 164, 100, 0.2);
    border-radius: 8px;
    overflow: hidden;
}

#admin-preview-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
}

#admin-preview-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.admin-crosshair-h,
.admin-crosshair-v {
    position: absolute;
    background: rgba(201, 164, 100, 0.4);
}

.admin-crosshair-h {
    width: 100%;
    height: 1px;
    top: 50%;
}

.admin-crosshair-v {
    height: 100%;
    width: 1px;
    left: 50%;
}

#admin-dim-label {
    position: absolute;
    bottom: 4px;
    right: 6px;
    font-size: 9px;
    color: rgba(201, 164, 100, 0.5);
}

/* Admin Controls Grid */
#admin-controls-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.admin-control-group {
    background: rgba(201, 164, 100, 0.05);
    border: 1px solid rgba(201, 164, 100, 0.12);
    border-radius: 12px;
    padding: 10px;
}

.admin-group-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(201, 164, 100, 0.5);
    margin-bottom: 8px;
}

.admin-btn-row {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-bottom: 8px;
}

.admin-numeric-inputs {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.admin-num-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.admin-num-group label {
    font-size: 9px;
    font-weight: 600;
    color: rgba(201, 164, 100, 0.5);
}

.admin-num-group input {
    width: 58px;
    padding: 4px 6px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(201, 164, 100, 0.2);
    border-radius: 6px;
    color: #c9a464;
    font-family: 'Poppins', monospace;
    font-size: 11px;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.admin-num-group input:focus {
    border-color: rgba(201, 164, 100, 0.5);
    box-shadow: 0 0 6px rgba(201, 164, 100, 0.2);
}

.admin-num-single {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 4px;
}

.admin-num-single input {
    width: 60px;
    padding: 4px 6px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(201, 164, 100, 0.2);
    border-radius: 6px;
    color: #c9a464;
    font-family: 'Poppins', monospace;
    font-size: 11px;
    text-align: center;
    outline: none;
}

.admin-num-single label {
    font-size: 11px;
    color: rgba(201, 164, 100, 0.5);
}

.btn-admin {
    background: #2a2a2a;
    color: white;
    border: 1px solid #444;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, transform 0.1s;
}

.btn-admin:active {
    background: #3a3a3a;
    transform: scale(0.95);
}

.btn-admin.style-scale {
    background: #1a3a5c;
    border-color: rgba(30, 80, 140, 0.5);
}

.btn-admin.style-scale:active {
    background: #1e4a7a;
}

.btn-admin.style-rotate {
    background: #4a1a5c;
    border-color: rgba(120, 40, 140, 0.5);
}

.btn-admin.style-rotate:active {
    background: #5a2a7a;
}

#admin-save-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding-top: 4px;
    border-top: 1px solid rgba(201, 164, 100, 0.1);
}

.btn-admin.btn-save {
    background: linear-gradient(135deg, #c9a464, #a07830);
    border: none;
    color: #fff;
    padding: 10px 32px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(201, 164, 100, 0.3);
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-admin.btn-save:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(201, 164, 100, 0.2);
}

#admin-values-display {
    font-size: 10px;
    color: rgba(201, 164, 100, 0.4);
    display: flex;
    align-items: center;
    gap: 6px;
}

#admin-current-values {
    font-family: monospace;
    font-size: 10px;
    color: rgba(201, 164, 100, 0.6);
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 8px;
    border-radius: 4px;
}

/* ===== ADMIN TOAST ===== */
#admin-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1e8449;
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

#admin-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

#admin-toast.error {
    background: #922b21;
}

#gesture-guide-panel.ar-active {
    display: block;
    opacity: 1;
}

/* ==================================================== */
/* UX OPTIMIZATIONS (FIRST-TIME UX)                     */
/* ==================================================== */

/* ===== MAIN UI STAGGERED FADE-IN & GLOW BUTTON ===== */
#main-ui {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: block;
    background: radial-gradient(circle at bottom, rgba(31, 27, 36, 0.4) 0%, transparent 60%);
}

#ui-layer {
    position: absolute;
    bottom: 8vh;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    width: 100%;
    pointer-events: auto;
    margin: 0;
    padding: 0;
}

#ui-layer h1 {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    color: #c9a464;
    font-size: 28px;
    margin: 0 auto 10px auto;
    display: block;
    opacity: 0;
    animation: fadeUpIn 1s cubic-bezier(0.2, 1, 0.3, 1) forwards 0.2s;
    text-align: center;
}

p#tagline-hand {
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    display: block;
    opacity: 0;
    animation: fadeUpIn 1s cubic-bezier(0.2, 1, 0.3, 1) forwards 0.4s;
}

#main-start-btn {
    margin: 30px auto 0 auto;
    display: inline-flex !important;
    justify-content: center;
    align-items: center;
    opacity: 0;
    background: linear-gradient(135deg, #e0bfb8 0%, #c9a464 100%);
    color: #3a2008;
    border: none;
    padding: 14px 30px;
    border-radius: 30px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    box-shadow: 0 10px 25px rgba(201, 164, 100, 0.3);
    position: relative;
    overflow: hidden;
    animation: fadeUpIn 1s cubic-bezier(0.2, 1, 0.3, 1) forwards 0.6s, floatGlow 3s ease-in-out infinite alternate;
}

#main-start-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: rotate(45deg) translateX(-100%);
    animation: shimmerSweep 3s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeUpIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== AMBIENT PETALS ===== */
#ambient-petals {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10;
    overflow: hidden;
}

.petal {
    position: absolute;
    bottom: -20px;
    width: 6px;
    height: 6px;
    border-radius: 50% 0 50% 50%;
    background: rgba(224, 191, 184, 0.4);
    box-shadow: 0 0 10px rgba(224, 191, 184, 0.2);
    animation: floatUp 8s linear forwards;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) rotate(0deg) scale(0.8);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(-120vh) rotate(360deg) scale(1.2);
        opacity: 0;
    }
}

/* ===== WELCOME MODAL ===== */
#welcome-modal {
    position: fixed;
    inset: 0;
    background: rgba(10, 5, 10, 0.85);
    backdrop-filter: blur(8px);
    z-index: 3000;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#welcome-modal.show {
    display: flex;
    opacity: 1;
}

#welcome-card {
    background: radial-gradient(circle at top right, #2a2228, #1f1b24);
    border: 1px solid rgba(224, 191, 184, 0.2);
    border-radius: 24px;
    padding: 36px 24px;
    width: 85%;
    max-width: 340px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: scaleUpIn 0.5s cubic-bezier(0.2, 1, 0.3, 1) forwards;
}

@keyframes scaleUpIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

#welcome-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
}

#welcome-title {
    font-family: 'Playfair Display', serif;
    color: #e0bfb8;
    font-size: 22px;
    margin-bottom: 12px;
}

#welcome-desc {
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 24px;
    line-height: 1.5;
}

#welcome-bullets {
    list-style: none;
    padding: 0;
    margin: 0 0 28px;
    text-align: left;
}

#welcome-bullets li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 12px;
}

.bullet-icon {
    font-size: 18px;
}

#welcome-start-btn {
    background: #c9a464;
    color: #3a2008;
    border: none;
    width: 100%;
    padding: 14px 0;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    font-family: 'Poppins', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

#welcome-fineprint {
    margin-top: 16px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
}

/* ===== MESSAGE CARD PARALLAX ORBS & SKIP ===== */
#card-orbs {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.card-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.15;
    animation: driftOrb 20s infinite alternate ease-in-out;
}

.orb-1 {
    width: 250px;
    height: 250px;
    background: #e0bfb8;
    top: -50px;
    left: -50px;
}

.orb-2 {
    width: 200px;
    height: 200px;
    background: #c9a464;
    bottom: 100px;
    right: -50px;
    animation-delay: -5s;
}

.orb-3 {
    width: 150px;
    height: 150px;
    background: #b4645a;
    top: 40%;
    left: 30%;
    animation-delay: -10s;
}

@keyframes driftOrb {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(30px, 40px);
    }
}

#card-skip-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 20;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    backdrop-filter: blur(4px);
}

/* ===== TUTORIAL SCAN TIPS CAROUSEL ===== */
#scan-tips-carousel {
    position: absolute;
    top: calc(50% + 200px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.65);
    padding: 0 20px;
    border-radius: 20px;
    border: 1px solid rgba(201, 164, 100, 0.3);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    height: 32px;
    overflow: hidden;
    min-width: 180px;
    justify-content: center;
    z-index: 2;
}

.scan-tip {
    font-size: 12px;
    color: #e0bfb8;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.5s ease;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    white-space: nowrap;
}

.scan-tip.active {
    opacity: 1;
    position: relative;
}

#tutorial-scan-halo {
    position: relative;
    width: 240px;
    height: 240px;
    border-radius: 16px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65), inset 0 0 20px rgba(201, 164, 100, 0.5);
    border: 2px solid rgba(201, 164, 100, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    animation: pulseHalo 2s infinite;
    z-index: 1;
}

@keyframes pulseHalo {
    0% {
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65), inset 0 0 10px rgba(201, 164, 100, 0.2);
    }

    50% {
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65), inset 0 0 30px rgba(201, 164, 100, 0.8);
    }

    100% {
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65), inset 0 0 10px rgba(201, 164, 100, 0.2);
    }
}

/* ===== MAGIC BUTTON UPGRADE ===== */
.magic-button {
    position: relative;
    overflow: hidden;
}

.magic-button::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: rotate(45deg) translateX(-100%);
    animation: shimmerSweep 3s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes shimmerSweep {
    0% {
        transform: rotate(45deg) translateX(-100%);
    }

    20% {
        transform: rotate(45deg) translateX(100%);
    }

    100% {
        transform: rotate(45deg) translateX(100%);
    }
}

/* ===== AR MASCOT POPUP ===== */
#ar-mascot-popup {
    position: fixed;
    bottom: 30px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none;
    transform: translateY(150%) scale(0.8);
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55), opacity 0.5s ease;
    opacity: 0;
}

#ar-mascot-popup.show {
    transform: translateY(0) scale(1);
    opacity: 1;
}

#ar-mascot-speech {
    background: white;
    color: #4a3b3d;
    padding: 10px 18px;
    border-radius: 20px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    margin-bottom: 12px;
    position: relative;
    animation: floatSpeech 2.5s ease-in-out infinite;
}

#ar-mascot-speech::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 40px;
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: white transparent transparent transparent;
}

#ar-mascot-popup img {
    width: 110px;
    height: auto;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.25));
    animation: mascotWobble 3.5s ease-in-out infinite;
}

@keyframes floatSpeech {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

@keyframes mascotWobble {

    0%,
    100% {
        transform: rotate(-3deg);
    }

    50% {
        transform: rotate(3deg);
    }
}

/* ===== BRANDING MASCOT STYLES ===== */
#loading-mascot {
    width: 120px;
    height: auto;
    filter: drop-shadow(0 0 20px rgba(226, 180, 189, 0.4));
    animation: mascotBounce 2s ease-in-out infinite;
}

.loading-mascot-speech {
    background: rgba(255, 255, 255, 0.95);
    color: #4a3b3d;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: fadeInOut 2s infinite alternate;
}

.loading-mascot-speech::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 6px 6px 6px;
    border-style: solid;
    border-color: transparent transparent rgba(255, 255, 255, 0.95) transparent;
}

@keyframes mascotBounce {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-10px) scale(1.05);
    }
}

.tutorial-mascot-container {
    position: absolute;
    bottom: calc(50% + 150px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0;
    width: max-content;
}

.tutorial-mascot {
    width: 130px;
    height: auto;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.3));
    animation: mascotBounce 3s ease-in-out infinite;
}

.tutorial-mascot-speech {
    background: white;
    color: #4a3b3d;
    padding: 12px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: floatSpeech 3s ease-in-out infinite;
    text-align: center;
}

.tutorial-mascot-speech::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: white transparent transparent transparent;
}

/* ===== FIX BRANDING MASCOT LAYOUT ===== */
.loading-mascot-speech::before {
    top: 50% !important;
    left: -8px !important;
    transform: translateY(-50%) !important;
    border-width: 8px 10px 8px 0 !important;
    border-color: transparent rgba(255, 255, 255, 0.95) transparent transparent !important;
}

/* ===== ENVELOPE HINT ANIMATIONS ===== */
@keyframes pulseHint {

    0%,
    100% {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    }

    50% {
        box-shadow: 0 4px 25px rgba(255, 255, 255, 0.4);
    }
}

@keyframes bounceUp {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }
}

/* ===== FIX WAX SEAL PULSE ===== */
@keyframes pulse-glow {
    0% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7), inset 0 0 10px rgba(80, 10, 10, 0.8);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.08);
        box-shadow: 0 0 20px 8px rgba(255, 215, 0, 0.5), inset 0 0 15px rgba(80, 10, 10, 0.9);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 30px 0 rgba(255, 215, 0, 0), inset 0 0 10px rgba(80, 10, 10, 0.8);
    }
}

/* ===== HIDE DEFAULT MINDAR UI FORCE ===== */
.mindar-ui-overlay, .mindar-ui-loading, .mindar-ui-scanning { 
    display: none !important; 
    opacity: 0 !important; 
    pointer-events: none !important; 
    z-index: -9999 !important; 
}

