:root {
  --bg: #0e0e11;
  --panel: #16161b;
  --panel-2: #1d1d24;
  --line: #2a2a33;
  --line-soft: #232329;
  --ink: #ececf1;
  --ink-dim: #9a9aa6;
  --ink-faint: #6e6e7a;
  --gold-1: #fdde9b;
  --gold-2: #e2a41e;
  --gold-ink: #241a05;
  --warn: #f0b429;
  --radius: 14px;
  --radius-sm: 9px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
               "PingFang HK", "Noto Sans CJK TC", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold-2); }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #131317, #0e0e11);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--gold-1), var(--gold-2));
  box-shadow: 0 0 0 1px #ffffff14, 0 6px 18px #e2a41e26;
}
.topbar h1 { font-size: 16px; margin: 0; letter-spacing: .01em; font-weight: 650; }
.topbar p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-dim); }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 18px; gap: 18px; }
  .topbar { padding: 14px 18px; }
}

.preview-col { position: sticky; top: 96px; }
@media (max-width: 900px) { .preview-col { position: static; } }

/* ---------- preview ---------- */
.preview-card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 20px;
}
.qr-stage {
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: var(--radius-sm);
  background-color: #0b0b0d;
  background-image:
    linear-gradient(45deg, #17171b 25%, transparent 25%, transparent 75%, #17171b 75%),
    linear-gradient(45deg, #17171b 25%, transparent 25%, transparent 75%, #17171b 75%);
  background-size: 18px 18px;
  background-position: 0 0, 9px 9px;
  min-height: 300px;
}
.qr-mount { display: grid; place-items: center; line-height: 0; }
.qr-mount canvas, .qr-mount svg {
  width: 272px !important;
  height: 272px !important;
  display: block;
  border-radius: 4px;
}

.qr-caption {
  margin: 14px 2px 0;
  font-size: 12px;
  color: var(--ink-faint);
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  min-height: 1.4em;
}

.warn {
  margin-top: 12px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: #f0b4291a;
  border: 1px solid #f0b42940;
  color: #f3cf86;
  font-size: 12.5px;
}
.warn strong { color: var(--warn); }

.export { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.export-row { display: flex; gap: 10px; }
.export-row + .export-row { margin-top: 10px; }
.export-row .btn { flex: 1; }
.export-row .field { flex: 1; }

/* ---------- cards ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.card h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-dim);
  margin: 0 0 14px;
  font-weight: 650;
  display: inline;
}
.card h2 .zh { color: var(--ink-faint); letter-spacing: 0; text-transform: none; font-weight: 500; }
.card h3 {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-faint);
  margin: 20px 0 10px;
  font-weight: 600;
}
.card h3:first-child { margin-top: 0; }

details.card > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after {
  content: "▾";
  color: var(--ink-faint);
  font-size: 12px;
  transition: transform .18s ease;
}
details.card[open] > summary::after { transform: rotate(180deg); }
details.card > summary h2 { margin: 0; }
.adv-body { margin-top: 18px; }

/* ---------- fields ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  font-size: 12.5px;
  color: var(--ink-dim);
  margin-bottom: 6px;
}
.field > span em { font-style: normal; color: var(--ink); float: right; font-variant-numeric: tabular-nums; }
.field.compact { margin-bottom: 0; }

input[type="text"], textarea, select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239a9aa6' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 28px; }
select.mini { width: auto; padding: 7px 26px 7px 9px; font-size: 12.5px; }
input:focus, textarea:focus, select:focus {
  border-color: #e2a41e88;
  box-shadow: 0 0 0 3px #e2a41e1f;
}

.field-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.field-row .label { font-size: 12.5px; color: var(--ink-dim); }
.inline { display: flex; align-items: center; gap: 8px; }

input[type="color"] {
  width: 38px; height: 30px; padding: 0;
  background: none; border: 1px solid var(--line);
  border-radius: 7px; cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 4px; }

.field.slider > span { margin-bottom: 2px; }
input[type="range"] {
  width: 100%; appearance: none; height: 22px; background: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px; background: var(--line);
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none; width: 15px; height: 15px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-1), var(--gold-2));
  margin-top: -5.5px; box-shadow: 0 1px 4px #0008;
}

.check { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-dim); cursor: pointer; margin-bottom: 4px; }
.check input { accent-color: var(--gold-2); width: 15px; height: 15px; cursor: pointer; }
.inline-check { margin-bottom: 0; font-size: 12.5px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; align-items: end; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- buttons ---------- */
.btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .06s ease;
  white-space: nowrap;
}
.btn:hover { background: #26262f; border-color: #37374a; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--gold-1), var(--gold-2));
  border-color: transparent;
  color: var(--gold-ink);
  font-weight: 650;
}
.btn-primary:hover { filter: brightness(1.07); background: linear-gradient(135deg, var(--gold-1), var(--gold-2)); border-color: transparent; }
.btn-ghost { background: none; }
.btn-tiny { padding: 4px 9px; font-size: 11.5px; border-radius: 7px; }

/* ---------- segmented ---------- */
.seg {
  display: inline-flex;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
  margin-bottom: 16px;
  width: 100%;
}
.seg-btn {
  flex: 1;
  background: none; border: none; color: var(--ink-dim);
  padding: 7px 10px; border-radius: 6px;
  font: inherit; font-size: 12.5px; font-weight: 550;
  cursor: pointer; transition: background .15s ease, color .15s ease;
  white-space: nowrap;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-on { background: #32323e; color: var(--ink); }
.seg.small { margin-bottom: 14px; }

/* ---------- presets ---------- */
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.preset {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  padding: 10px 8px 8px;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s ease, background .15s ease;
}
.preset:hover { border-color: #46465c; }
.preset.is-on { border-color: var(--gold-2); background: #e2a41e14; }
.preset .swatch {
  height: 40px; border-radius: 6px; margin-bottom: 7px;
  display: grid; place-items: center;
}
.preset .swatch span {
  width: 60%; height: 8px; border-radius: 3px;
}
.preset .name { font-size: 11.5px; color: var(--ink-dim); display: block; }
.preset.is-on .name { color: var(--ink); }

/* ---------- swatches ---------- */
.swatches { display: flex; gap: 7px; align-items: center; }
.tint {
  width: 26px; height: 26px; border-radius: 7px;
  border: 1px solid var(--line); cursor: pointer; padding: 0;
  transition: transform .1s ease, box-shadow .15s ease;
}
.tint:hover { transform: scale(1.08); }
.tint.is-on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--gold-2); }

/* ---------- saved links ---------- */
.saved { margin-top: 4px; }
.saved-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.saved-head .label { font-size: 12.5px; color: var(--ink-dim); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 20px; padding: 5px 6px 5px 11px;
  font-size: 12px; color: var(--ink-dim);
  cursor: pointer; max-width: 100%;
  transition: border-color .15s ease, color .15s ease;
}
.chip:hover { border-color: #46465c; color: var(--ink); }
.chip.is-on { border-color: var(--gold-2); color: var(--ink); background: #e2a41e14; }
.chip .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 168px; }
.chip .x {
  border: none; background: none; color: var(--ink-faint);
  cursor: pointer; font-size: 14px; line-height: 1;
  padding: 0 3px; border-radius: 50%;
}
.chip .x:hover { color: #ff8080; }
.chips-empty { font-size: 12px; color: var(--ink-faint); }

/* ---------- misc ---------- */
.hint { font-size: 11.5px; color: var(--ink-faint); margin: 10px 0 0; line-height: 1.45; }
.footnote { font-size: 11.5px; color: var(--ink-faint); text-align: center; margin: 4px 0 20px; }

.toast {
  position: fixed; bottom: 26px; left: 50%;
  transform: translate(-50%, 14px);
  background: #26262f; border: 1px solid var(--line);
  color: var(--ink); padding: 10px 18px; border-radius: 999px;
  font-size: 13px; box-shadow: 0 10px 30px #0009;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 50;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
