@charset "UTF-8";

html { scroll-behavior: smooth; touch-action: manipulation; }
body { font-family: "Helvetica Neue", Arial, sans-serif; padding: 0; margin: 0; background-color: #f4f4f4; color: #333; overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
.app-wrapper { max-width: 1400px; margin: 0 auto; padding: 15px; background: #222; color: white; box-shadow: 0 0 20px rgba(0,0,0,0.5); min-height: 100vh; display: flex; flex-direction: column; box-sizing: border-box; }

.app-header { margin-bottom: 10px; border-bottom: 1px solid #555; padding-bottom: 10px; display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 10px; }
.header-left h1 { margin: 0; font-size: 22px; color: white; letter-spacing: 1px; }
.header-left p { margin: 5px 0 0; font-size: 12px; color: #ccc; }
.header-right { display: flex; gap: 8px; }
.save-btn, .load-btn { padding: 8px 12px; font-weight: bold; font-size: 12px; border-radius: 4px; cursor: pointer; transition: 0.2s; border: none; }
.save-btn { background: #28a745; color: white; }
.save-btn:hover { background: #218838; }
.load-btn { background: #ffc107; color: #333; }
.load-btn:hover { background: #e0a800; }

#main-layout { display: flex; height: 80vh; min-height: 600px; background: #fff; border: 2px solid #555; border-radius: 8px; overflow: hidden; position: relative; flex-direction: row; }

#left-sidebar { width: 280px; flex-shrink: 0; background: #f8f9fa; border-right: 1px solid #ddd; overflow-y: auto; padding: 10px; z-index: 20; }
.sidebar-category { color: #333; font-weight: bold; font-size: 14px; padding: 5px 0; border-bottom: 2px solid #007bff; margin: 15px 0 10px 0; }
.sidebar-category:first-child { margin-top: 0; }
.item-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.item-card { background: #fff; border: 1px solid #e0e0e0; border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px 5px; cursor: pointer; transition: all 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,0.02); text-align: center;}
.item-card:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,123,255,0.15); border-color: #007bff; }
.item-thumb { width: 60px; height: 60px; background: #f0f0f0; border-radius: 4px; display: flex; align-items: center; justify-content: center; margin-bottom: 5px; overflow: hidden; font-size: 24px;}
.item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-name { font-size: 11px; font-weight: bold; color: #333; margin: 0; line-height: 1.2;}

#workspace { flex: 1; position: relative; display: flex; flex-direction: column; background: #f4f6f9; }
#canvas-container { flex: 1; position: relative; overflow: hidden; width: 100%; height: 100%; }
#canvas-3d { width: 100%; height: 100%; display: block; outline: none; cursor: default; touch-action: none; }
#canvas-3d.dragging { cursor: grabbing !important; }
#canvas-3d.rotating { cursor: crosshair !important; }
#canvas-3d.resizing { cursor: nwse-resize !important; }

#btn-3d-mode { position: absolute; top: 15px; left: 15px; z-index: 50; background: rgba(0,0,0,0.6); color: white; border: 1px solid rgba(255,255,255,0.3); font-size: 12px; padding: 6px 12px; border-radius: 15px; cursor: pointer; transition: 0.2s;}
#btn-3d-mode:hover { background: rgba(0,0,0,0.8); }

#floating-edit-panel { position: absolute; top: 15px; right: 15px; background: rgba(255,255,255,0.95); padding: 15px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.2); z-index: 100; display: none; flex-direction: column; gap: 8px; width: 220px; color: #333; border: 1px solid #ccc; touch-action: none;}
.edit-header { font-weight: bold; color: #007bff; border-bottom: 2px solid #ddd; padding-bottom: 5px; margin-bottom: 5px; font-size: 14px; text-align: center; }
.input-group { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
label { margin: 0; font-weight: bold; font-size: 12px; color: #555; }
input[type="number"] { width: 60px; padding: 4px; font-size: 13px; border: 1px solid #ccc; border-radius: 3px; }

.btn-group { display: flex; gap: 5px; width: 100%; margin-top: 5px; }
button.action-btn { cursor: pointer; padding: 8px 10px; background: #007bff; color: white; border: none; border-radius: 4px; font-size: 12px; transition: 0.2s; font-weight: bold; flex: 1; text-align: center;}
button.action-btn:hover { background: #0056b3; }
button.reset { background: #6c757d; }
button.reset:hover { background: #5a6268; }
button.delete { background: #dc3545; width: 100%; margin-top: 5px !important;}
button.delete:hover { background: #a71d2a; }

/* ??????????????????????? */
a.aff-btn { background: #f08b26 !important; }
a.aff-btn:hover { background: #e07b16 !important; }

#right-panel { width: 320px; flex-shrink: 0; background: #fff; border-left: 2px solid #ddd; display: flex; flex-direction: column; transition: width 0.3s ease, height 0.3s ease; position: relative; z-index: 30; }
#right-panel.closed { width: 40px; }
.right-header { display: flex; align-items: center; justify-content: space-between; padding: 8px; background: #333; color: #fff; white-space: nowrap; }
#right-panel.closed .right-title { display: none; }
.toggle-btn { background: #555; color: #fff; border: 1px solid #777; padding: 6px 8px; cursor: pointer; border-radius: 4px; width: 100%; font-size: 12px; font-weight: bold; transition: 0.2s; }
.toggle-btn:hover { background: #666; }

.right-content { width: 100%; display: flex; flex-direction: column; flex: 1; transition: opacity 0.2s; overflow: hidden; position: relative;}
#right-panel.closed .right-content { opacity: 0; pointer-events: none; }

#room-wrapper { width: 100%; height: 100%; flex: 1; background: #e9ecef; position: relative; overflow: hidden; cursor: grab; touch-action: none; }
#room-wrapper.panning { cursor: grabbing; }
.minimap-label { position: absolute; top: 5px; left: 5px; background: rgba(0,0,0,0.6); color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 4px; z-index: 500; pointer-events: none; font-weight: bold; }
.minimap-zoom-hint { position: absolute; bottom: 5px; left: 5px; background: rgba(0,0,0,0.4); color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 4px; z-index: 500; pointer-events: none; }
#room-container { width: 2000px; height: 2000px; background-image: linear-gradient(#ccc 1px, transparent 1px), linear-gradient(90deg, #ccc 1px, transparent 1px); background-size: 50px 50px; position: absolute; top: 0; left: 0; transform-origin: 0 0; }

.item { position: absolute; cursor: move; display: flex; align-items: center; justify-content: center; box-sizing: border-box; user-select: none; touch-action: none; }
.floor-block { background-color: rgba(255,255,255,0.8); border: 1px solid #999; z-index: 10; }
.floor-block.selected { border: 2px solid #007bff; z-index: 15; background-color: rgba(0,123,255,0.1); }
.furniture { border: 1px solid rgba(0,0,0,0.5); font-size: 12px; color: white; text-align: center; z-index: 50; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.furniture.selected { border: 2px solid #ff9900; z-index: 100; box-shadow: 0 0 10px rgba(255,153,0,0.5); }
.rug { z-index: 20 !important; border: 1px dashed rgba(0,0,0,0.3); }
.rug.selected { border: 2px solid #ff9900; z-index: 25 !important; }

.rotate-handle { width: 28px; height: 28px; background: white; color: #333; border: 1px solid #999; border-radius: 50%; position: absolute; top: -35px; left: 50%; transform: translateX(-50%); cursor: pointer; display: none; z-index: 200; text-align: center; line-height: 28px; font-weight: bold; font-size: 16px; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.resize-handle { width: 16px; height: 16px; background: white; border: 2px solid #333; border-radius: 50%; position: absolute; display: none; z-index: 200; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.selected .rotate-handle, .selected .resize-handle { display: block; }
.handle-tl { top: -8px; left: -8px; cursor: nwse-resize; } .handle-tr { top: -8px; right: -8px; cursor: nesw-resize; } .handle-bl { bottom: -8px; left: -8px; cursor: nesw-resize; } .handle-br { bottom: -8px; right: -8px; cursor: nwse-resize; }

.amazon-corner { background: #fff; padding: 15px 20px; border-radius: 8px; margin: 15px 0 5px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.amazon-corner h3 { margin: 0 0 15px 0; padding-bottom: 10px; border-bottom: 2px solid #ff9900; color: #333; font-size: 18px; }
.shop-toggle { display: flex; gap: 8px; margin-bottom: 12px; }
.shop-toggle button { background: transparent; color: #555; border: 1px solid rgba(0,0,0,0.2); padding: 6px 12px; border-radius: 6px; font-weight: bold; font-size: 12px; cursor: pointer; }
.shop-toggle button[aria-pressed="true"] { background: #0b5ed7; color: #fff; border-color: #0b5ed7; }
.amazon-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.amazon-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; background: #f8f9fa; border: 1px solid #ddd; border-radius: 8px; padding: 15px; text-decoration: none; color: #333; transition: all 0.2s; text-align: center; }
.amazon-btn:hover { background: #fff; border-color: #ff9900; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); color: #e67e22; }
.amazon-icon { font-size: 24px; margin-bottom: 5px; }
.amazon-text { font-size: 13px; font-weight: bold; }

.content-section { background: #fff; padding: 30px; border-radius: 12px; color: #333; box-shadow: 0 2px 10px rgba(0,0,0,0.08); margin: 20px 0; box-sizing: border-box; font-size: 14px; line-height: 1.8; }
.content-section h2 { border-bottom: 2px solid #007bff; padding-bottom: 10px; margin: 0 0 20px 0; color: #333; font-size: 22px; }
.content-section h3 { color: #333; margin-top: 30px; padding-left: 10px; border-left: 4px solid #007bff; font-size: 18px; margin-bottom: 15px; }
.content-section p { margin-bottom: 15px; }
.content-section ul { padding-left: 20px; margin-bottom: 20px; }
.content-section li { margin-bottom: 8px; }
.key-badge { background: #eee; padding: 2px 6px; border-radius: 4px; border: 1px solid #ccc; font-family: monospace; font-size: 12px; color: #333; }

.ofuse-corner-modern { background: #1e1e1e; color: #fff; padding: 30px; border-radius: 12px; margin: 30px 0; font-family: sans-serif; box-shadow: 0 4px 15px rgba(0,0,0,0.2); }
.ofuse-title { font-size: 20px; font-weight: bold; margin: 0 0 8px 0; }
.ofuse-desc { font-size: 13px; color: #aaa; margin: 0 0 25px 0; }
.ofuse-stats { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 8px; font-size: 12px; color: #aaa; }
.ofuse-stats .stat-val { font-size: 24px; font-weight: bold; color: #fff; line-height: 1.2; }
.ofuse-progress-bg { background: #333; height: 12px; border-radius: 6px; position: relative; overflow: hidden; margin-bottom: 12px; }
.ofuse-progress-fill { position: absolute; left: 0; top: 0; height: 100%; width: 5%; background: linear-gradient(90deg, #9b51e0 0%, #2f80ed 100%); border-radius: 6px; }
.ofuse-hint { text-align: center; font-size: 12px; color: #aaa; margin-bottom: 25px; }
.ofuse-btn-modern { display: block; width: 100%; background: #f08b26; color: #fff; text-align: center; font-weight: bold; padding: 15px 0; border-radius: 8px; text-decoration: none; font-size: 16px; transition: background 0.2s; }
.ofuse-btn-modern:hover { background: #e07b16; }

.ofuse-special-thanks { margin-top: 25px; padding-top: 15px; border-top: 1px solid #333; text-align: center; }
.ofuse-special-thanks .thanks-title { color: #f08b26; font-size: 12px; font-weight: bold; margin: 0 0 8px 0; letter-spacing: 1px; }
.ofuse-special-thanks .thanks-names { color: #666; font-size: 12px; margin: 0; line-height: 1.6; }

.app-footer { margin-top: 40px; padding: 20px; border-top: 1px solid #555; text-align: center; font-size: 12px; color: #aaa; }
.footer-links a { color: #ccc; text-decoration: none; margin: 0 10px; cursor: pointer; }

@media (max-width: 768px) {
    #main-layout { flex-direction: column; height: auto; min-height: 0; border: none; }
    
    #workspace { 
        width: 100%; 
        height: auto; 
        order: 1; 
        border: 2px solid #555; 
        border-radius: 8px; 
        display: flex;
        flex-direction: column;
    }
    #canvas-container { height: 400px; width: 100%; position: relative; }
    
    #floating-edit-panel { 
        position: static !important; 
        width: 100%; 
        box-sizing: border-box;
        border-radius: 0 0 8px 8px; 
        border: none; border-top: 1px solid #ddd; 
        box-shadow: none;
        flex-direction: row; flex-wrap: wrap; justify-content: space-between; 
        padding: 15px 10px; margin: 0; background: #fff;
    }
    #floating-edit-panel .edit-header { width: 100%; margin-bottom: 5px; }
    #floating-edit-panel .input-group { width: 31%; } 
    .btn-group { width: 100%; display: flex; gap: 5px; margin-top: 10px; }
    .btn-group .action-btn { font-size: 12px; padding: 8px; flex: 1;}
    button.delete { width: 100%; margin-top: 5px !important;}
    
    #left-sidebar { width: 100%; order: 2; height: auto; max-height: 300px; border-right: none; border-bottom: 2px solid #ddd; border-radius: 8px; margin-top: 10px; padding: 10px; }
    .item-grid { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
    
    #right-panel { width: 100%; order: 3; height: 350px; border-left: none; border: 2px solid #ddd; border-radius: 8px; margin-top: 10px; }
    #right-panel.closed { height: 40px; width: 100%; }
    .content-section { padding: 20px 15px; }
}