:root {
  --green: #12a77f;
  --paper: #f1f1f1;
  --ink: #080808;
  --muted: #73757f;
  --line: #c8c8c8;
  --yellow: #ffe95b;
  --shadow: 6px 6px 0 var(--ink);
  --shadow-sm: 4px 4px 0 var(--ink);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hero {
  min-height: 715px;
  background: var(--green);
  border-bottom: 5px solid var(--ink);
  position: relative;
  overflow: hidden;
}

.topbar {
  width: min(1380px, calc(100% - 40px));
  margin: 14px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand,
.icon-button,
.lang-button,
.stamp-title,
.free-pill,
.generator,
.small-control,
.total-badge,
.category-tab,
.prompt-card,
.detail-panel,
.detail-close,
.copy-button,
.favorite-button,
.share-button {
  border: 4px solid var(--ink);
  box-shadow: var(--shadow-sm);
  background: white;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px 8px 12px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
  font-size: 20px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 22px;
  background: var(--ink);
  color: white;
  font-size: 10px;
  line-height: 1;
  border-radius: 10px 10px 3px 3px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.lang-button {
  min-width: 42px;
  min-height: 42px;
  padding: 8px 10px;
  font-weight: 900;
  color: var(--ink);
}

.lang-button {
  min-width: 116px;
}

.hero-inner {
  width: min(770px, calc(100% - 36px));
  margin: 78px auto 0;
  text-align: center;
}

.title-lockup {
  display: inline-block;
  position: relative;
}

h1 {
  margin: 0;
  color: white;
  max-width: 12ch;
  font-size: clamp(44px, 7vw, 94px);
  line-height: .9;
  font-weight: 1000;
  text-shadow: 6px 6px 0 var(--ink);
}

.model-badge {
  position: absolute;
  right: 5%;
  bottom: -24px;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 4px solid white;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-size: 34px;
  font-weight: 1000;
  line-height: 1;
  text-shadow: 3px 3px 0 var(--ink);
  filter: drop-shadow(4px 4px 0 var(--ink));
}

.stamp-title {
  display: inline-block;
  margin: 30px 0 12px;
  padding: 13px 34px;
  font-size: clamp(34px, 4vw, 56px);
  font-weight: 1000;
}

.hero-kicker {
  margin: 0 0 44px;
  color: white;
  font-size: 16px;
  font-weight: 900;
  text-shadow: 2px 2px 0 var(--ink);
}

.generator {
  display: grid;
  grid-template-columns: 1fr 138px;
  min-height: 210px;
  padding: 8px;
  position: relative;
  text-align: left;
  box-shadow: var(--shadow);
}

.generator textarea {
  min-height: 190px;
  padding: 28px 30px 72px;
  background: #f5f6f8;
  border: 2px solid #b9bec7;
  resize: none;
  outline: none;
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
}

.generator textarea::placeholder {
  color: #9aa0ad;
}

.generator-tools {
  position: absolute;
  left: 34px;
  bottom: 28px;
  display: flex;
  gap: 10px;
  pointer-events: none;
}

.generator-tools button {
  padding: 9px 13px;
  background: white;
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font-weight: 900;
}

.generate-button {
  grid-column: 2;
  grid-row: 1;
  background: var(--ink);
  color: white;
  border: 0;
  font-size: 23px;
  font-weight: 1000;
}

.free-pill {
  display: inline-block;
  margin-top: 32px;
  padding: 11px 22px;
  border-radius: 999px;
  border-width: 3px;
  font-weight: 900;
}

.library {
  width: min(1200px, calc(100% - 44px));
  margin: 0 auto;
  padding: 34px 0 80px;
}

.library-head {
  border-bottom: 2px solid var(--line);
  margin-bottom: 32px;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 16px;
  border-bottom: 5px solid var(--ink);
}

h2 {
  margin: 0;
  font-size: 34px;
  line-height: 1;
  font-weight: 1000;
}

.search-row,
.filter-row,
.category-tabs,
.sort-actions,
.card-meta,
.card-actions {
  display: flex;
  align-items: center;
}

.search-row {
  gap: 12px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 52px;
  height: 52px;
  padding: 0 13px;
  overflow: hidden;
  background: white;
  border: 4px solid var(--ink);
  box-shadow: var(--shadow-sm);
  transition: width .18s ease;
}

.search-box:focus-within {
  width: 220px;
}

.search-box span {
  font-size: 26px;
  font-weight: 1000;
}

.search-box input {
  width: 0;
  opacity: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-weight: 900;
}

.search-box:focus-within input {
  width: 150px;
  opacity: 1;
}

.total-badge {
  padding: 12px 18px;
  background: var(--yellow);
  font-size: 18px;
  font-weight: 1000;
}

.filter-row {
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0 14px;
}

.category-tabs {
  flex-wrap: wrap;
  gap: 9px;
}

.category-tab,
.small-control {
  min-height: 42px;
  padding: 9px 16px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 1000;
}

.category-tab.is-active {
  background: var(--yellow);
}

.sort-actions {
  gap: 12px;
  flex: 0 0 auto;
  position: relative;
}

.control-popover {
  position: absolute;
  top: calc(100% + 12px);
  right: 92px;
  z-index: 6;
  display: grid;
  min-width: 150px;
  gap: 8px;
  padding: 12px;
  border: 4px solid var(--ink);
  box-shadow: var(--shadow-sm);
  background: white;
}

.filter-menu {
  right: 0;
}

.control-popover[hidden] {
  display: none;
}

.control-popover button {
  min-height: 38px;
  padding: 8px 10px;
  border: 3px solid var(--ink);
  background: white;
  color: var(--ink);
  font-weight: 1000;
  text-align: left;
}

.control-popover button.is-active {
  background: var(--yellow);
}

.masonry {
  columns: 3 330px;
  column-gap: 28px;
}

.prompt-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 32px;
  padding: 18px;
  position: relative;
  break-inside: avoid;
}

.empty-state {
  display: inline-block;
  width: 100%;
  padding: 34px;
  border: 4px solid var(--ink);
  box-shadow: var(--shadow-sm);
  background: white;
  font-size: 18px;
  font-weight: 1000;
  break-inside: avoid;
}

.prompt-card:not(.ad-card) .visual,
.share-button,
.favorite-button {
  cursor: pointer;
}

.prompt-card::after {
  content: "精选";
  position: absolute;
  top: -12px;
  right: -13px;
  z-index: 2;
  display: inline-block;
  padding: 8px 13px;
  background: var(--yellow);
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 14px;
  font-weight: 1000;
  transform: rotate(6deg);
}

.card-meta {
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 2px solid #e5e5e5;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.author {
  min-width: 0;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visual {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 3px solid #d4d4d4;
  background-color: #f8f8f8;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
}

.visual.is-tall {
  aspect-ratio: 1 / 1;
}

.visual.is-short {
  aspect-ratio: 16 / 9;
}

.prompt-body {
  margin-top: 13px;
  border: 3px solid var(--ink);
  background: #fafafa;
}

.prompt-label {
  padding: 8px 12px;
  background: var(--ink);
  color: white;
  font-size: 13px;
  font-weight: 1000;
}

.prompt-text {
  max-height: 148px;
  min-height: 104px;
  margin: 0;
  padding: 16px;
  overflow: hidden;
  color: #34343a;
  font-family: "Courier New", monospace;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.prompt-text.is-long {
  max-height: 196px;
  min-height: 148px;
}

.prompt-text.is-short {
  max-height: 92px;
  min-height: 82px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 14px 0 0;
}

.tag {
  padding: 5px 8px;
  background: #ededed;
  border: 2px solid var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.card-actions {
  gap: 9px;
  margin-top: 14px;
}

.copy-button {
  flex: 1;
  min-height: 48px;
  background: var(--ink);
  color: white;
  font-weight: 1000;
  font-size: 15px;
}

.share-button {
  width: 48px;
  height: 48px;
  font-weight: 1000;
}

.favorite-button {
  width: 48px;
  height: 48px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 22px;
  font-weight: 1000;
  line-height: 1;
}

.favorite-button.is-active {
  background: var(--ink);
  color: var(--yellow);
}

.ad-card {
  background: #ffe96a;
  padding: 22px;
}

.ad-card .visual {
  display: grid;
  place-items: center;
  min-height: 172px;
  aspect-ratio: auto;
  border-color: var(--ink);
  background:
    radial-gradient(circle at 80% 18%, #fff 0 28px, transparent 30px),
    linear-gradient(135deg, #fffef4, #fff0a0);
  color: var(--ink);
  font-size: 30px;
  font-weight: 1000;
  text-align: center;
  line-height: 1.1;
}

.ad-card .prompt-text {
  min-height: 76px;
}

.ad-card .copy-button {
  background: var(--ink);
}

.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 34px;
  background: rgba(0, 0, 0, .58);
}

.detail-overlay[hidden] {
  display: none;
}

.detail-panel {
  width: min(1040px, 100%);
  max-height: min(860px, calc(100vh - 68px));
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(320px, .95fr);
  gap: 0;
  position: relative;
  overflow: auto;
  box-shadow: 8px 8px 0 var(--ink);
}

.detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 48px;
  height: 48px;
  font-size: 28px;
  font-weight: 1000;
  line-height: 1;
}

.detail-image {
  min-height: 560px;
  border-right: 4px solid var(--ink);
  background-color: #f8f8f8;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
}

.detail-content {
  padding: 28px;
  background: #f7f7f7;
}

.detail-meta {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-right: 56px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.detail-meta span {
  color: var(--ink);
}

.detail-content h3 {
  margin: 20px 0 10px;
  font-size: 34px;
  line-height: 1.08;
  font-weight: 1000;
}

.detail-summary {
  margin: 0 0 18px;
  color: #45464f;
  font-size: 16px;
  line-height: 1.7;
  font-weight: 800;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.detail-prompt {
  border: 3px solid var(--ink);
  background: white;
}

.detail-prompt pre {
  max-height: 260px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  color: #282a31;
  font-family: "Courier New", monospace;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.detail-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.detail-actions .copy-button {
  flex: 1;
}

.detail-actions .favorite-button {
  flex: 0 0 52px;
  min-height: 48px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 10;
  padding: 12px 18px;
  background: var(--ink);
  color: white;
  border: 3px solid white;
  font-weight: 900;
  transform: translate(-50%, 120px);
  transition: transform .2s ease;
}

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

@media (max-width: 760px) {
  .hero {
    min-height: 642px;
  }

  .topbar {
    width: calc(100% - 32px);
  }

  .brand {
    padding: 7px 10px;
    font-size: 16px;
  }

  .top-actions {
    gap: 8px;
  }

  .icon-button,
  .lang-button {
    min-width: 40px;
    min-height: 40px;
    padding: 7px 9px;
  }

  .lang-button {
    min-width: 42px;
    width: 42px;
    overflow: hidden;
    font-size: 0;
  }

  .lang-button::before {
    content: "文";
    font-size: 16px;
  }

  .hero-inner {
    margin-top: 44px;
  }

  .model-badge {
    right: 7%;
    bottom: -18px;
    width: 42px;
    height: 42px;
    font-size: 26px;
    border-width: 3px;
  }

  .generator {
    grid-template-columns: 1fr;
  }

  .generator textarea {
    min-height: 190px;
    padding: 24px 16px 76px;
    font-size: 18px;
  }

  .generate-button {
    grid-column: 1;
    grid-row: 2;
    min-height: 76px;
  }

  .generator-tools {
    left: 34px;
    bottom: 104px;
  }

  .library {
    width: calc(100% - 32px);
    padding-top: 24px;
  }

  .title-row,
  .filter-row {
    align-items: stretch;
    flex-direction: column;
  }

  .search-row {
    justify-content: flex-end;
  }

  .search-box:focus-within {
    width: min(210px, 52vw);
  }

  .sort-actions {
    justify-content: flex-end;
  }

  .control-popover {
    right: auto;
    left: 0;
    top: calc(100% + 10px);
  }

  .filter-menu {
    left: auto;
    right: 0;
  }

  .masonry {
    columns: 1;
  }

  .detail-overlay {
    padding: 18px;
    place-items: start center;
    overflow: auto;
  }

  .detail-panel {
    max-height: none;
    grid-template-columns: 1fr;
  }

  .detail-image {
    min-height: 320px;
    border-right: 0;
    border-bottom: 4px solid var(--ink);
  }

  .detail-content {
    padding: 22px;
  }

  .detail-content h3 {
    font-size: 28px;
  }

  .detail-actions {
    flex-direction: column;
  }
}
