/* workspace.css - tool column, drawing stage, action column */

.app {
  flex: 1;
  min-height: 0;
  display: grid;
    grid-template-columns: 132px 1fr 140px;
  grid-template-rows: 1fr;
  grid-template-areas: "left stage right"
}

/* left tools */
.left {
  grid-area: left;
  background: var(--lime-soft);
  border-right: 3px solid var(--ink);
  padding: 14px 12px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--lime-deep) transparent
}

#tip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9999;
  pointer-events: none;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .08s
}
#tip.show { opacity: 1 }

.group {
  display: grid;
  grid-template-columns: repeat(2, 40px);
  gap: 10px;
  justify-content: center
}

.rule {
  height: 0;
  border-top: 2px dashed var(--lime-deep);
  margin: 14px 14px
}

.tool {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 2px solid var(--ink);
  background: var(--cream);
  display: grid;
  place-items: center;
  padding: 0;
  box-shadow: 0 2px 0 var(--ink);
  position: relative
}

.tool svg {
  width: 22px;
  height: 22px;
  fill: var(--ink);
  stroke: var(--ink)
}

.tool.shape svg {
  fill: none;
  stroke-width: 2.4;
  stroke-linejoin: round;
  stroke-linecap: round
}

.tool:hover {
  background: #f1f9d6
}

.tool:active {
  transform: translateY(2px);
  box-shadow: none
}

.tool.on {
  background: var(--lime);
  box-shadow: 0 2px 0 var(--ink), 0 0 0 3px var(--lime-soft), 0 0 0 5px var(--ink)
}

/* stage */
.stage {
  grid-area: stage;
  position: relative;
  overflow: hidden;
  background: var(--stage)
}

.scroll {
  position: absolute;
  inset: 0;
  overflow: auto;
  scrollbar-width: auto;
  scrollbar-color: var(--lime-deep) var(--lime-soft)
}

.scroll::-webkit-scrollbar {
  width: 14px;
  height: 14px
}

.scroll::-webkit-scrollbar-track {
  background: var(--lime-soft)
}

.scroll::-webkit-scrollbar-thumb {
  background: var(--lime-deep);
  border: 3px solid var(--lime-soft);
  border-radius: 99px
}

.scroll::-webkit-scrollbar-thumb:hover {
  background: var(--brand-dk)
}

.scroll::-webkit-scrollbar-corner {
  background: var(--lime-soft)
}

.scroll {
  display: flex
}

.sizer {
  position: relative;
  flex: none;
  margin: auto
}

.board {
  box-shadow: 0 2px 10px rgba(0, 0, 0, .25)
}

.page-h {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 2px solid var(--ink);
  box-sizing: border-box;
  touch-action: none;
  z-index: 3;
  opacity: 0;
  transition: opacity .12s
}

.page-h.near,
.page-h.drag {
  opacity: 1
}

.page-h:hover {
  background: var(--lime)
}

.ph-e,
.ph-w {
  cursor: ew-resize
}

.ph-n,
.ph-s {
  cursor: ns-resize
}

.ph-nw,
.ph-se {
  cursor: nwse-resize
}

.ph-ne,
.ph-sw {
  cursor: nesw-resize
}

.board {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  background: #fff
}

.board canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  border-radius: 3px
}

.coords {
  position: absolute;
  left: 14px;
  bottom: 10px;
  background: var(--ink);
  color: var(--lime);
  font-size: 13px;
  font-weight: 500;
  padding: 3px 12px;
  border-radius: 99px
}

/* right actions */
.right {
  grid-area: right;
  background: var(--lime-soft);
  border-left: 3px solid var(--ink);
    padding: 12px 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px
}

.right .rule {
  width: 44px;
  margin: 4px 0
}

.act {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  border: 2px solid var(--ink);
  background: var(--cream);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  padding: 0;
  position: relative
}

.act svg {
  width: 28px;
  height: 28px;
  fill: var(--ink)
}

.act:hover {
  background: #f1f9d6
}

.act:active {
  transform: translateY(3px);
  box-shadow: none
}

.act.danger:hover {
  background: #ffd9cf
}

.text-wrap {
  position: absolute;
  z-index: 5;
  padding: 6px;
  outline: 1px dashed var(--ink);
  cursor: move;
  box-sizing: content-box
}

.text-box {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  caret-color: var(--ink);
  cursor: text
}

.text-guide {
  position: absolute;
  outline: 1px dashed var(--ink);
  pointer-events: none;
  z-index: 4
}

.text-h {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 50%;
  box-sizing: border-box;
  touch-action: none
}

.text-h.h-nw {
  left: -11px;
  top: -11px;
  cursor: nwse-resize
}

.text-h.h-n {
  left: calc(50% - 6px);
  top: -11px;
  cursor: ns-resize
}

.text-h.h-ne {
  right: -11px;
  top: -11px;
  cursor: nesw-resize
}

.text-h.h-e {
  right: -11px;
  top: calc(50% - 6px);
  cursor: ew-resize
}

.text-h.h-se {
  right: -11px;
  bottom: -11px;
  cursor: nwse-resize
}

.text-h.h-s {
  left: calc(50% - 6px);
  bottom: -11px;
  cursor: ns-resize
}

.text-h.h-sw {
  left: -11px;
  bottom: -11px;
  cursor: nesw-resize
}

.text-h.h-w {
  left: -11px;
  top: calc(50% - 6px);
  cursor: ew-resize
}

.text-h:hover {
  background: var(--lime)
}

/* editable shapes */
.board canvas.shape-ov {
  pointer-events: none;
  cursor: default
}

.shape-sel {
  position: absolute;
  border: 1px dashed var(--ink);
  box-sizing: border-box;
  cursor: move;
  z-index: 5;
  touch-action: none
}

.shape-rot {
  position: absolute;
  left: calc(50% - 6px);
  top: -32px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--lime);
  border: 2px solid var(--ink);
  box-sizing: border-box;
  cursor: grab;
  touch-action: none
}

.shape-rot::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 8px;
  width: 2px;
  height: 20px;
  background: var(--ink);
  pointer-events: none
}


/* selection */
.shape-sel.sel-ants {
  outline: 1px dashed #fff;
  outline-offset: -1px
}

.shape-sel canvas.sel-pv {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  cursor: move;
  border-radius: 0
}

/* symmetry guide (on screen only, never saved) */
#symGuide{position:absolute;inset:0;pointer-events:none;z-index:2}
#symGuide i{position:absolute;border:0 dashed rgba(30,30,30,.45)}
#symGuide .sg-v{left:50%;top:0;height:100%;border-left-width:2px!important}
#symGuide .sg-h{top:50%;left:0;width:100%;border-top-width:2px!important}

.cp-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.cp-grid button{border:2px solid var(--ink);background:#fff;border-radius:14px;padding:12px 4px;font-weight:600;font-size:14px;box-shadow:0 2px 0 var(--ink)}
.cp-grid button:hover{background:var(--lime)}
.cp-grid b{display:block;font-size:30px;margin-bottom:4px}

/* flyout lists (Select, Shapes) */
.fly{display:contents}
.fly-btn::after{content:"";position:absolute;right:3px;bottom:3px;border:3px solid transparent;border-bottom-color:var(--ink);border-right-color:var(--ink)}
.fly-panel{display:none;position:fixed;z-index:9998;grid-template-columns:repeat(4,40px);gap:8px;padding:10px;background:var(--cream);border:2px solid var(--ink);border-radius:14px;box-shadow:var(--shadow);max-height:calc(100vh - 12px);overflow-y:auto}
.fly-panel.two{grid-template-columns:repeat(2,40px)}
.fly-panel.open{display:grid}
.tool.act2 svg{stroke:none}
.tool.danger:hover{background:#ffd9cf}

/* brush / mirror lists */
.fly-panel.list{grid-template-columns:1fr;width:290px;gap:2px;padding:6px}
.bs-item{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;padding:8px 12px;border:0;border-radius:8px;background:none;font-size:14px;text-align:left}
.bs-item:hover{background:var(--lime-soft)}
.bs-item.on{background:var(--lime);font-weight:600}
.bs-pv{width:150px;height:30px;flex:none}
.tool:disabled{opacity:.35;cursor:default;box-shadow:none}
.slot.rb{height:auto;min-height:38px;justify-content:center;padding:6px;font-size:12px;text-align:center}

/* circle canvas */
body.circle .board,
body.circle .board canvas{border-radius:50%}
body.circle .page-h{display:none}

/* right bar buttons */
.slot.rb{position:relative}
.slot.fs{margin-top:auto}
.th-sw{width:22px;height:22px;border-radius:50%;border:2px solid var(--ink);flex:none}

/* themes (header stays green) */
body.th-crayon{--lime:#ff9f1c;--lime-deep:#e07b00;--lime-soft:#fff1d6;--cream:#fffaf0;--stage:#d9a066}
body.th-crayon .group .tool:nth-child(4n+1){background:#ffd6d6}
body.th-crayon .group .tool:nth-child(4n+2){background:#fff0b3}
body.th-crayon .group .tool:nth-child(4n+3){background:#cfeccf}
body.th-crayon .group .tool:nth-child(4n){background:#cfe3ff}

body.th-candy{--lime:#ff8fc8;--lime-deep:#e45aa7;--lime-soft:#ffe3f1;--cream:#fff7fb;--stage:#d9f5ea}
body.th-candy .tool,body.th-candy .slot,body.th-candy .size{border-radius:50%}
body.th-candy .slot{border-radius:20px}

body.th-space{--lime:#7df9ff;--lime-deep:#7a5cff;--lime-soft:#1c2150;--cream:#e6eaff;--stage:#0a0d2b}
body.th-space .tool:hover,body.th-space .tool.on{box-shadow:0 0 12px #7df9ff}

body.th-ocean{--lime:#4dd0e1;--lime-deep:#0097a7;--lime-soft:#d8f3f8;--cream:#f3fcfd;--stage:#a7dff0}

body.th-sticker{--lime:#ffe14d;--lime-deep:#ff4d6d;--lime-soft:#ffffff;--cream:#ffffff;--stage:#cfe8ff}
body.th-sticker .tool:hover,body.th-sticker .slot:hover{transform:rotate(-6deg) scale(1.08)}

body.th-sunset{--lime:#ff7b54;--lime-deep:#c2410c;--lime-soft:#ffe8d6;--cream:#fffaf5;--stage:#f9c784}

/* copy to all sections button */
.one-copy{position:absolute;top:12px;left:50%;transform:translateX(-50%);z-index:6;padding:8px 18px;border:2px solid var(--ink);border-radius:99px;background:var(--lime);font-weight:700;font-size:14px;box-shadow:var(--shadow)}
.one-copy[hidden]{display:none}
.one-copy:active{transform:translateX(-50%) translateY(2px);box-shadow:none}

/* brush size in the left bar */
.left .sizes{grid-template-columns:repeat(3,28px);gap:8px}
.left .size{width:28px;height:28px;border-radius:9px}
.size-row{display:flex;align-items:center;gap:6px;margin-top:10px}
.size-row input{flex:1;min-width:0;accent-color:var(--lime-deep)}
.size-pv{width:30px;height:30px;flex:none;display:grid;place-items:center}
.size-pv i{display:block;border-radius:50%;background:var(--ink)}

/* opacity, gradient, eyedropper, timelapse */
.slot[hidden]{display:none}
.fx-box{width:100%;display:flex;flex-direction:column;gap:8px;margin-top:4px}
.op-row{display:flex;align-items:center;justify-content:space-between;gap:6px;font-size:12px;font-weight:600}
.op-chip{display:block;width:26px;height:20px;border:2px solid var(--ink);border-radius:6px;overflow:hidden;background:conic-gradient(#ccc 25%,#fff 0 50%,#ccc 0 75%,#fff 0) 0 0/8px 8px}
.op-chip i{display:block;width:100%;height:100%}
#opRange{width:100%;accent-color:var(--lime-deep)}
#eyeBub{position:fixed;display:none;width:38px;height:38px;border-radius:50%;border:3px solid var(--ink);box-shadow:var(--shadow);pointer-events:none;z-index:9997}
.tl-box{width:min(740px,94vw)}
.tl-box canvas{display:block;width:100%;height:auto;max-height:55vh;object-fit:contain;background:#fff;border:2px solid var(--ink);border-radius:10px}
.tl-box input[type=range]{height:auto;border:0;padding:0;margin:10px 0 6px;accent-color:var(--lime-deep)}
.tl-box select{width:auto;height:36px}
.tl-row{display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:flex-end}
.tl-row .save:disabled{opacity:.5}

/* opacity in the left bar */
.op-box{width:100%;display:flex;flex-direction:column;gap:6px}