/* ============================================================
   共享样式 — 工具集合站
   ============================================================ */

:root {
  --bg-0: #05070c;
  --bg-1: #0d1424;

  --surface: rgba(255, 255, 255, 0.035);
  --surface-hi: rgba(255, 255, 255, 0.065);
  --surface-solid: #111827;

  --border: rgba(255, 255, 255, 0.08);
  --border-hi: rgba(255, 255, 255, 0.18);

  --text: #eef2f8;
  --text-dim: #98a2b3;
  --text-faint: #5f6a7d;

  --accent: #7c9dff;
  --accent-2: #b79bff;
  --accent-3: #f6821f;

  --ok: #34d399;
  --err: #f87171;

  --radius: 16px;
  --radius-sm: 10px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, #16224a 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at 85% 100%, #1b1436 0%, transparent 55%),
    linear-gradient(#05070c, #05070c);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  padding: 0 24px 80px;
}

a { color: inherit; }

/* ---------- 布局容器 ---------- */

.wrap {
  max-width: 1160px;
  margin: 0 auto;
}

.wrap--narrow {
  max-width: 860px;
  margin: 0 auto;
}

/* ---------- 入口页头部 ---------- */

.hub-head {
  text-align: center;
  padding: 88px 0 52px;
}

.hub-title {
  margin: 0 0 14px;
  font-size: clamp(30px, 4.4vw, 46px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  background: linear-gradient(120deg, #b9d1ff 0%, #cdb9ff 55%, #9fb6ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hub-sub {
  margin: 0;
  color: var(--text-dim);
  font-size: 15px;
  letter-spacing: 0.01em;
}

/* ---------- 卡片网格 ---------- */

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

@media (max-width: 1080px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .grid { grid-template-columns: 1fr; }
  body { padding: 0 16px 60px; }
  .hub-head { padding: 56px 0 36px; }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 26px 24px 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition:
    background 0.22s ease,
    border-color 0.22s ease,
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.22s ease;
}

.sr-fix {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease;
  background: radial-gradient(
    circle at 18% 0%,
    color-mix(in srgb, var(--tint, #7c9dff) 22%, transparent),
    transparent 62%
  );
}

.card:hover {
  background: var(--surface-hi);
  border-color: var(--border-hi);
  transform: translateY(-3px);
  box-shadow: 0 16px 36px -18px rgba(0, 0, 0, 0.9);
}

.card:hover::after { opacity: 1; }

.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 21px;
  line-height: 1;
  background: color-mix(in srgb, var(--tint, #7c9dff) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--tint, #7c9dff) 26%, transparent);
  flex: 0 0 auto;
}

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-title .arrow {
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  color: var(--tint, #7c9dff);
  font-weight: 400;
}

.card:hover .card-title .arrow {
  opacity: 1;
  transform: translateX(0);
}

.card-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-dim);
}

/* 入场动画 */
.card {
  animation: card-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.card:nth-child(1) { animation-delay: 0.02s; }
.card:nth-child(2) { animation-delay: 0.06s; }
.card:nth-child(3) { animation-delay: 0.1s; }
.card:nth-child(4) { animation-delay: 0.14s; }
.card:nth-child(5) { animation-delay: 0.18s; }
.card:nth-child(6) { animation-delay: 0.22s; }
.card:nth-child(7) { animation-delay: 0.26s; }
.card:nth-child(8) { animation-delay: 0.3s; }

@media (prefers-reduced-motion: reduce) {
  .card { animation: none; transition: none; }
  .card:hover { transform: none; }
}

/* ---------- 子页面：顶部导航 ---------- */

.topbar {
  max-width: 860px;
  margin: 0 auto;
  padding: 26px 0 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 7px 14px 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.back:hover {
  color: var(--text);
  border-color: var(--border-hi);
  background: var(--surface);
}

.topbar .spacer { flex: 1; }

.topbar .tag {
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---------- 子页面：标题区 ---------- */

.page-head {
  padding: 34px 0 28px;
}

.page-head h1 {
  margin: 0 0 10px;
  font-size: clamp(25px, 3.4vw, 33px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.page-head p {
  margin: 0;
  color: var(--text-dim);
  font-size: 14.5px;
  line-height: 1.7;
}

/* ---------- 面板 ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.panel--flush { padding: 0; overflow: hidden; }

.panel h2 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.panel h2:only-child { margin-bottom: 0; }

.panel p {
  margin: 0 0 10px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.75;
}

.panel p:last-child { margin-bottom: 0; }

/* ---------- 按钮 ---------- */

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-hi);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 17px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.1s ease,
    color 0.16s ease;
  white-space: nowrap;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hi);
}

.btn:active { transform: scale(0.975); }

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--accent);
  border-color: transparent;
  color: #0a1020;
  font-weight: 600;
}

.btn--primary:hover {
  background: #93aeff;
  border-color: transparent;
}

.btn--ghost {
  background: transparent;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

/* ---------- 表单控件 ---------- */

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

.field > label {
  font-size: 12.5px;
  color: var(--text-dim);
  font-weight: 500;
}

input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  transition: border-color 0.16s ease, background 0.16s ease;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  background: rgba(0, 0, 0, 0.4);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

input[type="color"] {
  width: 100%;
  height: 38px;
  padding: 3px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---------- 通用文字 ---------- */

.mono {
  font-family: var(--mono);
  font-size: 13px;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.07);
  padding: 2px 6px;
  border-radius: 5px;
  color: #ffc290;
}

.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }

.status {
  font-size: 13px;
  min-height: 20px;
  line-height: 1.5;
}

.status.ok { color: var(--ok); }
.status.err { color: var(--err); }
