:root {
  color-scheme: dark;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #f1eeed;
  background: #0d0a10;
  --lime: #daff77;
  --violet: #9d73cb;
  --muted: #a99bb0;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  justify-items: center;
  align-items: center;
  padding: max(22px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  background:
    linear-gradient(90deg, #5e426210 1px, transparent 1px) center / 36px 36px,
    linear-gradient(#5e426210 1px, transparent 1px) center / 36px 36px,
    radial-gradient(ellipse at 50% 26%, #24152d, #100d15 51%, #0b090e 86%);
}

.workshop { width: min(100%, 446px); }

.heading {
  display: flex;
  align-items: center;
  gap: 15px;
  margin: 0 2px 19px;
}

.heading h1 {
  margin: 0 0 6px;
  font-size: clamp(33px, 8.2vw, 46px);
  line-height: 1.06;
  font-weight: 900;
  letter-spacing: -.06em;
}

.heading h1 span { color: var(--lime); }
.heading p { margin: 0; color: var(--muted); font-size: 13px; letter-spacing: .07em; }

.seal {
  position: relative;
  width: 41px;
  height: 41px;
  flex: 0 0 auto;
  border: 1px solid #76538b;
  border-radius: 50%;
  background: radial-gradient(#34203d, #130f18);
  box-shadow: inset 0 0 0 4px #17101d, 0 0 23px #b463ee19;
  transform: rotate(-13deg);
}

.seal::before, .seal::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 17px;
  height: 2px;
  content: "";
  background: var(--lime);
  box-shadow: 0 0 7px #d7ff7566;
}

.seal::before { transform: translate(-50%, -50%) rotate(45deg); }
.seal::after { transform: translate(-50%, -50%) rotate(-45deg); }

.booth {
  position: relative;
  isolation: isolate;
  margin: 0;
  padding: 6px;
  border: 1px solid #553a61;
  border-radius: 11px 11px 7px 7px;
  background: linear-gradient(145deg, #302139, #18101d 48%, #262032);
  box-shadow: 0 18px 54px #0009, inset 0 1px #b18ece2e;
}

.stage {
  --tag-x: 48.5%;
  --tag-y: 54.6%;
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  background: #100b16;
  border-radius: 5px;
}

.stage::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 22px 3px #08050c99;
  background: repeating-linear-gradient(0deg, #130a1d10 0 1px, transparent 1px 4px);
}

.doll {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  user-select: none;
  -webkit-user-drag: none;
}

.corners { position: absolute; inset: 12px; pointer-events: none; }
.corners i { position: absolute; width: 17px; height: 17px; border: solid #ab84c4; }
.corners i:nth-child(1) { inset: 0 auto auto 0; border-width: 1px 0 0 1px; }
.corners i:nth-child(2) { inset: 0 0 auto auto; border-width: 1px 1px 0 0; }
.corners i:nth-child(3) { inset: auto auto 0 0; border-width: 0 0 1px 1px; }
.corners i:nth-child(4) { inset: auto 0 0 auto; border-width: 0 1px 1px 0; }

.vents {
  width: 43px;
  height: 3px;
  margin: 5px auto 0;
  background: repeating-linear-gradient(90deg, #775c88 0 4px, transparent 4px 8px);
}

.nametag {
  position: absolute;
  z-index: 1;
  top: var(--tag-y);
  left: var(--tag-x);
  transform: translate(-50%, -50%) rotate(-8deg);
  width: clamp(84px, 25%, 111px);
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 7px 10px;
  border: 1px solid #dfd0a5;
  border-radius: 2px;
  background:
    repeating-linear-gradient(106deg, #fff4cd33 0 1px, transparent 1px 4px),
    linear-gradient(165deg, #eee4bf, #cbbb8d);
  color: #3c3025;
  box-shadow: 0 3px 7px #000b;
  line-height: 1.12;
}

.nametag::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px dashed #67553d77;
  pointer-events: none;
}

.nametag::after {
  content: "";
  position: absolute;
  top: -3px;
  left: 11px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 37% 31%, #ffefe5, #ad8293 38%, #554251 74%);
  box-shadow: 0 2px 2px #2a1328ac;
}

.nametag span {
  max-width: 100%;
  overflow-wrap: anywhere;
  unicode-bidi: plaintext;
  font-size: 13px;
  font-weight: 850;
}

.nametag:not(.bound) span { color: #5e5041; font-weight: 600; letter-spacing: .08em; }
.nametag.bound { background-color: #e3deb5; }
.nametag:hover { filter: brightness(1.1); }

.sparks {
  position: absolute;
  z-index: 2;
  top: var(--tag-y);
  left: var(--tag-x);
  pointer-events: none;
}

.sparks i {
  position: absolute;
  width: 13px;
  height: 2px;
  opacity: 0;
  background: var(--lime);
  box-shadow: 0 0 8px var(--lime);
  transform: rotate(var(--angle)) translateX(20px);
}

.sparks i:nth-child(1) { --angle: 15deg; }
.sparks i:nth-child(2) { --angle: 77deg; }
.sparks i:nth-child(3) { --angle: 125deg; }
.sparks i:nth-child(4) { --angle: 185deg; }
.sparks i:nth-child(5) { --angle: 238deg; }
.sparks i:nth-child(6) { --angle: 310deg; }

.stage.stamp .nametag { animation: stamp 500ms cubic-bezier(.2, .8, .2, 1) both; }
.stage.stamp .sparks i { animation: sparks 440ms 80ms ease-out both; }

@keyframes stamp {
  0% { transform: translate(-50%, -70%) rotate(9deg) scale(1.32); opacity: .35; }
  38% { transform: translate(-50%, -50%) rotate(-11deg) scale(.93); opacity: 1; }
  100% { transform: translate(-50%, -50%) rotate(-8deg); opacity: 1; }
}

@keyframes sparks {
  0% { opacity: 0; transform: rotate(var(--angle)) translateX(24px) scaleX(.4); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--angle)) translateX(83px) scaleX(.15); }
}

.printer {
  margin-top: 13px;
  border: 1px solid #4e365b;
  border-radius: 8px;
  padding: 12px 13px;
  background: linear-gradient(141deg, #21182a, #16111e);
  box-shadow: inset 0 1px #b18ece1a, 0 12px 28px #0005;
}

.field-header {
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.field-header label { font-size: 13px; font-weight: 750; letter-spacing: .12em; }
.controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }

button, input { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid #634c72;
  border-radius: 4px;
  background: #100c16;
  color: #fff;
  padding: 0 11px;
  font-size: 16px;
}

input::placeholder { color: #9b8ba4; opacity: 1; }
input[aria-invalid="true"] { border-color: #ffa3b2; }

.print {
  min-height: 46px;
  padding: 0 clamp(10px, 3.25vw, 17px);
  border: 1px solid #e9ffa7;
  border-radius: 4px;
  background: var(--lime);
  color: #152007;
  font-size: 14px;
  font-weight: 900;
  box-shadow: inset 0 -3px #aacc4e, 0 0 19px #caff5318;
  white-space: nowrap;
}

.print span { margin-inline-start: 3px; }
.print:hover { background: #e6ff9e; }
.print:active { box-shadow: inset 0 2px #aacc4e; }

.remove {
  margin: -9px -5px -9px 0;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: #bfb0c7;
  padding: 0 5px;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.remove:hover { color: white; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
.note { margin: 9px 0 0; min-height: 17px; color: var(--muted); font-size: 12px; line-height: 17px; }
.note.error { color: #ffa3b2; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-height: 820px) {
  .workshop { width: min(100%, max(288px, calc((100svh - 245px) * .75 + 14px))); }
}

@media (max-height: 680px) and (max-width: 400px) {
  body { padding-block: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-bottom)); }
  .heading { margin-bottom: 12px; }
  .printer { margin-top: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .stage.stamp .nametag, .stage.stamp .sparks i { animation: none; }
}
