:root {
  --bg: #0d1117;
  --bg-subtle: #010409;
  --surface: #1f2328;
  --surface-2: #161b22;
  --surface-light: #f0f6fc;
  --text: #f0f6fc;
  --text-on-light: #1f2328;
  --muted: #9198a1;
  --accent: #8dd6ff;
  --primary: #5fed83;
  --primary-hover: #72ff97;
  --primary-active: #4ace6a;
  --primary-dark: #08872b;
  --text-on-primary: #000000;
  --border: #484f58;
  --border-muted: #3d444d;
  --glow: 0 0 24px rgba(141, 214, 255, 0.15);
  --glow-hover: 0 0 32px rgba(141, 214, 255, 0.25);
  --header-bg: rgba(13, 17, 23, 0.85);
  --overlay: rgba(1, 4, 9, 0.7);

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 16px;
  --r-full: 9999px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  --font: "Mona Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  --mono: ui-monospace, "Mona Sans Mono", SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --header-h: 64px;
  --container: 1280px;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-subtle: #f6f8fa;
  --surface: #f6f8fa;
  --surface-2: #ffffff;
  --surface-light: #ffffff;
  --text: #1f2328;
  --text-on-light: #1f2328;
  --muted: #59636e;
  --accent: #0969da;
  --primary: #1f883d;
  --primary-hover: #2a9f47;
  --primary-active: #178136;
  --primary-dark: #1a7f37;
  --text-on-primary: #ffffff;
  --border: #d0d7de;
  --border-muted: #d8dee4;
  --glow: 0 0 24px rgba(9, 105, 218, 0.12);
  --glow-hover: 0 0 32px rgba(9, 105, 218, 0.2);
  --header-bg: rgba(255, 255, 255, 0.85);
  --overlay: rgba(31, 35, 40, 0.5);
}

@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #ffffff;
    --bg-subtle: #f6f8fa;
    --surface: #f6f8fa;
    --surface-2: #ffffff;
    --surface-light: #ffffff;
    --text: #1f2328;
    --text-on-light: #1f2328;
    --muted: #59636e;
    --accent: #0969da;
    --primary: #1f883d;
    --primary-hover: #2a9f47;
    --primary-active: #178136;
    --primary-dark: #1a7f37;
    --text-on-primary: #ffffff;
    --border: #d0d7de;
    --border-muted: #d8dee4;
    --glow: 0 0 24px rgba(9, 105, 218, 0.12);
    --glow-hover: 0 0 32px rgba(9, 105, 218, 0.2);
    --header-bg: rgba(255, 255, 255, 0.85);
    --overlay: rgba(31, 35, 40, 0.5);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--sp-6));
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

[hidden] {
  display: none !important;
}

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

h1, h2, h3, p, dl, dd, ol, ul {
  margin: 0;
}

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

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: var(--sp-2);
  z-index: 99;
  background: var(--primary);
  color: var(--text-on-primary);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-sm);
}

.skip-link:focus {
  left: var(--sp-4);
}

.link {
  color: var(--accent);
  transition: text-decoration-color 150ms ease-out;
}

.link:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
}

code {
  font-family: var(--mono);
  font-size: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-muted);
  border-radius: var(--r-sm);
  padding: 1px 6px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  padding: 11px 23px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 80ms cubic-bezier(0.33, 1, 0.68, 1),
    border-color 80ms cubic-bezier(0.33, 1, 0.68, 1), color 80ms cubic-bezier(0.33, 1, 0.68, 1);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-on-primary);
}

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

.btn-primary:active {
  background: var(--primary-active);
  border-color: var(--primary-active);
  transition: none;
}

.btn-secondary {
  border-color: var(--text);
  color: var(--text);
}

.btn-secondary:hover {
  background: rgba(240, 246, 252, 0.1);
}

:root[data-theme="light"] .btn-secondary:hover {
  background: rgba(31, 35, 40, 0.08);
}

.btn-secondary:active {
  background: rgba(240, 246, 252, 0.15);
  transition: none;
}

.btn-ghost {
  font-weight: 400;
  padding: 8px 12px;
}

.btn-ghost:hover {
  color: var(--accent);
  background: rgba(141, 214, 255, 0.1);
}

.btn-ghost:active {
  background: rgba(141, 214, 255, 0.15);
  transition: none;
}

:root[data-theme="light"] .btn-ghost:hover,
:root[data-theme="light"] .btn-ghost:active {
  background: rgba(9, 105, 218, 0.1);
}

.btn-sm {
  font-size: 14px;
  padding: 5px 10px;
}

.icon-btn {
  padding: 8px;
  min-width: 36px;
  min-height: 36px;
  font-size: 16px;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--r-full);
  line-height: 1.5;
  border: 1px solid transparent;
}

.badge-open {
  background: var(--primary-dark);
  color: #ffffff;
}

.badge-open .dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--primary);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 32;
  background: var(--header-bg);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border-muted);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: var(--sp-2);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.3px;
}

.brand-mark {
  font-size: 20px;
}

.brand-sub {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  margin-left: var(--sp-4);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0 var(--sp-3);
  margin: 0;
  flex: 0 1 300px;
  min-width: 120px;
  transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
}

.search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(141, 214, 255, 0.3);
}

:root[data-theme="light"] .search-field:focus-within {
  box-shadow: 0 0 12px rgba(9, 105, 218, 0.25);
}

.search-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 6px 0;
  color: var(--muted);
  cursor: pointer;
  flex: none;
  border-radius: var(--r-sm);
  transition: color 150ms ease-out, transform 150ms ease-out;
}

.search-submit:hover {
  color: var(--accent);
}

.search-submit:active {
  transform: scale(0.9);
}

.search-field .search-icon {
  color: inherit;
  flex: none;
}

.search-field input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-on-light);
  font-family: inherit;
  font-size: 14px;
  padding: 8px var(--sp-2);
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  transition: opacity 150ms ease-out;
}

.search-field input::placeholder {
  color: var(--muted);
}

.search-field kbd {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 5px;
  line-height: 1.6;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border-muted);
  padding: var(--sp-16) 0;
}

.hero-aurora {
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 140%;
  background:
    radial-gradient(45% 55% at 18% 30%, rgba(141, 214, 255, 0.18), transparent 70%),
    radial-gradient(40% 50% at 78% 20%, rgba(95, 237, 131, 0.14), transparent 70%),
    radial-gradient(50% 60% at 55% 90%, rgba(141, 214, 255, 0.1), transparent 70%);
  filter: blur(8px);
  z-index: -1;
  animation: aurora-shift 16s ease-in-out infinite alternate;
}

@keyframes aurora-shift {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to { transform: translate3d(3%, 2%, 0) scale(1.06); }
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: var(--sp-12);
  align-items: center;
}

.hero-copy > * + * {
  margin-top: var(--sp-5);
}

.hero-copy > * {
  animation: rise 620ms cubic-bezier(0.33, 1, 0.68, 1) backwards;
}

.hero-copy > *:nth-child(1) { animation-delay: 40ms; }
.hero-copy > *:nth-child(2) { animation-delay: 110ms; }
.hero-copy > *:nth-child(3) { animation-delay: 180ms; }
.hero-copy > *:nth-child(4) { animation-delay: 250ms; }
.hero-copy > *:nth-child(5) { animation-delay: 320ms; }

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero-title {
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -1.5px;
}

.hero-accent {
  color: var(--accent);
}

.hero-lead {
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 56ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.hero-stats {
  display: flex;
  gap: var(--sp-8);
  padding-top: var(--sp-2);
}

.stat dt {
  font-size: 14px;
  color: var(--muted);
}

.stat dd {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--text);
}

.hero-visual {
  position: relative;
  height: 420px;
}

.hero-tile {
  --rot: 0deg;
  position: absolute;
  width: 46%;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--glow);
  transform: rotate(var(--rot));
  animation: tile-in 700ms cubic-bezier(0.33, 1, 0.68, 1) backwards;
  transition: transform 240ms cubic-bezier(0.33, 1, 0.68, 1), box-shadow 240ms ease-out,
    border-color 240ms ease-out;
}

@keyframes tile-in {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.94) rotate(var(--rot));
  }
}

.hero-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  margin: -8px 0;
  object-fit: cover;
  animation: float 7s ease-in-out infinite alternate;
}

.hero-tile.t2 img { animation-duration: 8.5s; animation-delay: -1.2s; }
.hero-tile.t3 img { animation-duration: 9.5s; animation-delay: -2.4s; }
.hero-tile.t4 img { animation-duration: 8s; animation-delay: -3.1s; }

@keyframes float {
  from {
    transform: translateY(-5px);
  }
  to {
    transform: translateY(6px);
  }
}

.hero-tile:hover {
  border-color: var(--accent);
  box-shadow: var(--glow-hover);
  transform: rotate(var(--rot)) translateY(-4px);
}

.hero-tile.t1 { top: 0; left: 0; --rot: -4deg; z-index: 5; }
.hero-tile.t2 { top: 8%; right: 2%; --rot: 5deg; z-index: 1; }
.hero-tile.t3 { bottom: 2%; left: 20%; --rot: 3deg; z-index: 3; }
.hero-tile.t4 { bottom: 8%; right: 6%; --rot: -6deg; z-index: 2; }

.hero-tile:hover,
.hero-tile:focus-within {
  z-index: 10;
}

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: var(--sp-8);
  padding-top: var(--sp-10);
  padding-bottom: var(--sp-16);
  align-items: start;
}

.sidebar {
  position: sticky;
  top: calc(var(--header-h) + var(--sp-6));
}

.sidebar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 0 var(--sp-3);
  margin-bottom: var(--sp-2);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.side-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  color: var(--text);
  transition: background-color 150ms ease-out, border-color 150ms ease-out,
    color 150ms ease-out, transform 180ms cubic-bezier(0.33, 1, 0.68, 1);
}

.side-item:hover {
  background: rgba(141, 214, 255, 0.08);
  color: var(--accent);
  transform: translateX(3px);
}

:root[data-theme="light"] .side-item:hover {
  background: rgba(9, 105, 218, 0.08);
}

.side-item.is-active {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.side-icon {
  font-size: 16px;
}

.side-name {
  font-size: 15px;
  font-weight: 500;
}

.side-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.sidebar-note {
  margin-top: var(--sp-6);
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border-muted);
  border-radius: var(--r-md);
  font-size: 14px;
  color: var(--muted);
}

.sidebar-note p {
  margin-bottom: var(--sp-2);
}

/* ---------- Toolbar & Tabs ---------- */
.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  border-bottom: 1px solid var(--border-muted);
}

.tabs {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
}

.tab {
  font-family: inherit;
  font-size: 15px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: var(--sp-2) var(--sp-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  transition: color 150ms ease-out, border-color 200ms cubic-bezier(0.33, 1, 0.68, 1),
    transform 160ms ease-out;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text);
  transform: translateY(-1px);
}

.tab.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.tab .tab-count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.toolbar-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding-bottom: var(--sp-2);
}

.count {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Tag panel ---------- */
.tag-panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-5) 0;
}

.tag-group {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.tag-group-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  min-width: 84px;
  text-transform: lowercase;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.chip {
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  padding: 3px 10px;
  border-radius: var(--r-full);
  border: 1px solid var(--border-muted);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 80ms cubic-bezier(0.33, 1, 0.68, 1),
    border-color 80ms cubic-bezier(0.33, 1, 0.68, 1), color 80ms cubic-bezier(0.33, 1, 0.68, 1);
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chip.is-on {
  background: rgba(95, 237, 131, 0.14);
  border-color: var(--primary);
  color: var(--text);
  font-weight: 500;
}

:root[data-theme="light"] .chip.is-on {
  background: rgba(31, 136, 61, 0.15);
  border-color: var(--primary-dark);
  color: var(--primary-dark);
}

.chip:active {
  transform: scale(0.94);
}

.chip.is-on {
  animation: chip-pop 260ms cubic-bezier(0.33, 1, 0.68, 1);
}

@keyframes chip-pop {
  0% { transform: scale(0.88); }
  60% { transform: scale(1.07); }
  100% { transform: scale(1); }
}

/* ---------- Pagination ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  padding: var(--sp-4) 0;
}

.pager[hidden] {
  display: none;
}

.pager-bottom {
  border-top: 1px solid var(--border-muted);
}

.pager-info {
  font-size: 14px;
  color: var(--muted);
}

.pager-info strong {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
}

.pager-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex-wrap: wrap;
}

.pager-btn {
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border-muted);
  border-radius: var(--r-sm);
  padding: 5px 10px;
  min-height: 32px;
  cursor: pointer;
  transition: background-color 80ms cubic-bezier(0.33, 1, 0.68, 1),
    border-color 80ms cubic-bezier(0.33, 1, 0.68, 1),
    color 80ms cubic-bezier(0.33, 1, 0.68, 1), transform 120ms ease-out;
}

.pager-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(141, 214, 255, 0.08);
}

:root[data-theme="light"] .pager-btn:hover:not(:disabled) {
  background: rgba(9, 105, 218, 0.08);
}

.pager-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.pager-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pager-num {
  min-width: 32px;
}

.pager-btn.is-on {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-on-primary);
  font-weight: 600;
}

.pager-ellipsis {
  color: var(--muted);
  padding: 0 var(--sp-1);
}

.pager-size {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 14px;
  color: var(--muted);
}

.page-size-select {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 5px var(--sp-2);
  min-height: 32px;
  cursor: pointer;
  transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
}

.page-size-select:hover {
  border-color: var(--accent);
}

.page-size-select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 12px rgba(141, 214, 255, 0.3);
}

/* ---------- Masonry grid ---------- */
.grid {
  columns: 4 220px;
  column-gap: var(--sp-4);
}

.card {
  position: relative;
  break-inside: avoid;
  margin-bottom: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color 200ms ease-out, box-shadow 200ms ease-out,
    transform 220ms cubic-bezier(0.33, 1, 0.68, 1);
  animation: card-in 340ms cubic-bezier(0.33, 1, 0.68, 1) backwards;
  animation-delay: calc(var(--i, 0) * 34ms);
  will-change: transform, opacity;
}

.card:hover {
  border-color: var(--accent);
  box-shadow: var(--glow);
  transform: translateY(-4px);
}

.card:active {
  transform: translateY(-1px);
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.card-media {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-muted);
}

.card-media img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  opacity: 0;
  transition: opacity 260ms ease-out;
}

.card-media img.is-loaded {
  opacity: 1;
}

.card-open {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: zoom-in;
}

.card-open:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

.card-open svg {
  position: absolute;
  right: var(--sp-3);
  bottom: var(--sp-3);
  display: block;
  width: 36px;
  height: 36px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  opacity: 0;
  box-shadow: var(--glow);
  transition: opacity 150ms ease-out, color 150ms ease-out, border-color 150ms ease-out;
}

.card:hover .card-open svg,
.card-open:focus-visible svg {
  opacity: 1;
}

.card-media.is-broken {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
}

.card-body {
  padding: var(--sp-3) var(--sp-4) var(--sp-4);
}

.card-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.2px;
}

.download-btn {
  position: relative;
  z-index: 2;
  margin-left: auto;
  flex: none;
  color: var(--muted);
  opacity: 0;
  transition: opacity 150ms ease-out, color 150ms ease-out, background-color 150ms ease-out;
}

.card:hover .download-btn,
.download-btn:focus-visible {
  opacity: 1;
}

.download-btn:hover {
  color: var(--accent);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  margin-top: var(--sp-2);
}

.tag {
  font-size: 12px;
  line-height: 1.5;
  padding: 1px 8px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  border: 1px solid var(--border-muted);
  color: var(--muted);
}

/* ---------- Original image dialog ---------- */
.image-dialog {
  width: min(1100px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.image-dialog::backdrop {
  background: rgba(1, 4, 9, 0.84);
  backdrop-filter: blur(4px);
}

.image-dialog-content {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
}

.image-dialog-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 56px;
  padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-5);
  border-bottom: 1px solid var(--border-muted);
}

.image-dialog-title {
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-dialog-close {
  flex: none;
  margin-left: auto;
}

.image-dialog-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 180px;
  overflow: auto;
  padding: var(--sp-4);
  background: var(--bg-subtle);
}

.image-dialog-stage img {
  max-width: 100%;
  max-height: calc(100vh - 112px);
  max-height: calc(100dvh - 112px);
  width: auto;
  height: auto;
  object-fit: contain;
}

.image-dialog-status {
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Skeleton & empty ---------- */
.skeleton {
  break-inside: avoid;
  margin-bottom: var(--sp-4);
  border: 1px solid var(--border-muted);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}

.skeleton-media {
  aspect-ratio: 1 / 1;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}

.skeleton-line {
  height: 12px;
  margin: var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.skeleton-line.short {
  width: 50%;
  margin-bottom: var(--sp-4);
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.empty-state {
  text-align: center;
  padding: var(--sp-16) var(--sp-6);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  animation: fade-in 240ms cubic-bezier(0.33, 1, 0.68, 1) both;
}

.empty-state[hidden] {
  display: none;
}

.empty-icon {
  font-size: 40px;
  margin-bottom: var(--sp-3);
}

.empty-state h3 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.empty-state p {
  color: var(--muted);
  margin: var(--sp-2) 0 var(--sp-5);
}

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 520ms cubic-bezier(0.33, 1, 0.68, 1),
    transform 520ms cubic-bezier(0.33, 1, 0.68, 1);
  transition-delay: var(--d, 0ms);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Contribute ---------- */
.contribute {
  border-top: 1px solid var(--border-muted);
  background: var(--bg-subtle);
  padding: var(--sp-16) 0;
}

.section-head {
  max-width: 720px;
  margin-bottom: var(--sp-10);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: var(--sp-2);
}

.section-title {
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -1px;
}

.section-lead {
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
  margin-top: var(--sp-3);
}

.quest {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--sp-6);
}

.quest-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-6);
  transition: border-color 200ms ease-out, box-shadow 200ms ease-out;
}

.quest-card:hover {
  border-color: var(--accent);
  box-shadow: var(--glow);
}

.quest-num {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-on-primary);
  background: var(--primary);
  border-radius: var(--r-full);
  padding: 2px 10px;
  display: inline-block;
}

.quest-card h3 {
  font-size: 22px;
  font-weight: 400;
  line-height: 1.4;
  margin: var(--sp-4) 0 var(--sp-2);
}

.quest-en {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

.quest-card p {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: var(--sp-4);
}

.quest-cmd {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-muted);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  margin: 0 0 var(--sp-4);
  overflow-x: auto;
  white-space: pre;
}

.quest-card .quest-cmd {
  white-space: pre-wrap;
  word-break: break-all;
}

.quest-cli {
  margin-top: var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-6) var(--sp-5);
}

.quest-cli summary {
  cursor: pointer;
  font-size: 15px;
  color: var(--text);
}

.quest-cli summary:hover {
  color: var(--accent);
}

.quest-cli[open] summary {
  margin-bottom: var(--sp-3);
}

.quest-cli .quest-cmd {
  margin-bottom: 0;
}

.quest-note {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
  margin-top: var(--sp-3);
}

.quest-help {
  margin-top: var(--sp-6);
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border-muted);
  padding: var(--sp-8) 0;
  font-size: 14px;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  gap: var(--sp-5);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: var(--sp-8);
  transform: translate(-50%, 12px);
  z-index: 99;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  box-shadow: var(--glow-hover);
  padding: var(--sp-3) var(--sp-5);
  font-size: 14px;
  opacity: 0;
  transition: opacity 160ms ease-out, transform 160ms ease-out;
}

.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.noscript {
  padding: var(--sp-6);
  text-align: center;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin: var(--sp-6);
}

/* ---------- Responsive ---------- */
@media (max-width: 1011px) {
  .header-nav {
    display: none;
  }

  .search-field {
    flex-basis: 220px;
  }

  .hero-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--sp-8);
  }

  .hero-visual {
    height: 300px;
    max-width: 460px;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--sp-5);
  }

  .sidebar {
    position: static;
  }

  .sidebar-title {
    display: none;
  }

  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: var(--sp-1);
  }

  .side-item {
    flex: none;
    border-color: var(--border-muted);
  }

  .sidebar-note {
    display: none;
  }
}

@media (max-width: 767px) {
  .download-btn {
    opacity: 1;
  }

  .card-open svg {
    opacity: 1;
  }

  .image-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }

  .image-dialog-content {
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }

  .image-dialog-head {
    min-height: 48px;
    padding-left: var(--sp-3);
  }

  .image-dialog-stage {
    min-height: 120px;
    padding: var(--sp-2);
  }

  .image-dialog-stage img {
    max-height: calc(100vh - 80px);
    max-height: calc(100dvh - 80px);
  }

  .hero {
    padding: var(--sp-10) 0;
  }

  .hero-visual {
    display: none;
  }

  .hero-stats {
    gap: var(--sp-6);
  }

  .header-nav {
    display: none;
  }

  .search-field {
    flex-basis: 180px;
  }

  .search-field kbd {
    display: none;
  }

  .grid {
    columns: 2 150px;
    column-gap: var(--sp-3);
  }

  .contribute {
    padding: var(--sp-10) 0;
  }

  .layout {
    padding-top: var(--sp-6);
    padding-bottom: var(--sp-10);
  }

  .tag-group-label {
    min-width: 100%;
  }
}

@media (max-width: 543px) {
  .hide-sm {
    display: none;
  }

  .search-field {
    flex-basis: 150px;
    min-width: 96px;
  }

  .container {
    padding: 0 var(--sp-4);
  }

  .grid {
    columns: 1;
  }

  .pager {
    gap: var(--sp-2);
    justify-content: center;
  }

  .pager-info {
    width: 100%;
    text-align: center;
  }

  .hero-title {
    letter-spacing: -1px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
