:root {
  color-scheme: light;
  font-family: Inter, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #fff;
  color: #000;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: #fff;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  touch-action: manipulation;
}

button,
input { font: inherit; }

.artboard {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #fff;
}

.captcha-button {
  position: absolute;
  z-index: 2;
  top: calc(33.52% + 78px);
  left: 50%;
  width: min(31.343vw, 126px);
  height: 27px;
  margin: 0;
  padding: 0 9px 1px;
  border: 1px solid #494949;
  border-radius: 6px;
  background: #fff;
  color: #000;
  font: 400 18px/25px Inter, Arial, sans-serif;
  white-space: nowrap;
  cursor: pointer;
  transform: translateX(-50%);
}

.captcha-button.is-hidden { display: none; }

.arrange-button,
.clear-button {
  position: absolute;
  z-index: 4;
  top: max(40px, calc(env(safe-area-inset-top) + 26px));
  right: auto;
  left: 50%;
  width: 52px;
  height: 28px;
  margin: 0;
  padding: 0 0 1px;
  border: 1px solid #494949;
  border-radius: 6px;
  background: #fff;
  color: #000;
  font: 400 14px/26px "PingFang SC", Inter, Arial, sans-serif;
  cursor: pointer;
}

.arrange-button {
  transform: translateX(calc(-100% - 3px));
}

.clear-button { transform: translateX(3px); }

.arrange-button:disabled,
.clear-button:disabled {
  color: #a5a5a5;
  border-color: #cfcfcf;
  cursor: default;
}

.input-bar {
  position: absolute;
  z-index: 3;
  top: calc(41.3% + 56px);
  left: 50%;
  width: min(69.403vw, 279px);
  height: 41px;
  margin: 0;
  background: #f1f1f1;
  transform: translateX(-50%);
}

.input-bar input {
  position: absolute;
  top: 0;
  left: 12px;
  width: calc(100% - 58px);
  height: 41px;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #636363;
  caret-color: #000;
  font: 400 22px/41px "PingFang SC", Inter, Arial, sans-serif;
}

.enter-button {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 26px;
  height: 27px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.enter-button img {
  position: absolute;
  top: 2px;
  left: 1px;
  width: 24px;
  height: 23.364px;
  display: block;
  transform: rotate(180deg);
}

.artwork-layer {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
}

.captcha-artwork {
  position: absolute;
  aspect-ratio: 3 / 1;
  margin: 0;
  background: #fff;
  box-shadow: 0.5px 0.5px 1px 0 rgba(0, 0, 0, 0.5);
  cursor: grab;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: auto;
}

.captcha-artwork.is-dragging { cursor: grabbing; }
.captcha-artwork.is-resizing { cursor: nwse-resize; }

.captcha-artwork img {
  width: 100%;
  height: 100%;
  aspect-ratio: 3 / 1;
  display: block;
  object-fit: fill;
  background: #fff;
  pointer-events: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.artwork-menu {
  position: absolute;
  z-index: 6;
  display: flex;
  height: 28px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: auto;
}

.artwork-menu[hidden] { display: none; }

.artwork-menu button {
  width: 52px;
  height: 28px;
  margin: 0;
  padding: 0 0 1px;
  border: 1px solid #494949;
  border-radius: 0;
  background: #fff;
  color: #000;
  box-shadow: none;
  font: 400 14px/26px "PingFang SC", Inter, Arial, sans-serif;
  cursor: pointer;
}

.artwork-menu button + button { margin-left: -1px; }
.artwork-menu button:hover,
.artwork-menu button:focus-visible { background: #f1f1f1; outline: 0; }
#delete-artwork:hover,
#delete-artwork:focus-visible { color: #c83232; }

.input-bar.is-invalid { animation: nudge 120ms linear 2; }

@keyframes nudge { 50% { transform: translateX(calc(-50% + 3px)); } }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .input-bar.is-invalid { animation: none; }
}
