:root {
  --bg: #0b1020;
  --panel: #131a30;
  --panel-2: #182238;
  --line: #263252;
  --text: #e8ecf6;
  --muted: #93a0bd;
  --teal: #6de0d2;
  --amber: #ffc46b;
}

* { box-sizing: border-box; }

html {
  /* Reserve scrollbar space so page height changes never shift the width. */
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.55;
}

a { color: var(--teal); }

.hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 20px 8px;
  text-align: center;
}
.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 5vw, 44px);
  letter-spacing: 0.5px;
}
.hero .sub { color: var(--muted); margin: 0 0 14px; font-size: 16px; }
.hero .notice {
  color: var(--amber);
  font-size: 13px;
  max-width: 760px;
  margin: 0 auto 18px;
  opacity: 0.9;
}
.hero-actions { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; }
.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--teal);
  color: #06281f;
  font-weight: 600;
  text-decoration: none;
  font-size: 14px;
}
.btn.ghost { background: transparent; color: var(--teal); border: 1px solid var(--teal); }
.count { color: var(--muted); font-size: 14px; margin-left: 6px; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang-btn {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 7px 13px;
  font-size: 13.5px;
  cursor: pointer;
  font-family: inherit;
}
.lang-btn.active { background: var(--teal); color: #06281f; font-weight: 600; }

.filters {
  max-width: 1100px;
  margin: 26px auto 6px;
  padding: 0 20px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.pill {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 14px;
}
.pill:hover { border-color: var(--teal); }
.pill.active { background: var(--teal); color: #06281f; border-color: var(--teal); font-weight: 600; }
#search {
  flex: 1 1 200px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  padding: 7px 14px;
  font-size: 14px;
  outline: none;
}
#search:focus { border-color: var(--teal); }

/* Masonry via JS-managed flex columns: expanding a card only grows its own
   column, so nothing else on the page moves. */
.grid {
  max-width: 1100px;
  margin: 14px auto 30px;
  padding: 0 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.loading, .empty { color: var(--muted); text-align: center; padding: 40px 0; width: 100%; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.card img.preview {
  width: 100%;
  display: block;
  background: var(--panel-2);
  /* Fixed ratio: card height is stable before/after the image loads. */
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.card .body { padding: 14px 16px 16px; }
.card h3 { margin: 0 0 6px; font-size: 17px; }
.card .meta { color: var(--muted); font-size: 12.5px; margin-bottom: 8px; }
.card .summary { margin: 0 0 10px; font-size: 14px; color: #cdd6ec; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--teal);
  border-radius: 6px;
  padding: 1px 8px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.badge {
  display: inline-block;
  font-size: 12px;
  color: var(--amber);
  border: 1px solid var(--amber);
  border-radius: 999px;
  padding: 0 8px;
  margin-left: 8px;
  vertical-align: 1px;
}

/* Smooth prompt reveal: grid-rows 0fr -> 1fr transition. */
.prompt-toggle {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  padding: 0;
  margin: 2px 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.prompt-toggle:hover { color: var(--teal); }
.prompt-toggle .arrow {
  display: inline-block;
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
.prompt-toggle[aria-expanded="true"] .arrow { transform: rotate(90deg); }
.prompt-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}
.prompt-wrap.open { grid-template-rows: 1fr; }
.prompt-inner { overflow: hidden; min-height: 0; }
.prompt-inner pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font-size: 12.5px;
  margin: 0 0 10px;
}
.card .links { display: flex; gap: 14px; font-size: 14px; }
.card .links a { text-decoration: none; font-weight: 600; }
.card .links a:hover { text-decoration: underline; }

footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 20px 40px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
