/* Roll-up 3D visualizer */
.viz { padding: 40px 0 104px; }
.viz-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; align-items: start; }

/* Stage */
.viz-stage {
  position: relative; border-radius: 16px; overflow: hidden;
  background: linear-gradient(180deg, #F1EFEB 0%, #E4E1DC 100%);
  border: 1px solid var(--line);
  height: min(78vh, 760px); min-height: 520px;
}
.viz-stage canvas.gl { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.viz-stage canvas.gl:active { cursor: grabbing; }
.viz-views { position: absolute; top: 14px; left: 14px; display: flex; gap: 6px; flex-wrap: wrap; }
.viz-views button, .viz-tool {
  padding: 8px 14px; border-radius: var(--pill); border: 1px solid var(--line);
  background: rgba(255,255,255,.92); font-weight: 700; font-size: 0.9rem; cursor: pointer;
}
.viz-views button:hover, .viz-tool:hover { border-color: var(--accent); }
.viz-views button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: var(--white); }
.viz-tools { position: absolute; top: 14px; right: 14px; display: flex; gap: 6px; }
.viz-tool[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--navy); }
.viz-hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); font-size: 0.9rem; color: var(--muted); background: rgba(255,255,255,.85); padding: 6px 14px; border-radius: var(--pill); white-space: nowrap; pointer-events: none; }
.viz-flat {
  position: absolute; left: 14px; bottom: 14px; width: 112px; padding: 8px 8px 6px;
  background: rgba(255,255,255,.95); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 24px -16px rgba(0,0,0,.4);
}
.viz-flat canvas { display: block; width: 100%; height: auto; border-radius: 3px; }
.viz-flat span { display: block; margin-top: 4px; font-size: 0.75rem; font-weight: 700; color: var(--muted); text-align: center; }
.viz-fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 32px; text-align: center; gap: 16px; }
.viz-fallback canvas { max-height: 70%; width: auto; box-shadow: 0 20px 40px -20px rgba(0,0,0,.4); }

/* Panel */
.viz-panel { display: grid; gap: 16px; }
.viz-card { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 26px 28px; }
.viz-card h2 { font-size: 1.5rem; margin-bottom: 4px; }
.viz-card .sub { color: var(--muted); font-size: 1rem; margin-bottom: 16px; }
.viz-step { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--navy); font-family: var(--f-display); font-size: 1rem; margin-right: 10px; vertical-align: 3px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { padding: 11px 18px; border-radius: var(--pill); border: 2px solid var(--line); background: var(--white); font-weight: 700; font-size: 1rem; cursor: pointer; }
.seg button:hover { border-color: var(--accent); }
.seg button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--navy); }
.seg button small { font-weight: 600; opacity: .85; margin-left: 6px; }
.viz-fields { display: grid; gap: 16px; margin-top: 18px; }
.viz-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.swatches { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--white); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--accent); }
.swatches input[type="color"] { width: 44px; height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--white); cursor: pointer; }
.range { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.range label { grid-column: 1 / -1; font-weight: 700; font-size: 0.95rem; }
.range input { width: 100%; accent-color: var(--accent); }
.range output { font-weight: 800; font-size: 0.95rem; min-width: 3.5em; text-align: right; }
.upload {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 2px dashed var(--line); border-radius: 12px; background: var(--paper); cursor: pointer;
}
.upload:hover, .upload.over { border-color: var(--accent); background: var(--accent-soft); }
.upload svg { width: 28px; height: 28px; color: var(--accent); flex: none; }
.upload b { display: block; }
.upload span { color: var(--muted); font-size: 0.9rem; }
.upload.has-file { border-style: solid; border-color: var(--ok); background: #F0FAF3; }
.file-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; font-size: 0.95rem; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-deep); font-weight: 800; cursor: pointer; font-size: 0.95rem; }
.link-btn:hover { text-decoration: underline; }

/* Files mode: one row per roll-up */
.upload-big { padding: 22px 18px; }
.upload.busy { opacity: .6; pointer-events: none; }
.file-actions { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.files-summary { font-weight: 800; }
.files-summary:empty, .viz-note:empty { display: none; }
.roll-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.roll-item { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.roll-item canvas { width: 56px; height: auto; border-radius: 3px; box-shadow: 0 6px 12px -8px rgba(0,0,0,.5); }
.roll-info { display: grid; gap: 4px; min-width: 0; }
.roll-name { font-size: 0.9rem; color: var(--muted); overflow-wrap: anywhere; }
.roll-note { font-size: 0.9rem; font-weight: 700; }
.seg-small { margin-top: 6px; gap: 6px; }
.seg-small button { padding: 6px 12px; font-size: 0.9rem; border-width: 1.5px; }
.viz-note { font-size: 0.95rem; color: var(--muted); }
.viz-note.warn { color: var(--ink); background: var(--accent-soft); border: 1px solid #FFD3B0; padding: 12px 14px; border-radius: 10px; }
.viz-price { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 14px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.viz-price b { font-family: var(--f-display); font-weight: 600; font-size: 2.2rem; color: var(--accent-deep); }
.viz-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.viz-actions .btn { flex: 1; min-width: 180px; }
.check-row { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.check-row input { width: 20px; height: 20px; accent-color: var(--accent); }

@media (min-width: 1001px) { .viz-stage { position: sticky; top: 104px; } }
@media (max-width: 1000px) {
  .viz-grid { grid-template-columns: 1fr; }
  .viz-stage { height: 62vh; min-height: 440px; }
}
@media (max-width: 520px) {
  .viz-card { padding: 22px 18px; }
  .viz-row { grid-template-columns: 1fr; }
  .viz-flat { width: 84px; }
  .viz-hint { display: none; }
  .viz-tools { top: auto; bottom: 14px; }
}

/* All-products 3D page (vis3d.html) */
.viz-card select { width: 100%; }
.vis-size { display: flex; align-items: center; gap: 10px; }
.vis-size input { width: 130px; text-align: center; font-weight: 800; }
.vis-size span { font-weight: 800; color: var(--muted); }
.vis-own { margin-top: 14px; font-size: 0.95rem; color: var(--muted); }
.vis-own a { color: var(--accent-deep); font-weight: 800; }
