[hidden], .hidden { display: none !important; }

* { box-sizing: border-box; }

:root {
  --bg: #f3f5f7;
  --line: #d9dde3;
  --text: #0f2242;
  --muted: #6c7b95;
  --navy: #0d1b3d;
  --accent: #246b51;
  --green-bg: #e9fbf1;
  --green-line: #99e6ba;
  --green-strong: #b9f0cd;
  --danger: #b42318;
  --shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.shell {
  width: min(1280px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

h1, h2, h3, p { margin: 0; }

h1 {
  font-size: 24px;
  line-height: 1.35;
}

h2 {
  font-size: 18px;
  line-height: 1.35;
}

.topbar p,
.section-title span,
.msg,
.empty,
.panel-meta,
.result-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.panel,
.login-box {
  background: #f7f7f8;
  border: 1px solid #e2e5ea;
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 22px;
  margin-top: 18px;
}

.compact-panel {
  padding-bottom: 18px;
}

.login-panel {
  width: min(460px, 100%);
  margin: 12vh auto 0;
}

.login-panel h1 {
  margin-bottom: 18px;
}

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

.config-details {
  border: 1px solid #e1e6ed;
  border-radius: 18px;
  background: #fff;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.config-details summary {
  cursor: pointer;
  font-weight: 800;
  color: #24466f;
}

.config-details[open] summary {
  margin-bottom: 14px;
}

.tool-section {
  border-top: 1px solid #dfe5ed;
  padding-top: 20px;
  margin-top: 22px;
}

.tool-section:first-of-type {
  border-top: 0;
  padding-top: 4px;
}

.tool-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.tool-heading::before {
  content: "";
  width: 6px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent);
}

.tool-heading h3 {
  font-size: 17px;
  line-height: 1.35;
}

.tool-result-block {
  margin-top: 20px;
}

.tool-result-block h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

.readonly-box {
  min-height: 46px;
  border: 1px solid #d8dde6;
  border-radius: 12px;
  background: #f8fafc;
  padding: 13px 15px;
  margin-top: 8px;
  font-weight: 600;
  color: #24466f;
  line-height: 1.5;
}

.compact-textarea {
  min-height: 150px;
}

.code-output {
  min-height: 260px;
  white-space: pre;
  overflow: auto;
  font-size: 12px;
}

.tall-code-output {
  min-height: 320px;
}

.tool-options {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(260px, 1fr);
  gap: 16px;
  align-items: end;
  margin-top: 12px;
}

.tool-options input {
  height: 54px;
  font-size: 15px;
  font-weight: 700;
}

#toolMultiLinks {
  min-height: 170px;
}

label {
  display: block;
  font-weight: 700;
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d8dde6;
  border-radius: 12px;
  background: #fff;
  padding: 13px 15px;
  margin-top: 8px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #9bb1d9;
  box-shadow: 0 0 0 4px rgba(155, 177, 217, 0.14);
}

textarea {
  min-height: 144px;
  resize: vertical;
  font-family: Consolas, "SFMono-Regular", Menlo, Monaco, monospace;
  line-height: 1.55;
}

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

.panel-form .btn {
  align-self: end;
}

.full {
  display: block;
  margin-top: 16px;
}

.actions-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 12px;
}

.btn {
  min-width: 128px;
  border: 1px solid #d6dce6;
  border-radius: 12px;
  background: #eef2f7;
  color: var(--text);
  height: 46px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn.primary {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.btn.secondary {
  background: #eef2f7;
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.small-btn {
  border: 1px solid #d6dce6;
  border-radius: 10px;
  background: #fff;
  color: #20375f;
  min-height: 36px;
  padding: 0 12px;
  font-weight: 700;
  cursor: pointer;
}

.small-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.danger,
.status-failed {
  color: var(--danger);
}

.status-success {
  color: var(--accent);
}

.panel-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.panel-card {
  border: 1px solid #dde3eb;
  border-radius: 14px;
  background: #fff;
  padding: 14px;
}

.panel-card.active {
  border-color: #7ad79f;
  box-shadow: 0 0 0 3px rgba(153, 230, 186, .28);
}

.panel-card h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.panel-meta {
  word-break: break-word;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.node-routing {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.node-route-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 320px);
  gap: 10px;
  align-items: center;
  border: 1px solid #dde3eb;
  border-radius: 12px;
  background: #fff;
  padding: 10px;
}

.node-route-row.invalid {
  border-color: #f0b7b1;
}

.node-route-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.node-route-main strong {
  word-break: break-all;
}

.node-route-main span {
  color: var(--muted);
  font-size: 12px;
}

.result-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.link-item {
  display: grid;
  grid-template-columns: minmax(120px, 190px) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #dde3eb;
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px;
}

.link-item.failed {
  background: #fff8f7;
  border-color: #f0b7b1;
}

.link-name {
  font-size: 13px;
  font-weight: 700;
  color: #24466f;
  line-height: 1.5;
  word-break: break-word;
}

.link-output {
  min-height: 42px;
  height: 42px;
  resize: none;
  padding: 10px 12px;
  margin-top: 0;
  font-family: Consolas, "SFMono-Regular", Menlo, Monaco, monospace;
  font-size: 12px;
  line-height: 1.55;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(6, 156px);
  gap: 12px;
  align-items: start;
  margin-top: 16px;
}

.qr-card {
  width: 156px;
  min-width: 156px;
  border-radius: 18px;
  border: 2px solid var(--green-line);
  background: var(--green-bg);
  padding: 9px;
  box-shadow: var(--shadow);
  position: relative;
}

.qr-card.copied::after {
  content: "已复制图片";
  position: absolute;
  top: 12px;
  right: 12px;
  border-radius: 999px;
  background: rgba(13, 27, 61, 0.92);
  color: #fff;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.16);
}

.qr-title {
  min-height: 34px;
  border: 1px solid #7ad79f;
  border-radius: 999px;
  background: var(--green-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #24724a;
  word-break: break-word;
}

.copy-link-top {
  width: 100%;
  margin-top: 8px;
}

.qr-body {
  margin-top: 8px;
  border-radius: 16px;
  background: rgba(255,255,255,.78);
  padding: 8px;
}

.qr-body.clickable {
  cursor: copy;
}

.qr-body img {
  width: 100%;
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
}

.qr-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.qr-actions .small-btn {
  flex: 1;
}

@media (max-width: 760px) {
  .shell {
    width: calc(100vw - 20px);
    padding-top: 16px;
  }

  .topbar,
  .section-title {
    display: block;
  }

  .panel-form,
  .grid-2,
  .tool-options,
  .node-route-row,
  .link-item {
    grid-template-columns: 1fr;
  }

  .qr-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .qr-card {
    width: 100%;
    min-width: 0;
  }

  .btn,
  .small-btn {
    width: 100%;
  }
}

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