/* laopalette.css — laoPalette-specific styles. Tokens, buttons, segmented controls and the toast come from lao.css. */
.app {
  max-width: 1212px;
  margin: 22px auto 56px;
  padding-inline: 16px;
  display: grid;
  gap: 22px 32px;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr);
  align-items: start;
}
.viewbar {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.viewbar::-webkit-scrollbar {
  display: none;
}
.viewbar button {
  white-space: nowrap;
}
.viewbar .lao-seg {
  flex: none;
}
.lao-seg button:focus-visible {
  outline-offset: -3px;
}
.src {
  font: 400 12px var(--f-mono);
  color: var(--muted);
  overflow-wrap: anywhere;
  min-width: 0;
  margin-top: 8px;
}
.stage {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
  line-height: 0;
  min-height: 160px;
}
.tools {
  display: flex;
  flex: none;
  gap: 8px;
}
.tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tool .ti {
  display: none;
  flex: none;
}
.tool[data-crop='false'] .ti-full,
.tool[data-crop='true'] .ti-sel {
  display: none !important;
}
.tool {
  border: 1px solid var(--line-strong);
  background: var(--raise);
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
}
.tool[aria-pressed='true'] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.stage.selecting {
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.sel {
  position: absolute;
  pointer-events: none;
  border: 2px solid #fff;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 0 0 9999px rgba(0, 0, 0, 0.45);
}
.stage.over {
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
}
.stage canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  margin-inline: auto;
  max-height: calc(100vh - 240px);
  max-height: calc(100svh - 240px);
}
.busy {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  line-height: 1.4;
  background: color-mix(in srgb, var(--raise) 82%, transparent);
  font-weight: 500;
}
.imgrow {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.imgrow .stage {
  flex: 1 1 0;
  min-width: 0;
}
.strip {
  display: flex;
  flex-direction: column-reverse;
  flex: none;
  width: 56px;
  min-height: 160px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}
.strip .seg {
  flex: 1 1 0;
  min-height: 14px;
  min-width: 0;
  width: 100%;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.strip .seg:focus-visible {
  outline-offset: -4px;
}
/* Basic mode: a tapped band is selected (light grey edge) and the Vividness slider then acts on that color alone. */
.strip .seg.vsel {
  box-shadow:
    inset 0 0 0 3px #e4e6e7,
    inset 0 0 0 4px rgba(0, 0, 0, 0.28);
}
.strip .seg.vloc::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: #e4e6e7;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.strip .seg {
  position: relative;
}
/* Panel layout: main sliders, a "this color" card that replaces the global sliders, Sketch-only and Advanced groups. */
.sliders {
  display: grid;
  gap: 20px;
}
.panel.picked .sliders .gl {
  display: none;
}
.chead {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cSws {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 45%;
}
.cSws i {
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  box-shadow:
    0 0 0 2px #e4e6e7,
    0 0 0 3px rgba(0, 0, 0, 0.3);
}
.cSws.many i {
  width: 20px;
  height: 20px;
}
.chead .cHex {
  flex: 1 1 auto;
  min-width: 0;
  font: 500 14px var(--f-mono);
  letter-spacing: 0.02em;
}
.sketchctl {
  display: none;
  gap: 20px;
}
.app.sk .sketchctl {
  display: grid;
}
.advsum {
  margin-left: 8px;
  font-weight: 400;
  font-size: 13px;
  color: var(--muted);
}
.advbody {
  display: grid;
  gap: 20px;
  padding: 4px 12px 14px;
}
/* Loop buttons sit to the left of their slider. */
.srow {
  display: flex;
  align-items: center;
  gap: 10px;
}
.srow input[type='range'] {
  flex: 1 1 auto;
  min-width: 0;
}
.fine {
  display: grid;
  gap: 14px;
}
.fine[hidden] {
  display: none;
}
.fine .lao-btn {
  justify-self: start;
}
/* Tap the palette strip: it takes the place of the image, one band per color; tap it again to go back. */
.imgrow.pal .stage {
  display: none;
}
.imgrow.pal .strip {
  flex: 1 1 0;
  width: auto;
  border-radius: 10px;
}
/* Sketch view: the palette as rectangles in the image area (drawMosaic). */

/* Palette browser: replaces the image area. */
.panel.browsing > :not(.load):not(.browse):not(.applied):not(.pairctl) {
  display: none;
}
.card.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.browse {
  display: grid;
  gap: 12px;
}
.bbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}
.bbar input {
  flex: 1 1 180px;
  min-width: 0;
  border: 1px solid var(--line-strong);
  background: var(--raise);
  color: var(--ink);
  border-radius: 6px;
  padding: 7px 10px;
  font: inherit;
}
.bgrid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
#bsort button {
  padding: 7px 10px;
  white-space: nowrap;
}
.fams {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.fam {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  background: var(--raise);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 11px 4px 6px;
  cursor: pointer;
  font-size: 13.5px;
}
.fam i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: block;
}
.fam[aria-pressed='true'] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.bgrid h3 {
  grid-column: 1 / -1;
  margin: 10px 0 0;
  font: 500 13px var(--f-mono);
  color: var(--muted);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.bgrid h3::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--line);
}
.bgrid h3:first-child {
  margin-top: 0;
}
.card {
  display: grid;
  gap: 6px;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--raise);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  min-width: 0;
}
.card:focus-visible {
  outline-offset: 2px;
}
.card .bars {
  display: flex;
  height: 64px;
  border-radius: 5px;
  overflow: hidden;
}
.card .bars i {
  display: block;
  min-width: 0;
}
.card b {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card small {
  color: var(--muted);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#browseBtn {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
#browseBtn[aria-pressed='true'] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.panel {
  display: grid;
  gap: 20px;
  min-width: 0;
}
.load {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
}
.ctl {
  display: grid;
  gap: 6px;
}
.ctl label,
.ctl .lab {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-weight: 500;
}
.lh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.lo {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}
.nm {
  border: 0;
  background: none;
  padding: 2px 0;
  font: inherit;
  font-weight: 500;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.nm:hover {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.play {
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--raise);
  color: var(--ink);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}
.play .ic-pause {
  display: none;
}
.play[aria-pressed='true'] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.play[aria-pressed='true'] .ic-play {
  display: none;
}
.play[aria-pressed='true'] .ic-pause {
  display: block;
}
.applied {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
}
/* Full-screen palette with Valspar: each band carries the paint name, and is tall enough for one line of text. */
.seg .lb {
  display: none;
}
/* Valspar, palette full screen: two columns. Left, the Valspar colors with their names; right, the real palette, set apart by a gap. */
.seg.named {
  display: flex;
}
.seg .vl {
  flex: 1 1 auto;
  min-width: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  padding: 0 14px;
  text-align: left;
  font: 500 13.5px/1.2 var(--f-ui);
}
.imgrow.pal .seg.named {
  min-height: 30px;
}
.imgrow.pal .seg.named .lb {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex: 1 1 0;
  min-width: 0;
}
.seg .rl {
  display: none;
}
.imgrow.pal .seg.named .rl {
  display: block;
  flex: none;
  width: 56px;
  margin-left: 10px;
}
.imgrow.pal .strip.vs {
  border: 0;
  background: none;
  overflow: visible;
}
/* Both columns are rounded boxes of their own, like the palette strip beside the image. */
.imgrow.pal .strip.vs .seg.named:last-child .vl,
.imgrow.pal .strip.vs .seg.named:last-child .rl {
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
}
.imgrow.pal .strip.vs .seg.named:first-child .vl,
.imgrow.pal .strip.vs .seg.named:first-child .rl {
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
}
.seg .lb b {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.seg .lb i {
  font: 400 12px var(--f-mono);
  font-style: normal;
  opacity: 0.85;
  white-space: nowrap;
}
/* Pairing view: the real colors on the left, the selected palette on the right, a line between each pair. */
.pairbox {
  display: none;
  flex: none;
  width: 250px;
  position: relative;
  gap: 44px;
  align-items: stretch;
}
.imgrow.pair .strip {
  display: none;
}
/* the sketch shows the result */
.imgrow.pair .pairbox {
  display: flex;
}
.pcol {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column-reverse;
  border-radius: 10px;
  overflow: hidden;
}
.pb {
  position: relative;
  border: 0;
  padding: 0;
  min-height: 30px;
  cursor: pointer;
}
.pb.sel,
.pb.over {
  outline: 3px solid var(--ink);
  outline-offset: -3px;
}
.pw {
  position: absolute;
  right: 10px;
  top: 50%;
  width: 24px;
  height: 24px;
  margin-top: -12px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.pw.auto {
  border-style: dashed;
}
.pchips {
  width: 70px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pc2 {
  flex: 1 1 0;
  min-height: 26px;
  border: 0;
  border-radius: 10px;
  cursor: grab;
  touch-action: none;
  padding: 0;
}
.pc2.sel {
  box-shadow:
    0 0 0 3px var(--raise),
    0 0 0 6px var(--ink);
}
.imgrow.pair .strip {
  cursor: default;
}
.imgrow.pair .strip .seg {
  cursor: default;
  pointer-events: none;
}
.plines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.pghost {
  position: fixed;
  width: 44px;
  height: 30px;
  border-radius: 10px;
  pointer-events: none;
  z-index: 50;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.sel.staged::after {
  content: 'Tap to apply · drag to move';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font: 500 12px/1.2 var(--f-ui);
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  padding: 5px 9px;
  border-radius: 999px;
  white-space: nowrap;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stage.selecting.hasbox {
  cursor: move;
}
.ctl output {
  font: 500 14px var(--f-mono);
  font-variant-numeric: tabular-nums;
}
input[type='range'] {
  width: 100%;
  margin: 4px 0;
  accent-color: var(--accent);
}
.lao-btn.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
}
.fname {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--raise);
  padding-right: 10px;
  margin-right: 4px;
}
.fname:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.fname input {
  width: 11ch;
  min-width: 0;
  flex: 1 1 auto;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 400 13px var(--f-mono);
  padding: 9px 0 9px 10px;
  outline: none;
  text-align: right;
}
.fname span {
  font: 400 13px var(--f-mono);
  color: var(--muted);
  white-space: nowrap;
}
.gapmode {
  padding: 3px 10px;
  font-weight: 500;
}
.mmrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.mmrow .fname {
  padding-left: 10px;
  gap: 8px;
}
.mmrow .fname input {
  width: 6ch;
  padding-left: 0;
}
.wts {
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.wts .wcol {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.wts .plainb,
.wts #plain {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  padding: 10px 8px;
  white-space: nowrap;
}
.ctl .lbl {
  font-weight: 500;
}
.ctl .lao-seg {
  width: fit-content;
  max-width: 100%;
}
.ctl .lao-seg button {
  padding: 7px 12px;
}
input[type='range']:disabled {
  opacity: 0.4;
}
.tick {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  cursor: pointer;
  width: fit-content;
}
.tick input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}
.notice {
  margin: 0;
  padding: 9px 12px;
  border-radius: 6px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 13.5px;
}
details {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--raise);
}
summary {
  cursor: pointer;
  padding: 9px 12px;
  font-weight: 500;
}
.outwrap {
  padding: 0 12px 12px;
  display: grid;
  gap: 10px;
}
pre {
  margin: 0;
  padding: 10px;
  max-height: 260px;
  overflow: auto;
  background: var(--surface);
  border-radius: 4px;
  font: 400 12px/1.5 var(--f-mono);
  user-select: all;
}
/* The banner adapts to the width of the image column: labels turn into icons, then padding tightens. */
.imgsec {
  container-type: inline-size;
  min-width: 0;
}
.tool .rv {
  display: none;
}
@container (max-width: 560px) {
  .imgrow.pair {
    flex-direction: column;
  }
  .imgrow.pair .stage {
    flex: none;
  }
  .imgrow.pair .pairbox {
    width: auto;
    height: 280px;
  }
}
.pairctl {
  display: grid;
  gap: 10px;
}
.pairctl[hidden] {
  display: none;
}
.pairctl h4 {
  margin: 0;
  font: 500 13px var(--f-ui);
  opacity: 0.8;
}
@container (max-width: 640px) {
  .viewbar .lao-seg button {
    padding: 7px 10px;
    font-size: 13.5px;
  }
  .tool {
    padding: 7px 9px;
  }
  .tool .tl,
  .tool .rn {
    display: none;
  }
  .tool .ti {
    display: block;
  }
  .tool .rv {
    display: inline;
  }
}
@container (max-width: 420px) {
  .viewbar,
  .tools {
    gap: 4px;
  }
  .viewbar .lao-seg button {
    padding: 7px 6px;
    font-size: 12.5px;
  }
  .tool {
    padding: 7px 7px;
    font-size: 12.5px;
  }
}
@container (max-width: 350px) {
  .viewbar .lao-seg button {
    padding: 7px 4px;
    font-size: 12px;
  }
  .tool {
    padding: 7px 6px;
    font-size: 12px;
  }
}
@media (max-width: 860px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }
  .strip {
    width: 44px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .lao-seg button,
  .tool {
    transition: background-color 0.12s;
  }
}

/* Empty state: a large drop region with the three load buttons in the middle. */
.emptybox {
  display: none;
}
.app.empty .emptybox {
  flex: 1 1 0;
  min-width: 0;
  min-height: min(62vh, 560px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  border: 2px dashed var(--muted);
  border-radius: 14px;
  background: var(--raise);
  color: var(--ink);
}
.app.empty .emptybox.over {
  border-color: var(--ink);
  background: var(--accent-soft);
}
.emptybox p {
  margin: 0;
  font-size: 15px;
}
.emptybtns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}
.bigbtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 124px;
  height: 124px;
  border-radius: 14px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
}
.bigbtn:focus-within,
.bigbtn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.app.empty .stage,
.app.empty .strip,
.app.empty .pairbox,
.app.empty .src {
  display: none;
}
@media (max-width: 480px) {
  .bigbtn {
    width: 96px;
    height: 96px;
  }
}

/* selected states: soft grey for a current state, outline for an action */
.tool[aria-pressed='true'],
#browseBtn[aria-pressed='true'],
.play[aria-pressed='true'],
.fam[aria-pressed='true'] { background: var(--sel-bg); color: var(--ink); border-color: var(--sel-line); font-weight: 500; }
.bigbtn { background: var(--raise); color: var(--ink); border: 1.5px solid var(--ink); font-weight: 500; }

/* Top row: every control 36px tall; icon buttons 36px square */
.load { gap: 8px 5px; }
.load > .lao-btn { box-sizing: border-box; height: 36px; padding: 0 8px; min-width: 0; display: inline-flex; align-items: center; justify-content: center; }
.load > .lao-btn.icon,
.load > .lao-btn.primary { width: 36px; padding: 0; }
.load > #fmt { width: auto; min-width: 76px; padding: 0 10px; }
.load > #fmt { margin-left: auto; }

.radper { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
