:root {
  --bg: #05080c;
  --surface: #101820;
  --surface-soft: #151e26;
  --ink: #e8eef0;
  --muted: #9aa8ae;
  --line: rgba(226, 232, 240, 0.12);
  --primary: #4cc7b8;
  --primary-dark: #8be1d7;
  --accent: #4cc7b8;
  --accent-glow: rgba(76, 199, 184, 0.14);
  --radius: 10px;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #05080c 0%, #081017 52%, #0b1117 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -ms-overflow-style: none;
}

.light-rays {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 0;
  width: min(1080px, 100vw);
  height: min(1080px, 100vh);
  pointer-events: none;
  opacity: 0.82;
  overflow: hidden;
  mix-blend-mode: screen;
}

.light-rays-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.light-rays.is-fallback {
  background:
    radial-gradient(ellipse 90% 70% at 0% 0%, rgba(248, 250, 219, 0.4), transparent 68%),
    linear-gradient(122deg, rgba(248, 250, 219, 0.45), rgba(248, 250, 219, 0.12) 34%, transparent 72%);
  mask-image: linear-gradient(135deg, #000 0%, rgba(0, 0, 0, 0.54) 42%, transparent 84%);
}

a {
  color: inherit;
}

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

.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 20;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  transform: translateY(-140%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100dvh;
  position: relative;
  z-index: 1;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 14px 12px;
  border-right: 1px solid var(--line);
  background: #0b1117;
  overflow-y: auto;
  scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
  display: none;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 6px 12px;
  text-decoration: none;
  transition: transform 180ms var(--ease-out);
}

.brand:hover,
.brand:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 6px 16px rgba(0, 0, 0, 0.18);
  flex: 0 0 auto;
}

.brand-logo-image {
  display: block;
  width: 100%;
  height: 100%;
  padding: 3px;
  object-fit: contain;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.side-nav {
  display: grid;
  gap: 4px;
}

.nav-link {
  --nav-scale: 1;
  --nav-lift: 0px;
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--muted);
  text-decoration: none;
  transform: translateY(var(--nav-lift)) scale(var(--nav-scale));
  transform-origin: center left;
  transition:
    background 180ms var(--ease-out),
    border-color 180ms var(--ease-out),
    box-shadow 180ms var(--ease-out),
    color 180ms var(--ease-out),
    transform 180ms var(--ease-out);
  will-change: transform;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link.is-active {
  background: var(--surface-soft);
  color: var(--primary-dark);
  border-color: rgba(76, 199, 184, 0.22);
  box-shadow: none;
  outline: none;
}

.nav-link:active,
.button:active,
.card-link:active {
  transform: scale(0.98);
}

.main {
  min-width: 0;
  padding: 14px clamp(14px, 2.4vw, 30px) 34px;
}

.brand-stage {
  display: grid;
  grid-template-columns: auto minmax(360px, 620px);
  gap: clamp(24px, 5vw, 72px);
  align-items: center;
  justify-content: start;
  min-height: clamp(86px, 13vw, 150px);
  margin-bottom: 14px;
}

.shuffle-wordmark {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-height: clamp(54px, 8vw, 88px);
  padding: 0 clamp(16px, 3vw, 34px) 0 0;
  border: 0;
  background: transparent;
  color: #f3f7f6;
  cursor: pointer;
  font-family: "Press Start 2P", "Silkscreen", "Courier New", monospace;
  font-size: clamp(28px, 5.6vw, 68px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  text-shadow:
    0 1px 0 #889399,
    0 2px 0 #5b666b,
    0 12px 34px rgba(0, 0, 0, 0.34);
  image-rendering: pixelated;
  transition: color 180ms var(--ease-out), transform 180ms var(--ease-out), text-shadow 180ms var(--ease-out);
}

.shuffle-wordmark::before,
.shuffle-wordmark::after {
  content: "";
  position: absolute;
  left: clamp(18px, 3.2vw, 40px);
  right: clamp(18px, 3.2vw, 40px);
  pointer-events: none;
}

.shuffle-wordmark::before {
  top: 50%;
  height: 2px;
  background: rgba(76, 199, 184, 0.42);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 260ms var(--ease-out);
}

.shuffle-wordmark::after {
  bottom: 1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232, 238, 240, 0.34), transparent);
  opacity: 0.52;
}

.shuffle-wordmark:hover,
.shuffle-wordmark:focus-visible,
.shuffle-wordmark.is-shuffling {
  color: #ffffff;
  transform: translateY(-1px);
  text-shadow:
    0 1px 0 #a8b1b5,
    0 2px 0 #687277,
    0 14px 38px rgba(0, 0, 0, 0.38);
  outline: none;
}

.shuffle-wordmark:hover::before,
.shuffle-wordmark:focus-visible::before,
.shuffle-wordmark.is-shuffling::before {
  transform: scaleX(1);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding: 0 0 18px;
}

.topbar h1 {
  color: var(--ink);
}

.topbar .lead {
  color: var(--muted);
}

.split-text {
  display: block;
}

.split-unit {
  display: inline-block;
  opacity: 0;
  transform: translateY(40px);
  transition:
    opacity 720ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 720ms cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--split-index) * 34ms);
  will-change: opacity, transform;
}

.lead .split-unit {
  transition-delay: calc(var(--split-index) * 10ms);
}

.split-text-ready .split-unit {
  opacity: 1;
  transform: translateY(0);
}

.topbar::before {
  content: "";
  grid-column: 1 / -1;
  height: 1px;
  order: 3;
  margin-top: 2px;
  background: rgba(226, 232, 240, 0.12);
}

.topbar > div,
.brand-stage > label {
  min-width: 0;
}

.brand-stage .search-box {
  width: min(100%, 620px);
  color: #c7dad7;
}

.brand-stage .search-box input {
  min-height: 58px;
  border-color: rgba(184, 224, 216, 0.2);
  background: #0b1117;
  color: var(--ink);
  font-size: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.brand-stage .search-box input::placeholder {
  color: rgba(203, 219, 216, 0.62);
}

.brand-stage .search-box input:focus {
  outline: 3px solid var(--accent-glow);
  border-color: rgba(76, 199, 184, 0.5);
  box-shadow: 0 0 0 1px rgba(76, 199, 184, 0.22);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .sidebar,
  .topbar,
  .card {
    background: rgba(16, 24, 32, 0.9);
  }
}

.kicker {
  margin: 0 0 5px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.main h1,
.main h2,
.main h3,
.main p,
.main a,
.main span,
.main button,
.detail-main h1,
.detail-main h2,
.detail-main h3,
.detail-main p,
.detail-main a,
.detail-main span,
.detail-main button {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 860px;
  margin-bottom: 10px;
  font-size: clamp(38px, 5vw, 68px);
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

h2 {
  margin-bottom: 4px;
  font-size: clamp(20px, 2vw, 26px);
  line-height: 1.12;
}

h3 {
  margin-bottom: 4px;
  font-size: 16px;
  line-height: 1.18;
}

.lead,
.section-head p,
.hero-band p,
.card p,
.footer {
  color: var(--muted);
}

.card p {
  margin-bottom: 0;
  font-size: 13px;
  line-height: 1.38;
}

.lead {
  max-width: 720px;
  margin-bottom: 0;
  font-size: 14px;
  line-height: 1.45;
}

.search-box {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-weight: 700;
}

.search-box input {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  color: var(--ink);
  font: inherit;
  background: #fff;
  box-shadow: var(--shadow);
  transition: border-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}

.search-box input:focus {
  outline: 3px solid var(--accent-glow);
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), 0 12px 28px rgba(15, 118, 110, 0.1);
}

.hero-band {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #b7e5da;
  border-radius: var(--radius);
  background: #e8f8f4;
  box-shadow: 0 10px 28px rgba(15, 118, 110, 0.06);
}

.hero-band p {
  max-width: 680px;
  margin-bottom: 0;
  font-size: 13px;
  line-height: 1.35;
}

.hero-link,
.button,
.card-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border-radius: 8px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 150ms var(--ease-out),
    background 180ms var(--ease-out),
    border-color 180ms var(--ease-out),
    box-shadow 180ms var(--ease-out),
    color 180ms var(--ease-out);
}

.hero-link,
.button-primary {
  padding: 0 12px;
  background: var(--primary);
  color: #06221d;
  box-shadow: 0 6px 16px rgba(76, 199, 184, 0.12);
}

.hero-link:hover,
.button-primary:hover,
.hero-link:focus-visible,
.button-primary:focus-visible {
  background: var(--primary-dark);
  box-shadow: 0 8px 18px rgba(76, 199, 184, 0.14);
  outline: none;
}

.section {
  margin-top: 16px;
}

.section-head {
  margin-bottom: 8px;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 9px;
}

.card {
  min-width: 0;
  border: 1px solid rgba(226, 232, 240, 0.15);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 34%),
    rgba(13, 20, 28, 0.68);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    0 10px 28px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  overflow: hidden;
  transition:
    transform 220ms var(--ease-out),
    background 220ms var(--ease-out),
    border-color 180ms var(--ease-out),
    box-shadow 220ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .card:hover {
    transform: translateY(-4px);
    border-color: rgba(248, 250, 219, 0.22);
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.048), transparent 36%),
      rgba(13, 20, 28, 0.58);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.07),
      0 14px 34px rgba(0, 0, 0, 0.26);
  }
}

.card-body {
  padding: 8px;
}

.rank {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(76, 199, 184, 0.12);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 800;
}

.repo-name {
  margin: 3px 0 5px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.meta-row,
.tag-row,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.meta-row {
  margin: 6px 0;
}

.meta-pill,
.tag {
  min-height: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #d4e7e3;
  font-size: 11px;
  font-weight: 700;
}

.tag {
  background: rgba(76, 199, 184, 0.1);
  color: var(--primary-dark);
}

.card-actions {
  margin-top: 8px;
}

.button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.button-secondary {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

.button-secondary:hover,
.button-secondary:focus-visible {
  border-color: var(--primary);
  color: var(--primary-dark);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  outline: none;
}

.category-stack {
  display: grid;
  gap: 14px;
}

.category-section {
  scroll-margin-top: 22px;
}

.repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.repo-card {
  padding: 8px;
}

.repo-title {
  display: flex;
  gap: 7px;
  align-items: flex-start;
}

.repo-rank {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(76, 199, 184, 0.22);
  border-radius: 999px;
  background: rgba(76, 199, 184, 0.1);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.repo-rank-top {
  width: 26px;
  height: 26px;
  border-color: rgba(76, 199, 184, 0.28);
  color: #071016;
  font-size: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88), 0 8px 18px rgba(15, 118, 110, 0.12);
}

.repo-rank-plain {
  border-color: rgba(96, 117, 139, 0.22);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-weight: 800;
  box-shadow: none;
}

.repo-rank-1 {
  background: linear-gradient(135deg, #fff4b8 0%, #f6c453 42%, #d88718 100%);
  border-color: #a76209;
  color: #3b2500;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 10px 22px rgba(216, 135, 24, 0.2);
}

.repo-rank-2 {
  background: linear-gradient(135deg, #ffffff 0%, #dfe7ee 48%, #aebdcc 100%);
  border-color: #8a9aaa;
  color: #263241;
}

.repo-rank-3 {
  background: linear-gradient(135deg, #ffe4c7 0%, #d9955d 46%, #c17843 100%);
  border-color: #8b4318;
  color: #341907;
}

.repo-card p {
  min-height: 30px;
}

.card-link {
  min-height: 32px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--primary-dark);
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 42px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.detail-main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 42px) 48px;
}

.detail-hero {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 24px;
  align-items: center;
  margin-bottom: 26px;
}

.detail-hero img {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .detail-hero img:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.06), 0 18px 36px rgba(15, 118, 110, 0.12);
  }
}

.back-link {
  display: inline-flex;
  margin-bottom: 20px;
  color: var(--primary-dark);
  font-weight: 800;
  text-decoration: none;
  transition: transform 150ms var(--ease-out), color 180ms var(--ease-out);
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--primary);
  transform: translateX(-2px);
  outline: none;
}

.content-panel {
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.content-panel li + li {
  margin-top: 8px;
}

.repo-detail-hero {
  grid-template-columns: minmax(0, 1.04fr) minmax(280px, 0.96fr);
  align-items: center;
}

.repo-detail-visual {
  min-width: 0;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(11, 17, 23, 0.76);
  box-shadow: var(--shadow);
}

.repo-detail-visual[hidden] {
  display: none;
}

.repo-detail-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border-radius: 6px;
  background: #0b1117;
}

.repo-detail-main .content-panel {
  overflow: visible;
}

.repo-brief-panel p,
.readme-panel p,
.readme-panel li {
  max-width: 76ch;
}

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

.readme-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

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

.readme-translation-button {
  min-height: 44px;
}

.readme-translation-button[hidden] {
  display: none;
}

.readme-translation-button:disabled {
  cursor: progress;
  opacity: 0.62;
}

.readme-body {
  min-width: 0;
}

.readme-body .markdown-heading a,
.readme-body .anchor {
  display: none;
}

.readme-body h1,
.readme-body h2,
.readme-body h3,
.readme-body h4 {
  margin-top: 20px;
  margin-bottom: 8px;
}

.readme-body h1 {
  font-size: 26px;
}

.readme-body h2 {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.readme-body pre {
  overflow-x: auto;
  padding: 12px;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
}

.readme-body code {
  border-radius: 6px;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-size: 0.92em;
}

.readme-body pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.readme-body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-spacing: 0;
  border-collapse: collapse;
}

.readme-body th,
.readme-body td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.readme-body blockquote {
  margin-left: 0;
  padding-left: 14px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

.readme-body img {
  max-height: 520px;
  margin: 12px 0;
  border-radius: 8px;
}

@media (max-width: 940px) {
  .main,
  .detail-main {
    width: 100%;
    max-width: 100vw;
    overflow-x: clip;
  }

  .main {
    padding: 20px 18px 40px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px 16px 12px;
  }

  .side-nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .side-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-link {
    flex: 0 0 auto;
  }

  .topbar,
  .detail-hero,
  .featured-grid,
  .repo-grid {
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .brand-stage {
    grid-template-columns: 1fr;
    gap: 14px;
    min-height: auto;
    margin-bottom: 22px;
  }

  .brand-stage .search-box {
    width: 100%;
  }

  .topbar {
    gap: 0;
  }

  h1 {
    font-size: clamp(38px, 10vw, 52px);
  }

  .hero-band {
    padding: 22px 18px;
  }

  .hero-band,
  .readme-head,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .readme-tools {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .nav-link,
  .hero-link,
  .button,
  .card-link,
  .brand,
  .card,
  .detail-hero img,
  .back-link,
  .search-box input,
  .split-unit {
    transition: none;
  }

  .split-unit {
    opacity: 1;
    transform: none;
  }
}
