:root {
  --bg: #f4f8ff;
  --panel: rgba(255, 255, 255, 0.82);
  --ink: #122033;
  --muted: #5b6b7c;
  --accent: #0f9f8a;
  --accent-2: #2b7fff;
  --accent-hot: #ff5a3d;
  --line: rgba(18, 32, 51, 0.12);
  --danger: #e11d48;
  --font-display: "Space Grotesk", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: var(--font-display);
  color: var(--ink);
  background:
    radial-gradient(900px 480px at 0% 0%, rgba(43, 127, 255, 0.16), transparent 55%),
    radial-gradient(700px 500px at 100% 0%, rgba(15, 159, 138, 0.14), transparent 50%),
    radial-gradient(560px 380px at 70% 100%, rgba(255, 90, 61, 0.1), transparent 55%),
    linear-gradient(180deg, #f7fbff, #eef8f4);
  -webkit-font-smoothing: antialiased;
}

.fx {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.fx-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(43, 127, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 159, 138, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.4), transparent 75%);
  animation: gridDrift 20s linear infinite;
}
.fx-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(52px);
  opacity: 0.5;
}
.fx-orb-a {
  width: 280px; height: 280px; top: 6%; right: 4%;
  background: rgba(43, 127, 255, 0.35);
  animation: orbFloat 10s ease-in-out infinite;
}
.fx-orb-b {
  width: 220px; height: 220px; bottom: 8%; left: 3%;
  background: rgba(255, 90, 61, 0.22);
  animation: orbFloat 12s ease-in-out infinite reverse;
}
.fx-scan {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 4px,
    rgba(255,255,255,0.2) 4px,
    rgba(255,255,255,0.2) 5px
  );
  opacity: 0.28;
  mix-blend-mode: soft-light;
}

.top, .wrap, .admin-shell, .login-box, .tool { position: relative; z-index: 1; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  max-width: 1100px;
  margin: 0 auto;
}

.logo {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.logo span {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, #122033, var(--accent-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.logo small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.top-actions { display: flex; gap: 16px; }
.quiet {
  color: var(--muted);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}
.quiet:hover { color: var(--accent-2); }

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 24px 64px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 14px;
  animation: rise 0.5s ease both;
}
.pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-hot);
  box-shadow: 0 0 0 0 rgba(255, 90, 61, 0.45);
  animation: pulse 1.8s ease-out infinite;
}

.hero h1 {
  font-size: clamp(2.5rem, 5.5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  animation: rise 0.55s ease 0.05s both;
}
.hero > p {
  margin-top: 8px;
  color: var(--muted);
  animation: rise 0.55s ease 0.1s both;
}

.filters {
  margin-top: 28px;
  display: grid;
  gap: 12px;
  animation: rise 0.55s ease 0.15s both;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 460px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(18, 32, 51, 0.05);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
.search-prefix {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-2);
  white-space: nowrap;
}
#search {
  flex: 1;
  min-width: 0;
  padding: 12px 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  outline: none;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.7);
  color: var(--muted);
  padding: 7px 12px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.chip.active, .chip:hover {
  color: #fff;
  background: var(--accent-2);
  border-color: var(--accent-2);
  transform: translateY(-1px);
}
.chip[data-type="app"].active,
.chip[data-type="app"]:hover {
  background: var(--accent);
  border-color: var(--accent);
}
.chip[data-type="link"].active,
.chip[data-type="link"]:hover {
  background: var(--accent-hot);
  border-color: var(--accent-hot);
}

.grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(18, 32, 51, 0.06);
  text-decoration: none;
  color: inherit;
  min-height: 156px;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  animation: rise 0.45s ease both;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--accent-2), var(--accent), var(--accent-hot));
  opacity: 0.9;
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(43, 127, 255, 0.28);
  box-shadow: 0 16px 36px rgba(43, 127, 255, 0.12);
}
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.card-icon { font-size: 1.35rem; }
.badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: #fff;
  background: var(--accent);
  padding: 3px 7px;
}
.badge.link { background: var(--accent-hot); }
.card h2 { font-size: 1.08rem; font-weight: 600; letter-spacing: -0.01em; }
.card p { color: var(--muted); font-size: 0.9rem; line-height: 1.5; flex: 1; }
.card-meta {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.empty {
  grid-column: 1 / -1;
  color: var(--muted);
  font-family: var(--font-mono);
  padding: 32px 0;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 90, 61, 0.45); }
  70% { box-shadow: 0 0 0 12px rgba(255, 90, 61, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 90, 61, 0); }
}
@keyframes gridDrift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 48px, 48px 0; }
}
@keyframes orbFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-16px); }
}

/* Admin */
.admin-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 24px 64px;
}
.admin-shell h1 {
  font-size: 2rem;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.panel {
  margin-top: 20px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(18, 32, 51, 0.05);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}
.panel h2 { font-size: 1.05rem; margin-bottom: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.row input, .row select, .row textarea {
  flex: 1;
  min-width: 140px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.row textarea { min-height: 72px; width: 100%; }
.btn {
  border: 1px solid var(--accent-2);
  background: var(--accent-2);
  color: #fff;
  padding: 9px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn.ghost {
  background: transparent;
  color: var(--accent-2);
}
.btn.danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}
.login-box {
  max-width: 360px;
  margin: 12vh auto 0;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(18, 32, 51, 0.08);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}
.login-box h1 { margin-bottom: 16px; }
.login-box input {
  width: 100%;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.msg { color: var(--danger); font-size: 0.88rem; min-height: 1.2em; margin-bottom: 8px; }
.ok { color: var(--accent); }

@media (max-width: 640px) {
  .top, .wrap, .admin-shell { padding-left: 16px; padding-right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
