* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #1a1a2e;
    color: #eee;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 顶部工具栏 */
#toolbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px 20px;
    background: #16213e;
    border-bottom: 1px solid #0f3460;
    min-height: 60px;
}

.toolbar-title {
    font-size: 18px;
    font-weight: bold;
    color: #e94560;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toolbar-section label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    white-space: nowrap;
}

.toolbar-section input[type="text"],
.toolbar-section input[type="number"] {
    width: 130px;
    padding: 10px 12px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 4px;
    color: #eee;
    font-size: 14px;
    height: 40px;
    box-sizing: border-box;
}

.toolbar-section select {
    min-width: 100px;
    padding: 8px 12px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 4px;
    color: #eee;
    font-size: 14px;
    height: 60px;
    box-sizing: border-box;
}

.toolbar-section select option {
    padding: 8px;
    background: #1a1a2e;
}

.toolbar-section select option:checked {
    background: #e94560 !important;
    color: #fff !important;
}

.toolbar-section select:focus {
    outline: none;
    border-color: #e94560;
}

/* 游戏模式多选框样式 */
#gameMode {
    min-width: 120px;
}

#gameMode option {
    padding: 6px 10px;
    margin: 2px 0;
    border-radius: 3px;
    cursor: pointer;
}

#gameMode option:hover {
    background: #0f3460;
}

#gameMode option:checked {
    background: linear-gradient(0deg, #e94560 0%, #e94560 100%) !important;
    color: #fff !important;
    font-weight: bold;
}

.tool-btn {
    padding: 8px 16px;
    background: #0f3460;
    border: none;
    border-radius: 4px;
    color: #eee;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.tool-btn:hover {
    background: #1a4a7a;
}

.tool-btn.primary {
    background: #e94560;
}

.tool-btn.primary:hover {
    background: #ff6b6b;
}

.tool-btn.danger {
    background: #c0392b;
}

.tool-btn.danger:hover {
    background: #e74c3c;
}

/* 主内容区 */
#main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 左侧物件面板 */
#sidebar {
    width: 200px;
    min-width: 200px;
    background: #16213e;
    border-right: 1px solid #0f3460;
    overflow-y: auto;
    padding: 15px;
    flex-shrink: 0;
}

#sidebar h3 {
    font-size: 14px;
    margin-bottom: 15px;
    color: #e94560;
}

.object-category {
    margin-bottom: 20px;
}

.object-category h4 {
    font-size: 12px;
    color: #888;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.object-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #1a1a2e;
    border-radius: 4px;
    margin-bottom: 6px;
    cursor: grab;
    transition: background 0.2s;
    min-height: 50px;
}

.object-item:hover {
    background: #0f3460;
}

.object-item:active {
    cursor: grabbing;
}

.object-item span {
    font-size: 13px;
}

.preview {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    flex-shrink: 0;
}

.preview.floor { background: #7f8c8d; }
.preview.wall { background: #95a5a6; }
.preview.roof { background: #8b4513; }
.preview.box { background: #8b7355; }
.preview.crate { background: #a0522d; }
.preview.door { background: #5d4e37; }
.preview.ramp { background: #6c7a89; }
.preview.site-a { background: #e74c3c; border: 2px dashed #fff; }
.preview.site-b { background: #3498db; border: 2px dashed #fff; }
.preview.spawn-ct { background: #2980b9; }
.preview.spawn-t { background: #c0392b; }
.preview.barrel { background: #2c3e50; border-radius: 50%; }
.preview.sandbag { background: #bdc3c7; }
.preview.graffiti { background: linear-gradient(45deg, #e74c3c, #f39c12, #2ecc71); }
.preview.light { background: #f1c40f; border-radius: 50%; box-shadow: 0 0 10px #f1c40f; }

/* 3D 视图 */
#viewport {
    flex: 1;
    position: relative;
    background: #1a1a2e;
    min-width: 0;
    overflow: hidden;
}

#canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#coords {
    position: absolute;
    bottom: 50px;
    left: 10px;
    background: rgba(0,0,0,0.7);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
}

#help {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0,0,0,0.7);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 11px;
    color: #aaa;
}

/* 右侧属性面板 */
#properties {
    width: 220px;
    min-width: 220px;
    background: #16213e;
    border-left: 1px solid #0f3460;
    padding: 15px;
    overflow-y: auto;
    flex-shrink: 0;
}

#properties h3 {
    font-size: 14px;
    margin-bottom: 15px;
    color: #e94560;
}

#no-selection {
    color: #666;
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

.prop-group {
    margin-bottom: 12px;
}

.prop-group label {
    display: block;
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.prop-group input {
    width: 100%;
    padding: 8px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 4px;
    color: #eee;
}

.prop-group input[type="color"] {
    height: 35px;
    padding: 2px;
    cursor: pointer;
}

#prop-panel button {
    width: 100%;
    margin-top: 10px;
}

/* 弹窗 */
.modal {
    display: none !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex !important;
}

.modal-content {
    background: #16213e;
    padding: 25px;
    border-radius: 8px;
    width: 700px;
    max-height: 80vh;
}

.modal-content h3 {
    color: #e94560;
    margin-bottom: 10px;
}

.modal-content p {
    color: #888;
    font-size: 13px;
    margin-bottom: 15px;
}

#code-output {
    width: 100%;
    height: 400px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 4px;
    color: #2ecc71;
    font-family: 'Consolas', monospace;
    font-size: 12px;
    padding: 15px;
    resize: none;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: flex-end;
}

/* 滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a2e;
}

::-webkit-scrollbar-thumb {
    background: #0f3460;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #1a4a7a;
}


/* 预设地图列表 */
#preset-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.preset-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: #1a1a2e;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.preset-item:hover {
    background: #0f3460;
    transform: translateX(5px);
}

.preset-icon {
    font-size: 32px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #16213e;
    border-radius: 8px;
}

.preset-info {
    flex: 1;
}

.preset-name {
    font-size: 16px;
    font-weight: bold;
    color: #eee;
    margin-bottom: 4px;
}

.preset-desc {
    font-size: 12px;
    color: #888;
}


/* 橡皮擦按钮激活状态 */
.tool-btn.active,
#eraserTool.active {
    background: #e74c3c !important;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.5);
}


/* 云存储相关样式 */
.cloud-section {
    border-left: 1px solid #0f3460;
    padding-left: 15px;
    margin-left: 5px;
}

.cloud-status {
    padding: 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

.cloud-status.error {
    color: #e74c3c;
}

.cloud-status.success {
    color: #2ecc71;
}

#cloud-list {
    max-height: 350px;
    overflow-y: auto;
}

.cloud-map-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: #1a1a2e;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: background 0.2s;
}

.cloud-map-item:hover {
    background: #0f3460;
}

.cloud-map-thumbnail {
    width: 80px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
    background: #0f3460;
    flex-shrink: 0;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cloud-map-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cloud-map-thumbnail.no-thumb {
    font-size: 11px;
    color: #666;
}

.cloud-map-info {
    flex: 1;
    min-width: 0;
}

.cloud-map-name {
    font-size: 15px;
    font-weight: bold;
    color: #eee;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cloud-map-id {
    font-size: 12px;
    color: #888;
    font-family: monospace;
}

.cloud-map-time {
    font-size: 11px;
    color: #666;
    margin-top: 2px;
}

.cloud-map-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    margin-left: 15px;
}

.cloud-map-actions .tool-btn {
    padding: 6px 12px;
    font-size: 12px;
}

.cloud-save-info {
    background: #1a1a2e;
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
}

.cloud-save-info .prop-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.cloud-save-info .prop-group:last-child {
    margin-bottom: 0;
}

.cloud-save-info label {
    color: #888;
    font-size: 13px;
}

.cloud-save-info span {
    color: #eee;
    font-size: 14px;
    font-weight: bold;
}


/* 缩略图预览弹窗 */
#thumbnail-preview {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

#thumbnail-preview.active {
    display: flex;
}

.thumb-preview-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.thumb-preview-content img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.thumb-preview-close {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e94560;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumb-preview-close:hover {
    background: #ff6b6b;
}

/* 已点赞按钮样式 */
.cloud-like-btn.liked {
    background: #27ae60 !important;
    cursor: not-allowed;
    opacity: 0.8;
}

.cloud-like-btn.liked:hover {
    background: #27ae60 !important;
}

/* 缩略图悬停效果 */
.cloud-map-thumbnail[data-thumb]:hover {
    opacity: 0.8;
    transform: scale(1.05);
    transition: all 0.2s;
}


/* 默认地板提示卡片 */
#floor-hint {
    position: absolute;
    bottom: 80px;
    right: 10px;
    background: rgba(22, 33, 62, 0.95);
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 10px;
    max-width: 200px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.floor-hint-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.floor-hint-content img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #0f3460;
}

.floor-hint-text {
    font-size: 11px;
    color: #aaa;
    line-height: 1.4;
}

.floor-hint-text strong {
    color: #e94560;
}
