/* canvas.css — Public pixel canvas: left tool strip + contextual options, the
   256x384-at-2x board beside it, and colour/palette/actions below. */

.canvas-page-layout { display: flex; flex-direction: column; align-items: center; }

/* ===== STAGE: toolbar | board ===== */
.canvas-stage { display: flex; align-items: flex-start; gap: 4px; max-width: 100%; margin-bottom: 8px; }

.canvas-toolbar { flex: 0 0 auto; width: 58px; display: flex; flex-direction: column; gap: 5px; }
.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.tool-btn {
  display: flex; align-items: center; justify-content: center; padding: 3px;
  background: #c0c0c0; border: 2px solid; border-color: #dfdfdf #404040 #404040 #dfdfdf; cursor: pointer;
}
.tool-btn.active, .tool-btn:active { border-color: #404040 #dfdfdf #dfdfdf #404040; background: #a0a0a0; }
.tool-ico { display: block; width: 18px; height: 18px; fill: #000; shape-rendering: crispEdges; }

/* Contextual tool-options box — swaps its contents with the selected tool. */
.tool-options {
  background: #c0c0c0; border: 2px solid; border-color: #dfdfdf #404040 #404040 #dfdfdf;
  padding: 5px; display: flex; flex-direction: column; gap: 6px; min-height: 30px;
}
.tool-options .opt-group { display: flex; align-items: center; gap: 3px; }
.tool-options .opt-col { flex-direction: column; align-items: flex-start; }
.tool-options .opt-wrap { flex-wrap: wrap; }
.tool-options .row-inline { display: flex; align-items: center; gap: 3px; }
/* Vertical sliders (Size, Pixel scale) with a tick strip — one tick per level. */
.tool-options .opt-slider { align-items: center; gap: 4px; }
.vslider-wrap { display: flex; align-items: stretch; justify-content: center; gap: 3px; }
.vslider {
  writing-mode: vertical-lr; direction: rtl;
  -webkit-appearance: slider-vertical; appearance: slider-vertical;
  width: 18px; height: 116px; margin: 0; cursor: ns-resize;
}
.vslider-ticks { display: flex; flex-direction: column; justify-content: space-between; padding: 6px 0; }
.vslider-ticks i { display: block; width: 5px; height: 1px; background: #606060; }
.vslider-val { align-self: center; }

/* ===== BOARD ===== */
.canvas-container {
  position: relative; background: #fff; border: 2px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080; padding: 2px; line-height: 0; max-width: 100%;
}
#public-canvas { display: block; width: 512px; max-width: 100%; height: auto; background: #fff; image-rendering: pixelated; cursor: crosshair; }
.grid-overlay { position: absolute; top: 2px; left: 2px; width: 512px; height: 384px; image-rendering: pixelated; pointer-events: none; }

/* ===== CONTROLS (below): colour + presets | actions ===== */
.canvas-controls {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; width: 100%;
  padding: 8px; background: #c0c0c0; border: 2px solid; border-color: #dfdfdf #404040 #404040 #dfdfdf;
}
.canvas-left { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.canvas-color { display: flex; gap: 3px; }
#color-picker { cursor: crosshair; border: 1px solid #808080; display: block; }
#hue-slider { cursor: ns-resize; border: 1px solid #808080; display: block; }

.canvas-swatch-row { display: flex; align-items: center; gap: 8px; }
.swatch-box { position: relative; width: 40px; height: 40px; padding: 0; background: none; border: none; cursor: pointer; flex: 0 0 auto; }
.swatch-box .swatch { position: absolute; width: 26px; height: 26px; border: 1px solid #000; box-shadow: 0 0 0 1px #fff; }
.swatch-box .swatch-primary { left: 0; top: 0; z-index: 2; }
.swatch-box .swatch-secondary { right: 0; bottom: 0; z-index: 1; }

.hex-row { display: flex; align-items: center; gap: 2px; font-family: regular; font-size: var(--font-body); }
.hex-hash { color: #404040; }
.hex-input { width: 56px; font-family: regular; font-size: var(--font-body); padding: 2px 3px; border: 1px solid #808080; background: #fff; text-transform: uppercase; outline: none; cursor: text; }

/* Preset palette (MS Paint colours), 2 rows of 14 below the board. */
.preset-palette { display: grid; grid-template-columns: repeat(14, 1fr); gap: 2px; }
.preset { width: 16px; height: 16px; padding: 0; border: 1px solid #707070; cursor: pointer; }
.preset:hover { outline: 1px solid #000; }

.canvas-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.canvas-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

.opt-lbl { font-family: regular; font-size: var(--font-body); color: #000; }
.opt-btn, .canvas-action-btn {
  padding: 3px 7px; background: #c0c0c0; border: 2px solid; border-color: #dfdfdf #404040 #404040 #dfdfdf;
  cursor: pointer; font-family: regular; font-size: var(--font-body); color: #000;
}
.opt-btn.active, .opt-btn:active, .canvas-action-btn:active { border-color: #404040 #dfdfdf #dfdfdf #404040; background: #a0a0a0; }
