/* Accounts, cloud jobs and shop templates (cloud.mjs) */
body:not(.is-owner) .owner-only {
  display: none !important;
}
.account-slot {
  display: contents;
}
.account-btn:has(.avatar) {
  padding: 5px 12px 5px 6px;
}
.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  background: #d1f36b;
  color: #19221a;
  font: 700 13px system-ui;
}
.avatar.big {
  width: 54px;
  height: 54px;
  font-size: 22px;
}
@media (max-width: 720px) {
  .account-btn:has(.avatar) {
    padding: 5px;
  }
}

.jobs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0 0 10px;
}
.modal-body .jobs-head:not(:first-child) {
  margin-top: 24px;
}
.jobs-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  margin: 0;
}
.jobs-head small {
  color: #91a0b3;
  font-size: 12px;
}
.job-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}
.job .job-actions button {
  margin-left: 0;
}
.job-thumb {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e1e6ed;
  flex-shrink: 0;
}

.signin-card {
  display: flex;
  gap: 14px;
  align-items: center;
  border: 1px solid #d9e6b8;
  background: #f6fbe8;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 4px;
}
.signin-card > .ico {
  width: 30px;
  height: 30px;
  color: #5d7a2a;
}
.signin-card strong {
  display: block;
  font-size: 15px;
}
.signin-card p {
  margin: 2px 0 0;
  font-size: 13px;
  color: #65758c;
  line-height: 1.6;
}
.signin-card button {
  margin-left: auto;
}
@media (max-width: 720px) {
  .signin-card {
    flex-wrap: wrap;
  }
  .signin-card button {
    width: 100%;
  }
}

.account-card {
  display: flex;
  gap: 14px;
  align-items: center;
}
.account-card strong {
  display: block;
  font-size: 17px;
}
.account-card small {
  display: block;
  color: #7c899b;
}
.owner-chip {
  display: inline-block;
  margin-top: 6px;
  background: #273449;
  color: #d1f36b;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 10px;
}
.account-points li {
  color: #65758c;
  font-size: 14px;
  line-height: 1.8;
}

.publish-card {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.publish-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #eef1f5;
  border: 1px solid #e1e6ed;
  border-radius: 10px;
  overflow: hidden;
  display: grid;
  place-items: center;
  margin-top: 10px;
}
.publish-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.publish-thumb img:not([src]) {
  display: none;
}
.publish-thumb span {
  position: absolute;
  font-size: 12px;
  color: #7c899b;
}
.publish-fields textarea {
  border: 1px solid #dce2ea;
  border-radius: 7px;
  padding: 8px 10px;
  color: #283449;
  width: 100%;
  font: inherit;
  font-size: 14px;
  resize: vertical;
}
@media (max-width: 720px) {
  .publish-card {
    grid-template-columns: 1fr;
  }
}

/* Machine presets and the laser job summary */
.preset-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #dfe4ea;
  border-radius: 9px;
  padding: 10px 12px;
  margin: 6px 0 10px;
}
.preset-card.active {
  border-color: #b9d77a;
  background: #f6fbe8;
}
.preset-card strong {
  display: block;
  font-size: 14px;
}
.preset-card small {
  display: block;
  color: #7c899b;
  font-size: 12px;
}
.preset-card button,
.preset-on {
  margin-left: auto;
  flex-shrink: 0;
}
.preset-on {
  font-size: 12px;
  font-weight: 700;
  color: #4b6a1c;
}
.job-summary {
  border: 1px solid #dfe5ee;
  border-radius: 10px;
  padding: 14px;
  margin: 4px 0 12px;
  background: #fafbfd;
}
.js-size {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.js-size small {
  display: block;
  color: #7c899b;
  font-size: 12px;
}
.js-size b {
  font: 700 22px system-ui;
  color: #1d2838;
}
.js-size span {
  margin-left: 4px;
  color: #7c899b;
  font-size: 13px;
}
.js-line {
  margin: 8px 0 0;
  font-size: 13px;
  color: #556274;
}
.js-line.ok {
  color: #3f6b1f;
}
.js-line.warn {
  color: #b84444;
  font-weight: 600;
}
.js-layers {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 13px;
}
.js-layers th,
.js-layers td {
  text-align: left;
  padding: 5px 6px;
  border-bottom: 1px solid #e8edf3;
  white-space: nowrap;
}
.js-layers th {
  color: #7c899b;
  font-weight: 600;
  font-size: 12px;
}
.js-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.js-cut {
  background: #d23c3c;
}
.js-engrave {
  background: #3d6fc4;
}
.js-fill {
  background: #2a2a2a;
}
.js-image {
  background: #2f9e6a;
}
@media (max-width: 720px) {
  .job-summary {
    overflow-x: auto;
  }
}

/* Engrave-only switch in the 2D panel */
.engrave-only .check {
  align-items: flex-start;
}
.engrave-only .check span b {
  display: block;
  font-size: 14px;
}
.engrave-only .check span small {
  display: block;
  color: #7c899b;
  font-size: 12px;
  line-height: 1.5;
}
.engrave-only.on {
  background: #f3f7ff;
}
.engrave-only .hint {
  margin-bottom: 0;
}

/* ก่อนตัด: the bed at true scale and the block settings */
.preview-host {
  width: 100%;
  height: 100%;
  overflow: auto;
  container-type: inline-size;
}
.preview-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 14px;
  padding: 70px 14px 70px;
  align-items: start;
}
/* Side by side whenever the work area is wide enough, whatever the window. */
@container (max-width: 560px) {
  .preview-wrap {
    grid-template-columns: 1fr;
  }
}
.preview-stage {
  min-width: 0;
  display: grid;
  place-items: center;
}
.preview-stage svg {
  width: 100%;
  max-height: calc(100dvh - 330px);
  min-height: 220px;
}
.preview-panel {
  background: #fff;
  border: 1px solid #e1e6ed;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 10px 28px #1b2a4012;
  font-size: 13px;
}
.preview-panel .sub-head {
  margin-top: 14px;
}
.pv-big {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.pv-big b {
  font: 800 40px/1 system-ui;
  color: #1d2838;
}
.pv-big span {
  font-size: 14px;
  color: #556274;
  font-weight: 600;
}
.pv-sub {
  margin: 6px 0 10px;
  color: #6b778a;
}
.pv-facts {
  margin: 0 0 8px;
}
.pv-facts div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid #eef1f5;
}
.pv-facts dt {
  color: #7c899b;
}
.pv-facts dd {
  margin: 0;
  font-weight: 600;
  color: #273449;
  text-align: right;
}
.pv-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.pv-row .field {
  flex: 1;
  margin-bottom: 10px;
}
.pv-row button {
  margin-bottom: 10px;
}
.pv-seg {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.pv-go {
  width: 100%;
  margin-top: 14px;
  min-height: 44px;
}
@media (max-width: 720px) {
  .preview-stage svg {
    max-height: 55vh;
  }
}

/* Photos: raster engraving or traced into lines */
.img-use {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}
.img-use button {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  white-space: normal;
  text-align: left;
  padding: 8px 10px;
}
.img-use button .ico {
  width: 18px;
  height: 18px;
}
.img-use b {
  font-size: 13px;
}
.img-use small {
  font-size: 11px;
  color: #7c899b;
  line-height: 1.35;
}
.trace-preview {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  border: 1px solid #e3e8ef;
  border-radius: 9px;
  background: repeating-conic-gradient(#f3f5f8 0 25%, #fff 0 50%) 0 0 / 14px 14px;
  margin: 10px 0 4px;
  overflow: hidden;
  font-size: 12px;
  color: #7c899b;
}
.trace-preview svg {
  width: 100%;
  height: 100%;
}

/* A part picked in the 3D view */
#pick-card {
  position: absolute;
  top: 64px;
  right: 18px;
  z-index: 3;
  max-width: calc(100% - 36px);
}
.pick-card {
  width: 300px;
  max-width: 100%;
  background: #fff;
  border: 1px solid #e3e7ee;
  border-top: 3px solid #e0408f;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 12px 30px #1b2a4022;
}
.pick-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pick-head b {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pick-head button {
  margin-left: auto;
  width: 30px;
  min-height: 30px;
  padding: 5px;
  border-color: transparent;
}
.pick-id {
  font: 700 12px system-ui;
  color: #e0408f;
}
.pick-size {
  margin: 6px 0 0;
  font-size: 13px;
  color: #3d4b60;
}
.pick-meta {
  margin: 2px 0 0;
  font-size: 12px;
  color: #8592a5;
}
.pick-dim {
  margin-top: 10px;
  padding: 9px 10px;
  background: #f6f8fb;
  border-radius: 9px;
}
.pick-dim label {
  display: block;
  font-size: 12.5px;
  color: #556274;
  margin-bottom: 6px;
}
.pick-dim-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.pick-dim-row input {
  width: 76px;
  border: 1px solid #dce2ea;
  border-radius: 7px;
  padding: 5px 7px;
  font: 14px system-ui;
}
.pick-dim-row > button {
  width: 30px;
  padding: 4px;
  font-size: 16px;
}
.pick-steps {
  display: inline-flex;
  gap: 3px;
  margin-left: auto;
}
.pick-steps button {
  min-width: 32px;
}
.pick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.cell-card .pick-head b {
  color: #c0306f;
}
.cell-size {
  font: 600 12px system-ui;
  color: #7c899b;
}
.cell-adds {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
  padding: 10px;
  border: 1px dashed #f0a6c8;
  border-radius: 10px;
  background: #fff7fb;
}
.cell-add {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  white-space: normal;
  text-align: left;
  padding: 7px 9px;
}
.cell-add b {
  font-size: 13px;
}
.cell-add small {
  font-size: 11px;
  color: #7c899b;
}
.pick-hidden {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #e3e7ee;
  border-radius: 20px;
  padding: 4px 6px 4px 12px;
  font-size: 13px;
  box-shadow: 0 6px 16px #1b2a4014;
}
@media (max-width: 720px) {
  #pick-card {
    top: auto;
    bottom: 70px;
    right: 10px;
    left: 10px;
  }
  .pick-card {
    width: auto;
  }
}

/* Where a Ruida job starts */
.start-pos {
  border: 1px solid #dfe5ee;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 8px 0 12px;
  background: #fff;
}
.start-pos .sub-head {
  margin-top: 0;
}
.start-modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.start-mode {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  white-space: normal;
  text-align: left;
  padding: 7px 9px;
  min-height: 0;
}
.start-mode b {
  font-size: 13px;
}
.start-mode small {
  font-size: 11px;
  color: #7c899b;
}
.anchor-row {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 12px;
}
.anchor-grid {
  display: grid;
  grid-template-columns: repeat(3, 28px);
  gap: 6px;
  padding: 8px;
  border: 1px solid #dfe5ee;
  border-radius: 10px;
  background: #f7f9fb;
  flex-shrink: 0;
}
.anchor-dot {
  width: 28px;
  height: 28px;
  min-height: 0;
  padding: 0;
  border-radius: 8px;
  border-color: transparent;
  background: transparent;
}
.anchor-dot i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b7c1ce;
}
.anchor-dot.on {
  background: #fde7f1;
  border-color: #e0408f;
}
.anchor-dot.on i {
  width: 12px;
  height: 12px;
  background: #e0408f;
}
.anchor-info p {
  margin: 8px 0 0;
  font-size: 13px;
  color: #556274;
}
.anchor-ref {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Gallery: shop templates */
.tpl-badge-shop {
  background: #273449;
  color: #d1f36b;
}
.tpl-shop-pic {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.tpl-shop-del {
  margin-top: 10px;
  color: #c35757;
  background: transparent;
  border-color: #f0d4d4;
}
.tpl-shop-del:hover {
  background: #fdf2f2;
}

/* Machine link (machine-link.mjs): the chip in the top bar, the connect
   window and the send box in the export window. Dot colours follow state. */
.link-chip {
  gap: 7px;
  white-space: nowrap;
}
/* Low specificity so the state colours below always win. */
:where(.link-chip, .link-status, .send-card b, .send-link) i {
  display: inline-block;
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #8a95a5;
}
.link-ready i,
.link-ready > i {
  background: #7ed957;
  box-shadow: 0 0 0 3px #7ed95733;
}
.link-sending i,
.link-sending > i,
.link-connecting i,
.link-connecting > i {
  background: #f2c14e;
  animation: link-blink 1s ease-in-out infinite;
}
.link-silent i,
.link-silent > i,
.link-lost i,
.link-lost > i,
.link-error i,
.link-error > i {
  background: #e06c6c;
}
@keyframes link-blink {
  50% {
    opacity: 0.35;
  }
}
@media (prefers-reduced-motion: reduce) {
  .link-chip i,
  .link-status > i,
  .send-card b i,
  .send-link i {
    animation: none !important;
  }
}
.link-status {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid #dfe5ee;
  border-radius: 10px;
  padding: 13px 14px;
  margin-bottom: 14px;
}
.link-status > i {
  flex: none;
  width: 12px;
  height: 12px;
  margin-top: 5px;
}
.link-status b {
  display: block;
  font-size: 16px;
}
.link-status small {
  color: #7c899b;
}
.link-status p {
  margin: 6px 0 0;
  font-size: 13px;
  color: #556377;
}
.link-steps {
  margin: 12px 0 8px;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.8;
  color: #3d4b60;
}
.send-card {
  display: flex;
  gap: 12px;
  align-items: center;
  border: 1px solid #dfe5ee;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 12px 0 4px;
  background: #f8fafc;
}
.send-card.link-ready {
  border-color: #b7dc8f;
  background: #f4faec;
}
.send-card b {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.send-card p {
  margin: 3px 0 0;
  font-size: 12px;
  color: #6b778a;
}
.send-card button {
  margin-left: auto;
  white-space: nowrap;
}
/* Buttons are display: inline-flex, which would beat the hidden attribute. */
#modal [hidden] {
  display: none !important;
}
.send-head {
  margin: 0 0 4px;
  font-size: 14px;
}
.send-link {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 12px;
  font-size: 13px;
  font-weight: 600;
}
.send-progress {
  margin: 12px 0 4px;
}
.send-progress div {
  height: 8px;
  border-radius: 4px;
  background: #e7ecf2;
  overflow: hidden;
}
.send-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: #7ab648;
  transition: width 0.2s;
}
.send-progress span {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: #3d4b60;
}
.export-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  margin-left: auto;
}
.export-choice .export-btns button {
  margin-left: 0;
}
.link-chip .lc-short {
  display: none;
}
/* Narrow top bar: the dot and a short label; the full state is in the title. */
@media (max-width: 1180px) {
  .link-chip .lc-long {
    display: none;
  }
  .link-chip .lc-short {
    display: inline;
  }
}
/* Top bar with the account, new, open, save, machine and export buttons:
   on medium screens the secondary buttons keep only their icons (the text
   stays for screen readers) so the bar never runs over the brand. */
@media (max-width: 1180px) {
  .top-actions > button.hide-mobile {
    font-size: 0;
    gap: 0;
    padding-inline: 10px;
  }
  .top-actions {
    gap: 6px;
  }
}
/* Free parts, stretch tool: the live size beside the pointer. */
.stretch-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: #1d2838;
  color: #fff;
  font: 600 13px system-ui;
  padding: 4px 9px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 4px 14px #0003;
}
/* Free parts: the stretch grips on the picked hole's corners, and its card. */
.sk-hgrip {
  fill: #fff;
  stroke: #2f6fe4;
  stroke-width: 1.6px;
  vector-effect: non-scaling-stroke;
  cursor: nwse-resize;
}
.sk-hgrip:hover {
  fill: #2f6fe4;
}
.hole-card.on {
  border-color: #2f6fe4;
  box-shadow: inset 0 0 0 1px #2f6fe4;
}
/* Compartment card: how many equal parts, and the door choices. */
.cell-split {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin: 8px 0 4px;
  font-size: 13px;
  color: #556377;
}
.cell-split button {
  min-width: 34px;
  justify-content: center;
}
.cell-split button.active {
  background: #e0408f;
  border-color: #e0408f;
  color: #fff;
}
.cell-sub {
  margin: 10px 0 2px;
  font-size: 12px;
  font-weight: 700;
  color: #7c899b;
}
.sk-hgrip.side.ew {
  cursor: ew-resize;
}
.sk-hgrip.side.ns {
  cursor: ns-resize;
}
/* Part card: doors on a panel (hinge edge, size, nudges). */
.hinge-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin: 6px 0;
  font-size: 13px;
  color: #556377;
}
.hinge-row > span {
  margin-right: 2px;
}
.hinge-row button.active {
  background: #e0408f;
  border-color: #e0408f;
  color: #fff;
}
.hatch-size {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 6px 0;
  font-size: 13px;
  color: #556377;
}
.hatch-size input {
  width: 76px;
  border: 1px solid #dce2ea;
  border-radius: 6px;
  padding: 4px 6px;
  font: inherit;
}
/* Placing a picture: on which outline, and fit / fill / enlarge / stretch / free. */
.fit-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 2px 0 10px;
}
.fit-center {
  display: flex;
  align-items: flex-end;
}
.img-swap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}
/* คลังลาย: designs shown as engraved wood. */
dialog:has(#lib-view),
dialog:has(#lib-add) {
  width: 860px;
}
.lib-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.lib-tabs,
.lib-fit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.lib-bar input {
  flex: 1 1 180px;
  max-width: 260px;
  min-height: 34px;
  border: 1px solid #dce2ea;
  border-radius: 8px;
  padding: 4px 10px;
  font: inherit;
}
.lib-fit {
  margin-top: 12px;
  font-size: 13px;
  color: #556377;
}
.lib-fit > span {
  margin-right: 4px;
}
.lib-where input {
  width: 64px;
  border: 1px solid #dce2ea;
  border-radius: 6px;
  padding: 2px 6px;
  font: inherit;
}
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.lib-empty {
  grid-column: 1 / -1;
}
.lib-card {
  position: relative;
}
.lib-pick {
  width: 100%;
  height: 100%;
  flex-direction: column;
  gap: 4px;
  padding: 10px 8px;
  white-space: normal;
  text-align: center;
}
.lib-pick b {
  font-size: 13px;
  line-height: 1.25;
}
.lib-pick small {
  font-size: 11px;
  color: #7c899b;
}
.lib-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 30px !important;
  min-height: 30px;
  padding: 5px !important;
  background: #ffffffd9;
}
.lib-thumb {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: #f3f5f8;
}
.lib-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* Ink designs: the picture's alpha cut out of a brown layer, on wood. */
.lib-thumb.ink {
  background: radial-gradient(circle at 35% 30%, #f1dcb6, #e2c594);
}
.lib-thumb.ink.round {
  border-radius: 50%;
}
.lib-thumb.ink i {
  position: absolute;
  inset: 5%;
  background: #6e4422;
  -webkit-mask: var(--m) center / contain no-repeat;
  mask: var(--m) center / contain no-repeat;
}
.lib-new-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin: 10px 0;
}
.lib-new {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  align-items: center;
}
.lib-new small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: #7c899b;
}
.lib-wait {
  width: 22px;
  height: 22px;
  border: 3px solid #d4dde8;
  border-top-color: #245cd6;
  border-radius: 50%;
  animation: lib-spin 0.8s linear infinite;
}
@keyframes lib-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (max-width: 560px) {
  .lib-grid {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  }
  .lib-bar input {
    max-width: none;
  }
}
/* กรอบพระ: settings beside a live preview of every layer. */
dialog:has(#frame-view) {
  width: 1000px;
}
.frame-modal {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 20px;
  align-items: start;
}
.frame-side {
  position: sticky;
  top: 0;
}
.frame-stage {
  border: 1px solid #e3e8ef;
  border-radius: 10px;
  background: repeating-conic-gradient(#f6f7f9 0 25%, #fff 0 50%) 0 0 / 16px 16px;
  padding: 10px;
}
.frame-stage svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 56dvh;
}
.frame-facts {
  margin-top: 8px;
}
.frame-shapes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 4px;
}
.frame-shape {
  flex-direction: column;
  gap: 3px;
  padding: 6px 4px;
  font-size: 12px;
  white-space: normal;
  line-height: 1.2;
}
.frame-shape svg {
  width: 20px;
  height: 27px;
}
.frame-pats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}
.frame-lines {
  align-self: end;
  margin-bottom: 10px;
}
.frame-layers {
  display: grid;
  gap: 4px;
}
.frame-note {
  margin-right: auto;
  align-self: center;
  font-size: 12px;
  color: #7c899b;
}
@media (max-width: 760px) {
  .frame-modal {
    grid-template-columns: 1fr;
  }
  .frame-side {
    position: static;
    order: -1;
  }
}
/* กรอบพระ from a picture */
.frame-art {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.frame-art small {
  display: block;
  font-size: 11px;
  color: #7c899b;
}
.frame-art-thumb {
  width: 54px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f5f8;
  display: grid;
  place-items: center;
}
.frame-art-thumb img {
  max-width: 100%;
  max-height: 100%;
}
.frame-art-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.frame-art-btns select {
  flex: 1 1 160px;
  min-height: 30px;
  border: 1px solid #dce2ea;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
}
