:root {
  color-scheme: light;
  --bg: #ffffff;
  --card: #ffffff;
  --ink: #111111;
  --muted: #667085;
  --line: #e6e8ec;
  --accent: #1d4ed8;
  --accent-dark: #1e40af;
  --red: #b42318;
  --shadow: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 "Segoe UI", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button,
.download-button,
input,
textarea {
  font: inherit;
}

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  padding: 8px 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }

.menu {
  display: flex;
  flex: 1;
  gap: 4px;
}
.menu a {
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
}
.menu a:hover { color: var(--ink); text-decoration: none; background: #f4f6f8; }
.menu a.active { color: var(--ink); background: #eef1f5; }

.narrow,
.wide {
  width: min(100% - 32px, 420px);
  margin: 64px auto 48px;
}

.wide {
  width: min(100% - 32px, 760px);
  margin-top: 28px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.page-head + .list { margin-top: 0; }
a.button {
  display: inline-block;
  border-radius: 6px;
  padding: 9px 14px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
a.button:hover { background: var(--accent-dark); text-decoration: none; }
.back {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.back:hover { color: var(--ink); }
.progress-wrap {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.progress-wrap[hidden] { display: none; }
.progress {
  height: 14px;
  border-radius: 99px;
  background: #e6e8ec;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 120ms linear;
}
.progress-text {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 28px; }
h2 { font-size: 16px; margin-bottom: 12px; }
h3 { font-size: 16px; }
h3 span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
h3.build-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
h3 .build-name {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}
.list-icon {
  width: 32px;
  height: 32px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: #fff;
}

.eyebrow,
.version {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.lead,
.meta,
.hint,
.empty { color: var(--muted); }
.lead { margin-top: 8px; }
.hint { margin: 0; font-size: 13px; }
.parsed { display: flex; gap: 12px; align-items: center; }
.parsed[hidden],
.parsed img[hidden] { display: none; }
.parsed img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: white;
  border: 1px solid var(--line);
}
#upload-fields { display: grid; gap: 16px; }
.card.uploading > h1,
.card.uploading > .lead,
.card.uploading #upload-fields { display: none; }
main:has(.card.uploading) > .back { display: none; }
.upload-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.upload-summary[hidden] { display: none; }
.upload-summary img {
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: 14px;
  object-fit: cover;
  background: #fff;
  border: 1px solid var(--line);
}
.upload-summary img[hidden] { display: none; }
.upload-name {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.notes { white-space: pre-wrap; }
.download .notes { margin: 12px 0 0; }

form { display: grid; gap: 16px; margin-top: 20px; }
fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
legend { font-size: 13px; font-weight: 600; }
.choices { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.choices label { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.choices input { width: auto; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

input,
textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

input:focus,
textarea:focus {
  outline: 2px solid rgba(29, 78, 216, 0.2);
  border-color: var(--accent);
}

button,
.download-button {
  border: 0;
  border-radius: 6px;
  padding: 9px 14px;
  background: var(--accent);
  color: white;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.download-button:hover { background: var(--accent-dark); text-decoration: none; }
button:disabled { opacity: 0.55; cursor: progress; }

.ghost,
.danger {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.ghost:hover,
.danger:hover { background: #f8f9fb; }

.danger { color: var(--red); }
.bar form,
.build form { margin: 0; }

.notice {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #eff4ff;
  color: #1e3a8a;
}
.notice.error { background: #fef3f2; color: var(--red); }

.list { margin-top: 28px; }
.build {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  margin-bottom: 12px;
}
.link-row,
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.link-row button,
.actions button,
.bar button {
  flex: none;
  white-space: nowrap;
}
.link-row { margin: 12px 0; }
.link-row input {
  font-size: 13px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
.actions a { margin-right: 8px; }
.qr {
  display: block;
  width: fit-content;
  align-self: start;
}
.qr-code {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.qr-frame {
  position: relative;
  display: block;
  width: fit-content;
}
.download .qr-frame { margin: 0 auto; }
.qr .qr-logo,
.qr-frame .qr-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  object-fit: cover;
  background: #fff;
  border: 0;
  box-shadow: 0 0 0 3px #fff;
}
.qr-frame .qr-logo {
  width: 46px;
  height: 46px;
  border-radius: 12px;
}
.qr .qr-logo {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.download { text-align: center; }
.download .app-icon {
  display: block;
  width: 84px;
  height: 84px;
  margin: 0 auto 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  object-fit: cover;
  background: #fff;
}
.download-button {
  display: block;
  margin: 20px 0 8px;
  padding: 12px 16px;
  font-size: 16px;
}
.download .curl-copy { margin-top: 8px; }
.download .curl-copy + .hint { margin-top: 8px; }
.qr-block {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.qr-frame .qr-code { margin: 0 auto; }
.qr-block p { color: var(--muted); font-size: 13px; }
.page-warn {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid #f3d6d2;
  border-radius: 8px;
  background: #fef3f2;
  color: #912018;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  width: min(100% - 48px, 440px);
  height: fit-content;
  margin: 0;
  transform: translate(-50%, -50%);
  padding: 28px 28px 24px;
  border: 0;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 18px 50px rgba(17, 17, 17, 0.24);
}
dialog[open] { animation: toast-fade 180ms ease; }
dialog::backdrop { background: rgba(17, 17, 17, 0.45); }
dialog h2 { font-size: 22px; }
dialog p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
}
.dialog-actions button {
  min-width: 96px;
  padding: 11px 18px;
  font-size: 15px;
}
.dialog-actions form { margin: 0; }
button.solid-danger {
  background: var(--red);
  color: #fff;
  border: 0;
}
button.solid-danger:hover { background: #912018; }

.toasts {
  position: fixed;
  z-index: 30;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  width: max-content;
  max-width: min(100% - 32px, 420px);
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border-radius: 8px;
  background: #1f2328;
  color: #fff;
  font-size: 14px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(17, 17, 17, 0.18);
  animation: toast-in 180ms ease;
}
.toast.error { background: var(--red); }
.toast.out { animation: toast-out 180ms ease forwards; }

@keyframes toast-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-8px); }
}
@media (prefers-reduced-motion: reduce) {
  dialog[open],
  .toast,
  .toast.out { animation: none; }
}

@media (max-width: 720px) {
  .grid,
  .build { grid-template-columns: 1fr; }
  .qr { justify-self: start; }
  .narrow { margin-top: 32px; }
}
