/* ========================= */
html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #000000;
    color: #1a2035;
}
#cesiumContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}
/* ========================= */
#uiContainer {
    position: fixed;
    top: 0;
    right: 0;
    width: 360px;
    height: 100%;
    background: #ffffff;
    border-left: 1px solid #e0e4ef;
    padding: 20px 16px 60px 16px;
    box-sizing: border-box;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    transition: transform 0.3s;
    overflow-y: scroll;
    overflow-x: hidden;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}
#uiContainer.hidden {
    transform: translateX(calc(100% - 8px));
    opacity: 1;
}

/* ========================= */
/* 토글 버튼 — ui.js 인라인 스타일 override */
#toggleBtn {
    position: fixed !important;
    top: 50% !important;
    right: 360px !important;
    transform: translateY(-50%) !important;
    z-index: 1000 !important;
    cursor: pointer !important;
    background: linear-gradient(180deg, #3d7eff 0%, #00d4ff 100%) !important;
    color: #ffffff !important;
    width: 3px !important;
    height: 20vh !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 3px 0 0 3px !important;
    font-size: 0px !important;
    border: none !important;
    box-shadow: -2px 0 8px rgba(61,127,255,0.3) !important;
    opacity: 0.6 !important;
    transition: all 0.2s !important;
}
#toggleBtn:hover {
    width: 5px !important;
    opacity: 0.9 !important;
}

/* ========================= */
.header-title {
    font-weight: 700;
    font-size: 13px;
    text-align: center;
    padding: 12px 8px;
    margin-bottom: 14px;
    color: #3d7eff;
    background: #f0f4ff;
    border: 1px solid #d0d8ff;
    border-radius: 8px;
    letter-spacing: 0.08em;
}
/* ========================= */
.header-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.search-box {
    display: flex;
    width: 100%;
}
.search-box input {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid #e0e4ef;
    border-right: none;
    border-radius: 6px 0 0 6px;
    font-size: 13px;
    background: #ffffff;
    color: #1a2035;
    outline: none;
}
.search-box input::placeholder { color: #8892a4; }
.search-box input:focus { border-color: #3d7eff; }
.search-box button {
    padding: 7px 11px;
    border: 1px solid #1e2840;
    border-radius: 0 6px 6px 0;
    background: #3d7eff;
    color: #fff;
    cursor: pointer;
    font-size: 13px;
}
.search-box button:hover { background: #2a6ae0; }

/* ========================= */
/* 로그인/로그아웃 — 버튼 없애고 텍스트만 */
.auth {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
}
.auth span {
    font-size: 11px;
    cursor: pointer;
    transition: opacity 0.2s;
    letter-spacing: 0.01em;
}
#loginBtn {
    background: none !important;
    border: none !important;
    color: #3d7eff !important;
    padding: 0 !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    text-decoration: underline !important;
    cursor: pointer !important;
}
#loginBtn:hover { opacity: 0.7; }

#signupBtn {
    background: none !important;
    border: none !important;
    color: #3d7eff !important;
    padding: 0 !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    text-decoration: underline !important;
    cursor: pointer !important;
}
#signupBtn:hover { opacity: 0.7; }

#logoutBtn {
    background: none !important;
    border: none !important;
    color: #ff6b6b !important;
    padding: 0 !important;
    font-size: 11px !important;
    font-weight: 400 !important;
    text-decoration: none !important;
    cursor: pointer !important;
}
#logoutBtn:hover { opacity: 0.7; }

#mypageBtn {
    background: none !important;
    border: none !important;
    color: #1a2035 !important;
    padding: 0 !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
}
#mypageBtn:hover { opacity: 0.7; }

.auth-avatar {
    width: 22px; height: 22px;
    border-radius: 50%;
    object-fit: cover;
}
.auth-initial {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: #3d7eff;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}

/* ========================= */
.form-box {
    margin-top: 4px;
    margin-bottom: 16px;
    padding: 16px 14px;
    background: #f8f9ff;
    border: 1px solid #e0e4ef;
    border-left: 3px solid #3d7eff;
    border-radius: 8px;
    max-height: 80vh;
    overflow-y: auto;
}
.form-title {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 12px;
    color: #00d4ff;
}

/* 입력칸 배경 연한 색으로 변경 */
.form-box input[type=text],
.form-box input[type=email],
.form-box input[type=password] {
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 8px;
    border: 1px solid #d0d8ff;
    border-radius: 6px;
    font-size: 13px;
    box-sizing: border-box;
    background: #f0f4ff;
    color: #1a2035;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    cursor: text;
}
.form-box input::placeholder { color: #8892a4; }
.form-box input:focus {
    border-color: #3d7eff;
    background: #ffffff;
}

.form-btns {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.btn-primary {
    flex: 1;
    padding: 8px;
    background: #3d7eff;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-primary:hover { background: #2a6ae0; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary {
    padding: 8px 14px;
    background: transparent;
    color: #8892a4;
    border: 1px solid #d0d8ff;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}
.btn-secondary:hover { background: #f0f4ff; color: #1a2035; }
.form-msg {
    font-size: 12px;
    margin-bottom: 2px;
    min-height: 16px;
}
.form-msg.error   { color: #ff6b6b; }
.form-msg.success { color: #00c896; }

/* ========================= */
.step-indicator {
    display: flex;
    align-items: center;
    margin-bottom: 14px;
}
.step {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: #e0e4ef;
    color: #6b7280;
    font-size: 12px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.step.active { background: #3d7eff; color: #fff; }
.step.done   { background: #00c896; color: #fff; }
.step-line {
    flex: 1; height: 2px;
    background: #e0e4ef;
    margin: 0 4px;
}
.step-line.active { background: #3d7eff; }
.step-label {
    font-size: 11px;
    color: #3d7eff;
    font-weight: 400;
    margin-left: 6px;
}

/* ========================= */
.avatar-section { margin-top: 10px; }
.avatar-label {
    font-size: 12px;
    color: #a0aec0;
    margin-bottom: 8px;
    font-weight: 600;
}
.required {
    font-size: 11px;
    color: #ff6b6b;
    font-weight: 400;
    margin-left: 4px;
}

/* ========================= */
.avatar-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 10px 0 12px;
}
.avatar-slot {
    width: 100%;
    aspect-ratio: 1;
    border: 2px dashed #d0d8ff;
    border-radius: 10px;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    background: #f0f4ff;
    box-sizing: border-box;
    transition: border-color 0.2s, background 0.2s;
    min-height: 70px;
}
.avatar-slot:hover {
    border-color: #3d7eff;
    background: #e6edff;
}
.avatar-slot.drag-over {
    border-color: #00d4ff;
    background: #e0f7ff;
}
.avatar-result {
    border: 2px solid #3d7eff !important;
    background: #f0f4ff !important;
}
.slot-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
.slot-plus {
    font-size: 24px;
    color: #b0b8d0;
    line-height: 1;
}
.slot-label {
    font-size: 10px;
    color: #8892a4;
    text-align: center;
    margin-top: 4px;
    line-height: 1.4;
}
.slot-req { color: #ff6b6b; }
.slot-remove {
    position: absolute;
    top: 4px; right: 4px;
    width: 18px; height: 18px;
    background: rgba(255,107,107,0.8);
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    z-index: 10;
}

/* ========================= */
#avatarCanvas {
    width: 200px !important;
    height: 200px !important;
    display: block;
    border-radius: 50%;
}

/* ========================= */
.mypage-box {
    padding: 14px !important;
    max-height: 80vh;
    overflow-y: auto;
}
.mypage-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e4ef;
}
.mypage-avatar { flex-shrink: 0; }
.mypage-avatar-img {
    width: 52px; height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #3d7eff;
}
.mypage-avatar-initial {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: #f0f4ff;
    border: 3px solid #3d7eff;
    color: #3d7eff;
    font-size: 22px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.mypage-info { flex: 1; }
.mypage-nickname {
    font-size: 16px;
    font-weight: 700;
    color: #1a2035;
}
.mypage-subtitle {
    font-size: 11px;
    color: #3d7eff;
    margin-top: 2px;
}
.mypage-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.mypage-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f8f9ff;
    border: 1px solid #e0e4ef;
    border-radius: 8px;
    cursor: pointer !important;
    transition: background 0.15s, border-color 0.15s;
}
.mypage-item:hover {
    background: #f0f4ff !important;
    border-color: #3d7eff;
}
.menu-icon {
    font-size: 20px;
    width: 32px;
    text-align: center;
    flex-shrink: 0;
}
.menu-text { flex: 1; }
.menu-title {
    font-size: 13px;
    font-weight: 600;
    color: #1a2035;
}
.menu-desc {
    font-size: 11px;
    color: #6b7280;
    margin-top: 1px;
}
.menu-arrow {
    font-size: 18px;
    color: #d0d8ff;
    font-weight: 300;
}

/* ========================= */
.results-wrapper { margin-top: 4px; }
.result-item {
    padding: 8px 10px;
    border: 1px solid #e0e4ef;
    border-radius: 6px;
    margin-bottom: 6px;
    background: #f8f9ff;
    cursor: pointer !important;
    font-size: 12px;
    color: #1a2035;
    transition: background 0.15s;
}
.result-item:hover { background: #f0f4ff; border-color: #3d7eff; }
.result-item strong { color: #3d7eff; }
.result-item small { color: #6b7280; }

/* ========================= */
#btn-create3d {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 360px;
    background: #3d7eff;
    color: #fff;
    text-align: center;
    padding: 14px 0;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    z-index: 1001;
    letter-spacing: 0.3px;
    transition: background 0.2s;
    border-top: 1px solid #2a6ae0;
}
#btn-create3d:hover { background: #2a6ae0; }
#uiContainer { padding-bottom: 48px !important; }

/* ========================= */
.joystick-circle {
    position: relative;
    width: 140px; height: 140px;
    margin: 10px auto;
    border-radius: 50%;
    background: #f0f4ff;
    border: 1px solid #d0d8ff;
}
.joystick-circle .btn {
    position: absolute;
    width: 50%; height: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #1a2035;
    font-size: 18px;
    cursor: pointer;
}
.up    { top: 0; left: 25%; }
.down  { bottom: 0; left: 25%; }
.left  { left: 0; top: 25%; }
.right { right: 0; top: 25%; }
.joystick-circle .btn:active { background: rgba(61,127,255,0.2); border-radius: 50%; }

/* ===== mobile portrait ===== */
@media (max-width: 768px) and (orientation: portrait) {
    #cesiumContainer {
        width: 100%;
        height: 70%;
        top: 0;
        left: 0;
    }
    #uiContainer {
        width: 100%;
        height: 30%;
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        border-left: none;
        border-top: 1px solid #e0e4ef;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
        padding: 10px 16px;
        overflow-y: scroll;
    }
    #uiContainer.hidden {
        transform: translateY(100%);
    }
    #toggleBtn {
        top: auto;
        bottom: 30%;
        right: 0;
        border-radius: 6px 0 0 6px;
    }
}

@media (max-width: 768px) and (orientation: portrait) {
    #cesiumContainer {
        position: fixed !important;
        width: 100% !important;
        height: 70% !important;
        top: 0 !important;
        left: 0 !important;
    }
    #uiContainer {
        position: fixed !important;
        width: 100% !important;
        height: 30% !important;
        top: 70% !important;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        border-left: none !important;
        border-top: 1px solid #e0e4ef !important;
        transform: none !important;
        opacity: 1 !important;
    }
    #uiContainer.hidden {
        transform: translateY(100%) !important;
    }
    #toggleBtn {
        display: none !important;
    }
}
