/* Topper 3D Studio — inspired by 3dkeychain.net/easy, simplified for non-technical users */
.studio-body {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.studio-nav { margin-left: 8px; }
.studio-nav a.active {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.help-btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.help-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }

/* ---- Sub-header ---- */
.subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 20px 11px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex: none;
}
.subbar-title { display: flex; align-items: center; gap: 8px; }
.subbar-title .spark { color: var(--muted); font-size: 14px; }
.subbar-title h1 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.subbar-desc { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.quick-steps {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.quick-steps span { display: inline-flex; align-items: center; gap: 5px; }
.quick-steps b {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  color: var(--text); font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---- Main split ---- */
.editor {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 336px 1fr;
}

/* ---- Left control sidebar ---- */
.panel {
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding: 14px 16px 28px;
  background: var(--bg);
}
.panel .block {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.step-lbl {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.opt-tag {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--dim);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  margin-left: 4px;
}

.name-input {
  background: var(--bg-2) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: 8px !important;
  padding: 11px 13px !important;
  font-size: 17px !important;
  font-weight: 600;
}
.name-input:focus { border-color: var(--text) !important; }
.name-input.attention {
  border-color: #facc15 !important;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.25);
}
.field-sub {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

/* ---- Font tiles ---- */
.fonts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 8px;
}
.fonts button {
  height: 44px;
  padding: 0 8px;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 15.5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: border-color .12s, background .12s;
}
.fonts button:hover { border-color: var(--border-strong); background: var(--surface-2); }
.fonts button.on {
  border: 1.5px solid #ffffff;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.25);
}
.more-fonts { margin-top: 6px; }
.more-fonts summary {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
}
.more-fonts summary:hover { color: var(--text); }
.font-select {
  margin-top: 6px;
  background: var(--bg-2) !important;
  padding: 8px 10px !important;
  font-size: 13px !important;
  color: var(--text) !important;
}

/* ---- Accordion sections ---- */
.acc {
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 12px;
}
.acc > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
}
.acc > summary::-webkit-details-marker { display: none; }
.acc-ico {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.acc-ico svg { width: 14px; height: 14px; }
.acc-meta { flex: 1; min-width: 0; }
.acc-meta strong { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); line-height: 1.25; }
.acc-meta small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.acc-chev { color: var(--dim); font-size: 15px; transition: transform .15s; line-height: 1; }
.acc:not([open]) .acc-chev { transform: rotate(-90deg); }
.acc-body { padding-top: 10px; }

.sub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.inline-chk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
}
.inline-chk input { width: auto; accent-color: #ffffff; margin: 0; }
.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 6px;
  white-space: nowrap;
}
.link-btn:hover { color: var(--text); background: var(--surface-2); }

/* ---- Motifs ---- */
.motifs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.motifs button {
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 6px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: border-color .12s, background .12s;
}
.motifs button:hover { border-color: var(--border-strong); background: var(--surface-2); }
.motifs button.on { border: 1.5px solid #ffffff; background: var(--surface-2); }
.motifs svg { width: 38px; height: 38px; }
.motifs span { font-size: 10.5px; color: var(--muted); line-height: 1.15; text-align: center; }

/* ---- Minimalist white range sliders ---- */
.slider { margin-bottom: 13px; user-select: none; }
.slider:last-child { margin-bottom: 2px; }
.thick-group { margin-bottom: 13px; }
.thick-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; margin-bottom: 7px; }
.thick-head span { color: var(--text); font-weight: 500; }
.thick-head output { color: var(--muted); font-size: 12px; }
.thick-pills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.thick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 4px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 12px; font-weight: 700; cursor: pointer; transition: border-color .15s, background .15s;
}
.thick-btn small { font-size: 10px; font-weight: 500; color: var(--muted); }
.thick-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.thick-btn.on { border-color: var(--brand); background: var(--brand-soft, rgba(107, 193, 25, 0.14)); color: #fff; }
.thick-btn.on small { color: var(--brand, #6bc119); }
.slider div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12.5px;
  margin-bottom: 6px;
}
.slider div span { color: var(--text); font-weight: 500; }
.slider div output { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.slider input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(to right, #fafafa var(--pct, 50%), #27272a var(--pct, 50%));
  outline: none;
  cursor: pointer;
  margin: 5px 0;
}
.slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #09090b;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
  cursor: pointer;
}
.slider input[type=range]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #09090b;
  cursor: pointer;
}

/* ---- Color cards ---- */
.color-summary { display: flex !important; align-items: center; gap: 5px; margin-top: 3px !important; }
.color-summary i {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.color-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.color-cards:has(#color2Box[hidden]) { grid-template-columns: 1fr; }
.color-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 9px 11px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color .12s;
}
.color-card:hover { border-color: var(--border-strong); }
.color-card[hidden] { display: none; }
.color-card.full { width: 100%; }
.swatch-wrap {
  display: inline-flex;
  width: 30px;
  height: 18px;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.25);
  flex: none;
}
.color-card input[type=color] {
  width: 44px;
  height: 30px;
  padding: 0;
  margin: -6px;
  border: 0;
  background: none;
  cursor: pointer;
}
.presets { display: flex; gap: 9px; flex-wrap: wrap; }
.presets button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 5px solid;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
  transition: transform .12s;
}
.presets button:hover { transform: scale(1.08); }

/* ---- Bottom CTA & Print info card ---- */
.panel-cta { margin: 14px 0 12px; }
.big-cta { padding: 12px 16px; font-size: 15px; }
.cta-sub { margin: 6px 0 0; font-size: 11.5px; color: var(--muted); text-align: center; }

.info-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 13px;
  font-size: 12px;
}
.info-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.info-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 6px;
}
.info-row {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  padding: 3px 0;
  font-size: 12px;
}
.info-row strong { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.info-warn {
  margin: 8px 0 0;
  padding: 7px 9px;
  border-radius: 7px;
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.35);
  color: #facc15;
  font-size: 11.5px;
  line-height: 1.4;
}
.info-warn[hidden] { display: none; }
.series-box {
  margin-top: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
}
.series-box strong { display: block; color: var(--text); font-size: 12px; margin-bottom: 2px; }
.series-box p { margin: 0; }
.series-box.ok {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.35);
  color: #d4d4d8;
}
.series-box.ok strong { color: #4ade80; }

/* ---- Right 3D viewport ---- */
.stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 10px 18px 16px;
  background: var(--bg);
}
.stagebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  flex: none;
}
.stagebar .dims {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.stagebar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.build-meta {
  font-size: 12px;
  color: var(--muted);
}
.stage-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

#view {
  position: relative;
  flex: 1;
  min-height: 260px;
  border-radius: 12px;
  overflow: hidden;
  background: #edf0f4;
  border: 1px solid var(--border);
  touch-action: none;
}
#view canvas { display: block; position: absolute; inset: 0; }

.view-tools {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: inline-flex;
  background: rgba(17, 17, 20, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  backdrop-filter: blur(8px);
}
.view-tools button {
  background: transparent;
  color: #a1a1aa;
  border: none;
  border-radius: 6px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.view-tools button:hover { color: #ffffff; }
.view-tools button.on { background: #27272a; color: #ffffff; }

.viewhint {
  position: absolute;
  right: 12px;
  bottom: 10px;
  z-index: 1;
  font-size: 11.5px;
  color: #475569;
  pointer-events: none;
}

/* ---- Paint-on-3D toolbar ---- */
.paint-bar {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  max-width: calc(100% - 24px);
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(17, 17, 20, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fafafa;
  font-size: 12px;
  backdrop-filter: blur(8px);
}
.paint-bar[hidden] { display: none; }
.paint-swatches { display: flex; gap: 6px; align-items: center; }
.paint-swatches button {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3); cursor: pointer;
}
.paint-swatches button.on { border: 2.5px solid #ffffff; transform: scale(1.12); }
.paint-custom {
  width: 24px; height: 24px; border-radius: 50%; overflow: hidden; margin: 0;
  border: 1.5px dashed #a1a1aa; display: inline-flex; cursor: pointer;
}
.paint-custom input { width: 38px; height: 38px; margin: -7px; border: 0; padding: 0; cursor: pointer; }
#view.painting canvas { cursor: crosshair; }

/* ---- Help modal & Guided Tour ---- */
.help-modal { max-width: 520px; }
.help-list {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--muted);
}
.help-list strong { color: var(--text); }
.help-tip {
  margin-top: 16px;
  padding: 11px 13px;
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  font-size: 13px;
  color: #d4d4d8;
  line-height: 1.45;
}
.help-tip strong { display: block; color: #4ade80; margin-bottom: 3px; }
.help-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 18px;
}

.tour-highlight {
  outline: 2px solid #ffffff !important;
  outline-offset: 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04) !important;
}
.tour-bar {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 150;
  width: min(560px, calc(100vw - 24px));
  background: #141418;
  border: 1.5px solid #ffffff;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.tour-bar[hidden] { display: none; }
.tour-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #4ade80;
  margin-bottom: 2px;
}
.tour-copy strong { display: block; font-size: 14.5px; color: var(--text); }
.tour-copy p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.tour-btns { display: flex; gap: 8px; flex: none; }

@media (max-width: 820px) {
  .studio-body { height: auto; overflow: auto; }
  .quick-steps { display: none; }
  .editor { grid-template-columns: 1fr; }
  .stage { order: -1; position: sticky; top: 54px; z-index: 3; padding: 10px 12px; border-bottom: 1px solid var(--border); }
  #view { height: 36vh; flex: none; min-height: 210px; }
  .panel { overflow: visible; border-right: none; }
  .tour-bar { flex-direction: column; align-items: stretch; }
  .tour-btns { justify-content: flex-end; }
}
