:root {
  --ink: #1c2430;
  --ink-soft: #3d4a5c;
  --muted: #6b7789;
  --line: #d8e0ea;
  --paper: #f3f6f9;
  --surface: #ffffff;
  --accent: #0f6e56;
  --accent-deep: #0a5542;
  --accent-soft: #e6f4ef;
  --warn: #b45309;
  --shadow: 0 12px 40px rgba(28, 36, 48, 0.12);
  --radius: 14px;
  --font-display: "ZCOOL XiaoWei", "Songti SC", serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --sidebar: 240px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, #c8ebe9 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, #dce6f5 0%, transparent 50%),
    linear-gradient(180deg, #eef3f7 0%, var(--paper) 40%, #e8eef4 100%);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

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

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

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

/* —— Header —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(243, 246, 249, 0.88);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 160px;
  cursor: pointer;
  border-radius: 10px;
  padding: 2px 4px;
  margin: -2px -4px;
  transition: background 0.15s;
}

.brand:hover {
  background: var(--accent-soft);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--muted);
}

.search-wrap {
  flex: 1;
  min-width: 200px;
  max-width: 420px;
  position: relative;
}

.search-wrap input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-wrap::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 14px;
  height: 14px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  transform: translateY(-60%);
  opacity: 0.7;
}

.search-wrap::after {
  content: "";
  position: absolute;
  left: 26px;
  top: 58%;
  width: 7px;
  height: 2px;
  background: var(--muted);
  transform: rotate(45deg);
  opacity: 0.7;
}

.stats {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.stats strong {
  color: var(--accent-deep);
  font-weight: 600;
}

.back-link {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}

.back-link:hover {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

/* —— Top tools —— */
.top-tools {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 24px 0;
}

.top-tools-inner {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(232, 244, 239, 0.55));
  border: 1px solid rgba(15, 110, 86, 0.12);
  box-shadow: 0 4px 18px rgba(28, 36, 48, 0.04);
  overflow: hidden;
}

.top-tools .tool-nav {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 5px;
  margin: 0;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.top-tools .tool-nav::-webkit-scrollbar {
  display: none;
}

.top-tools .tool-nav a,
.top-tools .tool-nav button {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.top-tools .tool-nav a:hover,
.top-tools .tool-nav button:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}

.top-tools .tool-nav button:active,
.top-tools .tool-nav a:active {
  transform: scale(0.97);
}

/* —— Layout —— */
.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px 100px;
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  gap: 28px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 78px;
  max-height: calc(100vh - 100px);
  overflow: auto;
  padding-right: 6px;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

.nav-label {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
  padding-left: 8px;
}

.filter-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.65);
  font-size: 0.85rem;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}

.filter-check input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}

.tool-nav {
  display: none;
}

.cat-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cat-nav a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  transition: background 0.15s, color 0.15s;
}

.cat-nav a:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.cat-nav a.active {
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}

.cat-nav a.active .count {
  background: rgba(15, 110, 86, 0.14);
  color: var(--accent-deep);
}

.cat-nav a .count {
  font-size: 0.72rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.8);
  padding: 1px 7px;
  border-radius: 999px;
}

.cat-nav a.hidden {
  display: none;
}

/* —— Main gallery —— */
.gallery {
  min-width: 0;
}

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(15, 110, 86, 0.18);
  color: var(--accent-deep);
  font-size: 0.88rem;
}

.filter-bar[hidden] {
  display: none !important;
}

.filter-clear {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid rgba(15, 110, 86, 0.25);
  color: var(--accent-deep);
  font-size: 0.82rem;
  font-weight: 500;
  transition: background 0.15s, transform 0.15s;
}

.filter-clear:hover {
  background: #fff;
  transform: translateY(-1px);
}

.section {
  margin-bottom: 36px;
  scroll-margin-top: 90px;
}

.section.hidden {
  display: none;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 400;
}

.section-head .meta {
  font-size: 0.78rem;
  color: var(--muted);
}

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

.card-thumb {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  overflow: hidden;
  background: #dde4ec;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.2s;
  animation: riseIn 0.45s ease both;
}

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

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.25s ease;
  background: #d5dde6;
}

.card-thumb img.is-loaded,
.card-thumb img[src] {
  opacity: 1;
}

.card-thumb .title-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 28px 8px 8px;
  background: linear-gradient(transparent, rgba(20, 28, 40, 0.78));
  color: #fff;
  font-size: 0.72rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-thumb.no-prompt::after {
  content: "无提示词";
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(28, 36, 48, 0.65);
  color: #fff;
}

.card-thumb .recon-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 6px;
  background: #b45309;
  color: #fff;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(180, 83, 9, 0.35);
}

.card-thumb.is-reconstructed {
  border-color: rgba(180, 83, 9, 0.35);
}

.card-thumb.hidden {
  display: none;
}

.filter-hint {
  font-style: normal;
  font-weight: 600;
  color: var(--accent-deep);
  margin-left: 2px;
}

.prompt-badge {
  font-size: 0.78rem;
  line-height: 1.45;
  padding: 8px 12px;
  border-radius: 10px;
  margin: -2px 0 2px;
}

.prompt-badge.reconstructed {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fdba74;
}

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

.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

/* —— Detail modal —— */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(20, 28, 40, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  z-index: 70;
  top: 50%;
  left: 50%;
  width: min(960px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  transform: translate(-50%, -46%) scale(0.97);
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, transform 0.3s ease, visibility 0.25s;
}

.modal.open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.modal-preview {
  background: #e8eef4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  min-height: 280px;
  overflow: auto;
  position: relative;
}

.modal-preview img {
  max-height: min(70vh, 560px);
  width: auto;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.modal-preview img.is-zoomable {
  cursor: zoom-in;
}

.modal-preview .zoom-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(20, 23, 28, 0.55);
  color: #fff;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.modal-preview:hover .zoom-hint,
.modal-preview:focus-within .zoom-hint {
  opacity: 1;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 12, 16, 0.88);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  cursor: zoom-out;
}

.lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lightbox img {
  max-width: min(96vw, 1100px);
  max-height: calc(100dvh - 72px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  cursor: default;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.lightbox-tip {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.78rem;
  pointer-events: none;
}

.modal-body {
  padding: 22px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  max-height: calc(100vh - 48px);
}

.modal-body h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.35;
}

.modal-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.prompt-toolbar {
  display: flex;
  gap: 6px;
  margin: -2px 0 2px;
}

.prompt-tab {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  font-size: 0.78rem;
}

.prompt-tab.active {
  background: var(--accent-soft);
  border-color: #b7ddd2;
  color: var(--accent-deep);
  font-weight: 600;
}

.prompt-box {
  flex: 1;
  margin: 0;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 0.82rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink-soft);
  max-height: 42vh;
  overflow: auto;
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
}

.prompt-meta {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}

.prompt-meta[hidden] {
  display: none !important;
}

.prompt-meta.warn {
  color: var(--warn);
}

.modal-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  flex-shrink: 0;
  background: var(--surface);
  position: relative;
  z-index: 2;
}

.modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.modal-actions .btn {
  padding: 7px 14px;
  font-size: 0.82rem;
  border-radius: 8px;
  white-space: nowrap;
  line-height: 1.2;
}

.gen-tip {
  margin: 0;
  padding-top: 4px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}

.modal.just-copied .gen-tip {
  color: var(--accent-deep);
  font-weight: 500;
}

.modal.just-copied .gen-tip::before {
  content: "✓ ";
  color: var(--accent);
}

.platform-recommend-tip {
  margin: 0;
  padding: 0;
  color: var(--accent-deep);
  font-size: 0.76rem;
  line-height: 1.45;
  font-weight: 500;
}

.guide-body .platform-recommend-tip {
  margin: 0 0 10px;
  padding: 8px 10px;
  background: var(--accent-soft);
  border-radius: 8px;
}

.platform-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.platform-links a.is-recommended,
.platform-card.is-recommended {
  box-shadow: inset 0 0 0 1px rgba(15, 110, 86, 0.35);
  background: rgba(15, 110, 86, 0.06);
}

.platform-links a em.rec,
.platform-card strong em.rec {
  color: var(--accent-deep);
  background: rgba(15, 110, 86, 0.12);
  border: none;
  font-style: normal;
}

.platform-links a {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 500;
  transition: background 0.15s, transform 0.15s;
}

.platform-links a em,
.platform-card strong em {
  font-style: normal;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 0.68em;
  font-weight: 600;
  background: #efe6d8;
  color: #8a5a2b;
  vertical-align: 0.05em;
}

.platform-links a.is-overseas {
  background: #f5efe6;
  color: #6b4a2e;
}

.platform-links a.is-overseas:hover {
  background: #ebe1d1;
}

.platform-overseas-note {
  flex: 1 0 100%;
  margin: 2px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

.platform-links a:hover {
  background: #d4eee6;
  transform: translateY(-1px);
}

.platform-cards {
  display: grid;
  gap: 8px;
  margin: 10px 0 12px;
}

.platform-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  transition: border-color 0.15s, background 0.15s;
}

.platform-card.is-overseas {
  border-color: #e4d5bf;
  background: #faf6f0;
}

.platform-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.platform-card.is-overseas:hover {
  border-color: #c9a87a;
  background: #f5efe6;
}

.platform-card strong {
  font-size: 0.95rem;
  color: var(--accent-deep);
}

.platform-card.is-overseas strong {
  color: #6b4a2e;
}

.platform-card span {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}

.platform-card .platform-note {
  font-size: 0.74rem;
  color: #8a5a2b;
  line-height: 1.4;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s, transform 0.15s, opacity 0.2s;
}

.btn[hidden],
.prompt-toolbar[hidden],
.prompt-badge[hidden],
.prompt-meta[hidden] {
  display: none !important;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-deep);
}

.btn-primary.copied {
  background: #0f766e;
}

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

.btn-ghost {
  background: var(--paper);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  background: #e8eef4;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.82rem;
  margin-top: 4px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: opacity 0.25s, background 0.15s;
}

.modal-close:hover {
  background: #fff;
  opacity: 1;
}

.modal.just-copied .modal-close {
  opacity: 0.35;
}

/* —— FAB + Guide centered modal —— */
.fab-stack {
  position: fixed;
  right: 22px;
  bottom: 28px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.fab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #f5f8fb;
  font-size: 0.88rem;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 10px 28px rgba(28, 36, 48, 0.28);
  transition: transform 0.2s, background 0.2s;
}

.fab:hover {
  transform: translateY(-2px);
  background: #2a3545;
}

.fab-style {
  background: var(--accent, #0f6e56);
  box-shadow: 0 10px 28px rgba(15, 110, 86, 0.28);
}

.fab-style:hover {
  background: #0c5a46;
}

.fab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5eead4;
  animation: pulse 1.8s ease infinite;
}

.fab-dot-warm {
  background: #fbbf24;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(0.85);
  }
}

.guide-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(20, 28, 40, 0.48);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.guide-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.guide-modal {
  position: fixed;
  z-index: 90;
  top: 50%;
  left: 50%;
  width: min(720px, calc(100vw - 32px));
  max-height: min(86vh, 820px);
  transform: translate(-50%, -46%) scale(0.96);
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, transform 0.3s ease, visibility 0.25s;
}

.guide-modal.open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.guide-head {
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-shrink: 0;
  background:
    linear-gradient(180deg, var(--accent-soft) 0%, transparent 100%);
}

.guide-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
}

.guide-head p {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.guide-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.2rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.85);
  transition: background 0.15s, color 0.15s;
}

.guide-close:hover {
  background: #fff;
  color: var(--ink);
}

.guide-body {
  flex: 1;
  overflow: auto;
  padding: 8px 24px 32px;
}

.guide-block {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.guide-block:last-child {
  border-bottom: none;
}

.guide-block h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: var(--accent-deep);
}

.guide-block p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.65;
  color: var(--ink-soft);
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

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

.guide-table th {
  background: var(--paper);
  font-weight: 600;
}

.guide-code {
  margin: 0;
  padding: 12px;
  background: #1c2430;
  color: #e2e8f0;
  border-radius: 10px;
  font-size: 0.75rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, Consolas, monospace;
}

.guide-compare {
  display: grid;
  gap: 10px;
}

.guide-compare .label {
  font-size: 0.72rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.guide-compare .bad .label {
  color: #b91c1c;
}

.guide-compare .good .label {
  color: var(--accent-deep);
}

.guide-compare pre {
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  line-height: 1.55;
  white-space: pre-wrap;
  font-family: ui-monospace, Consolas, monospace;
}

.guide-compare .bad pre {
  background: #fef2f2;
  color: #7f1d1d;
}

.guide-compare .good pre {
  background: var(--accent-soft);
  color: #134e4a;
}

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

.principle-list li {
  padding: 10px 12px;
  background: var(--paper);
  border-radius: 10px;
  font-size: 0.84rem;
  line-height: 1.45;
}

.principle-list strong {
  color: var(--accent-deep);
  display: block;
  margin-bottom: 2px;
}

.step-list {
  margin: 0;
  padding-left: 1.2em;
  font-size: 0.86rem;
  line-height: 1.7;
  color: var(--ink-soft);
}

.guide-actions {
  margin-top: 10px;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.palette-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.palette-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.palette-body {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.swatch-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

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

.swatch-chip.copied {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.swatch-chip .swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.swatch-code {
  font-size: 0.7rem;
  font-family: ui-monospace, Consolas, monospace;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.palette-copy-all {
  flex-shrink: 0;
  align-self: center;
  margin-top: 0;
  margin-left: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  white-space: nowrap;
}

.palette-copy-all:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
  background: var(--accent-soft);
}

/* —— Responsive —— */
@media (max-width: 900px) {
  .header-inner {
    padding: 12px 16px;
    gap: 10px 12px;
  }

  .brand {
    min-width: 0;
    flex: 1;
  }

  .brand-sub {
    display: none;
  }

  .search-wrap {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
    min-width: 0;
  }

  .stats {
    font-size: 0.72rem;
    white-space: normal;
  }

  .top-tools {
    padding: 10px 12px 0;
  }

  .top-tools-inner {
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
  }

  .top-tools .tool-nav {
    width: 100%;
  }

  .top-tools .tool-nav a,
  .top-tools .tool-nav button {
    font-size: 0.75rem;
    padding: 6px 10px;
  }

  /* 手机：左分类、右图库 */
  .layout {
    grid-template-columns: 96px 1fr;
    gap: 10px;
    padding: 10px 12px 100px;
    align-items: stretch;
  }

  .sidebar {
    position: sticky;
    top: 64px;
    z-index: 20;
    max-height: calc(100dvh - 72px);
    overflow: auto;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    backdrop-filter: none;
  }

  .sidebar .nav-label {
    display: none;
  }

  .cat-nav {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 6px;
    overflow: visible;
    margin: 0;
    padding: 0;
  }

  .cat-nav a {
    display: block;
    width: 100%;
    white-space: normal;
    line-height: 1.25;
    padding: 8px 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--line);
    font-size: 0.7rem;
    text-align: center;
  }

  .cat-nav a.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    box-shadow: none;
    color: var(--accent-deep);
  }

  .cat-nav a .count {
    display: block;
    margin-top: 2px;
    background: var(--accent-soft);
    color: var(--accent-deep);
  }

  .gallery {
    min-width: 0;
  }

  .section-head h2 {
    font-size: 1.05rem;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
  }

  .modal {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    width: min(100vw - 16px, 560px);
    max-height: calc(100dvh - 24px);
    border-radius: 16px;
  }

  .modal-preview {
    min-height: 0;
    max-height: min(28vh, 200px);
    padding: 12px;
  }

  .modal-preview img {
    max-height: min(24vh, 176px);
  }

  /* 整块正文不滚动：标题/按钮钉住，只滚提示词小框 */
  .modal-body {
    min-height: 0;
    max-height: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 14px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }

  .modal-body > h3,
  .modal-body > .modal-meta,
  .modal-body > .prompt-badge,
  .modal-body > .prompt-toolbar,
  .modal-body > .prompt-meta {
    flex: 0 0 auto;
  }

  .prompt-box {
    flex: 1 1 auto;
    min-height: 120px;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    font-size: 0.78rem;
  }

  .modal-footer {
    position: static;
    z-index: 2;
    flex: 0 0 auto;
    margin: 0;
    padding: 10px 0 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    box-shadow: none;
  }

  .modal-actions {
    position: static;
    padding-top: 0;
    background: none;
  }

  .modal-actions .btn {
    flex: 0 1 auto;
    min-height: 0;
    padding: 6px 12px;
    font-size: 0.78rem;
  }

  .guide-modal {
    width: min(100vw - 16px, 720px);
    max-height: calc(100dvh - 24px);
  }

  .guide-head {
    padding: 16px 16px 12px;
  }

  .guide-body {
    padding: 4px 16px 24px;
  }

  .guide-compare {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .brand-name {
    font-size: 1.25rem;
  }

  .stats {
    display: none;
  }

  .back-link {
    padding: 6px 8px;
    font-size: 0.8rem;
  }

  .layout {
    grid-template-columns: 84px 1fr;
    gap: 8px;
    padding: 8px 10px calc(88px + env(safe-area-inset-bottom, 0px));
  }

  .sidebar {
    top: 56px;
    max-height: calc(100dvh - 64px);
  }

  .cat-nav a {
    font-size: 0.65rem;
    padding: 7px 4px;
    border-radius: 8px;
  }

  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .card-thumb {
    border-radius: 10px;
  }

  .card-thumb .title-bar {
    font-size: 0.68rem;
    padding: 22px 6px 6px;
  }

  .modal {
    inset: auto;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: min(100vw - 20px, 520px);
    max-width: min(100vw - 20px, 520px);
    max-height: calc(100dvh - 20px);
    border-radius: 16px;
    transform: translate(-50%, -46%) scale(0.97);
  }

  .modal.open {
    transform: translate(-50%, -50%) scale(1);
  }

  .modal-close {
    top: 10px;
    right: 10px;
  }

  .modal-preview {
    max-height: min(24vh, 160px);
    padding: 10px;
  }

  .modal-preview img {
    max-height: min(20vh, 140px);
  }

  .prompt-box {
    min-height: 100px;
  }

  @media (max-height: 680px) {
    .modal-preview {
      max-height: min(18vh, 120px);
      padding: 8px;
    }
    .modal-preview img {
      max-height: min(15vh, 100px);
    }
    .modal-preview .zoom-hint {
      display: none;
    }
  }

  .guide-modal {
    inset: auto;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: min(100vw - 20px, 560px);
    max-width: min(100vw - 20px, 560px);
    max-height: calc(100dvh - 28px);
    border-radius: 16px;
    transform: translate(-50%, -46%) scale(0.96);
  }

  .guide-modal.open {
    transform: translate(-50%, -50%) scale(1);
  }

  .guide-head h2 {
    font-size: 1.2rem;
  }

  .guide-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .fab-stack {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(20px, env(safe-area-inset-bottom));
  }

  .fab {
    padding: 12px 14px;
    min-height: 48px;
  }

  .fab span:last-child {
    font-size: 0.82rem;
  }
}

@media (hover: none) and (pointer: coarse) {
  .card-thumb:hover {
    transform: none;
    box-shadow: none;
  }

  .card-thumb:active {
    transform: scale(0.98);
  }

  .btn:active {
    transform: scale(0.97);
  }
}
