/* 아이소 빌더 UI — 산호 + SUIT, 기존 HUD 아래에 붙인다. */

#iso-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #cbb6e0;
  z-index: 20;
}
#iso-loading.hidden { display: none; }
.loading-card {
  width: min(380px, 88vw);
  background: #fffcf8;
  border-radius: 22px;
  padding: 22px 22px 20px;
  box-shadow: 0 18px 40px rgba(40, 28, 20, 0.16);
  text-align: center;
}
.iso-hero {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 12px;
}
.loading-title { font-size: 20px; font-weight: 800; letter-spacing: -0.03em; }
.loading-sub { color: var(--mute); margin-top: 4px; font-size: 13px; }
.loading-bar {
  margin-top: 16px;
  height: 6px;
  background: var(--paper-2);
  border-radius: 99px;
  overflow: hidden;
}
.loading-fill {
  height: 100%;
  width: 0;
  background: var(--coral);
  transition: width 0.18s ease;
}
.loading-status { margin-top: 8px; font-size: 12px; color: var(--mute); }

#toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 6px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 8;
}
.tool {
  width: 56px;
  padding: 8px 4px 6px;
  border: 0;
  background: transparent;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--ink);
}
.tool:hover { background: var(--paper); }
.tool.active { background: #fde7e7; color: var(--coral); }
.tool .ti { width: 32px; height: 32px; display: block; }
.tool span.label { font-size: 11px; font-weight: 700; }

#palette {
  position: absolute;
  right: 12px;
  top: 12px;
  bottom: 12px;
  width: 196px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 8;
  padding: 8px 8px 6px;
  display: flex;
  flex-direction: column;
}
#palette-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
  flex-shrink: 0;
  overflow: visible;
}
.tab {
  border: 0;
  background: transparent;
  padding: 7px 0 8px;
  border-radius: 8px 8px 0 0;
  font-size: 11px;
  font-weight: 800;
  color: var(--mute);
  white-space: nowrap;
  text-align: center;
  min-width: 0;
}
.tab.active {
  color: var(--coral);
  border-bottom: 2px solid var(--coral);
  margin-bottom: -1px;
}
#palette-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  overflow-y: auto;
  flex: 1;
  align-content: start;
}
.swatch {
  background: var(--paper);
  border-radius: 10px;
  padding: 4px 3px 3px;
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.swatch.selected { border-color: var(--coral); background: #fde7e7; }
.swatch canvas, .swatch img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  pointer-events: none;
}
.swatch .name {
  font-size: 10px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.15;
  height: 22px;
  display: flex;
  align-items: center;
  text-align: center;
}

#iso-toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, 8px);
  padding: 8px 16px;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  z-index: 12;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
#iso-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.stage .world-tag {
  position: absolute;
  left: 0;
  top: 0;
}

.pad { display: none !important; }

@media (max-width: 900px) {
  #palette {
    top: auto;
    left: 12px;
    right: 12px;
    width: auto;
    height: 176px;
    bottom: 10px;
  }
  #palette-grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
  #toolbar { top: 8px; left: 8px; }
}
@media (max-width: 640px) {
  #toolbar { padding: 5px 4px; }
  .tool { width: 46px; }
  .tool span.label { display: none; }
  #palette { height: 168px; }
}
