:root {
  color-scheme: light;
  --ink: #253129;
  --muted: #69746c;
  --paper: #f4f1e9;
  --paper-deep: #e9ede6;
  --card: #fffefa;
  --accent: #35583f;
  --accent-soft: #dfe9df;
  --line: #d8dfd7;
  --shadow: 0 18px 54px rgba(32, 49, 38, 0.09);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 255, 255, 0.9), transparent 30rem),
    var(--paper);
  color: var(--ink);
}

a {
  color: inherit;
}

.site-header,
.detail-header,
main,
footer {
  width: min(1080px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  padding: 42px 0 24px;
}

.brand {
  display: inline-block;
  color: var(--ink);
  font-family: "Songti SC", "Noto Serif SC", serif;
  font-size: clamp(34px, 8vw, 54px);
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 1;
  text-decoration: none;
}

.site-header p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  letter-spacing: 0.12em;
}

#categories {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 4px 2px 22px;
  scrollbar-width: none;
}

#categories::-webkit-scrollbar {
  display: none;
}

.category-chip {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 19px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 254, 250, 0.78);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.category-chip:hover {
  transform: translateY(-1px);
}

.category-chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 22px;
}

.artwork-card {
  overflow: hidden;
  border: 1px solid rgba(216, 223, 215, 0.8);
  border-radius: 26px;
  background: var(--card);
  box-shadow: var(--shadow);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.artwork-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 64px rgba(32, 49, 38, 0.13);
}

.artwork-card a {
  display: block;
  text-decoration: none;
}

.card-image-wrap {
  position: relative;
  overflow: hidden;
  background: var(--paper-deep);
}

.artwork-card img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  transition: transform 300ms ease;
}

.artwork-card:hover img {
  transform: scale(1.015);
}

.card-image-error:not([hidden]) {
  display: grid;
  width: 100%;
  aspect-ratio: 3 / 4;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.generated-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  background: rgba(24, 35, 28, 0.68);
  color: white;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

.card-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 19px;
}

.card-copy h2 {
  margin: 0 0 7px;
  font-size: 20px;
  line-height: 1.3;
}

.card-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.card-action {
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
}

.empty-state,
.error-state {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  min-height: 190px;
  place-content: center;
  padding: 48px 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 254, 250, 0.72);
  color: var(--muted);
  text-align: center;
}

.error-state strong {
  color: var(--ink);
  font-size: 20px;
}

footer {
  padding: 52px 0 40px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid #7ba889;
  outline-offset: 3px;
}

@media (min-width: 760px) {
  .site-header {
    padding-top: 64px;
  }

  .gallery {
    gap: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

.detail-header {
  padding: 22px 0;
}

.detail-header a,
.text-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

#detail {
  padding-bottom: 54px;
}

.detail-card {
  width: min(760px, 100%);
  margin: 0 auto;
}

.detail-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 2px 18px;
}

.detail-card h1 {
  margin: 5px 0 0;
  font-family: "Songti SC", "Noto Serif SC", serif;
  font-size: clamp(30px, 7vw, 46px);
  line-height: 1.18;
}

.detail-category,
.section-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.ratio-badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
}

.image-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 0 0 11px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--accent-soft);
}

.image-tabs button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.image-tabs button[aria-pressed="true"] {
  background: var(--card);
  font-weight: 800;
  box-shadow: 0 3px 12px rgba(28, 54, 32, 0.1);
}

.detail-image-wrap {
  position: relative;
  display: grid;
  min-height: 320px;
  overflow: hidden;
  place-items: center;
  border-radius: 26px;
  background: var(--paper-deep);
  box-shadow: var(--shadow);
}

.detail-image-wrap img {
  display: block;
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
}

.image-error {
  min-height: 320px;
  place-content: center;
  color: var(--muted);
}

.image-error:not([hidden]) {
  display: grid;
}

.metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 20px 2px;
  color: var(--muted);
  font-size: 14px;
}

.metadata a {
  color: var(--accent);
  font-weight: 800;
}

.prompt-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.prompt-card h2 {
  margin: 6px 0 18px;
  font-size: 22px;
}

.prompt-card pre {
  max-height: 50vh;
  overflow: auto;
  margin: 0 0 20px;
  padding: 17px;
  border-radius: 16px;
  background: #f1f3ee;
  font: inherit;
  line-height: 1.72;
  white-space: pre-wrap;
  user-select: text;
}

.prompt-card button {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 15px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

#copy-status {
  min-height: 1.5em;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.detail-error {
  width: min(760px, 100%);
  margin-inline: auto;
}
