body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #111; /* 다크 그레이 배경 */
    color: white;
    font-family: 'Helvetica Neue', Arial, sans-serif;
}

#webgl-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* 3D 캔버스를 배경으로 */
}

#ui-layer {
    position: absolute;
    top: 50px;
    left: 50px;
    z-index: 10;
    pointer-events: none;
}

h1 {
    font-weight: 300;
    letter-spacing: 2px;
    margin: 0 0 10px 0;
}

p {
    color: #888;
    font-weight: 300;
}

.webcam-preview {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 240px;
    height: 180px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    overflow: hidden;
    z-index: 100;
}

#webcam-video, #webcam-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1); /* 거울 모드 */
    object-fit: cover;
}

/* Swipe Prompt */
#swipe-prompt {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    font-weight: 300;
    letter-spacing: 3px;
    text-transform: uppercase;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

#swipe-prompt.visible {
    opacity: 1;
}

.swipe-arrow {
    display: inline-block;
    animation: swipeArrowBounce 1.5s ease-in-out infinite;
    font-size: 20px;
}

@keyframes swipeArrowBounce {
    0%, 100% { transform: translateX(0); opacity: 0.6; }
    50% { transform: translateX(10px); opacity: 1; }
}

/* Restart Button */
#restart-btn {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    z-index: 50;
    color: rgba(255, 255, 255, 0.9);
    font-size: 28px;
    font-weight: 400;
    letter-spacing: 3px;
    text-transform: uppercase;
    padding: 24px 64px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 60px;
    cursor: pointer;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease, background 0.2s ease, border-color 0.2s ease;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.05);
}

#restart-btn.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) scale(1);
}

#restart-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Intro Overlay */
#intro-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 200;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 50px;
    transition: opacity 0.8s ease;
}

#intro-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.intro-icons {
    display: flex;
    align-items: center;
    gap: 36px;
}

.intro-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.intro-icon-box {
    width: 160px;
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.intro-icon {
    width: 170px;
    height: 135px;
}

.intro-step-label {
    font-size: 14px;
    color: #999;
    font-weight: 300;
    letter-spacing: 1px;
    text-align: center;
    margin: 0;
}

.intro-step-divider {
    font-size: 28px;
    color: rgba(255, 255, 255, 0.25);
    font-weight: 200;
    margin-bottom: 36px;
}

/* Icon 1: hand detect pulse */
.hand-detect {
    animation: handPulse 2s ease-in-out infinite;
    transform-origin: 72px 58px;
}
@keyframes handPulse {
    0%, 100% { opacity: 0.6; transform: scale(0.95); }
    50%      { opacity: 1;   transform: scale(1.05); }
}

.scan-corners {
    animation: scanPulse 2s ease-in-out infinite;
}
@keyframes scanPulse {
    0%, 100% { opacity: 0.5; }
    50%      { opacity: 1; }
}

.rec-dot {
    animation: recBlink 1.2s ease-in-out infinite;
}
@keyframes recBlink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.2; }
}

/* Icon 2: hand swipe */
.hand-swipe {
    animation: handSwipeMove 2s ease-in-out infinite;
}
@keyframes handSwipeMove {
    0%   { transform: translate(42px, 66px); opacity: 0.5; }
    50%  { transform: translate(88px, 62px); opacity: 1; }
    100% { transform: translate(42px, 66px); opacity: 0.5; }
}

#intro-start-btn {
    color: #fff;
    font-size: 18px;
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 16px 48px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
    backdrop-filter: blur(6px);
}

#intro-start-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.7);
    transform: scale(1.03);
}