/* ===== 전역 스타일 ===== */
:root {
    /* 따뜻하고 연한 파스텔 톤 */
    --primary-color: #e6b8a2;
    --primary-dark: #d4a373;
    --secondary-color: #faedcd;
    --accent-color: #ccd5ae;
    --bg-color: #feffae;
    --bg-overlay: #fdfbf7;
    --bg-gradient: linear-gradient(135deg, #fdfbf7 0%, #fff0e6 100%);
    --text-color: #5e503f;
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-bg-dark: rgba(45, 40, 35, 0.95);
    --font-main: 'Pretendard', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-soft: 0 4px 20px rgba(94, 80, 63, 0.15);
    --shadow-strong: 0 10px 40px rgba(94, 80, 63, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 모든 UI 요소 드래그 방지 (검은 네모상자 방지) */
* {
    -webkit-user-drag: none !important;
    -webkit-tap-highlight-color: transparent;
}
button, .control-btn, .nav-btn, .nav-center,
#controls, #nav-controls, #room-info,
svg, img, a-scene {
    user-select: none;
}
button, .control-btn, .nav-btn {
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}
button img, button svg, .nav-btn svg, .nav-btn * {
    pointer-events: none;
    -webkit-user-drag: none !important;
}

body {
    font-family: var(--font-main);
    overflow: hidden;
    background: linear-gradient(135deg, #fdfbf7 0%, #fff0e6 100%);
    color: var(--text-color);
}

/* 제목의 이모티콘이 드래그 시 색상이 사라지지 않도록 */
h1,
h2 {
    user-select: none;
    -webkit-user-select: none;
}

/* ===== 설정 화면 (Setup UI) ===== */
#setup-ui {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #fdfbf7 0%, #fff0e6 50%, #fae8dc 100%);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s var(--transition-smooth), transform 0.8s var(--transition-smooth);
}

#setup-ui.fade-out {
    opacity: 0;
    transform: scale(1.05);
    pointer-events: none;
}

.setup-container {
    background: rgba(255, 255, 255, 0.98);
    width: 95%;
    max-width: 1400px;
    max-height: 90vh;
    border-radius: 24px;
    box-shadow: var(--shadow-strong), 0 0 100px rgba(102, 126, 234, 0.3);
    padding: 50px;
    padding-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 35px;
    overflow-y: auto;
    backdrop-filter: blur(20px);
}

.setup-container .cta-button {
    flex-shrink: 0;
}

.setup-container::-webkit-scrollbar {
    width: 8px;
}

.setup-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.setup-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
    border-radius: 4px;
}

.setup-container header {
    text-align: center;
    margin-bottom: 10px;
}

.setup-container h1 {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #d4a373, #9c6644);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    letter-spacing: -1px;
}

.setup-container header p {
    font-size: 1.1rem;
    color: #666;
}

.setup-section h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, var(--primary-color), transparent) 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.setup-section h2::before {
    content: '';
    width: 4px;
    height: 24px;
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

/* 테마 선택 그리드 */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 10px;
}

.theme-card {
    background: white;
    border: 2px solid #eee;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s var(--transition-smooth);
    display: flex;
    flex-direction: column;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.theme-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, transparent);
    transition: background 0.3s;
    z-index: 2;
}

.theme-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.theme-card:hover::before {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.theme-card.selected {
    border-color: var(--primary-color);
    box-shadow: 0 8px 25px rgba(74, 144, 217, 0.2);
}

.theme-card.selected::before {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

/* 체크마크 제거됨 - 사용자 요청 */
.theme-card.selected::after {
    display: none;
}

/* 테마 썸네일 이미지 영역 */
.theme-thumbnail {
    width: 100%;
    height: 140px;
    background-size: cover;
    background-position: center;
    border-radius: 14px 14px 0 0;
    position: relative;
    image-rendering: -webkit-optimize-contrast;
}

.theme-thumbnail::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30%;
    background: linear-gradient(to top, rgba(0,0,0,0.25), transparent);
    border-radius: 0;
    pointer-events: none;
}

/* 테마 이름 - 썸네일 하단에 분리 배치 */
.theme-name {
    padding: 14px 16px;
    background: white;
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    text-align: center;
    border-radius: 0 0 14px 14px;
    border-top: 1px solid #f0f0f0;
}

.theme-card.selected .theme-name {
    background: linear-gradient(135deg, #f0f7ff, #e8f4fd);
    color: var(--primary-color);
}

.theme-preview {
    width: 100%;
    height: 90px;
    border-radius: 12px;
    margin-bottom: 15px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 0, 0, 0.08);
    overflow: hidden;
    background-size: cover;
    background-position: center;
}

.theme-preview .color-dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.theme-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 6px;
}

.theme-card p {
    font-size: 0.85rem;
    color: #888;
    line-height: 1.4;
}

/* 파일 업로드 그리드 */
.upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
}

.upload-card {
    border: 2px dashed #ddd;
    border-radius: 16px;
    height: 130px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s var(--transition-smooth);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fafafa, #f5f5f5);
}

.upload-card:hover {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #fff, #f8faff);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.upload-card label {
    cursor: pointer;
    text-align: center;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 0.95rem;
    font-weight: 500;
    gap: 8px;
}

.upload-card .icon {
    font-size: 2rem;
    transition: transform 0.3s;
}

.upload-card:hover .icon {
    transform: scale(1.2);
}

.upload-card input[type="file"] {
    display: none;
}

.file-preview {
    position: absolute;
    bottom: 8px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 0.8rem;
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.95);
    padding: 4px 8px;
    opacity: 0;
    transition: opacity 0.3s;
    font-weight: 600;
}

.file-preview.active {
    opacity: 1;
}

/* 시작 버튼 */
.cta-button {
    display: block;
    width: auto;
    max-width: 360px;
    margin: auto auto 0 auto;
    padding: 18px 48px;
    font-size: 1.15rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #d4a373, #e6b8a2);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s var(--transition-smooth);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.cta-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(212, 163, 115, 0.4);
}

.cta-button:hover::before {
    left: 100%;
}

.cta-button:active {
    transform: translateY(-1px);
}

/* ===== UI 패널 공통 ===== */
.ui-panel {
    position: fixed;
    z-index: 100;
    pointer-events: auto;
}

/* ===== 미니맵 (시선 방향 표시 + 구역 표시) ===== */
#minimap {
    top: 24px;
    right: 24px;
    width: 200px;
    height: 200px;
    background: rgba(30, 30, 35, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    padding: 0;
    transition: all 0.4s var(--transition-smooth);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

#minimap::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.5;
    pointer-events: none;
}

#minimap.hidden {
    transform: scale(0.8) translateY(-20px);
    opacity: 0;
    pointer-events: none;
}

/* 현재 위치 마커 */
#map-marker {
    position: absolute;
    width: 16px;
    height: 16px;
    transform: translate(-50%, -50%);
    z-index: 20;
    pointer-events: none;
}

#map-marker::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    background: #FF5A5F;
    border: 2px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px rgba(255, 90, 95, 0.6);
    z-index: 2;
}

/* 시선 방향 콘 (부채꼴) - 뾰족한 끝이 사용자(중심)에 위치 */
.view-cone {
    position: absolute;
    bottom: 50%;
    /* 마커의 중심(50%)에서 시작 */
    left: 50%;
    width: 0;
    height: 0;
    /* 위로 넓어지는 부채꼴: border-top이 넓은 부분 */
    border-left: 30px solid transparent;
    border-right: 30px solid transparent;
    border-top: 60px solid rgba(255, 255, 255, 0.25);
    /* 아래쪽 꼭지점(bottom)을 회전축으로 설정 */
    transform-origin: center bottom;
    /* 왼쪽으로 50% 이동하여 중앙 정렬 후 회전은 JS에서 적용 */
    transform: translateX(-50%);
    z-index: 1;
    filter: blur(1px);
    border-radius: 50%;
    /* 부드러운 가장자리 */
}

/* 웨이포인트 컨테이너 */
#map-waypoints {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

/* 방 (네모 박스 형태 유지하되 더 예쁘게) */
.map-waypoint {
    position: absolute;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 활성화된 방 */
.map-waypoint.active {
    background: rgba(255, 255, 255, 0.9);
    border-color: white;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    z-index: 15;
    width: 36px;
    height: 36px;
}

.map-waypoint:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%) scale(1.1);
}

.map-waypoint .waypoint-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.map-waypoint.active .waypoint-label {
    color: #333;
    text-shadow: none;
}

/* 방 연결(문) 표시 - 좀 더 은은하게 */
.map-waypoint[data-openings*="north"] {
    border-top-color: rgba(255, 255, 255, 0.05);
}

.map-waypoint[data-openings*="south"] {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

.map-waypoint[data-openings*="east"] {
    border-right-color: rgba(255, 255, 255, 0.05);
}

.map-waypoint[data-openings*="west"] {
    border-left-color: rgba(255, 255, 255, 0.05);
}

/* ===== 컨트롤 버튼 (레퍼런스 스타일: 우측 세로 배치) ===== */
#controls {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 10px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 30px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.12);
    z-index: 5005;
}

.control-btn {
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    color: #555555;
}

.control-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    transform: scale(1.1);
    color: #333333;
}

.control-btn svg {
    width: 22px;
    height: 22px;
}

.control-btn .icon {
    font-size: 20px;
}

.control-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.control-btn.active svg {
    stroke: white;
}

.control-btn.playing {
    animation: pulse-glow 2s infinite;
    color: var(--primary-color);
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 5px rgba(74, 144, 217, 0.3); }
    50% { box-shadow: 0 0 15px rgba(74, 144, 217, 0.6); }
}

/* BGM 볼륨 패널 */
#bgm-volume-panel {
    position: fixed;
    top: 50%;
    right: 90px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    padding: 15px 20px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 5006;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    transition: all 0.3s var(--transition-smooth);
}

#bgm-volume-panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(20px);
}

#bgm-volume {
    width: 100px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
}

#bgm-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#bgm-volume::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    cursor: pointer;
    border: none;
}

#bgm-volume-text {
    color: #555555;
    font-size: 0.85rem;
    min-width: 35px;
}

/* ===== 브랜딩/워터마크 (레퍼런스 스타일) ===== */
#gallery-branding {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    z-index: 5003;
    backdrop-filter: blur(10px);
}

.branding-logo {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

.branding-logo svg {
    stroke: currentColor;
}

.branding-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.branding-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333333;
    letter-spacing: -0.02em;
}

.branding-subtitle {
    font-size: 0.7rem;
    color: #888888;
}

/* 소셜 공유 드롭다운 */
.share-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    padding: 8px;
    min-width: 140px;
    z-index: 100;
    transition: all 0.3s var(--transition-smooth);
}

.share-dropdown.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
}

.share-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
    transition: background 0.2s;
}

.share-option:hover {
    background: rgba(0, 0, 0, 0.05);
}

.share-icon {
    font-size: 1.1rem;
}

/* 카카오톡 색상 */
.share-option[data-platform="kakao"]:hover {
    background: #FEE500;
    color: #3C1E1E;
}

/* 트위터 색상 */
.share-option[data-platform="twitter"]:hover {
    background: #1DA1F2;
    color: white;
}

/* 페이스북 색상 */
.share-option[data-platform="facebook"]:hover {
    background: #4267B2;
    color: white;
}

/* ===== 방 정보 ===== */
#room-info {
    bottom: 80px;
    left: 30px;
    background: var(--card-bg-dark);
    backdrop-filter: blur(15px);
    color: white;
    padding: 20px 28px;
    border-radius: 16px;
    max-width: 320px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-strong);
}

#room-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#room-description {
    font-size: 0.95rem;
    opacity: 0.8;
    line-height: 1.5;
}

/* 방 카운터 */
.room-counter {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    opacity: 0.7;
    margin-bottom: 8px;
}

#room-current {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.room-divider {
    opacity: 0.5;
}

/* 진행 도트 인디케이터 */
.room-progress-dots {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.room-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s var(--transition-smooth);
    cursor: pointer;
}

.room-dot:hover {
    background: rgba(255, 255, 255, 0.6);
    transform: scale(1.2);
}

.room-dot.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    box-shadow: 0 0 8px var(--primary-color);
    width: 20px;
    border-radius: 4px;
}

.room-dot.visited {
    background: rgba(255, 255, 255, 0.6);
}

/* ===== 전시물 모달 ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 6000;
    opacity: 1;
    transition: opacity 0.3s var(--transition-smooth);
    backdrop-filter: blur(10px);
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal.opening .modal-content {
    animation: modalOpen 0.4s var(--transition-smooth);
}

.modal.closing .modal-content {
    animation: modalClose 0.3s var(--transition-smooth);
}

@keyframes modalOpen {
    from {
        transform: scale(0.85) translateY(30px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes modalClose {
    from {
        transform: scale(1) translateY(0);
        opacity: 1;
    }

    to {
        transform: scale(0.85) translateY(30px);
        opacity: 0;
    }
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 20px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

#modal-media {
    max-width: 850px;
    max-height: 65vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

#modal-media img,
#modal-media video {
    max-width: 100%;
    max-height: 65vh;
    object-fit: contain;
}

/* 줌 기능 */
#modal-media img {
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

#modal-media img.zoomed {
    cursor: grab;
    max-width: none;
    max-height: none;
}

#modal-media img.zoomed:active {
    cursor: grabbing;
}

.modal-zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.zoom-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.zoom-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.zoom-level {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    display: flex;
    align-items: center;
}

#modal-info {
    padding: 28px 32px;
    color: white;
}

#modal-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#modal-description {
    font-size: 1.1rem;
    opacity: 0.8;
    max-width: 800px;
}

#modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: rgba(255, 71, 87, 0.9);
    color: white;
    font-size: 20px;
    line-height: 36px;
    text-align: center;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s, transform 0.2s;
}

#modal-close:hover {
    background: rgba(255, 71, 87, 1);
    transform: scale(1.15);
}

/* ===== 로딩 화면 ===== */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e, #0a0a14);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: opacity 0.6s var(--transition-smooth);
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary-color);
    border-right-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#loading-screen p {
    color: white;
    margin-top: 24px;
    font-size: 1.15rem;
    opacity: 0.8;
    font-weight: 500;
}

/* 로딩 프로그레스 바 */
.loading-progress-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    width: 280px;
}

.loading-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    overflow: hidden;
}

.loading-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 3px;
    transition: width 0.3s ease-out;
}

.loading-percent {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    font-weight: 600;
    min-width: 40px;
    text-align: right;
}

/* ===== 관람 가이드 오버레이 ===== */
#instruction-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    z-index: 6000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s var(--transition-smooth);
}

#instruction-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#instruction-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.instruction-container {
    background: white;
    padding: 50px;
    border-radius: 24px;
    text-align: center;
    max-width: 950px;
    width: 90%;
    color: #333;
    animation: modalOpen 0.5s var(--transition-smooth);
    box-shadow: var(--shadow-strong);
}

.instruction-container h2 {
    font-size: 2.2rem;
    margin-bottom: 35px;
    font-weight: 800;
    background: linear-gradient(135deg, #d4a373, #9c6644);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.instruction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.instruction-card {
    background: linear-gradient(135deg, #f8f9fa, #fff);
    padding: 30px;
    border-radius: 18px;
    border: 1px solid #eee;
    transition: all 0.3s var(--transition-smooth);
}

.instruction-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.instruction-card .icon-circle {
    width: 80px;
    height: 80px;
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color, #764ba2));
    border-radius: 50%;
    color: white;
}

.instruction-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: #333;
}

.instruction-card p {
    font-size: 0.95rem;
    color: #666;
    line-height: 1.6;
}

#btn-enter-scene {
    background: linear-gradient(135deg, #d4a373, #e6b8a2);
    width: auto;
    padding: 18px 60px;
    margin: 0 auto;
    font-size: 1.15rem;
}

/* ===== 반응형 ===== */

/* --- 태블릿 (max-width: 1024px) --- */
@media (max-width: 1024px) {
    .setup-container {
        padding: 35px;
        width: 92%;
    }

    .theme-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .modal-zoom-controls {
        bottom: 12px;
        right: 12px;
    }

    /* 테마 카드 이름 줄바꿈 방지 */
    .theme-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.9rem;
    }

    /* 레이아웃/배치 카드 제목 줄바꿈 방지 */
    .layout-card h3,
    .arrangement-card h3 {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.85rem;
    }

    /* 레이아웃/배치 카드 설명 텍스트 2줄 제한 */
    .layout-card p,
    .arrangement-card p {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: 0.75rem;
        word-break: keep-all;
    }

    /* 푸터 모바일 대응 - 세로 배치 */
    .dawith-footer-content {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }

    .dawith-footer-info {
        text-align: center;
        flex-basis: 100%;
    }

    #kakao-adfit-container {
        min-width: auto;
        max-width: 100%;
        overflow: hidden;
    }

    .dawith-ai-button-wrapper {
        justify-content: center;
        flex-basis: 100%;
    }

    /* 모달 모바일 대응 */
    .modal-content {
        width: 95vw;
        max-width: 95vw;
    }

    #modal-info {
        padding: 20px 24px;
    }

    #modal-title {
        font-size: 1.5rem;
    }

    #modal-description {
        font-size: 1rem;
    }
}

/* --- 모바일 (max-width: 768px) --- */
@media (max-width: 768px) {
    /* 전체 오버플로우 방지 */
    #setup-ui {
        overflow-x: hidden;
    }

    #minimap {
        width: 120px;
        height: 120px;
        top: 10px;
        right: 10px;
        padding: 8px;
    }

    .view-cone {
        border-left: 12px solid transparent;
        border-right: 12px solid transparent;
        border-top: 25px solid rgba(74, 144, 217, 0.4);
        border-bottom: none;
    }

    /* 컨트롤 버튼 - 미니맵 아래로 이동, 충돌 방지 */
    #controls {
        right: 10px;
        top: 140px;
        flex-direction: column;
        padding: 8px 6px;
        border-radius: 24px;
    }

    .control-btn {
        width: 44px;
        height: 44px;
    }

    #room-info {
        bottom: 65px;
        left: 15px;
        right: 15px;
        max-width: none;
        padding: 15px 20px;
    }

    /* 방 제목 줄바꿈 방지 */
    #room-title {
        font-size: 1.1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #room-description {
        font-size: 0.85rem;
        word-break: keep-all;
    }

    .setup-container {
        padding: 25px;
        width: 95%;
        gap: 25px;
        max-width: 100vw;
    }

    .setup-container h1 {
        font-size: 2rem;
        word-break: keep-all;
    }

    /* 섹션 제목 줄바꿈 방지 */
    .setup-section h2 {
        font-size: 1.1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .theme-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .theme-card {
        padding: 0;
    }

    /* 테마 썸네일 높이 축소 */
    .theme-thumbnail {
        height: 100px;
    }

    /* 테마 이름 크기 조정 + 줄바꿈 방지 */
    .theme-name {
        font-size: 0.85rem;
        padding: 10px 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .theme-preview {
        height: 70px;
    }

    /* 레이아웃 그리드 2열 */
    .layout-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .layout-card {
        padding: 14px !important;
    }

    .layout-card h3 {
        font-size: 0.85rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .layout-card p {
        font-size: 0.72rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        word-break: keep-all;
    }

    /* 배치 그리드 2열 */
    .arrangement-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .arrangement-card {
        padding: 14px;
    }

    .arrangement-card h3 {
        font-size: 0.85rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .arrangement-card p {
        font-size: 0.72rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        word-break: keep-all;
    }

    /* 업로드 그리드 1열 */
    .upload-drop-grid {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    /* 드롭존 높이 축소 */
    .drop-zone {
        min-height: 220px;
    }

    .instruction-container {
        padding: 30px 20px;
    }

    .instruction-container h2 {
        font-size: 1.6rem;
    }

    .instruction-grid {
        gap: 15px;
    }

    .instruction-card {
        padding: 20px;
    }

    .instruction-card h3 {
        font-size: 1.1rem;
        white-space: nowrap;
    }

    .instruction-card p {
        font-size: 0.88rem;
        word-break: keep-all;
    }

    /* 모달 정보 영역 */
    #modal-info {
        padding: 18px 20px;
    }

    #modal-title {
        font-size: 1.3rem;
        word-break: keep-all;
    }

    #modal-description {
        font-size: 0.95rem;
        word-break: keep-all;
    }

    /* 모달 닫기 버튼 충분한 터치 영역 */
    #modal-close {
        width: 44px;
        height: 44px;
        font-size: 22px;
        line-height: 44px;
    }

    /* 줌 버튼 터치 영역 확보 */
    .zoom-btn {
        width: 44px;
        height: 44px;
    }

    /* 푸터 완전 세로 배치 */
    .dawith-footer {
        padding: 1.5rem 0;
        margin-top: 2rem;
    }

    .dawith-footer-container {
        padding: 0 1rem;
    }

    .dawith-footer-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1rem;
        flex-wrap: wrap;
    }

    .dawith-footer-info {
        text-align: center;
    }

    .dawith-footer-info .title {
        font-size: 0.7rem;
        word-break: keep-all;
    }

    #kakao-adfit-container {
        min-width: auto;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        justify-content: center;
    }

    .dawith-ai-button-wrapper {
        justify-content: center;
    }

    /* 네비게이션 버튼 크기 조정 */
    .nav-btn {
        width: 50px;
        height: 50px;
    }

    .nav-center {
        width: 42px;
        height: 42px;
        font-size: 18px;
    }

    /* 상단 좌측 컨트롤 터치 영역 확보 */
    #top-left-controls .control-btn {
        width: 44px !important;
        height: 44px !important;
    }

    /* BGM 볼륨 패널 위치 조정 */
    #bgm-volume-panel {
        right: 70px;
        top: auto;
        bottom: 20px;
        transform: none;
    }

    /* 갤러리 브랜딩 간소화 */
    #gallery-branding {
        padding: 8px 12px;
        bottom: 12px;
        left: 12px;
    }

    .branding-title {
        font-size: 0.75rem;
    }

    .branding-subtitle {
        font-size: 0.6rem;
    }
}

/* ===== 네비게이션 컨트롤 (화면 하단 방향 버튼) ===== */
#nav-controls {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

#nav-controls.hidden {
    display: none;
}

.nav-btn {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s var(--transition-smooth);
    color: white;
    font-size: 24px;
}

.nav-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: transparent;
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(74, 144, 217, 0.5);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-btn svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* 가운데 위치 표시 또는 줌 버튼 */
.nav-center {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

/* 방향 라벨 */
.nav-btn-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.nav-btn-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== A-Frame 커스텀 스타일 ===== */
a-scene {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

a-scene canvas,
.a-canvas {
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
}

/* 커서 스타일 */
[cursor] {
    cursor: pointer;
}

/* 클릭 가능한 요소 호버 */
.clickable:hover {
    cursor: pointer;
}

/* ===== 암실 (Dark Room) 모드 ===== */
body.dark-room-mode {
    --room-overlay-color: rgba(0, 0, 0, 0.3);
}

body.dark-room-mode #room-info {
    background: rgba(10, 10, 15, 0.95);
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark-room-mode #room-title {
    background: linear-gradient(135deg, #ffba08, #f48c06);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.dark-room-mode #minimap {
    background: rgba(10, 10, 15, 0.85);
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark-room-mode .control-btn {
    background: rgba(10, 10, 15, 0.9);
    border-color: rgba(255, 255, 255, 0.08);
}

/* 암실 입장 시 부드러운 전환 애니메이션 */
body.dark-room-mode::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.06) 100%);
    pointer-events: none;
    z-index: 50;
    animation: dark-room-vignette 1s ease-out;
}

@keyframes dark-room-vignette {
    from {
        opacity: 0;
        background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.15) 100%);
    }
    to {
        opacity: 1;
        background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.06) 100%);
    }
}

/* ===== 모바일 최적화 (small phones) ===== */
@media (max-width: 480px) {
    /* 전체 오버플로우 방지 */
    body {
        overflow-x: hidden;
    }

    #setup-ui {
        overflow-x: hidden;
        align-items: flex-start;
        padding-top: 8px;
    }

    .setup-container {
        padding: 16px;
        width: 98%;
        gap: 16px;
        border-radius: 16px !important;
        max-width: 100vw;
        box-sizing: border-box;
    }

    /* 메인 타이틀 */
    .setup-container h1 {
        font-size: 1.4rem;
        word-break: keep-all;
        letter-spacing: -0.5px;
    }

    .setup-container header p {
        font-size: 0.82rem;
        word-break: keep-all;
    }

    .setup-container p {
        font-size: 0.82rem;
    }

    /* 섹션 제목 - 줄바꿈 방지 + 축소 */
    .setup-section h2 {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }

    /* 테마 그리드 */
    .theme-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .theme-card {
        height: auto;
        border-radius: 12px;
        padding: 0;
    }

    .theme-thumbnail {
        height: 80px;
        border-radius: 10px 10px 0 0;
    }

    .theme-name {
        font-size: 0.78rem;
        padding: 8px 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 레이아웃 그리드 */
    .layout-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .layout-card {
        padding: 10px !important;
    }

    .layout-card h3 {
        font-size: 0.78rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .layout-card p {
        font-size: 0.68rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        word-break: keep-all;
    }

    .layout-preview {
        height: 55px;
        margin-bottom: 8px;
    }

    /* 배치 그리드 */
    .arrangement-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .arrangement-card {
        padding: 12px;
    }

    .arrangement-card h3 {
        font-size: 0.78rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .arrangement-card p {
        font-size: 0.68rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        word-break: keep-all;
    }

    .arrangement-preview {
        height: 55px;
        margin-bottom: 8px;
    }

    /* 업로드 그리드 */
    .upload-drop-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .drop-zone {
        min-height: 200px;
    }

    /* CTA 버튼 */
    .cta-button {
        font-size: 1rem;
        padding: 16px 24px;
        min-height: 52px;
    }

    /* 전시 정보 입력 */
    .admin-input {
        font-size: 0.88rem;
        padding: 10px 12px;
    }

    /* 미니맵 */
    #minimap {
        width: 90px;
        height: 90px;
        top: 8px;
        right: 8px;
        padding: 6px;
        border-radius: 14px;
    }

    /* 컨트롤 버튼 - 미니맵 아래에 배치, 터치 영역 확보 */
    #controls {
        right: 8px;
        top: 106px;
        gap: 4px;
        padding: 8px 6px;
        border-radius: 22px;
    }

    /* 최소 44px 터치 영역 유지 */
    .control-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    .control-btn svg {
        width: 18px;
        height: 18px;
    }

    /* 방 정보 */
    #room-info {
        bottom: 55px;
        left: 10px;
        right: 10px;
        padding: 10px 14px;
    }

    #room-info h2,
    #room-title {
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #room-info p,
    #room-description {
        font-size: 0.72rem;
        word-break: keep-all;
    }

    .room-counter {
        font-size: 0.75rem;
        margin-bottom: 4px;
    }

    #room-current {
        font-size: 0.95rem;
    }

    .room-progress-dots {
        margin-top: 8px;
        gap: 6px;
    }

    .room-dot {
        width: 6px;
        height: 6px;
    }

    .room-dot.active {
        width: 16px;
    }

    /* 네비게이션 컨트롤 */
    #nav-controls {
        bottom: 10px;
        padding: 8px 12px;
        gap: 6px;
    }

    .nav-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    .nav-btn svg {
        width: 20px;
        height: 20px;
    }

    .nav-center {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    /* 브랜딩 숨김 */
    #gallery-branding {
        display: none;
    }

    /* 가이드 오버레이 */
    .instruction-container {
        padding: 20px 15px;
        width: 95%;
        border-radius: 18px;
    }

    .instruction-container h2 {
        font-size: 1.3rem;
        margin-bottom: 20px;
        word-break: keep-all;
    }

    .instruction-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .instruction-card {
        padding: 15px;
        flex-direction: row;
        display: flex;
        align-items: center;
        gap: 14px;
        text-align: left;
    }

    .instruction-card .icon-circle {
        width: 52px;
        height: 52px;
        min-width: 52px;
        margin: 0;
    }

    .instruction-card .icon-circle svg {
        width: 28px;
        height: 28px;
    }

    .instruction-card h3 {
        font-size: 1rem;
        margin-bottom: 4px;
        white-space: nowrap;
    }

    .instruction-card p {
        font-size: 0.82rem;
        word-break: keep-all;
    }

    /* 관람 시작 버튼 */
    #btn-enter-scene {
        padding: 14px 40px;
        font-size: 1rem;
        min-height: 50px;
    }

    /* 전시물 모달 */
    .modal-content {
        width: 98vw;
        max-width: 98vw;
        max-height: 95vh;
        border-radius: 14px;
    }

    #modal-media {
        max-height: 50vh;
    }

    #modal-media img,
    #modal-media video {
        max-height: 50vh;
    }

    #modal-info {
        padding: 14px 16px;
    }

    #modal-title {
        font-size: 1.15rem;
        word-break: keep-all;
    }

    #modal-description {
        font-size: 0.88rem;
        word-break: keep-all;
    }

    #modal-close {
        width: 44px;
        height: 44px;
        font-size: 22px;
        line-height: 44px;
        top: 10px;
        right: 10px;
    }

    .modal-zoom-controls {
        bottom: 8px;
        right: 8px;
    }

    .zoom-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    /* 상단 좌측 컨트롤 - 터치 영역 확보 */
    #top-left-controls {
        top: 8px;
        left: 8px;
    }

    #top-left-controls .control-btn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
    }

    /* BGM 볼륨 패널 */
    #bgm-volume-panel {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        top: auto;
        bottom: 80px;
    }

    /* 공유 드롭다운 */
    .share-dropdown {
        min-width: 130px;
    }

    .share-option {
        padding: 10px 12px;
        font-size: 0.85rem;
        min-height: 44px;
    }

    /* 푸터 */
    .dawith-footer {
        padding: 1rem 0;
        margin-top: 1.5rem;
    }

    .dawith-footer-container {
        padding: 0 0.75rem;
    }

    .dawith-footer-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.75rem;
    }

    .dawith-footer-info {
        text-align: center;
    }

    .dawith-footer-info .title {
        font-size: 0.65rem;
        word-break: keep-all;
    }

    .dawith-footer-info .subtitle {
        font-size: 0.65rem;
    }

    #kakao-adfit-container {
        min-width: auto;
        min-height: auto;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        flex-direction: column;
        gap: 10px;
    }

    .dawith-ai-button-wrapper {
        justify-content: center;
    }

    .dawith-ai-button {
        padding: 0.5rem 1rem;
    }

    .dawith-ai-logo {
        width: 1.75rem;
        height: 1.75rem;
    }

    .dawith-ai-text .brand-name {
        font-size: 0.8rem;
    }

    /* 로딩 화면 */
    #loading-screen p {
        font-size: 1rem;
        padding: 0 20px;
        word-break: keep-all;
        text-align: center;
    }

    .loading-progress-container {
        width: 240px;
    }
}

/* 모바일 터치 최적화 */
@media (hover: none) and (pointer: coarse) {
    .clickable {
        cursor: pointer;
    }
    /* 모든 인터랙티브 요소에 최소 44px 터치 영역 보장 */
    .nav-btn, .control-btn, .share-option, .zoom-btn, #modal-close {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        min-width: 44px;
        min-height: 44px;
    }
    .nav-btn:active:not(:disabled) {
        background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
        transform: scale(0.95);
    }
    .control-btn:active {
        transform: scale(0.9);
    }
    /* iOS safe area */
    #nav-controls {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
    #room-info {
        margin-bottom: env(safe-area-inset-bottom);
    }
    /* 설정 화면 safe area */
    .setup-container {
        padding-bottom: max(30px, calc(env(safe-area-inset-bottom) + 16px));
    }
}

/* 가로 모드 (landscape) 모바일 */
@media (max-height: 480px) and (orientation: landscape) {
    #minimap {
        width: 80px;
        height: 80px;
    }
    #room-info {
        bottom: 5px;
        padding: 8px 12px;
        max-width: 220px;
    }
    #room-title {
        font-size: 0.85rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    #room-description {
        font-size: 0.7rem;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    #nav-controls {
        bottom: 5px;
        padding: 6px 12px;
    }
    .nav-btn {
        width: 44px;
        height: 44px;
    }
    .nav-center {
        width: 34px;
        height: 34px;
    }
    #controls {
        padding: 6px;
        gap: 2px;
    }
    .control-btn {
        width: 38px;
        height: 38px;
    }
    #gallery-branding {
        display: none;
    }
    /* 모달 가로 모드 */
    .modal-content {
        max-height: 95vh;
    }
    #modal-media {
        max-height: 55vh;
    }
    #modal-info {
        padding: 12px 16px;
    }
    #modal-title {
        font-size: 1.1rem;
    }
}

/* 매우 작은 화면 (360px 이하) */
@media (max-width: 360px) {
    .setup-container {
        padding: 12px;
        gap: 14px;
    }

    .setup-container h1 {
        font-size: 1.25rem;
    }

    .setup-section h2 {
        font-size: 0.88rem;
    }

    .theme-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .theme-thumbnail {
        height: 65px;
    }

    .theme-name {
        font-size: 0.72rem;
        padding: 6px 8px;
    }

    .layout-grid,
    .arrangement-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 6px !important;
    }

    .layout-card h3,
    .arrangement-card h3 {
        font-size: 0.72rem;
    }

    .layout-card p,
    .arrangement-card p {
        font-size: 0.62rem;
    }

    .cta-button {
        font-size: 0.92rem;
        padding: 14px 18px;
    }

    .admin-input {
        font-size: 0.82rem;
        padding: 8px 10px;
    }

    .instruction-container h2 {
        font-size: 1.15rem;
    }

    .instruction-card h3 {
        font-size: 0.92rem;
    }

    .instruction-card p {
        font-size: 0.78rem;
    }
}

/* ===== Dawith Standard Footer ===== */
.dawith-footer {
    border-top: 1px solid #e2e8f0;
    background-color: rgba(241, 245, 249, 0.2);
    padding: 2.5rem 0;
    margin-top: 4rem;
    width: 100%;
    /* setup-container 내에서 하단에 배치되도록 설정 */
    position: relative;
    z-index: 10;
}

.dawith-footer-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* 좌측 텍스트 / 우측 Dawith AI 배지. 모바일에선 세로. */
.dawith-footer-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.dawith-footer-info {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-align: left;
    min-width: 0;
    overflow-wrap: anywhere;
}

#kakao-adfit-container {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 250px;
    min-width: 250px;
}

.dawith-ai-button-wrapper {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-width: 0;
}

.dawith-footer-info .title {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(15, 23, 42, 0.7);
    margin: 0;
    line-height: 1.4;
}

.dawith-footer-info .subtitle {
    font-size: 0.75rem;
    color: #64748b;
    margin: 0;
}

.dawith-ai-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
    text-decoration: none;
    flex-shrink: 0;
}

.dawith-ai-button:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: scale(1.02);
}

.dawith-ai-logo {
    width: 2.25rem;
    height: 2.25rem;
    object-fit: cover;
    border-radius: 50%;
}

.dawith-ai-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.dawith-ai-text .created-by {
    font-size: 9px;
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
    margin-bottom: 0.125rem;
}

.dawith-ai-text .brand-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: #0f172a;
}