/* ---- Microduck 3D Painter — styled after pollen-robotics.com/microduck ---- */
:root {
  --bg: #101018;
  --bg-2: #0b0b10;
  --panel: #16161f;
  --panel-2: #1d1d28;
  --line: #2a2a38;
  --text: #ffffff;
  --muted: #9a9ab0;
  --orange: #ff7a2f;
  --yellow: #ffd23f;
  --teal: #2ff0e6;
  --pink: #ff2fa8;
  --cream: #faf8f2;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(120% 90% at 50% 0%, #1a1a26 0%, var(--bg) 45%, var(--bg-2) 100%);
  color: var(--text);
  font-family: "DM Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

/* ---------------------------------------------------------------- topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 12, 18, 0.6);
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { font-size: 24px; }
.brand-name {
  font-family: "Anton", sans-serif; letter-spacing: 1px;
  font-size: 26px; line-height: 1;
}
.brand-tag {
  font-family: "Anton", sans-serif; font-size: 13px; letter-spacing: 1px;
  color: var(--bg); background: var(--yellow);
  padding: 4px 8px; transform: translateY(-1px);
}
.topbar-actions { display: flex; gap: 8px; }

/* ---------------------------------------------------------------- buttons */
.btn {
  font-family: "DM Sans", sans-serif; font-weight: 700; font-size: 13px;
  padding: 9px 14px; border: 1px solid var(--line); border-radius: 0;
  background: transparent; color: var(--text); cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
  user-select: none;
}
.btn:hover { border-color: #46465c; background: rgba(255,255,255,.04); }
.btn:active { transform: translateY(1px); }
.btn-accent { background: var(--orange); color: #101018; border-color: var(--orange); }
.btn-accent:hover { background: #ff8f52; border-color: #ff8f52; }
.btn-ghost { color: var(--text); }

/* ---------------------------------------------------------------- layout */
.layout {
  display: grid; grid-template-columns: 1fr 340px;
  height: calc(100% - 60px);
}
.stage { position: relative; min-width: 0; }
#canvas-wrap { position: absolute; inset: 0; }
#scene { width: 100%; height: 100%; display: block; touch-action: none; }

.stage-hint {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  font-size: 12px; color: var(--muted); background: rgba(12,12,18,.55);
  padding: 6px 12px; border: 1px solid var(--line); white-space: nowrap;
  pointer-events: none;
}
.hover-label {
  position: absolute; padding: 4px 9px; font-size: 12px; font-weight: 700;
  background: var(--text); color: var(--bg); pointer-events: none;
  transform: translate(-50%, -140%); white-space: nowrap; z-index: 5;
}

/* loader */
.loader {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  color: var(--muted); background: var(--bg);
}
.loader-duck { font-size: 46px; animation: bob 1.1s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-10px) } }

/* ---------------------------------------------------------------- panel */
.panel {
  background: var(--panel); border-left: 1px solid var(--line);
  padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 22px;
}
.panel-block { display: flex; flex-direction: column; gap: 12px; }
.panel-title {
  font-family: "Anton", sans-serif; font-weight: 400; letter-spacing: .5px;
  font-size: 15px; text-transform: uppercase; margin: 0; color: var(--text);
}
.row-between { display: flex; align-items: center; justify-content: space-between; }

/* swatches */
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.swatch {
  aspect-ratio: 1; border: 2px solid var(--line); cursor: pointer;
  position: relative; border-radius: 0; transition: transform .08s ease;
}
.swatch:hover { transform: scale(1.08); }
.swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--orange); }
.swatch.active::after {
  content: "✓"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #000; mix-blend-mode: difference;
}
.custom-color {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; color: var(--muted); gap: 10px;
}
.custom-color input[type=color] {
  width: 46px; height: 30px; padding: 0; border: 2px solid var(--line);
  background: none; cursor: pointer; border-radius: 0;
}

/* symmetry switch */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12px; color: var(--muted); }
.switch input { display: none; }
.switch-ui {
  width: 34px; height: 18px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; position: relative; transition: background .15s ease;
}
.switch-ui::after {
  content: ""; position: absolute; top: 1px; left: 1px; width: 14px; height: 14px;
  background: var(--muted); border-radius: 50%; transition: transform .15s ease, background .15s ease;
}
.switch input:checked + .switch-ui { background: var(--teal); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); background: #05231f; }
.switch input:checked ~ .switch-label { color: var(--text); }

/* part list */
.part-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.part-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  border: 1px solid var(--line); background: var(--panel-2); cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.part-item:hover, .part-item.hot { border-color: #46465c; background: #23232f; }
.part-chip { width: 20px; height: 20px; border: 1px solid rgba(255,255,255,.25); flex: none; }
.part-name { font-size: 13px; font-weight: 500; }
.part-pair { margin-left: auto; font-size: 10px; color: var(--muted); letter-spacing: .5px; }

/* presets */
.presets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.preset {
  border: 1px solid var(--line); background: var(--panel-2); cursor: pointer;
  padding: 8px; display: flex; flex-direction: column; gap: 7px; align-items: flex-start;
  transition: border-color .12s ease, transform .08s ease;
}
.preset:hover { border-color: #46465c; }
.preset:active { transform: translateY(1px); }
.preset-swatches { display: flex; gap: 3px; }
.preset-swatches span { width: 14px; height: 14px; border: 1px solid rgba(0,0,0,.25); }
.preset-name { font-size: 12px; font-weight: 700; }

.panel-actions { flex-direction: row; gap: 8px; }
.panel-actions .btn { flex: 1; justify-content: center; }

.license { font-size: 11px; color: var(--muted); line-height: 1.5; margin: 0; }
.license a { color: var(--muted); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 820px) {
  body { overflow: auto; }
  .layout { grid-template-columns: 1fr; height: auto; }
  .stage { height: 58vh; }
  #canvas-wrap { position: absolute; }
  .panel { border-left: none; border-top: 1px solid var(--line); }
  .topbar { padding: 0 12px; }
  .brand-tag { display: none; }
  .brand-name { font-size: 20px; }
  .topbar-actions .btn { padding: 8px 9px; font-size: 11px; }
}
