/* ===== Reset & Variables ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --c-page: #2B0F3B;
  --c-section-a: #0F3A2E;
  --c-section-b: #4A1018;
  --c-card: #241E2E;
  --c-primary: #00D4FF;
  --c-accent: #39FF14;
  --c-new: #FF8C00;
  --c-update: #FF3B30;
  --c-done: #00C7B7;
  --c-tag-hot: #FFC300;
  --c-tag-mid: #FF4C9E;
  --c-tag-cool: #00D4FF;
  --c-tag-live: #39FF14;
  --c-text: #F5EFF7;
  --c-muted: #C9A8D7;
  --c-border: #8E5B9E;
  --c-header-bg: #1C0A29;
  --font-head: "Noto Sans SC", "Source Han Sans CN", "Microsoft YaHei UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --font-body: "Noto Sans SC", "Microsoft YaHei UI", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Consolas, monospace;
  --header-width: 0px;
}

html {
  line-height: 1.6;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--c-text);
  background-color: var(--c-page);
  background-image:
    linear-gradient(rgba(245, 239, 247, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245, 239, 247, 0.025) 1px, transparent 1px);
  background-size: 24px 24px;
  min-height: 100vh;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--c-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

p {
  margin-bottom: 1em;
}

ul,
ol {
  margin: 0 0 1em 1.4em;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-head);
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 0.5em;
}

[hidden] {
  display: none !important;
}

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

::selection {
  background: var(--c-primary);
  color: #111;
}

/* ===== Layout Shell ===== */
.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 100;
  background: var(--c-accent);
  color: #111;
  font-weight: 700;
  padding: 8px 12px;
  border: 1px solid #fff;
}

.skip-link:focus {
  left: 8px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 70;
  width: 100%;
  background-color: var(--c-header-bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 22px 22px;
  border-bottom: 1px solid var(--c-border);
}

.site-header__inner {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.site-header__topline {
  border-left: 4px solid var(--c-accent);
  background: rgba(0, 0, 0, 0.35);
}

.brand-theme {
  margin: 0;
  padding: 5px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--c-muted);
  border: 1px solid var(--c-border);
  border-left: 0;
}

.site-header__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
}

.brand:hover {
  text-decoration: none;
}

.brand__logo {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: var(--c-primary);
  color: #1a1a2e;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 22px;
  border: 1px solid #fff;
  box-shadow: 4px 4px 0 var(--c-accent);
}

.brand__name {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 0.04em;
  color: var(--c-text);
  line-height: 1.1;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--c-border);
  color: var(--c-text);
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.nav-toggle__bars {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  width: 18px;
}

.nav-toggle__bar {
  display: block;
  height: 2px;
  background: currentColor;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
}

.site-header__body {
  display: none;
  flex-direction: column;
  gap: 14px;
}

@media (max-width: 767px) {
  .site-header__body {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    padding: 12px 16px 20px;
    background-color: var(--c-header-bg);
    border-bottom: 1px solid var(--c-border);
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25);
  }

  .site-header[data-open] .site-header__body {
    display: flex;
  }
}

.main-nav {
  counter-reset: nav-index;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 12px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 15px;
  color: var(--c-text);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.nav-link::before {
  counter-increment: nav-index;
  content: counter(nav-index, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--c-muted);
}

.nav-link:hover {
  text-decoration: none;
  border-color: var(--c-border);
  color: var(--c-primary);
  background: rgba(0, 0, 0, 0.25);
}

.nav-link[aria-current="page"] {
  background: var(--c-primary);
  color: #111;
  border-color: #fff;
  box-shadow: 3px 3px 0 var(--c-accent);
}

.nav-link[aria-current="page"]::before {
  color: #111;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.header-search:focus-within {
  border-color: var(--c-accent);
  box-shadow: 2px 2px 0 var(--c-accent);
}

.header-search__icon {
  color: var(--c-primary);
  font-size: 18px;
  line-height: 1;
}

.header-search__input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
}

.header-search__input::placeholder {
  color: var(--c-muted);
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--c-border);
}

.version-badge,
.batch-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
}

.version-badge {
  color: var(--c-accent);
  border: 1px solid var(--c-accent);
  background: rgba(57, 255, 20, 0.1);
}

.batch-badge {
  color: var(--c-new);
  border: 1px dashed var(--c-new);
  background: rgba(255, 140, 0, 0.08);
}

.header-meta__text {
  font-size: 12px;
  color: var(--c-muted);
}

/* ===== Header Desktop Breakpoints ===== */
@media (min-width: 768px) {
  :root {
    --header-width: 260px;
  }

  .site-header {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--header-width);
    height: 100vh;
    border-right: 1px solid var(--c-border);
    border-bottom: none;
    overflow-y: auto;
  }

  .site-header__inner {
    padding: 18px 16px 24px;
  }

  .site-header__body {
    display: flex;
  }

  .nav-toggle {
    display: none;
  }

  .main-content,
  .site-footer {
    margin-left: var(--header-width);
  }
}

@media (min-width: 1024px) {
  :root {
    --header-width: 300px;
  }

  .site-header__inner {
    padding: 22px 20px 28px;
  }

  .main-content,
  .site-footer {
    margin-left: var(--header-width);
  }
}

/* ===== Main Content & Footer ===== */
.main-content {
  display: block;
}

.content-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 16px 56px;
}

.section {
  margin-bottom: 48px;
}

.section--a {
  background: var(--c-section-a);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 24px;
}

.section--b {
  background: var(--c-section-b);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 24px;
}

.section-title {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 900;
  padding: 6px 0 8px 12px;
  margin-bottom: 18px;
  border-left: 4px solid var(--c-primary);
  border-bottom: 1px solid var(--c-border);
}

.section-title::after {
  content: attr(data-index);
  position: absolute;
  right: 0;
  top: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--c-muted);
}

.page-title {
  font-size: 32px;
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 0.3em;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 12px;
  color: var(--c-muted);
}

.breadcrumbs a {
  color: var(--c-muted);
}

.breadcrumbs a:hover {
  color: var(--c-primary);
}

.breadcrumbs [aria-current="page"] {
  color: var(--c-text);
}

.notice-box {
  padding: 14px 16px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-left: 4px solid var(--c-primary);
  color: var(--c-muted);
  font-size: 14px;
}

/* ===== Footer ===== */
.site-footer {
  background-color: var(--c-section-a);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
  border-top: 4px solid var(--c-accent);
}

.site-footer__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 16px 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

.footer-brand__desc {
  margin: 12px 0;
  font-size: 12px;
  color: var(--c-muted);
  max-width: 32em;
  border-left: 3px solid var(--c-accent);
  padding-left: 10px;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.footer-nav__title {
  font-size: 14px;
  color: var(--c-accent);
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.footer-nav__title::before {
  content: "▍";
  margin-right: 4px;
}

.footer-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-nav__list a {
  color: var(--c-text);
  opacity: 0.85;
}

.footer-nav__list a:hover {
  color: var(--c-accent);
  opacity: 1;
}

.footer-contact__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--c-text);
  opacity: 0.9;
  font-size: 14px;
}

.site-footer__bottom {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 12px;
  color: var(--c-muted);
}

.footer-copyright,
.footer-icp {
  margin: 0;
}

.to-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  background: var(--c-section-b);
  color: var(--c-text);
  border: 1px solid var(--c-accent);
  padding: 10px 14px;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  transition: background 0.15s ease, color 0.15s ease;
}

.to-top:hover {
  background: var(--c-accent);
  color: #111;
}

/* ===== Shared Content Components ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.card::before {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: 14px;
  height: 14px;
  background: var(--c-primary);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.45);
  background: #2C2634;
}

.card__title {
  font-size: 16px;
  font-weight: 800;
  color: var(--c-text);
}

.card__meta {
  font-size: 12px;
  color: var(--c-muted);
}

.card__footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--c-border);
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 116px;
  padding: 14px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.tile:hover {
  transform: translateY(-2px);
  box-shadow: 3px 3px 0 var(--c-primary);
}

.tile--blue {
  border-color: var(--c-primary);
}

.tile--green {
  border-color: var(--c-accent);
}

.tile--yellow {
  border-color: var(--c-tag-hot);
}

.tile--pink {
  border-color: var(--c-tag-mid);
}

.tile--red {
  border-color: var(--c-update);
}

.tile__title {
  font-size: 16px;
  font-weight: 800;
}

.tile__count {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--c-primary);
}

.batch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.batch-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-top: 4px solid var(--c-primary);
}

.batch-cell__index {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--c-muted);
}

.batch-cell__title {
  font-size: 16px;
  font-weight: 800;
}

.batch-cell__meta {
  font-size: 12px;
  color: var(--c-muted);
}

.entry-list {
  display: flex;
  flex-direction: column;
}

.entry-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 10px;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text);
}

.entry-row:hover {
  background: rgba(0, 212, 255, 0.08);
  text-decoration: none;
}

.entry-row__main {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-row__meta {
  font-size: 12px;
  color: var(--c-muted);
  white-space: nowrap;
}

.index-number {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--c-primary);
  font-weight: 700;
}

@media (max-width: 767px) {
  .entry-row {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .entry-row__meta {
    grid-column: 2;
    white-space: normal;
  }
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  background: transparent;
  border: 1px solid currentColor;
  cursor: pointer;
}

.tag:hover {
  background: currentColor;
  color: #111;
}

.tag--hot {
  color: var(--c-tag-hot);
  font-size: 15px;
  border-width: 2px;
}

.tag--mid {
  color: var(--c-tag-mid);
  font-size: 13px;
}

.tag--cool {
  color: var(--c-tag-cool);
  font-size: 12px;
}

.tag--live {
  color: var(--c-tag-live);
  font-size: 13px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.05);
}

.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  background: currentColor;
  flex-shrink: 0;
}

.status-badge.is-new {
  color: var(--c-new);
  background: rgba(255, 140, 0, 0.12);
}

.status-badge.is-running {
  color: var(--c-update);
  background: rgba(255, 59, 48, 0.12);
}

.status-badge.is-done {
  color: var(--c-done);
  background: rgba(0, 199, 183, 0.12);
}

.metric-bar {
  display: block;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.metric-bar__fill {
  display: block;
  height: 100%;
  width: var(--metric, 50%);
  background: linear-gradient(90deg, var(--c-primary), var(--c-accent));
}

.index-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.index-bar a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 4px 8px;
  border: 1px solid var(--c-border);
  font-size: 12px;
  color: var(--c-text);
  background: transparent;
}

.index-bar a:hover {
  border-color: var(--c-accent);
  color: var(--c-accent);
}

.index-bar a.is-active {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: #111;
}

.rail-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.rail-scroll > * {
  flex: 0 0 auto;
  scroll-snap-align: start;
  width: min(280px, 82vw);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--c-card);
  font-size: 14px;
}

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

.data-table thead th {
  background: var(--c-section-b);
  color: var(--c-text);
  font-family: var(--font-head);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.data-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}

.data-table tbody tr:hover {
  background: rgba(0, 212, 255, 0.08);
}

/* ===== Buttons & Filters ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--c-primary);
  color: var(--c-primary);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  background: var(--c-primary);
  color: #111;
  text-decoration: none;
}

.btn--primary {
  background: var(--c-primary);
  color: #111;
}

.btn--primary:hover {
  background: transparent;
  color: var(--c-primary);
}

.filter-btn {
  padding: 6px 14px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--c-border);
  color: var(--c-text);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.filter-btn:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
}

.filter-btn[aria-pressed="true"] {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #111;
  box-shadow: 2px 2px 0 var(--c-accent);
}

.filter-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  font-size: 13px;
}

.filter-status__label {
  color: var(--c-muted);
}

.filter-status__value {
  color: var(--c-accent);
  font-weight: 700;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 6px 12px;
  border: 1px solid var(--c-border);
  background: transparent;
  color: var(--c-text);
  font-family: var(--font-mono);
  font-size: 14px;
}

.pagination a:hover {
  border-color: var(--c-accent);
  color: var(--c-accent);
}

.pagination .is-active {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: #111;
}

/* ===== Media Frames & Image Placeholders ===== */
.media-frame,
.figure {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  color: var(--c-muted);
  font-size: 12px;
  overflow: hidden;
}

.media-frame[data-ratio="16-9"],
.figure[data-ratio="16-9"] {
  aspect-ratio: 16 / 9;
}

.media-frame[data-ratio="1-1"],
.figure[data-ratio="1-1"] {
  aspect-ratio: 1;
}

.media-frame img,
.figure img {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
