:root {
  --bg0: #f4f6fb;
  --bg1: #eef2f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e6ebf3;
  --line-strong: #d5dde9;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-ring: rgba(37, 99, 235, 0.18);
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --topbar-h: 64px;
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 420px at 8% -8%, #dbeafe 0%, transparent 55%),
    radial-gradient(700px 360px at 100% 0%, #e0e7ff 0%, transparent 50%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  background-attachment: fixed;
}

body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a { color: var(--primary); }

.hidden { display: none !important; }

/* ---------- shell ---------- */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(230, 235, 243, 0.9);
  box-shadow: var(--shadow-sm);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  padding: 4px;
  color: inherit;
  text-align: left;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.28);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 0.98rem;
}

.brand-text small {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.nav-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link {
  border: 0;
  background: transparent;
  color: var(--text-2);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
}

.nav-link:hover,
.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
}

.user-chip .meta {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 0;
}

.user-chip .name {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
}

.user-chip .role {
  font-size: 0.72rem;
  color: var(--muted);
}

.main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
  flex: 1;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 8px 16px 24px;
}

/* ---------- primitives ---------- */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-head h1 {
  margin: 0 0 6px;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.page-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 56ch;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 10px;
}

.breadcrumbs button {
  border: 0;
  background: transparent;
  color: var(--primary);
  padding: 0;
  font-weight: 600;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.stat-card .label {
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 6px;
}

.stat-card .value {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 16px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.card-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.card-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 16px;
}

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

/* ---------- forms ---------- */
.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-2);
  font-size: 0.88rem;
  font-weight: 600;
}

.field .hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-ring);
}

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

.input-with-action .input {
  flex: 1;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 10px;
  color: var(--text-2);
  font-size: 0.9rem;
}

.check-row input {
  width: 16px;
  height: 16px;
}

.check-row-onetime {
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
}

.check-row-onetime code {
  background: #ffedd5;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.86rem;
  color: var(--text-2);
  user-select: none;
}

.switch-row input {
  width: 16px;
  height: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

@media (max-width: 760px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ---------- buttons ---------- */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s, background 0.12s, border-color 0.12s, box-shadow 0.12s;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(180deg, #3b82f6, var(--primary));
  color: #fff;
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.22);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #2563eb, var(--primary-2));
}

.btn-secondary {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--text-2);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: #c9d4e4;
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #fecaca;
}

.btn-danger:hover:not(:disabled) {
  background: #fee2e2;
}

.btn-sm {
  padding: 7px 10px;
  border-radius: 9px;
  font-size: 0.82rem;
}

.btn-block { width: 100%; }

/* ---------- badges / tags ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary);
}

.badge-admin {
  background: var(--warn-soft);
  color: #b45309;
}

.badge-soft {
  background: #f1f5f9;
  color: var(--muted);
}

.badge-expired {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-used {
  background: #f1f5f9;
  color: #64748b;
  text-decoration: line-through;
}

.badge-onetime {
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  color: #c2410c;
  border: 1px solid #fdba74;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.badge-onetime.is-used {
  background: #f1f5f9;
  color: #94a3b8;
  border-color: #e2e8f0;
  text-decoration: line-through;
  font-weight: 700;
}

.row-onetime td {
  background: rgba(255, 247, 237, 0.55);
}

.row-onetime-used td {
  background: #f8fafc;
}

.key-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  background: #ea580c;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  flex: 0 0 auto;
}

.pid-onetime {
  color: #c2410c;
  background: #fff7ed !important;
  border: 1px solid #fdba74;
  font-weight: 700;
}

.sub-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: #e8eef8;
  border-radius: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.sub-tabs .tab {
  padding: 7px 12px;
  font-size: 0.86rem;
}

.toolbar-wrap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.toolbar-wrap .search {
  flex: 1;
  min-width: 160px;
  margin: 0;
}

.stat-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2em;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 700;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

.op-cell .btn {
  margin: 2px;
}

textarea.input {
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
}

.row-expired td {
  opacity: 0.72;
}

.key-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.key-cell .pid {
  word-break: break-all;
}

.pwd-text {
  font-family: var(--mono);
  font-size: 0.86rem;
  min-width: 5em;
}

.expire-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.radio-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.radio-row input {
  width: 16px;
  height: 16px;
}

.zh-date-picker {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.zh-date-picker.hidden {
  display: none !important;
}

.zh-date-part {
  display: block;
  margin: 0;
}

.zh-date-part .select {
  margin: 0;
  text-align: center;
}

@media (max-width: 480px) {
  .zh-date-picker {
    grid-template-columns: 1fr;
  }
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 0.8rem;
  font-weight: 600;
}

/* ---------- login ---------- */
.login-layout {
  min-height: calc(100vh - var(--topbar-h) - 80px);
  display: grid;
  place-items: center;
  padding: 12px 0 24px;
}

.login-card {
  width: min(440px, 100%);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  padding: 28px 28px 24px;
  backdrop-filter: blur(10px);
}

.login-card .hero-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #dbeafe, #e0e7ff);
  color: var(--primary);
  font-size: 1.4rem;
  margin-bottom: 14px;
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 1.45rem;
}

.login-card .subtitle {
  margin: 0 0 20px;
  color: var(--muted);
}

.login-tips {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
}

/* ---------- games grid ---------- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.game-card {
  position: relative;
  text-align: left;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #f8fafc);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  cursor: pointer;
  color: inherit;
  width: 100%;
}

.game-card:hover {
  transform: translateY(-2px);
  border-color: #bfdbfe;
  box-shadow: var(--shadow);
}

.game-card .icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
  margin-bottom: 12px;
}

.game-card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.game-card .slug {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-all;
}

.game-card .footer {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.game-card .arrow {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.86rem;
}

/* ---------- empty / loading ---------- */
.empty-state {
  text-align: center;
  padding: 36px 18px;
  color: var(--muted);
}

.empty-state .icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  font-size: 1.5rem;
}

.empty-state h3 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 1.05rem;
}

.empty-state p {
  margin: 0 auto;
  max-width: 36ch;
  font-size: 0.9rem;
}

.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  padding: 28px 8px;
  justify-content: center;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #dbeafe;
  border-top-color: var(--primary);
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- table ---------- */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.toolbar .search {
  flex: 1;
  min-width: 200px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: #fff;
}

table.data th,
table.data td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

table.data th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

table.data tr:last-child td {
  border-bottom: 0;
}

table.data tbody tr:hover td {
  background: #fafcff;
}

code, .mono {
  font-family: var(--mono);
  font-size: 0.86em;
}

.pid {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #f1f5f9;
  font-family: var(--mono);
  font-size: 0.84rem;
}

/* ---------- api box ---------- */
.api-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #0b1220;
  color: #e2e8f0;
  margin-bottom: 12px;
}

.api-box-compact {
  margin-bottom: 0;
}

.api-box-compact .api-box-head {
  padding: 5px 8px;
}

.api-box-compact pre {
  padding: 6px 8px;
  font-size: 0.74rem;
  line-height: 1.35;
}

.api-box-ok {
  border-color: rgba(5, 150, 105, 0.45);
}

.api-box-ok .api-box-head {
  background: #064e3b;
}

.api-box-ok .label {
  color: #a7f3d0;
}

.api-box-fail {
  border-color: rgba(220, 38, 38, 0.4);
}

.api-box-fail .api-box-head {
  background: #7f1d1d;
}

.api-box-fail .label {
  color: #fecaca;
}

.sample-title {
  margin: 8px 0 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-2);
}

.help-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 720px) {
  .help-grid-2 {
    grid-template-columns: 1fr;
  }
}

.api-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: #111827;
  border-bottom: 1px solid #1f2937;
}

.api-box-head .label {
  font-size: 0.78rem;
  color: #94a3b8;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.api-box pre {
  margin: 0;
  padding: 12px 14px;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  color: #dbeafe;
}

.api-steps {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.api-steps li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--text-2);
  font-size: 0.88rem;
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 800;
  flex: 0 0 auto;
  margin-top: 1px;
}

/* ---------- tabs ---------- */
.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: #e8eef8;
  border-radius: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 9px 14px;
  border-radius: 11px;
  font-weight: 700;
  font-size: 0.9rem;
}

.tab:hover { color: var(--text-2); }

.tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ---------- alert ---------- */
.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  font-size: 0.9rem;
}

.alert-error {
  background: var(--danger-soft);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-ok {
  background: var(--ok-soft);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-info {
  background: var(--primary-soft);
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* ---------- toast ---------- */
.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 24px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: #0f172a;
  color: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow-lg);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: toast-in 0.2s ease;
}

.toast.ok { background: #065f46; }
.toast.err { background: #991b1b; }

.toast .body {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.4;
}

.toast button {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- modal ---------- */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 23, 42, 0.45);
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 20px;
}

.modal h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.modal p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-help {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--primary);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
  padding: 0;
}

.btn-help:hover {
  background: var(--primary-soft);
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px var(--primary-ring);
}

.form-card {
  width: 100%;
  max-width: none;
}

.modal-help {
  width: min(960px, calc(100vw - 24px));
  max-height: none;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.modal-help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.modal-help-head h3 {
  margin: 0;
  font-size: 1rem;
}

.modal-help-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.btn-help-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.btn-help-close:hover {
  background: var(--surface-2);
  color: var(--text);
}

.modal-help-body {
  padding: 10px 14px 4px;
  overflow: visible;
  flex: 0 1 auto;
}

.modal-help .modal-actions {
  padding: 8px 14px 12px;
  border-top: 1px solid var(--line);
  flex: 0 0 auto;
  gap: 8px;
}

.help-lead {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.api-test {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line-strong);
}

.api-test-tip {
  margin: 0 0 8px;
  font-size: 0.82rem;
}

.api-test-preview {
  margin: 8px 0 0;
  font-size: 0.84rem;
}

.api-test-count-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 8px;
  min-height: 1.2em;
}

.api-test-count-line .hint {
  margin: 0;
}

.api-test-head .sample-title {
  margin: 0;
}

.api-test-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.api-test-input {
  flex: 1;
  min-width: 180px;
  margin: 0 !important;
  padding: 8px 10px !important;
}

.api-test-row .btn {
  height: 36px;
  margin: 0;
  flex: 0 0 auto;
}

.api-test-result {
  margin-top: 8px;
}

.api-test-result.hidden {
  display: none !important;
}

.api-test-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}

.api-test-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.74rem;
}

.api-test-status.is-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.api-test-status.is-fail {
  background: var(--danger-soft);
  color: var(--danger);
}

.api-test-url {
  font-family: var(--mono);
  font-size: 0.74rem;
  word-break: break-all;
}

.api-test-result.is-ok .api-box {
  border-color: rgba(5, 150, 105, 0.45);
}

.api-test-result.is-fail .api-box {
  border-color: rgba(220, 38, 38, 0.4);
}

/* ---------- misc ---------- */
.help-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.88rem;
}

.help-list li { margin: 4px 0; }

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

@media (max-width: 640px) {
  .main {
    width: min(100% - 20px, 1120px);
    padding-top: 18px;
  }

  .topbar {
    padding: 0 12px;
    height: auto;
    min-height: var(--topbar-h);
    flex-wrap: wrap;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .nav-bar {
    width: 100%;
    justify-content: flex-start;
  }

  .brand-text small { display: none; }

  .login-card { padding: 22px 18px; }
}