/* Modest widen vs default .wrap (720px); stays within wood-bg comfort */
.wrap.viz-wrap {
  width: min(960px, calc(100% - 2rem));
  max-width: none;
}

.viz-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 0.5rem;
}

.viz-stage {
  position: relative;
  width: 100%;
  background:
    linear-gradient(160deg, rgba(255, 248, 237, 0.92), rgba(243, 230, 200, 0.95)),
    #f3e6c8;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  touch-action: none;
  min-height: 220px;
  aspect-ratio: 4 / 3;
}

.viz-stage.has-photo {
  background: #1c1a17;
}

.viz-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.viz-empty {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(47, 93, 80, 0.1), transparent 55%),
    linear-gradient(160deg, rgba(255, 248, 237, 0.55), rgba(243, 230, 200, 0.35));
}

.viz-empty.hidden { display: none !important; }

.viz-empty-inner {
  max-width: 26rem;
  text-align: center;
  padding: 1.15rem 1.25rem 1.3rem;
  background: rgba(255, 248, 237, 0.92);
  border: 1px solid rgba(112, 76, 43, 0.28);
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(37, 18, 9, 0.12);
}

.viz-empty-kicker {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.viz-empty-title {
  margin: 0 0 0.75rem;
  color: var(--ink);
  font-size: clamp(1.05rem, 2.4vw, 1.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.viz-empty-steps {
  margin: 0;
  padding-left: 1.15rem;
  text-align: left;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.viz-empty-steps li { margin-bottom: 0.35rem; }
.viz-empty-steps li:last-child { margin-bottom: 0; }

.corner-hint {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 0.85rem;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  pointer-events: none;
  max-width: calc(100% - 1.5rem);
}

.texture-panel { margin-top: 1.25rem; }
.texture-panel h2 { margin: 0 0 0.35rem; font-size: 1.1rem; }

.texture-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.6rem;
  margin: 0.75rem 0 1rem;
}

.tex-opt {
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  padding: 0;
  font: inherit;
  text-align: left;
  color: var(--ink);
}

.tex-opt img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.tex-opt span {
  display: block;
  padding: 0.35rem 0.45rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}

.tex-opt.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(47, 93, 80, 0.25);
}

.tex-opt:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.scale-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--muted);
}

.scale-row input[type="range"] { flex: 1; }

.limits-box {
  margin-top: 1.25rem;
  padding: 1rem;
  background: #f3e6c8;
  border-radius: 10px;
  border: 1px solid #e2d0a8;
}

.limits-box h2 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  color: var(--warn);
}

.limits-box ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--ink);
  font-size: 0.9rem;
}

.limits-box li { margin-bottom: 0.35rem; }

@media (max-width: 480px) {
  .viz-stage { aspect-ratio: 3 / 4; }
  .texture-picker { grid-template-columns: repeat(3, 1fr); }
}

.measure-panel,
.share-panel {
  margin-top: 1.25rem;
  padding: 1rem 1.1rem 1.15rem;
  background: #fffaf0;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.measure-panel.hidden,
.share-panel.hidden,
.hidden {
  display: none !important;
}

.measure-panel h2,
.share-panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.measure-grid {
  margin-top: 0.75rem;
}

.field-hint {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 0.2rem;
}

.measure-results {
  margin-top: 0.85rem;
  padding: 0.75rem 0.9rem;
  background: #f7fbf9;
  border: 1px solid rgba(47, 93, 80, 0.25);
  border-radius: 10px;
  font-size: 0.95rem;
}

.measure-results dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 1rem;
  margin: 0;
}

.measure-results dt { color: var(--muted); }
.measure-results dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
  color: var(--ink);
}

.share-title-label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--muted);
  margin: 0.5rem 0 0.65rem;
}

.share-title-label input {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.shop-list {
  margin: 0.75rem 0 0;
  padding-left: 1.2rem;
}

.shop-list li { margin-bottom: 0.45rem; }
