/* World Sketch record page (WorkbenchSketch*.js) — the Plan and Regions
   surfaces. Colours come from the theme's tokens; the sketch shapes keep the
   renderer's own dark palette (WorldSketchRenderer.js), which is the one
   owner of what colour a building or a road is. */

.wsk-plan,
.wsk-regions {
  display: grid;
  flex: 1 1 auto;
  gap: 16px;
  min-width: 0;
  min-height: 0;
}

.wsk-plan {
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
}

.wsk-regions {
  grid-template-columns:
    minmax(200px, 250px) minmax(280px, 380px)
    minmax(0, 1fr);
}

.wsk-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.wsk-pane-h {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.wsk-pane-h .wb-fgroup-h {
  margin: 0;
}

.wsk-spacer {
  flex: 1 1 auto;
}

.wsk-empty {
  padding: 16px;
}

/* ── Region list ── */
.wsk-region-list {
  overflow-y: auto;
}

.wsk-region-list li.wsk-region {
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
}

.wsk-region:hover {
  background: var(--bg-hover);
}

.wsk-region.sel {
  background: var(--wb-selected);
}

.wsk-region-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wsk-brief {
  max-height: 120px;
  margin: 0;
  padding: 10px 12px;
  overflow-y: auto;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* ── Layer chips (the shared .wb-chip) — the drawing's colour key ── */
.wsk-layers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
}

.wsk-layers .wb-chip .ws-swatch {
  opacity: 0.45;
}

.wsk-layers .wb-chip.on .ws-swatch {
  opacity: 1;
}

.wsk-cell-at {
  font-size: 12px;
}

/* ── The sketch drawing on the dark surface: page, grid and captions ── */
.wb-map .wsk-page {
  fill: var(--bg-primary);
}

.wb-map .wsk-grid {
  stroke: var(--border-subtle);
}

.wb-map .wsk-frame {
  fill: none;
  stroke: var(--border);
}

.wb-map .wsk-cell {
  fill: var(--bg-tertiary);
  stroke: var(--border);
}

.wb-map .wsk-drop {
  fill: var(--accent-glow);
  stroke: var(--accent);
}

/* More specific than the classic page's .ws-svg caption rules, which are
   paper ink and apply everywhere world-sketch.css is loaded. */
.wb-map .ws-svg .ws-label {
  font: 11px var(--font-sans);
  fill: var(--text-primary);
}

.wb-map .ws-svg .ws-ruler,
.wb-map .wm-name,
.wb-map .wm-empty {
  font: 10px var(--font-sans);
  fill: var(--text-muted);
}

/* ── Dragging regions on the world map (WorldSketchMapDrag.js) ── */
.wb-map > .ws-world-svg {
  /* The drop hint for a cell past the last column is drawn outside the grid. */
  overflow: visible;
  touch-action: none;
  user-select: none;
}

.wb-map .wm-region {
  cursor: grab;
}

.wb-map .wm-region:hover .wsk-cell {
  stroke: var(--accent);
  stroke-width: 2;
}

.wb-map .wm-region.wm-dragging {
  cursor: grabbing;
  opacity: 0.75;
}

/* ── Plan problems, and a region's exits ── */
.wsk-problems {
  max-height: 30%;
  padding: 10px 12px;
  overflow-y: auto;
  border-top: 1px solid var(--border-subtle);
}

.wsk-problems .wb-list li {
  align-items: flex-start;
  padding: 5px 0;
  font-size: 12.5px;
}

.wsk-exits {
  margin: 0;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── "In this region" under the sketch (WorkbenchSketchThings.js) ── */
.wsk-things {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  max-height: 38%;
  min-height: 0;
  border-top: 1px solid var(--border-subtle);
}

.wsk-things-body {
  min-height: 0;
  overflow-y: auto;
}

.wsk-things-list li.wsk-thing {
  gap: 8px;
  padding: 5px 12px;
  font-size: 12.5px;
  cursor: pointer;
}

.wsk-things-list li.wsk-things-h {
  padding: 10px 12px 4px;
  border-bottom: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.wsk-thing:hover {
  background: var(--bg-hover);
}

.wsk-thing.wsk-hl {
  background: var(--wb-selected);
}

.wsk-thing-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wsk-thing-at {
  flex: none;
  font-size: 11.5px;
}

.wsk-thing .wsk-open {
  height: 22px;
  padding: 0 7px;
}

/* A shape on the map answers to a click, and the picked one glows. Ground
   areas cover the whole map, so they take no pointer: hovering the ground
   explains nothing, and a click on it lets the picked shape go. */
.wb-map [data-shape] {
  cursor: pointer;
}

.wb-map [data-ground] {
  pointer-events: none;
}

.wb-map [data-shape].wsk-hl {
  filter: drop-shadow(0 0 2px var(--accent)) drop-shadow(0 0 6px var(--accent));
}

/* ── Tiles used ── */
/* Tiles used holds two cards. They used to share one scroll, so a long tile
   list pushed "Placed with no tile" down to a sliver of its own heading — the
   shapes a built world would leave empty were the hardest thing on the page to
   read. Each card scrolls on its own instead: the list takes the room going
   spare, and the untiled card keeps its height. */
.wsk-tiles {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow: hidden;
}

.wsk-tiles-sheet {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

/* Never shrink — it is short, and being crushed is the bug. It grows with its
   rows up to a share of the sub-tab, then scrolls. */
.wsk-untiled-sheet {
  flex: 0 0 auto;
  max-height: 45%;
  overflow: auto;
}

.wsk-thumb {
  display: inline-flex;
  flex: none;
  width: 28px;
  height: 28px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--bg-tertiary);
}

.wsk-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ── Ground and Tiles used sheets ── */
.wb-surface > .wsk-sheet {
  flex: 1 1 auto;
  align-self: flex-start;
  max-height: 100%;
  overflow: auto;
}

.wsk-sheet select.wb-in {
  max-width: 340px;
}

.wsk-tile-idea {
  max-width: 460px;
  margin-top: 3px;
  font-size: 12px;
}

@media (max-width: 1100px) {
  .wsk-plan,
  .wsk-regions {
    grid-template-columns: 1fr;
  }
}
