/* laotrace.css — laoTrace-specific styles. Tokens, top bar, buttons and the toast come from lao.css.
   Colours below belong to the drawing, not the interface: the selected path, the junction nodes, the paper. */
:root {
  --select: #2f54c9;
  --junction: #c03a7a;
  --canvas: #f2f2f2;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --select: #8aa2ff;
    --junction: #f07ab3;
    --canvas: #0d0d0d;
  }
}
:root[data-theme='dark'] {
  --select: #8aa2ff;
  --junction: #f07ab3;
  --canvas: #0d0d0d;
}
input[type='checkbox'] {
  accent-color: var(--accent);
}
.lao-btn {
  position: relative;
}
.lao-btn.icon {
  justify-content: center;
  padding: 6px 10px;
}
html,
body {
  height: 100%;
}
body {
  padding-left: max(0px, env(safe-area-inset-left, 0px));
  padding-right: max(0px, env(safe-area-inset-right, 0px));
}
.app {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
}
.lao-btn input[type='file'] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.lao-btn {
  position: relative;
}
.work {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  min-height: 0;
}
.side {
  background: var(--surface);
  overflow: auto;
  min-height: 0;
  border-left: 1px solid var(--line);
}
.side > details {
  border-top: 1px solid var(--line);
}
.side > details:first-child {
  border-top: 0;
}
.side > details > summary {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  padding: 12px 14px;
}
.side .filelist {
  max-height: 34vh;
  overflow: auto;
}
.side .status {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 3px;
  padding: 0 14px 12px;
  border-top: 0;
  background: transparent;
  font-size: 12px;
}
.side .status span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.vopts {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
}
.vopts label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--muted);
}
.toolcol {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  align-items: center;
}
.toolcol {
  overflow-y: auto;
  min-height: 0;
}
.shapetools {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}
.toolcol .shapebtn {
  font-size: 12px;
  padding: 9px 6px;
}
.toolcol button {
  box-sizing: border-box;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  justify-content: center;
}
.vhint {
  position: absolute;
  left: 10px;
  bottom: 8px;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
  text-shadow:
    0 0 3px var(--canvas),
    0 0 3px var(--canvas);
}
.field.fmtf {
  grid-template-columns: 1fr auto;
}
.field .fmtval {
  white-space: nowrap;
  text-align: right;
  font-family: var(--f-mono);
  font-size: 12px;
}
.filelist {
  list-style: none;
  margin: 0;
  padding: 0 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.filelist li button {
  width: 100%;
  justify-content: space-between;
  text-align: left;
  border-color: transparent;
  background: transparent;
  padding: 7px 8px;
}
.filelist li button[aria-current='true'] {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.filelist .fname {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.pathlist li {
  display: flex;
  gap: 4px;
  align-items: stretch;
}
.pathlist li .mv {
  width: auto;
  flex: none;
  justify-content: center;
  padding: 7px 10px;
  border-color: var(--line);
}
.chip {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
  white-space: nowrap;
}
.chip.ok {
  color: var(--accent);
  border-color: var(--accent);
}
.chip.bad {
  color: var(--warn);
  border-color: var(--warn);
}
.chip.edit {
  color: var(--junction);
  border-color: var(--junction);
}
.stage {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: 1fr;
  min-height: 0;
  min-width: 0;
}
.stage .toolcol {
  grid-column: 1;
  grid-row: 1;
}
.stage .viewport {
  grid-column: 2;
  grid-row: 1;
}
.stage.tools-right {
  grid-template-columns: minmax(0, 1fr) auto;
}
.stage.tools-right .toolcol {
  grid-column: 2;
  border-right: 0;
  border-left: 1px solid var(--line);
}
.stage.tools-right .viewport {
  grid-column: 1;
}
.toolcol .sideflip {
  margin-bottom: 32px;
}
.flash {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--surface);
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 5;
}
.flash.on {
  opacity: 0.92;
  transition-duration: 0.1s;
}
.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.tools .sep {
  width: 1px;
  height: 22px;
  background: var(--line);
  margin: 0 4px;
}
.tools label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--muted);
}
.viewport {
  position: relative;
  min-height: 0;
  background: var(--canvas);
  overflow: hidden;
}
canvas#view {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  display: block;
}
.overlay-msg {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: 360px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 18px;
}
[hidden] {
  display: none !important;
}
.placenow {
  position: absolute;
  left: 50%;
  top: calc(50% + 70px);
  transform: translateX(-50%);
}
.placebar {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  z-index: 4;
}
.placebar select {
  font: inherit;
  font-size: 13px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--raise);
  color: var(--ink);
}
.banner {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--warn);
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 10px;
}
.status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 7px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.status b {
  color: var(--ink);
  font-weight: 500;
}
details {
  border-top: 1px solid var(--line);
}
details:first-of-type {
  border-top: 0;
}
summary {
  cursor: pointer;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 13px;
  list-style: none;
  display: flex;
  justify-content: space-between;
}
summary::after {
  content: '+';
  color: var(--muted);
  font-family: var(--f-mono);
}
details[open] summary::after {
  content: '–';
}
.group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 14px 14px;
}
.field {
  display: grid;
  grid-template-columns: 1fr 74px;
  gap: 4px 8px;
  align-items: center;
}
.field > label {
  font-size: 13px;
}
.field .hint {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
  margin-top: -2px;
}
.field input[type='range'] {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--accent);
  margin: 0;
}
.field input[type='number'],
.field select {
  width: 100%;
  font: inherit;
  font-family: var(--f-mono);
  font-size: 12px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--raise);
  color: var(--ink);
}
.field.wide {
  grid-template-columns: 1fr;
}
.field.wide select,
.field.wide input[type='text'],
textarea {
  width: 100%;
  font: inherit;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--raise);
  color: var(--ink);
}
textarea {
  min-height: 70px;
  resize: vertical;
  font-family: var(--f-mono);
  font-size: 12px;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.check input {
  accent-color: var(--accent);
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.small {
  font-size: 12px;
  color: var(--muted);
}
@media (max-width: 900px) {
  html,
  body {
    height: auto;
  }
  .app {
    height: auto;
  }
  .work {
    grid-template-columns: minmax(0, 1fr);
  }
  .stage {
    order: 1;
  }
  .viewport {
    height: 62svh;
    min-height: 320px;
  }
  .side {
    order: 2;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .side .filelist {
    max-height: none;
  }
  summary,
  .group {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  .filelist {
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
/* the "move toolbar" button keeps its own, non-square shape */
.toolcol .sideflip {
  width: auto;
  height: auto;
  min-height: 28px;
  padding: 9px;
}
