/* ==========================================================================
   POLIXNEO ROBOTICS — 3D viewer (bright & friendly) + Poli the helper
   ========================================================================== */

html, body { height: 100%; }
body.viewer-body { overflow: hidden; }

.workspace { display: grid; grid-template-columns: 1fr 400px; height: calc(100vh - var(--nav-h)); }

/* ---------------------------------------------------------- 3D stage ----- */
.stage {
  position: relative;
  overflow: hidden;
  /* dark simulation backdrop — soft slate spotlight fading to near-black */
  background: radial-gradient(62% 62% at 50% 38%, #1b2231, #0e131c 55%, #070a0f);
}
.stage canvas { position: relative; z-index: 1; display: block; width: 100% !important; height: 100% !important; touch-action: none; }

/* Friendly title chip */
.crumb {
  position: absolute; top: 18px; left: 18px; z-index: 6;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px 8px 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  box-shadow: var(--sh-1);
}
.crumb__back { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--ink); transition: all 0.2s var(--ease); }
.crumb__back:hover { background: var(--yellow); transform: translateX(-2px); }
.crumb__back .ic { width: 20px; height: 20px; }
.crumb h1 { font-size: 1.05rem; line-height: 1.1; }
.crumb small { font-weight: 700; font-size: 0.78rem; color: var(--ink-2); }

/* Get this kit (top right) */
.stage__buy { position: absolute; top: 18px; right: 18px; z-index: 6; }

/* Friendly hint */
.vhint {
  position: absolute; bottom: 92px; left: 50%; transform: translateX(-50%); z-index: 6;
  font-family: var(--font-display); font-weight: 700; font-size: 0.82rem; color: var(--ink-2);
  background: #fff; border: 1px solid var(--line); border-radius: var(--pill);
  padding: 8px 16px; box-shadow: var(--sh-1); display: inline-flex; align-items: center; gap: 8px;
  transition: opacity 0.6s;
}
.vhint .ic { width: 16px; height: 16px; color: var(--yellow-deep); }

/* Toolbar with labels */
.toolbar {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 7;
  display: flex; align-items: center; gap: 4px;
  padding: 8px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--pill);
  box-shadow: var(--sh-2);
}
.tool {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 16px;
  border: none; border-radius: var(--pill);
  background: transparent; color: var(--ink-2);
  font-family: var(--font-display); font-weight: 700; font-size: 0.9rem;
  cursor: pointer; transition: background 0.2s, color 0.2s, transform 0.2s var(--ease);
}
.tool .ic { width: 20px; height: 20px; }
.tool:hover { background: var(--surface-2); color: var(--ink); transform: translateY(-2px); }
.tool.active { color: var(--ink); background: var(--yellow); }
.tool__sep { width: 1px; height: 26px; background: var(--line); margin: 0 4px; }

/* ------------------------------------------------------- Loader --------- */
.loader {
  position: absolute; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: radial-gradient(62% 62% at 50% 40%, #1b2231, #0c1017);
  color: #eef1f8;
  transition: opacity 0.6s var(--ease-soft), visibility 0.6s;
}
.loader.hidden { opacity: 0; visibility: hidden; }
.loader__inner { width: min(320px, 80vw); text-align: center; }
.loader__mark { width: 76px; height: 76px; margin: 0 auto 22px; animation: floaty 2.4s ease-in-out infinite; }
.loader__mark .logomark { width: 100%; height: 100%; }
.loader__label { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; margin-bottom: 16px; }
.loader__bar { height: 12px; border-radius: var(--pill); background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14); overflow: hidden; }
.loader__fill { height: 100%; width: 0%; border-radius: var(--pill); background: var(--grad); transition: width 0.3s var(--ease-soft); }
.loader__pct { margin-top: 12px; font-family: var(--font-display); font-weight: 800; color: var(--yellow); }
.loader__msg { margin-top: 6px; color: #aab3c6; font-weight: 600; }
.loader__error { color: var(--coral); }

/* ============================================================= Poli ===== */
.chat { display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); height: 100%; min-height: 0; }
.chat__head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.chat__avatar { width: 44px; height: 44px; flex: none; }
.chat__avatar svg { width: 100%; height: 100%; }
.chat__title { flex: 1; }
.chat__title h3 { font-size: 1.1rem; }
.chat__status { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.8rem; color: #0f9b8e; }
.chat__status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 7px var(--teal); animation: pulse 2s infinite; }
.chat__close { display: none; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; }
.chat__close .ic { width: 18px; height: 18px; }

.chat__log { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 18px; display: flex; flex-direction: column; gap: 16px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.chat__log::-webkit-scrollbar { width: 7px; }
.chat__log::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }

.msg { display: flex; gap: 10px; max-width: 90%; animation: msgin 0.3s var(--ease); }
@keyframes msgin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg__avatar { width: 32px; height: 32px; flex: none; }
.msg__avatar svg { width: 100%; height: 100%; }
.msg__bubble { padding: 11px 15px; border-radius: var(--r-md); line-height: 1.55; font-size: 0.96rem; font-weight: 600; }
.msg__bubble b { font-weight: 800; }
.msg--bot .msg__bubble { background: var(--surface-2); border: 1px solid var(--line); border-top-left-radius: 4px; color: var(--ink); }
.msg--user { align-self: flex-end; flex-direction: row-reverse; }
.msg--user .msg__bubble { background-image: var(--grad); color: var(--ink); border-top-right-radius: 4px; }
.msg__note { display: block; margin-top: 8px; font-size: 0.74rem; color: var(--ink-3); font-weight: 600; }

.typing { display: inline-flex; gap: 5px; padding: 4px 2px; }
.typing span { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); animation: bounce 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }

.chat__chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 14px; }
.suggest { font-family: var(--font-display); font-weight: 700; font-size: 0.84rem; padding: 8px 14px; border-radius: var(--pill); background: var(--teal-soft); border: 1px solid transparent; color: #0f9b8e; cursor: pointer; transition: all 0.2s var(--ease); }
.suggest:hover { background: var(--teal); color: #fff; transform: translateY(-2px); }

.chat__form { display: flex; gap: 10px; align-items: flex-end; padding: 14px 16px 16px; border-top: 1px solid var(--line); }
.chat__input { flex: 1; resize: none; max-height: 120px; font-family: var(--font-body); font-weight: 600; font-size: 0.98rem; color: var(--ink); background: var(--surface-2); border: 2px solid var(--line); border-radius: var(--r-md); padding: 11px 14px; line-height: 1.45; }
.chat__input::placeholder { color: var(--ink-3); }
.chat__input:focus { outline: none; border-color: var(--yellow); box-shadow: 0 0 0 4px var(--ring); }
.chat__send { flex: none; width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer; display: grid; place-items: center; color: var(--ink); background-image: var(--grad); box-shadow: var(--sh-pop); transition: transform 0.2s var(--ease); }
.chat__send .ic { width: 20px; height: 20px; }
.chat__send:hover { transform: translateY(-2px) scale(1.05); }
.chat__send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* Mobile assistant launcher */
.assistant-fab { display: none; position: absolute; bottom: 84px; right: 18px; z-index: 8; align-items: center; gap: 9px; padding: 12px 18px; border-radius: var(--pill); border: none; font-family: var(--font-display); font-weight: 700; color: var(--ink); background-image: var(--grad); box-shadow: var(--sh-2); cursor: pointer; }
.assistant-fab svg { width: 24px; height: 24px; }

/* ----------------------------------------------------- Assembly mode ----- */
.build-btn {
  position: absolute; bottom: 22px; left: 20px; z-index: 7;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 18px; border-radius: var(--pill); border: none;
  font-family: var(--font-display); font-weight: 700; color: var(--ink);
  background-image: var(--grad); box-shadow: var(--sh-2); cursor: pointer;
  transition: transform 0.2s var(--ease);
}
.build-btn:hover { transform: translateY(-2px); }
.build-btn svg { width: 20px; height: 20px; }

.assembly { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 9; display: flex; flex-direction: column; align-items: center; gap: 12px; width: max-content; max-width: 94vw; }
.assembly[hidden] { display: none; }
.asm__tip { font-weight: 600; font-size: 0.92rem; color: #e7eaf2; background: rgba(12,16,24,0.72); border: 1px solid rgba(255,255,255,0.12); border-radius: var(--pill); padding: 8px 16px; backdrop-filter: blur(8px); text-align: center; }
.asm__bar { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: var(--pill); box-shadow: var(--sh-2); padding: 8px; }
.asm__exit { width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--surface-2); color: var(--ink-2); cursor: pointer; display: grid; place-items: center; }
.asm__exit:hover { background: var(--coral-soft); color: var(--coral); }
.asm__exit svg { width: 18px; height: 18px; }
.asm__nav { display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 16px; border-radius: var(--pill); border: 1px solid var(--line-2); background: #fff; color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 0.92rem; cursor: pointer; transition: border-color 0.2s, transform 0.2s var(--ease); }
.asm__nav:hover:not(:disabled) { border-color: var(--ink); transform: translateY(-1px); }
.asm__nav:disabled { opacity: 0.4; cursor: default; }
.asm__nav svg { width: 16px; height: 16px; }
.asm__next { border: none; color: var(--ink); background-image: var(--grad); box-shadow: var(--sh-pop); }
.asm__info { display: flex; flex-direction: column; align-items: center; line-height: 1.15; padding: 0 8px; min-width: 116px; }
.asm__step { font-family: var(--font-display); font-weight: 700; font-size: 0.66rem; color: var(--ink-3); letter-spacing: 0.04em; }
.asm__label { font-family: var(--font-display); font-weight: 800; font-size: 0.98rem; color: var(--ink); }
.asm__dots { display: flex; gap: 6px; padding: 0 6px; }
.asm__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); transition: background 0.2s, transform 0.2s; }
.asm__dot.done { background: var(--teal); }
.asm__dot.on { background: var(--yellow-deep); transform: scale(1.2); }

/* ----------------------------------------------------- Build guide panel - */
.guide { display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); height: 100%; min-height: 0; }
.guide[hidden] { display: none; }
.guide__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.guide__head h3 { font-size: 1.15rem; }
.guide__progress { font-family: var(--font-display); font-weight: 700; font-size: 0.78rem; color: var(--yellow-deep); }
.guide__close { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; display: grid; place-items: center; }
.guide__close:hover { background: var(--coral-soft); color: var(--coral); }
.guide__close .ic { width: 18px; height: 18px; }
.guide__dots { display: flex; gap: 8px; padding: 16px 18px 0; }
.guide__dot { flex: 1; height: 6px; border-radius: var(--pill); background: var(--line-2); transition: background 0.3s; }
.guide__dot.done { background: var(--teal); }
.guide__dot.on { background: var(--yellow-deep); }
.guide__body { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 20px; display: flex; flex-direction: column; animation: msgin 0.35s var(--ease); }
.guide__num { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; background-image: var(--grad); color: var(--ink); font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; box-shadow: var(--sh-pop); margin-bottom: 18px; }
.guide__title { font-size: 1.7rem; margin-bottom: 14px; }
.guide__desc { color: var(--ink-2); font-size: 1.05rem; line-height: 1.62; }
.guide__nav { display: flex; gap: 10px; padding: 16px 18px; border-top: 1px solid var(--line); }
.guide__nav .btn { flex: 1; justify-content: center; }
.guide__nav .btn:disabled { opacity: 0.45; cursor: default; box-shadow: none; transform: none; }

/* ------------------------------------------------ Real product photo ----- */
.real-photo { position: absolute; bottom: 20px; left: 20px; z-index: 7; width: 92px; height: 92px; padding: 0; border-radius: var(--r-md); border: 3px solid #fff; background: #fff; box-shadow: var(--sh-2); cursor: pointer; overflow: hidden; transition: transform 0.2s var(--ease); }
.real-photo[hidden] { display: none; }
.real-photo:hover { transform: translateY(-3px) scale(1.04); }
.real-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 16%; }
.real-photo__tag { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; gap: 4px; font-family: var(--font-display); font-weight: 700; font-size: 0.6rem; color: #fff; background: linear-gradient(transparent, rgba(7,10,15,0.82)); padding: 14px 4px 4px; }
.real-photo__tag .ic { width: 13px; height: 13px; }

.lightbox { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 5vh 5vw; background: rgba(7,10,15,0.82); backdrop-filter: blur(6px); animation: fade 0.25s ease; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: min(560px, 92vw); max-height: 90vh; border-radius: var(--r-lg); box-shadow: var(--sh-3); background: #fff; animation: popin 0.3s var(--ease); }
.lightbox__close { position: absolute; top: 20px; right: 20px; width: 46px; height: 46px; border-radius: 50%; border: none; background: rgba(255,255,255,0.92); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.lightbox__close .ic { width: 22px; height: 22px; }

/* ------------------------------------------------------------ Responsive - */
@media (max-width: 940px) {
  .workspace { grid-template-columns: 1fr; }
  .assistant-fab { display: inline-flex; }
  .chat { position: fixed; top: var(--nav-h); right: 0; bottom: 0; width: min(420px, 100%); z-index: 40; transform: translateX(105%); transition: transform 0.35s var(--ease-soft); box-shadow: -20px 0 60px rgba(30,34,51,0.25); }
  .chat.open { transform: translateX(0); }
  .chat__close { display: grid; place-items: center; }
  /* Build guide becomes a bottom sheet so the 3D stays visible above it */
  .guide { position: fixed; left: 0; right: 0; bottom: 0; height: 54vh; border-left: 0; border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; z-index: 40; box-shadow: 0 -16px 50px rgba(30,34,51,0.25); }
  .guide__title { font-size: 1.4rem; }
  .guide__body { padding: 18px 20px; }
}
@media (max-width: 560px) {
  .tool__label { display: none; }
  .tool { padding: 0 12px; }
  /* Compact, icon-only "Get this kit" so it never overlaps the title */
  #buy-btn { width: 48px; height: 48px; padding: 0; border-radius: 50%; }
  #buy-btn .buy-label { display: none; }
  .crumb { max-width: calc(100% - 90px); }
  .crumb h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* compact assembly bar: icon-only nav */
  .asm__nav { padding: 0 13px; font-size: 0; gap: 0; }
  .asm__info { min-width: 84px; }
  .build-btn { padding: 11px 15px; bottom: 18px; left: 14px; }
}
