:root {
  --ink: #16202b;
  --muted: #5d6b78;
  --card: rgba(255, 255, 255, 0.86);
  --line: rgba(22, 32, 43, 0.1);
  --accent: #1f4e8c;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; font-family: Inter, system-ui, -apple-system, sans-serif; color: var(--ink); background: #a9c4dd; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.top {
  position: fixed; top: 16px; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: flex-start;
  pointer-events: none; z-index: 3;
}
.brand { display: flex; gap: 12px; align-items: center; background: var(--card); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding: 10px 16px 10px 12px; border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0,0,0,.12); pointer-events: auto; }
.logo { font-size: 26px; line-height: 1; }
.brand h1 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.2px; }
.brand p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.icon-btn { pointer-events: auto; border: 0; background: var(--card); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  width: 44px; height: 44px; border-radius: 12px; font-size: 20px; cursor: pointer; box-shadow: 0 6px 24px rgba(0,0,0,.12); color: var(--ink); }

.panel {
  position: fixed; right: 16px; top: 76px; width: 300px; max-height: calc(100% - 92px); overflow: auto; z-index: 2;
  background: var(--card); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius); padding: 14px 16px 12px; box-shadow: 0 10px 34px rgba(0,0,0,.16);
  transition: transform .25s ease, opacity .25s ease;
}
.panel.hidden { transform: translateX(calc(100% + 24px)); opacity: 0; pointer-events: none; }
.panel section { padding: 10px 0; border-bottom: 1px solid var(--line); }
.panel section:last-of-type { border-bottom: 0; }
.panel h2 { margin: 0 0 8px; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button, .actions button {
  border: 1px solid var(--line); background: #fff; color: var(--ink); font: 500 13px Inter, sans-serif;
  padding: 7px 11px; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.chips button:hover, .actions button:hover { border-color: rgba(22,32,43,.3); }
.chips button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 32px; height: 32px; border-radius: 50%; border: 3px solid #fff; background: var(--c); cursor: pointer;
  box-shadow: 0 0 0 1px var(--line); transition: transform .15s, box-shadow .15s; }
.swatches button.on { box-shadow: 0 0 0 2px var(--ink); transform: scale(1.06); }

.row { display: flex; gap: 18px; flex-wrap: wrap; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; user-select: none; }
.toggle input { width: 16px; height: 16px; accent-color: var(--ink); }

.actions { display: flex; gap: 8px; }
.actions button { flex: 1; border-radius: 10px; padding: 9px 10px; }
.actions .primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.hint { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.45; }

#loader { position: fixed; inset: 0; display: grid; place-items: center; z-index: 10; background: linear-gradient(#b9d1e6, #e8eef3); transition: opacity .5s; }
#loader.done { opacity: 0; pointer-events: none; }
.loader-card { width: min(320px, 80vw); text-align: center; }
.loader-title { font-weight: 700; font-size: 18px; margin-bottom: 14px; }
.bar { height: 6px; background: rgba(22,32,43,.12); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 4%; background: var(--ink); transition: width .2s; }
.loader-sub { margin-top: 10px; font-size: 12.5px; color: var(--muted); }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 999px; font-size: 13.5px; opacity: 0; transition: opacity .25s, transform .25s; z-index: 5; pointer-events: none; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 720px) {
  .top { top: 10px; left: 10px; right: 10px; }
  .brand p { display: none; }
  .panel { left: 10px; right: 10px; top: auto; bottom: 10px; width: auto; max-height: 52%; }
  .panel.hidden { transform: translateY(calc(100% + 24px)); }
}
