/* World Builder — scoped under .wb container */
/* MkDocs overrides: full-width, no margins, hide title */
.md-typeset .wb { margin: 0; position: relative; }
.md-content:has(.wb) { max-width: none; }
.md-content__inner:has(.wb) { margin: 0 !important; padding: 0; }
.md-content__inner:has(.wb)::before { display: none; }
.md-content__inner:has(.wb) > h1 { display: none; }

/* Mobile block overlay */
.wb-mobile-block {
  display: none;
}

/* Loading overlay */
.wb-loading-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 100;
  background: rgba(255,255,255,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
}
[data-md-color-scheme="slate"] .wb-loading-overlay {
  background: rgba(30,30,30,0.95);
}
.wb-loading-inner {
  text-align: center;
  font-size: 16px;
  color: #555;
}
[data-md-color-scheme="slate"] .wb-loading-inner {
  color: #aaa;
}
.wb-loading-spinner {
  width: 40px; height: 40px;
  margin: 0 auto 16px;
  border: 4px solid #ddd;
  border-top-color: #1976d2;
  border-radius: 50%;
  animation: wb-spin 0.8s linear infinite;
}
@keyframes wb-spin {
  to { transform: rotate(360deg); }
}
@media (max-width: 768px), (pointer: coarse) {
  .wb-mobile-block {
    display: flex;
    position: relative;
    min-height: 60vh;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
  }
  .wb-mobile-block ~ * {
    display: none !important;
  }
  .wb-mobile-block-inner h2 {
    margin: 16px 0 8px;
    font-size: 20px;
  }
  .wb-mobile-block-inner p {
    font-size: 14px;
    color: #888;
    line-height: 1.6;
  }
}

/* Desktop Only 안내 언어 전환 (html[lang]에 따라) */
.wb-mobile-block .wb-i18n-ko { display: none; }
html[lang="ko"] .wb-mobile-block .wb-i18n-en { display: none; }
html[lang="ko"] .wb-mobile-block .wb-i18n-ko { display: block; }

.wb .main-layout {
  box-sizing: border-box;
}

/* ── Fullscreen mode ── */
body.wb-fullscreen .md-header,
body.wb-fullscreen .md-tabs,
body.wb-fullscreen .md-sidebar,
body.wb-fullscreen .md-footer {
  display: none !important;
}
/* 풀스크린에서 하단 chat 위젯 숨김 */
body.wb-fullscreen .physicar-chat-container,
body.wb-fullscreen .physicar-chat-overlay {
  display: none !important;
}
body.wb-fullscreen .md-main__inner {
  margin: 0;
}
body.wb-fullscreen .md-content {
  margin: 0;
}
body.wb-fullscreen .main-layout {
  height: 100vh;
}
body.wb-fullscreen .main-content {
  flex: 1;
  min-height: 0;
}

/* ── Top toolbar ── */
.wb-toolbar {
  height: 36px;
  flex-shrink: 0;
  z-index: 1; /* Material 헤더(z-index 4)보다 낮게 → 언어 선택 드롭다운이 툴바 위로 표시됨 */
  background: rgba(255,255,255,0.92);
  border-bottom: 1px solid #ccc;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.wb-toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.wb-toolbar-label {
  font-size: 11px;
  color: #555;
  font-weight: 600;
  white-space: nowrap;
}
.wb-toolbar-input {
  width: 40px;
  height: 24px;
  font-size: 11px;
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 0 2px;
}
.wb-toolbar-unit {
  font-size: 11px;
  color: #888;
}
.wb-toolbar-sep {
  width: 1px;
  height: 20px;
  background: #ddd;
  flex-shrink: 0;
}
.wb-toolbar-checkbox {
  font-size: 11px;
  color: #555;
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  white-space: nowrap;
}

.wb-toolbar-btn {
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  transition: filter 0.15s;
}

.wb-toolbar-btn:hover {
  filter: brightness(1.12);
}

/* ── 3D Preview button (top center of canvas) ── */
.wb-3d-btn {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(255,255,255,0.85);
  color: #555;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.wb-3d-btn:hover {
  background: #fff;
  color: #222;
}

/* ── Main Layout ── */
.main-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 88px); /* MkDocs header(48px) + tabs(40px) */
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  color: #333;
}

.main-content {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Canvas Area ── */
.canvas-area {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #e8e8e8;
}

.canvas-container-wrapper {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
}

/* Axis rulers */
.axis-x, .axis-y {
  position: absolute;
  pointer-events: none;
  z-index: 5;
}

.axis-x {
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: #f0f0f0;
  border-top: 1px solid #ccc;
}

.axis-y {
  top: 0;
  left: 0;
  bottom: 24px;
  width: 32px;
  background: #f0f0f0;
  border-right: 1px solid #ccc;
}

.axis-label {
  position: absolute;
  font-size: 10px;
  color: #888;
}

/* Coordinate display */
.coord-display {
  position: absolute;
  bottom: 28px;
  left: 36px;
  font-size: 11px;
  color: #666;
  background: rgba(240, 240, 240, 0.9);
  padding: 2px 8px;
  border-radius: 3px;
  z-index: 6;
  pointer-events: none;
}

/* Status overlay */
.status-overlay {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: #666;
  background: rgba(240, 240, 240, 0.95);
  padding: 3px 14px;
  border-radius: 4px;
  z-index: 6;
  pointer-events: none;
  white-space: nowrap;
  max-width: 80%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Right Panel ── */
.right-panel {
  width: 220px;
  background: #fafafa;
  border-left: 1px solid #ddd;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.panel-section {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.wb .md-typeset h3,
.panel-section h3 {
  font-size: 10px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 6px 0;
}

.panel-section-objects {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

/* ── Floating Properties Card ── */
.props-card {
  position: fixed;
  right: 228px;
  top: 50%;
  transform: translateY(-50%);
  width: 220px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  z-index: 100;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.props-card.visible {
  display: flex;
}
.props-card-header {
  padding: 8px 12px 4px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}
.props-card-header h3 {
  font-size: 10px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0;
}
.props-card-body {
  padding: 4px 12px 12px;
  overflow-y: auto;
  flex: 1;
}

.panel-section-props {
  flex-shrink: 0;
}

.panel-section-props h3 {
  padding: 4px 0;
}

.canvas-size-display {
  font-size: 10px;
  color: #aaa;
  margin-top: 2px;
  text-align: center;
}

/* ── Zoom Row ── */
.zoom-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.zoom-display {
  font-size: 11px;
  color: #666;
  min-width: 40px;
  text-align: center;
  flex-shrink: 0;
}

.btn-icon {
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Object List (unified) ── */
.object-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  margin-top: 4px;
}
.object-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  color: #666;
  transition: background 0.15s;
  user-select: none;
}
.object-item:hover { background: rgba(0,0,0,0.05); }
.object-item.active { background: rgba(33,150,243,0.12); color: #333; }
.object-item-3d.active { background: rgba(255,105,0,0.12); color: #333; }
.object-item .obj-name { font-family: 'Consolas','Monaco',monospace; font-weight: 500; font-size: 11px; white-space: nowrap; }
.object-item .obj-name-track { font-weight: 700; color: #444; }

/* Object type indicators */
.obj-ico {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.obj-ico svg {
  width: 14px;
  height: 14px;
}

.layer-file {
  font-size: 9px;
  color: #aaa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50px;
  flex-shrink: 1;
}

.layer-btns {
  display: flex;
  gap: 1px;
  margin-left: auto;
  flex-shrink: 0;
}

.layer-btn {
  background: rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.1);
  color: #888;
  font-size: 8px;
  width: 16px;
  height: 16px;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}
.layer-btn:hover:not(:disabled) {
  background: rgba(33,150,243,0.15);
  color: #333;
}
.layer-btn:disabled {
  opacity: 0.2;
  cursor: default;
}

.panel-placeholder {
  font-size: 11px;
  color: #aaa;
  text-align: center;
  padding: 12px 4px;
}

/* ── Buttons ── */
.btn {
  padding: 4px 10px;
  font-size: 11px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #333;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn:hover {
  background: #e8e8e8;
}

.btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.btn:disabled:hover {
  background: #fff;
}

.btn.active {
  background: #2196F3;
  border-color: #2196F3;
  color: #fff;
}

.btn-sm {
  padding: 3px 8px;
  font-size: 11px;
}

.btn-danger {
  border-color: #e53935;
  color: #e53935;
}

.btn-danger:hover {
  background: #e53935;
  color: #fff;
}

.btn-warning {
  border-color: #f57c00;
  color: #f57c00;
}

.btn-warning:hover {
  background: #f57c00;
  color: #fff;
}

/* ── Hidden file input ── */
#imageFileInput {
  display: none;
}

/* ── Properties ── */
.prop-section {
  margin-bottom: 10px;
}

.prop-section h4 {
  font-size: 11px;
  color: #888;
  margin-bottom: 4px;
  font-weight: 500;
}

.prop-row {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 3px;
}

.prop-row label {
  font-size: 11px;
  color: #888;
  min-width: 28px;
}

.prop-row input[type="number"] {
  width: 58px;
  padding: 3px 5px;
  font-size: 11px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 3px;
  color: #333;
  text-align: center;
}

.prop-row input:focus {
  outline: none;
  border-color: #2196F3;
}

.prop-row .unit {
  font-size: 10px;
  color: #aaa;
}

.prop-row .checkbox-label {
  font-size: 11px;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.prop-row .checkbox-label input[type="checkbox"] {
  width: auto;
  accent-color: #2196F3;
}

.prop-value {
  font-size: 11px;
  color: #333;
  font-family: 'Consolas', 'Monaco', monospace;
}

/* ── Pixel warning badge ── */
.pixel-warning {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  margin-top: 6px;
  background: rgba(255, 170, 0, 0.1);
  border: 1px solid rgba(255, 170, 0, 0.3);
  border-radius: 4px;
  font-size: 10px;
  color: #e65100;
}

.pixel-warning.show {
  display: flex;
}

.img-info {
  font-size: 10px;
  color: #aaa;
  margin-top: 4px;
}

/* ── Path Info ── */
.path-info {
  font-size: 11px;
  color: #666;
  padding: 4px 0;
}

/* ── Download Modal ── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-dialog {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  min-width: 340px;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
.modal-dialog h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
  color: #333;
}
.modal-body label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}
.input-prefix-group {
  display: flex;
  align-items: stretch;
}
.input-prefix {
  display: flex;
  align-items: center;
  padding: 0 10px;
  background: #eee;
  border: 1px solid #ccc;
  border-right: none;
  border-radius: 4px 0 0 4px;
  font-size: 14px;
  font-family: 'Consolas', 'Monaco', monospace;
  color: #555;
  white-space: nowrap;
  user-select: none;
}
.input-prefix-group input[type="text"] {
  flex: 1;
  border-radius: 0 4px 4px 0;
}
.modal-body input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  font-family: 'Consolas', 'Monaco', monospace;
  box-sizing: border-box;
}
.modal-body input[type="text"]:focus {
  border-color: var(--md-primary-fg-color);
  outline: none;
  box-shadow: 0 0 0 2px rgba(103,58,183,0.2);
}
.modal-hint {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}
.modal-error {
  font-size: 12px;
  color: #d32f2f;
  margin-top: 6px;
  font-weight: 500;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}
.modal-footer .btn {
  padding: 7px 18px;
  font-size: 13px;
}

/* ── 모달 선택 옵션 (Download / Import) ── */
.modal-choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.modal-choice-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid #d8d8d8;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.modal-choice-btn:hover {
  border-color: var(--md-primary-fg-color);
  background: #f6f3fb;
  box-shadow: 0 1px 5px rgba(0,0,0,0.08);
}
.modal-choice-btn .choice-title {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #333;
}
.modal-choice-btn .choice-desc {
  display: block;
  font-size: 11px;
  color: #888;
  margin-top: 3px;
  line-height: 1.4;
}
/* 섹션 라벨 */
.modal-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #aaa;
  margin: 16px 0 2px 0;
}
.modal-section-label:first-child {
  margin-top: 4px;
}

/* ── Print 이미지 생성 로딩 오버레이 ── */
.wb-print-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wb-print-box {
  background: #fff;
  border-radius: 8px;
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
.wb-print-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #eee;
  border-top-color: var(--md-primary-fg-color);
  border-radius: 50%;
  animation: wb-spin 0.8s linear infinite;
}
@keyframes wb-spin {
  to { transform: rotate(360deg); }
}
.wb-print-text {
  font-size: 13px;
  color: #555;
  font-weight: 600;
}

.modal-progress {
  margin-top: 16px;
}
.progress-bar {
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: #FF6F00;
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 3px;
}
.progress-text {
  font-size: 11px;
  color: #777;
  margin-top: 6px;
  text-align: center;
}

/* ── Shape buttons ── */
.shape-btn-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.btn-shape {
  flex: 1;
  min-width: 56px;
  font-size: 10px;
  padding: 4px 2px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.btn-shape-ico {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}
.btn-shape:hover {
  background: #e3f2fd;
  border-color: #90caf9;
}

/* ── Texture buttons ── */
.btn-tex {
  flex: 1;
  padding: 2px 6px;
  font-size: 10px;
  background: #f5f5f5;
  border: 1px solid #ccc;
  border-radius: 3px;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100px;
}
.btn-tex:hover { background: #e8e8e8; }
.btn-tex.has-image { background: #e8f5e9; border-color: #81c784; }
.btn-tex-clear {
  width: 20px; height: 20px; padding: 0;
  font-size: 11px; line-height: 1;
  border: 1px solid #ccc; border-radius: 3px;
  background: #fff; color: #999; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.btn-tex-clear:hover { background: #ffebee; color: #e53935; border-color: #e53935; }

/* ── Box net (전개도) ── */
.box-net-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 2px;
  width: 100%;
  margin: 2px 0 4px;
}
.box-net-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border-radius: 2px;
  font-size: 9px;
  color: #999;
  overflow: hidden;
  user-select: none;
}
.box-net-cell.face {
  border: 1.5px dashed #ccc;
  cursor: pointer;
  background: #fafafa;
  transition: border-color 0.15s, background 0.15s;
}
.box-net-cell.face:hover {
  border-color: #2196f3;
  background: #e3f2fd;
}
.box-net-cell.face.has-image {
  border: 1.5px solid #81c784;
  background-size: cover;
  background-position: center;
}
.box-net-cell.face.has-image span {
  background: rgba(0,0,0,0.55);
  color: #fff;
  padding: 0 3px;
  border-radius: 2px;
  font-size: 8px;
}
.box-net-cell .face-clear {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 14px;
  height: 14px;
  font-size: 9px;
  line-height: 14px;
  text-align: center;
  background: rgba(255,255,255,0.85);
  border: 1px solid #ccc;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  color: #999;
}
.box-net-cell.has-image .face-clear { display: block; }
.box-net-cell .face-clear:hover { background: #ffebee; color: #e53935; border-color: #e53935; }


