/* Same stage treatment as the 2D map — see tools/seed-map/seed-map.css for why
   `contain: layout paint` is the line that matters. The 3D viewer draws into a canvas it
   sizes from the window, so it also needs the canvas pinned to the stage. */

#tool-root .sm-stage {
  contain: layout paint;
  position: relative;
  height: min(82vh, 860px);
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}
@media (max-width: 900px) { #tool-root .sm-stage { height: 78vh; min-height: 440px; } }

#tool-root .sm-stage #world-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* The viewer's own floating panels sit above the canvas. */
#tool-root .sm-stage .sm-sidebar { z-index: 30; }

#tool-root .sm-back {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  padding: 5px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--fg);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
}
#tool-root .sm-back:hover { border-color: var(--grass); color: var(--grass); }

#tool-root .sm-note {
  margin-top: 10px;
  color: var(--fg-muted);
  font-size: 0.82rem;
  line-height: 1.65;
}
#tool-root .sm-note a { color: var(--grass); }

/* ---------- the toolbar under the map ----------
 *
 * seed-map-3d.js moves the viewer's own .sm-seedcard out of the stage and into this bar, so
 * the controls sit under the world instead of floating over the corner the reader pans
 * toward. The card arrives still carrying the app's absolute-positioning rules, which is why
 * every one of them is unset here rather than trusted to stop applying. */
#tool-root .sm-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}


#tool-root .sm-toolbar .sm-seedcard,
#tool-root .sm-toolbar .sm-seedcard-head,
#tool-root .sm-toolbar .sm-seedcard-row {
  display: contents;
}

/* The version chip kept the panel's dark fill, which in a light bar is a black tab floating
   on white — and at 5.08:1 it passes contrast, so only looking at it finds this. */
#tool-root .sm-toolbar .sm-seedcard-version {
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--fg-muted);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

#tool-root .sm-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-left: auto;                /* actions to the trailing edge, controls to the leading one */
}
#tool-root .sm-toolbar .sm-goto { display: flex; align-items: center; gap: 6px; }
#tool-root .sm-toolbar .sm-goto label {
  color: var(--fg-muted);
  font-size: 0.78rem;
  font-weight: 700;
}
#tool-root .sm-toolbar .sm-goto input { width: 6.5ch; }

/* A seed is at most 20 digits, so letting it absorb every spare pixel gave it a box far
   wider than anything it can hold while the version sat cramped next to it. It gets a cap
   instead, and the version — the longest label in the bar, "1.21.4+ – 26.2" — gets room to
   show its option text rather than an ellipsis. */
#tool-root .sm-toolbar #seed-input { flex: 1 1 22ch; min-width: 14ch; max-width: 30ch; }
#tool-root .sm-toolbar :is(#edition-select, #dimension-select) { flex: 0 0 auto; width: auto; }
#tool-root .sm-toolbar #sm-version { flex: 0 0 auto; width: auto; min-width: 17ch; }

/* Under ~720px the row-of-rows becomes a stack, and pushing the actions to the far edge
   would strand Goto and Share on a line of their own. */
@media (max-width: 720px) {
  #tool-root .sm-toolbar-actions { margin-left: 0; }
  #tool-root .sm-toolbar .sm-seedcard { width: 100%; }
}

/* This widget carries its own dark palette and tool-theme.css deliberately keeps its fields
   dark on the light theme (see the seed-map-3d block there). The bar around them is site
   chrome, not app chrome, so it uses the site's surface and follows the theme normally. */
