:root {
  --bg: #0b0c0c;
  --bg-2: #121416;
  --surface: rgba(255, 255, 255, 0.032);
  --surface-hover: rgba(255, 255, 255, 0.055);
  --line: rgba(249, 250, 250, 0.13);
  --line-strong: rgba(249, 250, 250, 0.28);
  --ink: #f4f5f2;
  --muted: #a6aba8;
  --ember: #ee9833;
  --ion: #8adbe6;
  --ok: #7ed49d;
  --err: #f07b72;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

input, textarea, select, code {
  user-select: text;
  -webkit-user-select: text;
}

a { color: inherit; }

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 68% 45% at 78% 12%, rgba(138, 219, 230, 0.09), transparent 62%),
    radial-gradient(ellipse 52% 42% at 14% 86%, rgba(238, 152, 51, 0.08), transparent 64%);
}

.topbar {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 24px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  font-weight: 600;
}

.brand-mark {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid var(--ink);
  box-shadow: inset 3px 0 0 var(--ion);
}

.sep { color: var(--muted); opacity: 0.5; }
.kicker { color: var(--ion); }

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
}

.topbar-nav a {
  text-decoration: none;
  color: var(--muted);
  transition: color 160ms ease;
}

.topbar-nav a:hover { color: var(--ink); }

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 24px 56px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  font: 500 11px/1.4 var(--mono);
  letter-spacing: 0.18em;
  color: var(--ion);
  text-transform: uppercase;
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.lead {
  margin: 0;
  max-width: 580px;
  color: var(--muted);
  font-size: 14px;
}

.mc-pill {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 12px 14px;
  min-width: 280px;
  display: grid;
  gap: 8px;
}

.mc-pill-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-family: var(--mono);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.dot.is-up {
  background: var(--ok);
  box-shadow: 0 0 8px rgba(126, 212, 157, 0.55);
}

.dot.is-down { background: var(--err); }

.mc-pill-title { color: var(--ink); }
.mc-pill-stat { margin-left: auto; color: var(--muted); }

.mc-pill-addr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mc-pill-addr code {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ion);
}

.mini-btn {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font: 500 11px/1 var(--sans);
  padding: 6px 10px;
  cursor: pointer;
}

.mini-btn:hover {
  border-color: var(--ion);
  color: var(--ion);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}

.tab {
  appearance: none;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--muted);
  padding: 11px 18px;
  font: 500 14px/1.2 var(--sans);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  position: relative;
  top: 1px;
}

.tab-code {
  font-family: var(--mono);
  font-size: 11px;
  opacity: 0.7;
}

.tab.is-active {
  color: var(--ink);
  background: var(--bg-2);
  border-color: var(--line);
  border-top: 2px solid var(--ion);
}

.panel[hidden] { display: none; }

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 20px;
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 22px;
}

.card-head {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.card-tag {
  display: inline-block;
  font: 500 10px/1.2 var(--mono);
  letter-spacing: 0.16em;
  color: var(--ember);
  margin-bottom: 6px;
}

h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.field {
  margin-bottom: 16px;
}

.field label,
.label-text {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

input[type="text"],
textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 12px;
  font: 14px/1.5 var(--sans);
  outline: none;
  transition: border-color 150ms ease;
}

input[type="text"]:focus,
textarea:focus {
  border-color: var(--ion);
}

textarea { resize: vertical; }

.input-row {
  display: flex;
  gap: 8px;
}

.input-row input { flex: 1 1 auto; min-width: 0; }

.hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.seg-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--muted);
  padding: 8px 13px;
  font: 13px/1.2 var(--sans);
  cursor: pointer;
}

.seg-btn.is-on {
  border-color: var(--ion);
  color: var(--ink);
  background: rgba(138, 219, 230, 0.11);
}

label.dropzone {
  display: grid;
  gap: 6px;
  place-items: center;
  text-align: center;
  padding: 22px 16px;
  margin-bottom: 0;
  border: 1px dashed var(--line-strong);
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.dropzone:hover,
.dropzone.is-drag {
  border-color: var(--ion);
  background: rgba(138, 219, 230, 0.06);
}

.dz-title { font-size: 14px; font-weight: 500; }
.dz-sub { font-size: 12px; color: var(--muted); }

.type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.type-chip {
  appearance: none;
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.24);
  color: var(--muted);
  padding: 10px 12px;
  display: grid;
  gap: 3px;
  cursor: pointer;
}

.type-chip strong {
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
}

.type-chip span { font-size: 11.5px; }

.type-chip.is-on {
  border-color: var(--ember);
  background: rgba(238, 152, 51, 0.09);
}

.actions { margin-top: 18px; }

.btn-primary {
  width: 100%;
  appearance: none;
  border: 1px solid var(--ion);
  background: rgba(138, 219, 230, 0.14);
  color: var(--ink);
  padding: 12px 18px;
  font: 500 14px/1.2 var(--sans);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 160ms ease;
}

.btn-primary:hover:not(:disabled) {
  background: rgba(138, 219, 230, 0.24);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn-ghost {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  padding: 0 14px;
  font: 13px/1 var(--sans);
  cursor: pointer;
  white-space: nowrap;
}

.btn-ghost:hover { border-color: var(--ion); color: var(--ion); }

.alert {
  margin-top: 14px;
  padding: 11px 13px;
  border-left: 2px solid var(--ion);
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
  line-height: 1.6;
}

.alert.is-ok { border-left-color: var(--ok); }
.alert.is-err { border-left-color: var(--err); color: #ffd4d0; }

.preview-stage {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.preview-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.figure-box {
  margin: 0;
  border: 1px solid var(--line);
  background: radial-gradient(circle at 50% 42%, rgba(138, 219, 230, 0.06), rgba(0, 0, 0, 0.35));
  padding: 14px 8px 10px;
  display: grid;
  place-items: center;
  gap: 8px;
}

.figure-box canvas {
  width: 112px;
  height: 224px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.figure-box figcaption {
  font: 500 10px/1 var(--mono);
  letter-spacing: 0.14em;
  color: var(--muted);
}

.preview-meta {
  font-size: 12.5px;
  color: var(--muted);
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.24);
}

.guide {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

.guide-full { border-top: none; padding-top: 0; }

.guide h3 {
  margin: 0 0 8px;
  font-size: 13.5px;
  color: var(--ink);
}

.guide ol,
.guide ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 7px;
}

.guide code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ion);
  background: rgba(138, 219, 230, 0.08);
  padding: 1px 5px;
}

.guide-p { margin: 0 0 10px; }

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.grid-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mod-results {
  margin-top: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.34);
  max-height: 280px;
  overflow-y: auto;
  display: grid;
}

.mod-results[hidden] { display: none; }

.mod-hit {
  appearance: none;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
  cursor: pointer;
}

.mod-hit:last-child { border-bottom: none; }
.mod-hit:hover { background: rgba(138, 219, 230, 0.08); }

.mod-hit-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
}

.mod-hit-badge {
  font: 500 10.5px/1 var(--mono);
  padding: 3px 6px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  white-space: nowrap;
}

.mod-hit-badge.is-263 {
  border-color: var(--ok);
  color: var(--ok);
}

.mod-hit-desc {
  font-size: 12px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 820px) {
  .grid-two { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .topbar { padding: 16px 16px 12px; }
  .topbar-nav { gap: 12px; }
  .shell { padding: 20px 16px 44px; }
  .mc-pill { width: 100%; min-width: 0; }
  .type-grid,
  .grid-fields { grid-template-columns: 1fr; }
  .tab { padding: 10px 12px; font-size: 13px; }
  .card { padding: 16px; }
}
