:root,
html[data-drwater-theme="ocean"] {
  color-scheme: dark;
  --paper: #061725;
  --surface: #0d2638;
  --surface-soft: #123248;
  --surface-hover: #103047;
  --ink: #edf7f7;
  --muted: #aec2c8;
  --line: #25485c;
  --accent: #88ddd7;
  --accent-strong: #5fc7c1;
  --gold: #f6c85f;
  --danger: #ffaaa5;
  --code-bg: #0a2030;
  --code-ink: #bad4d8;
  --hero-a: #081c2d;
  --hero-b: #102a43;
  --hero-c: #145267;
  --shadow: 0 1rem 3rem rgba(0, 0, 0, 0.24);
}

html[data-drwater-theme="paper"] {
  color-scheme: light;
  --paper: #f4f8f8;
  --surface: #ffffff;
  --surface-soft: #eaf2f3;
  --surface-hover: #f8fbfb;
  --ink: #172126;
  --muted: #52646c;
  --line: #d8e4e6;
  --accent: #145267;
  --accent-strong: #5fc7c1;
  --gold: #b37b0c;
  --danger: #a33a38;
  --code-bg: #edf4f5;
  --code-ink: #35525d;
  --hero-a: #102a43;
  --hero-b: #173d5a;
  --hero-c: #145267;
  --shadow: 0 1rem 3rem rgba(8, 28, 45, 0.11);
}

html[data-drwater-theme="sand"] {
  color-scheme: light;
  --paper: #f5efe2;
  --surface: #fffaf0;
  --surface-soft: #ede4d4;
  --surface-hover: #f8f1e5;
  --ink: #2d302e;
  --muted: #716b60;
  --line: #d8cbb7;
  --accent: #315f62;
  --accent-strong: #8f7548;
  --gold: #b87918;
  --danger: #a33a38;
  --code-bg: #eee5d5;
  --code-ink: #5c554b;
  --hero-a: #3e3429;
  --hero-b: #594b3b;
  --hero-c: #315f62;
  --shadow: 0 1rem 3rem rgba(62, 52, 41, 0.14);
}

html[data-drwater-theme="slate"] {
  color-scheme: dark;
  --paper: #111820;
  --surface: #1b252f;
  --surface-soft: #26333e;
  --surface-hover: #263844;
  --ink: #edf2f4;
  --muted: #afbdc5;
  --line: #394956;
  --accent: #8bd3cf;
  --accent-strong: #66b9b5;
  --gold: #e9be63;
  --danger: #ffaaa5;
  --code-bg: #15212a;
  --code-ink: #c5d4d8;
  --hero-a: #111820;
  --hero-b: #26333e;
  --hero-c: #155e63;
  --shadow: 0 1rem 3rem rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "Jost", "Libre Franklin", "Noto Sans SC", "Source Han Sans SC",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 30rem),
    radial-gradient(circle at 94% 10%, color-mix(in srgb, var(--gold) 10%, transparent), transparent 26rem),
    var(--paper);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: color-mix(in srgb, var(--accent) 24%, transparent);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

button,
input,
select {
  font: inherit;
}

.skip-link {
  position: fixed;
  top: 0.8rem;
  left: 0.8rem;
  z-index: 20;
  padding: 0.7rem 1rem;
  border-radius: 0.55rem;
  background: var(--gold);
  color: var(--paper);
  transform: translateY(-160%);
}

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

.site-header,
main,
.site-footer {
  width: min(100% - 2rem, 78rem);
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 5.6rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  text-decoration: none;
}

.brand img {
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 0.75rem;
}

.brand span {
  display: grid;
  gap: 0.08rem;
}

.brand strong {
  font-size: 1.08rem;
  letter-spacing: 0.035em;
}

.brand small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.06em;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 750;
  text-decoration: none;
}

.button:hover {
  border-color: var(--accent);
  background: var(--surface-soft);
}

.button-primary {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--paper);
}

.hero {
  display: grid;
  gap: 1.25rem;
  margin: 0.6rem 0 1.4rem;
  padding: clamp(1.5rem, 5vw, 3.3rem);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.3rem;
  background:
    radial-gradient(circle at 82% 12%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 18rem),
    linear-gradient(135deg, var(--hero-a), var(--hero-b) 62%, var(--hero-c));
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}

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

h1 {
  max-width: 19ch;
  margin-bottom: 0.8rem;
  font-size: clamp(2.2rem, 6vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.hero-copy {
  max-width: 46rem;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.98rem;
  line-height: 1.7;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) minmax(9rem, 13rem) auto;
  gap: 0.55rem;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.08);
}

.search-form label {
  display: grid;
  gap: 0.3rem;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.7rem;
  font-weight: 700;
}

.search-form input,
.search-form select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0.5rem;
  background: rgba(6, 23, 37, 0.74);
  color: #fff;
}

.search-form .button {
  align-self: end;
  min-height: 2.75rem;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin: 2rem 0 0.9rem;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.type-nav {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  overflow-x: auto;
  overscroll-behavior: contain;
}

.type-nav a {
  flex: 0 0 auto;
  padding: 0.42rem 0.68rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
  text-decoration: none;
}

.type-nav a:hover,
.type-nav a[aria-current="page"] {
  border-color: var(--accent);
  background: var(--surface-soft);
  color: var(--ink);
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 0.8rem;
}

.resource-card {
  display: grid;
  gap: 0.65rem;
  min-width: 0;
  min-height: 12rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 0.55rem 1.5rem rgba(0, 0, 0, 0.08);
}

.resource-card:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
  box-shadow: var(--shadow);
}

.card-top,
.card-meta,
.file-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.65rem;
  align-items: center;
}

.type-chip,
.visibility-chip,
.version-chip {
  width: fit-content;
  padding: 0.18rem 0.48rem;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--accent);
  font-size: 0.66rem;
  font-weight: 800;
}

.visibility-protected {
  background: color-mix(in srgb, var(--gold) 18%, transparent);
  color: var(--gold);
}

.resource-card h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.resource-card p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.card-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 0.7rem;
  margin-top: auto;
}

.card-meta,
.file-meta {
  color: var(--muted);
  font-size: 0.7rem;
}

.open-link {
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.empty-state,
.error-state {
  grid-column: 1 / -1;
  padding: 2rem;
  border: 1px dashed var(--line);
  border-radius: 0.9rem;
  color: var(--muted);
  text-align: center;
}

.error-state {
  color: var(--danger);
}

.detail-shell {
  display: grid;
  gap: 1rem;
}

.detail-hero {
  padding: clamp(1.3rem, 4vw, 2.4rem);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.detail-hero h1 {
  margin: 0.55rem 0;
  color: var(--ink);
  font-size: clamp(1.8rem, 5vw, 3rem);
}

.detail-hero p {
  max-width: 58rem;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.panel {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--surface);
}

.panel h2 {
  margin-bottom: 0.75rem;
  font-size: 1.05rem;
}

.version-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.version-list a {
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  color: var(--accent);
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 0.75rem;
  text-decoration: none;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.7rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.breadcrumb a {
  color: var(--accent);
}

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

.file-row {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto auto;
  gap: 0.8rem;
  align-items: center;
  padding: 0.72rem 0.2rem;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.file-row:hover {
  background: var(--surface-soft);
}

.file-name {
  min-width: 0;
  overflow: hidden;
  color: var(--accent);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-icon {
  display: inline-grid;
  width: 1.65rem;
  height: 1.65rem;
  margin-right: 0.45rem;
  place-items: center;
  border-radius: 0.4rem;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.72rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding: 1.3rem 0 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.76rem;
}

.site-footer a {
  color: var(--accent);
}

@media (max-width: 720px) {
  .site-header,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions,
  .header-actions .button {
    width: 100%;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  .file-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .file-row .file-size {
    display: none;
  }
}

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

