:root {
  --void: #000;
  --bg: #050403;
  --panel: rgba(17, 14, 12, 0.64);
  --panel-soft: rgba(13, 12, 10, 0.48);
  --line: #e7d2be1a;
  --line-strong: #e7d2be33;
  --cream: #e1e0cc;
  --muted: #8a8378;
  --faint: #5b574e;
  --ember: #cc6437;
  --ease-quart: cubic-bezier(.22, 1, .36, 1);
  --ease-std: cubic-bezier(.4, 0, .2, 1);
  --dur-hover: .24s;
  --font-body: "Almarai", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "Barlow Condensed", "Arial Narrow", "PingFang SC", sans-serif;
  --font-mono: "JetBrains Mono", "Courier New", monospace;
}

@font-face{font-family:Almarai;font-style:normal;font-weight:400;font-display:swap;src:url(/fonts/almarai-400-latin.woff2)format("woff2")}
@font-face{font-family:Almarai;font-style:normal;font-weight:700;font-display:swap;src:url(/fonts/almarai-700-latin.woff2)format("woff2")}
@font-face{font-family:Barlow Condensed;font-style:normal;font-weight:500;font-display:swap;src:url(/fonts/barlow-condensed-500-latin.woff2)format("woff2")}
@font-face{font-family:Barlow Condensed;font-style:normal;font-weight:600;font-display:swap;src:url(/fonts/barlow-condensed-600-latin.woff2)format("woff2")}
@font-face{font-family:JetBrains Mono;font-style:normal;font-weight:400;font-display:swap;src:url(/fonts/jetbrains-mono-400-latin.woff2)format("woff2")}
@font-face{font-family:JetBrains Mono;font-style:normal;font-weight:500;font-display:swap;src:url(/fonts/jetbrains-mono-500-latin.woff2)format("woff2")}

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

html {
  background: var(--bg);
  color: var(--cream);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  background:
    radial-gradient(68% 50% at 75% 12%, rgba(14, 93, 103, 0.24), transparent 68%),
    radial-gradient(52% 44% at 22% 80%, rgba(217, 101, 53, 0.14), transparent 72%),
    #050403;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background: url("/media/qianwen-ai-assistant.gif") center / cover no-repeat;
  opacity: 0.24;
  filter: saturate(1.04) brightness(0.8) blur(1px);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.3) 40%, rgba(0, 0, 0, 0.76)),
    radial-gradient(82% 72% at 50% 44%, transparent 0%, rgba(0, 0, 0, 0.55) 100%);
}

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

[hidden] { display: none !important; }

.grain {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: overlay;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.22) 0 1px, transparent 1px),
    radial-gradient(circle at 70% 80%, rgba(255, 255, 255, 0.14) 0 1px, transparent 1px);
  background-size: 5px 5px, 7px 7px;
}

.nav-pill {
  z-index: 1000;
  -webkit-backdrop-filter: blur(16px) saturate(1.08);
  backdrop-filter: blur(16px) saturate(1.08);
  position: fixed;
  top: 0;
  left: 50%;
  transform: translate(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: calc(100% - 56px);
  min-height: 56px;
  gap: clamp(16px, 2vw, 28px);
  padding: 13px clamp(14px, 1.6vw, 20px);
  border: 1px solid rgba(231, 210, 190, 0.12);
  border-top: none;
  border-radius: 0 0 18px 18px;
  background: rgba(11, 10, 9, 0.66);
  box-shadow: none;
  transition: padding .3s var(--ease-std);
}

.star-mark {
  flex: none;
  width: 1em;
  height: 1em;
}

.star-mark .st-body { fill: var(--cream); }
.star-mark .st-tip { fill: var(--ember); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.16em;
  white-space: nowrap;
  text-transform: uppercase;
  color: var(--cream);
  transition: color 0.24s;
}

.brand:hover { color: var(--ember); }
.brand:hover .star-mark .st-body { fill: var(--ember); }

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(16px, 1.8vw, 26px);
}

.nav-links a {
  position: relative;
  color: #e1e0ccc7;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .04em;
  text-transform: none;
  white-space: nowrap;
  transition: color 0.24s;
}

.nav-links a[aria-current="page"] { color: var(--cream); }

.nav-links a:hover { color: var(--ember); }

.nav-links a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -4px;
  left: 0;
  height: 1px;
  background: var(--ember);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform var(--dur-hover) var(--ease-quart);
}

.nav-links a:hover::after {
  transform: scaleX(1);
}

.wrap {
  width: min(1700px, calc(100vw - 64px));
  margin: 0 auto;
}

.toolbox-page {
  padding-top: 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.42em;
  color: var(--ember);
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 30px;
  height: 1px;
  background: currentColor;
}

.toolbox-board {
  padding: clamp(124px, 16vh, 174px) 0 92px;
}

.category-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: clamp(46px, 5vw, 78px);
}

.tab {
  min-height: 70px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(12, 10, 9, 0.58);
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(14px);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.tab:hover {
  transform: translateY(-2px);
  border-color: rgba(217, 101, 53, 0.45);
}

.tab.is-active {
  color: var(--cream);
  border-color: rgba(217, 101, 53, 0.72);
  background: rgba(27, 18, 13, 0.76);
}

.tab span {
  display: none;
  margin-bottom: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--ember);
  text-transform: uppercase;
}

.tab b {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 1.9vw, 2.1rem);
  font-weight: 500;
  line-height: 0.98;
}

.panel {
  animation: panelIn 0.22s ease both;
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.source-group {
  margin-top: 34px;
}

.source-group h3 {
  margin: 0 0 12px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.source-group h3 span {
  margin-left: 8px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 14px;
}

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

.source-tile {
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr;
  grid-template-areas:
    "icon name"
    "icon desc";
  column-gap: 10px;
  min-height: 88px;
  padding: 16px 92px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 8, 7, 0.68);
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.source-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(217, 101, 53, 0.52);
  background: rgba(18, 14, 11, 0.8);
}

.source-icon {
  grid-area: icon;
  color: rgba(217, 101, 53, 0.64);
  font-family: var(--font-mono);
  font-size: 18px;
  line-height: 1.4;
}

.source-name {
  grid-area: name;
  color: var(--cream);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.2;
}

.source-desc {
  grid-area: desc;
  margin-top: 7px;
  color: var(--faint);
  font-size: 14px;
  line-height: 1.45;
}

.source-tag {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 5px 10px;
  border-radius: 6px;
  color: rgba(235, 232, 214, 0.58);
  background: rgba(235, 232, 214, 0.1);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.compact-list {
  border-top: 1px solid var(--line);
}

.empty-note {
  padding: 34px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  font-size: 18px;
  line-height: 1.7;
}

.list-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 180px;
  gap: 24px;
  align-items: center;
  min-height: 104px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.list-row:hover {
  border-color: rgba(217, 101, 53, 0.45);
}

.row-type {
  color: var(--ember);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.row-main b {
  display: block;
  color: var(--cream);
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 2.05vw, 2.35rem);
  font-weight: 500;
  line-height: 1;
}

.row-main em {
  display: block;
  margin-top: 10px;
  color: var(--faint);
  font-size: 16px;
  font-style: normal;
  line-height: 1.5;
}

.row-action {
  justify-self: end;
  color: var(--ember);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  white-space: nowrap;
}

.article {
  width: min(980px, calc(100vw - 64px));
  margin: 0 auto;
  padding: 150px 0 100px;
}

.article h1 {
  max-width: 14em;
  margin-bottom: 28px;
  font-family: var(--font-display);
  font-size: clamp(2.45rem, 4.8vw, 5.6rem);
  font-weight: 500;
  line-height: 1.02;
  text-wrap: balance;
}

.article-figure {
  margin: 0 0 34px;
  overflow: hidden;
  border: 1px solid rgba(235, 232, 214, 0.18);
  border-radius: 18px;
  background: rgba(9, 8, 7, 0.56);
  box-shadow: 0 28px 70px -50px rgba(0, 0, 0, 0.9);
}

.article-figure img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 7.4;
  object-fit: cover;
  filter: brightness(0.76) saturate(1.08) contrast(1.03);
}

.article p {
  color: rgba(235, 232, 214, 0.76);
  font-size: 19px;
  line-height: 2;
}

.article h2 {
  margin-top: 58px;
  font-family: var(--font-display);
  font-size: 3.4rem;
  font-weight: 500;
}

.foot {
  padding: 44px 0;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.foot .wrap {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

@media (max-width: 1180px) {
  .source-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .nav-links {
    overflow-x: auto;
  }

  .wrap,
  .article { width: min(100vw - 32px, 1700px); }

  .toolbox-board {
    padding-top: 112px;
  }

  .category-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 42px;
  }

  .source-grid { grid-template-columns: 1fr; }

  .list-row {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 0;
    padding: 22px 0;
  }

  .row-action { justify-self: start; }

  .foot .wrap { display: block; }
}
