:root {
  color-scheme: light;
  --page: #f5f6f8;
  --surface: #fff;
  --ink: #17191e;
  --muted: #555d6b;
  --line: #e0e4ec;
  --accent: #1859d1;
  --accent-hover: #1249b0;
  --secondary: #eef3fb;
  --error: #a12936;
  --mono: "LXGW WenKai Mono Screen", ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-family: "LXGW WenKai Screen", ui-sans-serif, system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--page);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .65; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.workspace {
  width: min(calc(100% - 88px), 1040px);
  margin-inline: auto;
  padding-bottom: 44px;
}

.workspace h1 {
  margin: clamp(64px, 14vh, 140px) 0 clamp(30px, 5vh, 62px);
  text-align: center;
  font-size: clamp(37px, 6vw, 80px);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -.025em;
}

.stage {
  padding: clamp(22px, 4vw, 48px);
  border: 1px solid var(--line);
  border-radius: 32px;
  background: var(--surface);
  box-shadow: 0 16px 60px #2039630b;
  transition: box-shadow 170ms ease;
}

.stage[data-dragging] {
  box-shadow: 0 0 0 4px #1859d144, 0 16px 60px #20396310;
}

#picker {
  position: relative;
  isolation: isolate;
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: clamp(176px, 24vw, 296px);
}

.picker-art {
  position: absolute;
  inset: 0;
  z-index: -1;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: radial-gradient(ellipse closest-side, #eaf1ff, transparent) center / min(100%, 470px) 100% no-repeat;
}

.picker-photo {
  grid-area: 1 / 1;
  position: relative;
  width: clamp(84px, 12vw, 142px);
  aspect-ratio: 4 / 3;
  border: clamp(4px, .55vw, 7px) solid #fff;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(145deg, #f4f8ff, #dbe8ff);
  box-shadow: 0 0 0 1px #dce7f8, 0 9px 23px #274f8d16;
}

.picker-photo:first-child { transform: translate(-70%, -26%) rotate(-13deg); }
.picker-photo:last-child { transform: translate(70%, 25%) rotate(11deg); }

.picker-photo::before,
.picker-photo::after {
  position: absolute;
  content: "";
}

.picker-photo::before {
  inset: 17% auto auto 18%;
  width: 12%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #b4ccf4;
}

.picker-photo:last-child::before { inset-inline: auto 18%; }

.picker-photo::after {
  inset: 26% 0 0;
  background: linear-gradient(120deg, #c5d8f8, #9ebdf0);
  clip-path: polygon(0 73%, 29% 27%, 48% 57%, 72% 8%, 100% 66%, 100% 100%, 0 100%);
}

.stage:has(#picker:not([hidden])) .status { text-align: center; }

.stage h2, dialog h2 {
  margin: 0;
  font-size: clamp(25px, 3vw, 36px);
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: -.045em;
}

.stage-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 14px;
  margin-bottom: 20px;
}

.button {
  min-height: 46px;
  padding: 10px 19px;
  border: 1px solid transparent;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
  transition: background-color 150ms ease;
}

.primary { background: var(--accent); color: #fff; }
.primary:not(:disabled):hover { background: var(--accent-hover); }
.secondary { background: var(--secondary); color: var(--accent-hover); }
.secondary:not(:disabled):hover { background: #e1ebfa; }
#choose { min-height: 54px; padding-inline: 29px; font-size: 16px; }

.thumbnails, .link-list { padding: 0; margin: 0; list-style: none; }

.thumbnails {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 132px), 1fr));
  gap: 14px;
}

.thumbnail { position: relative; min-width: 0; }

.thumbnail img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border-radius: 14px;
  background: var(--page);
}

.filename {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thumbnail .filename { margin: 7px 3px 0; color: var(--muted); font-size: 13px; }

.remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #17191e13;
  border-radius: 100px;
  background: #fffffff2;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.remove:not(:disabled):hover { background: var(--secondary); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.stage .actions { margin-top: 22px; }

.link-list { display: grid; gap: 12px; }

.link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px 8px;
}

.link-row .filename { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }

.link-field {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--page);
  color: var(--ink);
  font: 13px/1.5 var(--mono);
}

#manual-copy { margin-top: 12px; resize: vertical; }

.status { margin: 13px 0 0; color: var(--error); font-size: 13px; line-height: 1.5; }
.status:empty { margin: 0; }
.status[data-success] { color: var(--muted); }

.site-footer { margin-top: 17px; text-align: center; }

.rules {
  max-width: 480px;
  margin-inline: auto;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.rules summary {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  padding-inline: 9px;
  cursor: pointer;
  border-radius: 8px;
}

.rules summary::-webkit-details-marker { display: none; }
.rules summary:hover { color: var(--accent-hover); }
.rules summary::after {
  width: 6px;
  height: 6px;
  content: "";
  border: solid currentColor;
  border-width: 0 1px 1px 0;
  transform: translateY(-2px) rotate(45deg);
}
.rules[open] summary::after { transform: translateY(2px) rotate(225deg); }

.rules dl {
  margin: 4px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
  text-align: start;
}
.rules dl div { display: grid; grid-template-columns: auto 1fr; gap: 12px; }
.rules dl div + div { margin-top: 8px; }
.rules dt { color: var(--ink); font-weight: 650; }
.rules dd { margin: 0; }

dialog {
  width: min(444px, calc(100% - 32px));
  padding: clamp(22px, 6vw, 32px);
  border: 1px solid var(--line);
  border-radius: 24px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 20px 64px #17191e22;
}

dialog::backdrop { background: #111b3266; }
dialog h2 { font-size: 26px; }
dialog p { margin-block: 12px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.dialog-actions { justify-content: flex-end; margin-top: 22px; }

@media (max-width: 740px) {
  .workspace { width: calc(100% - 32px); }
  .workspace h1 { margin-block: 65px 28px; }
  .stage { border-radius: 24px; }
  .thumbnails { grid-template-columns: repeat(auto-fill, minmax(min(100%, 108px), 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .stage, .button { transition: none; }
}
