/* 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);
}

/* ── Ground and New tiles 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;
  }
}
