:root {
  color-scheme: dark;
  --bg: #020617;
  --surface: #0f172a;
  --card: #0e1223;
  --text: #f8fafc;
  --muted: #94a3b8;
  --line: #334155;
  --accent: #22c55e;
  --accent-ink: #052e16;
  --danger: #ef4444;
  --sans: Inter, "Noto Sans SC", "Noto Sans TC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
body[data-lang="zh-Hans"] { font-family: "Noto Sans SC", Inter, sans-serif; }
body[data-lang="zh-Hant"] { font-family: "Noto Sans TC", Inter, sans-serif; }
a { color: inherit; }
a:hover { color: var(--accent); }
.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 12px;
  z-index: 30;
}
.skip:focus { top: 12px; }
.wrap { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.site-header, .site-footer {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.site-header { position: sticky; top: 0; z-index: 20; }
.site-footer { border-bottom: 0; border-top: 1px solid var(--line); margin-top: 48px; background: var(--bg); }
.bar, .footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  flex-wrap: wrap;
  padding: 8px 0;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: -0.03em; text-decoration: none; }
.brand:hover { color: var(--text); }
.brand svg { width: 28px; height: 28px; display: block; flex: none; }
.nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.nav form { margin: 0; }
.nav a { text-decoration: none; color: var(--muted); padding: 4px 0; border-bottom: 2px solid transparent; }
.nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.nav a:hover { color: var(--text); }
.langs { display: flex; gap: 8px; }
.langs a { color: var(--muted); text-decoration: none; font-size: 14px; }
.langs a[aria-current="true"] { color: var(--accent); font-weight: 600; }
main { padding: 32px 0 48px; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.03em; }
h1 { font-size: 40px; line-height: 1.15; margin: 0 0 16px; }
h1 .who { margin-left: 12px; font-size: 22px; font-weight: 600; letter-spacing: 0; color: var(--text); }
h2 { font-size: 22px; line-height: 1.3; margin: 24px 0 12px; }
h1 + .lead, .card > h2:first-child, .card > p:first-child + h2 { margin-top: 0; }
.card h2:first-child { margin-top: 0; }
.lead { color: var(--muted); font-size: 18px; line-height: 1.6; max-width: 40rem; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 32px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: none;
}
.card a { text-decoration: none; }
.follow { margin-top: 16px; }
.narrow { max-width: 420px; }
a.card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
a.card:hover {
  color: var(--text);
  border-color: var(--accent);
}
a.card:hover h2 { color: var(--accent); }
a.card .price { margin-bottom: 16px; }
a.card .button { margin-top: auto; align-self: flex-start; }
a.card:hover .button { color: var(--accent-ink); }
.muted { color: var(--muted); }
.mono, .num, .price, .endpoint, .history-id, .slug, code, pre {
  font-family: var(--mono);
}
.num, .price, .history-when, .history-media, .wait-line { font-variant-numeric: tabular-nums; }
.price { color: var(--accent); font-weight: 600; }
.slug { color: var(--muted); font-size: 13px; }
.endpoint { font-size: 16px; font-weight: 500; letter-spacing: 0; overflow-wrap: anywhere; }
.size-result { font-size: 32px; font-weight: 600; margin: 12px 0 8px; letter-spacing: -0.03em; }
.pay-qr-wrap { margin: 12px 0; }
.pay-qr { display: block; width: 222px; max-width: 100%; height: auto; background: #fff; border-radius: var(--radius); }
.pay-dialog {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius);
  padding: 24px;
  max-width: min(360px, calc(100% - 32px));
  box-shadow: none;
}
.pay-dialog::backdrop { background: rgba(2, 6, 23, 0.72); }
.pay-dialog p { font-size: 22px; font-weight: 600; margin: 0 0 16px; }
.pay-dialog .submit-detail { font-size: 16px; font-weight: 400; color: var(--muted); }
.notice {
  border: 1px solid var(--accent);
  background: rgba(34, 197, 94, 0.08);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 12px;
}
button:disabled { opacity: 0.55; cursor: not-allowed; }
#submit-button:disabled { cursor: progress; }
button, .button {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .button:hover { color: var(--accent-ink); }
button.ghost, .button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
button.ghost:hover, .button.ghost:hover { border-color: var(--accent); color: var(--text); }
button.danger { background: var(--danger); color: white; border-color: var(--danger); }
button.danger:hover { color: white; }
label { display: block; margin: 16px 0; font-size: 14px; font-weight: 500; color: var(--muted); }
input, select, textarea {
  width: 100%;
  margin-top: 6px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  line-height: 1.5;
}
textarea { min-height: 7.5rem; resize: vertical; }
input[type="radio"], input[type="checkbox"] { width: auto; margin: 0 8px 0 0; vertical-align: middle; }
label:has(input[type="radio"]), label:has(input[type="checkbox"]) { display: flex; align-items: center; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.tabs { display: flex; gap: 8px; margin: 16px 0 24px; flex-wrap: wrap; }
.tabs a {
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
}
.tabs a:hover { color: var(--text); border-color: var(--accent); }
.tabs a[aria-current="page"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.playground {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 16px;
  align-items: start;
}
.playground > .card { min-width: 0; }
.history-when { white-space: nowrap; }
.history-id { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.result-frame {
  margin: 12px 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.result-stage {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: min(42dvh, calc(100dvh - 18rem));
  max-height: calc(100dvh - 12rem);
  min-width: 0;
  margin-inline: auto;
  overflow: hidden;
  border-radius: 8px;
  background: #020617;
}
.result-stage img,
.result-stage video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  background: transparent;
}
.result-link { align-self: stretch; overflow-wrap: anywhere; font-size: 13px; margin: 8px 0 0; }
.table-wrap { overflow-x: auto; }
.return-fields code { overflow-wrap: anywhere; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); }
tbody tr:hover td { background: rgba(15, 23, 42, 0.72); }
.price-table th:nth-child(n+2),
.price-table td:nth-child(n+2),
.price-grid th:nth-child(n+2) { text-align: right; }
.price-grid td:nth-child(n+2) { text-align: right; }
.price-grid td input { text-align: right; }
pre, code { font-family: var(--mono); }
pre {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
}
code { font-size: 0.92em; }
.error {
  border: 1px solid var(--danger);
  color: #fecaca;
  background: rgba(239, 68, 68, 0.08);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 12px;
}
.flag { color: #fecaca; }
.state {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--muted);
}
.state-running, .state-open { color: var(--text); border-color: var(--accent); }
.state-succeeded, .state-answered { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.state-failed, .state-canceled { color: #fecaca; border-color: var(--danger); }
.state-on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.state-off { color: #fecaca; background: rgba(239, 68, 68, 0.12); border-color: var(--danger); }
tbody tr.account-off > td,
tbody tr.account-off:hover > td { color: #fecaca; background: rgba(239, 68, 68, 0.08); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.row-actions form { margin: 0; }
form.account-edit { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 0; }
form.account-edit label { margin: 0; flex: 1 1 16rem; }
body.admin form.account-edit input { width: 100%; min-width: 12rem; }
.row-actions label { margin: 0; flex: 1 1 12rem; }
.subnav { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.subnav a {
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 14px;
}
.subnav a:hover { color: var(--text); border-color: var(--accent); }
.subnav a[aria-current="page"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.pager { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 16px 0; }
.pager a {
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
}
.pager a:hover { border-color: var(--accent); color: var(--text); }
body.admin .price-grid input { width: 6.5rem; margin-top: 0; padding: 6px 8px; text-align: right; }
footer p { color: var(--muted); margin: 8px 0; }
.footer-bar a { text-decoration: none; }
.back { color: var(--muted); text-decoration: none; }
.key-list { list-style: none; padding: 0; margin: 16px 0 0; }
.key-list li {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.key-list form { margin: 0; }
td form { margin: 0 0 8px; }
td form:last-child { margin-bottom: 0; }
body.admin main { padding: 24px 0 32px; }
body.admin h1 { font-size: 28px; margin-bottom: 12px; }
body.admin .card { padding: 16px; }
body.admin table { font-size: 13px; }
body.admin th, body.admin td { padding: 8px 10px; }
body.admin td input, body.admin td select { width: 9rem; margin-top: 0; padding: 6px 8px; }
body.admin td input[name="reason"] { width: 12rem; }
@media (max-width: 1023px) {
  h1 { font-size: 32px; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .playground { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .wrap { width: min(1120px, calc(100% - 24px)); }
  h1 { font-size: 28px; }
  .grid { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  main { padding: 24px 0 32px; }
  .bar, .footer-bar { min-height: 56px; }
}
a, button, .button, .card, input, select, textarea {
  transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
.thread { display: grid; gap: 12px; margin: 16px 0; }
.message { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--surface); }
.message.staff { border-color: var(--accent); }
.message p { margin: 8px 0 0; white-space: pre-wrap; }
.shots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.shots img { max-width: min(240px, 100%); height: auto; border-radius: 8px; background: var(--bg); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
