:root {
  --black: #111111;
  --white: #ffffff;
  --red: #e4002b;
  --gray: #888888;
  --gray-light: #eeeeee;
  --rule: 2px solid var(--black);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--black);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ---------- Header ---------- */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 24px;
  border-bottom: var(--rule);
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 10;
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header__mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--black);
  color: var(--white);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
}

.header__title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 4px;
}

.header__nav {
  display: flex;
  gap: 28px;
  height: 100%;
}

.header__link {
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gray);
  border-bottom: 4px solid transparent;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s;
}

.header__link:hover {
  color: var(--black);
}

.header__link.is-active {
  color: var(--black);
  border-bottom-color: var(--red);
}

.header__status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
}

/* ---------- Tabs ---------- */

.tab {
  display: none;
}

.tab.is-active {
  display: block;
}

/* ---------- Hero ---------- */

.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.hero {
  padding: 72px 0 56px;
  border-bottom: var(--rule);
}

.hero__meta {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--red);
  margin-bottom: 16px;
}

.hero__title {
  font-size: 52px;
  font-weight: 700;
  letter-spacing: 2px;
  line-height: 1.1;
}

.hero__line {
  width: 120px;
  height: 8px;
  background: var(--black);
  margin: 28px 0;
}

.hero__desc {
  font-size: 15px;
  line-height: 1.8;
  color: #444;
}

.hero--small {
  padding: 56px 0 40px;
}

/* ---------- Form ---------- */

.form {
  border: 1px solid var(--black);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
}

.field__label--hint {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--gray);
  align-self: end;
  padding-bottom: 13px;
}

.field__input {
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--black);
  border-radius: 0;
  background: var(--white);
  font-family: inherit;
  font-size: 14px;
  color: var(--black);
  outline: none;
  transition: box-shadow 0.15s;
}

.field__input:focus {
  box-shadow: 4px 4px 0 var(--black);
}

.field__input::placeholder {
  color: var(--gray);
}

/* CodeMirror */

.CodeMirror {
  border: 1px solid var(--black);
  border-radius: 0;
  height: auto;
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--black);
}

.CodeMirror-focused {
  box-shadow: 4px 4px 0 var(--black);
}

.CodeMirror pre.CodeMirror-line {
  padding: 0 4px;
}

.CodeMirror-scroll {
  min-height: 72px;
}

#f-extractor + .CodeMirror .CodeMirror-scroll {
  min-height: 150px;
}

.CodeMirror-gutters {
  border-right: 1px solid var(--gray-light);
  background: var(--white);
}

.CodeMirror-linenumber {
  color: var(--gray);
}

/* ---------- Modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 17, 0.6);
  align-items: center;
  justify-content: center;
  z-index: 100;
  display: none;
}

.modal.is-open {
  display: flex;
}

.modal__box {
  width: 480px;
  max-width: calc(100vw - 48px);
  background: var(--white);
  border: 3px solid var(--black);
  box-shadow: 10px 10px 0 rgba(17, 17, 17, 0.3);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal__box--wide {
  width: 640px;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
}

.modal__row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
}

/* ---------- 预设字段交互式编辑 ---------- */

.pe-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

.pe-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr auto;
  gap: 8px;
  align-items: center;
}

.pe-field-row .field__input {
  height: 36px;
  font-size: 13px;
}

.pe-field-row .field__input.is-invalid {
  border-color: var(--red);
}

.btn--sm {
  align-self: flex-start;
  font-size: 12px;
  padding: 8px 14px;
}

#transfer-text {
  height: 300px;
  resize: vertical;
  font-size: 12px;
  line-height: 1.6;
}

.field__input--area {
  height: auto;
  padding: 10px 12px;
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: 12px;
  resize: vertical;
  line-height: 1.6;
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: var(--rule);
  padding-bottom: 12px;
}

.modal__title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
}

.modal__close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--gray);
}

.modal__close:hover {
  color: var(--red);
}

.modal__desc {
  font-size: 12px;
  color: var(--gray);
  line-height: 1.7;
}

.modal__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal__actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  border-top: 1px solid var(--gray-light);
  padding-top: 16px;
}

.btn {
  align-self: flex-start;
  height: 44px;
  padding: 0 32px;
  background: var(--black);
  color: var(--white);
  border: 1px solid var(--black);
  border-radius: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn:hover {
  background: var(--red);
  border-color: var(--red);
}

.btn--ghost {
  background: var(--white);
  color: var(--black);
  height: 32px;
  padding: 0 16px;
  font-size: 11px;
}

.btn--ghost:hover {
  background: var(--black);
  color: var(--white);
}

.field--wide {
  grid-column: 1 / -1;
}

.field__hint {
  font-size: 11px;
  color: var(--gray);
  letter-spacing: 1px;
}

.field--check {
  justify-content: flex-end;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1px;
  cursor: pointer;
  user-select: none;
}

.check input {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--black);
  border-radius: 0;
  cursor: pointer;
  position: relative;
}

.check input:checked::after {
  content: '';
  position: absolute;
  inset: 3px;
  background: var(--red);
}

.form__actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.form__msg {
  font-size: 12px;
  letter-spacing: 1px;
}

.form__msg.is-error {
  color: var(--red);
}

/* ---------- Table ---------- */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--gray);
  font-weight: 700;
  border-bottom: var(--rule);
  padding: 12px 16px;
  white-space: nowrap;
}

.table td {
  padding: 16px;
  border-bottom: 1px solid var(--gray-light);
  vertical-align: middle;
}

/* URL 等长英文串可任意断行, 避免撑爆表格 */
.table td.table__url {
  word-break: break-all;
  overflow-wrap: anywhere;
  white-space: normal;
  max-width: 340px;
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: 12px;
}

.table td:first-child {
  font-weight: 700;
  letter-spacing: 1px;
}

.table__empty td {
  text-align: center;
  color: var(--gray);
  padding: 40px 16px;
  letter-spacing: 2px;
  font-size: 12px;
}

.table__action {
  background: none;
  border: none;
  border-bottom: 1px solid var(--red);
  color: var(--red);
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 0 0 2px;
  margin-right: 12px;
}

.table__action:hover {
  color: var(--black);
  border-bottom-color: var(--black);
}

.table__action--danger:hover {
  color: var(--red);
  border-bottom-color: var(--red);
}

.tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 8px;
  border: 1px solid var(--black);
}

.tag--on {
  color: var(--red);
}

.tag--off {
  color: var(--gray);
}

.table__msg {
  font-size: 11px;
  color: var(--gray);
  margin-left: 8px;
}

.table__msg.is-error {
  color: var(--red);
}

/* ---------- Section ---------- */

.section {
  padding: 48px 0 64px;
}

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--black);
  padding-bottom: 12px;
  margin-bottom: 32px;
}

.section__title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
}

.section__note {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--gray);
}

.section__desc {
  font-size: 12px;
  color: var(--gray);
  letter-spacing: 1px;
  margin-bottom: 20px;
}

/* ---------- 快速配置卡片 ---------- */

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.quick-card {
  text-align: left;
  border: 1px solid var(--black);
  background: var(--white);
  padding: 20px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
}

.quick-card:hover {
  box-shadow: 6px 6px 0 var(--black);
  transform: translate(-2px, -2px);
  border-color: var(--red);
}

.quick-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.quick-card__name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
}

.quick-card__badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  border: 1px solid var(--black);
  color: var(--gray);
  padding: 2px 6px;
}

.quick-card__desc {
  font-size: 11px;
  color: var(--gray);
  letter-spacing: 1px;
  line-height: 1.6;
}

.quick-card__ops {
  border-top: 1px solid var(--gray-light);
  padding-top: 10px;
  display: flex;
  gap: 14px;
}

.section__head-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.section__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin: -20px 0 24px;
}

/* 导入导出区块: 两个按钮等高协调, 统一视觉 */
.section__actions .btn {
  align-self: center;
  height: 44px;
}

.section__actions .btn--ghost {
  height: 44px;
  padding: 0 24px;
  font-size: 13px;
}

.section__actions .form__msg {
  margin-left: 8px;
}

/* ---------- Grid / Cards ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.card {
  border: 1px solid var(--black);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: box-shadow 0.15s, transform 0.15s;
}

.card:hover {
  box-shadow: 8px 8px 0 var(--black);
  transform: translate(-2px, -2px);
}

.card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card__platform {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
}

.card__tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 4px 8px;
  border: 1px solid var(--black);
  color: var(--gray);
}

.card__tag.tag--warn {
  border-color: var(--red);
  color: var(--red);
}

.card__balance {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
}

.card__affix {
  font-size: 14px;
  font-weight: 400;
  color: var(--gray);
  letter-spacing: 0;
  margin: 0 2px;
}

.card__foot {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--gray);
  border-top: 1px solid var(--gray-light);
  padding-top: 12px;
  word-break: break-all;
}

.card__foot--error {
  color: var(--red);
}

.card--error {
  border-color: var(--red);
}

.card--empty .card__balance {
  color: var(--gray-light);
}

/* ---------- Footer ---------- */

.footer {
  display: flex;
  justify-content: space-between;
  padding: 20px 24px;
  border-top: var(--rule);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--gray);
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr 1fr;
  }
  .form__row {
    grid-template-columns: 1fr;
  }
  .table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

@media (max-width: 640px) {
  .header__nav {
    display: none;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .hero__title {
    font-size: 36px;
  }
}
