/* ============================================
   Prompt Cards — CSS Stylesheet
   Light retro prompt gallery
   ============================================ */

:root {
  --bg: rgb(255, 250, 235);
  --card-bg: rgb(255, 250, 235);
  --soft-bg: rgb(251, 243, 228);
  --primary: rgb(16, 86, 82);
  --primary-75: rgba(16, 86, 82, .75);
  --primary-55: rgba(16, 86, 82, .55);
  --primary-25: rgba(16, 86, 82, .25);
  --primary-10: rgba(16, 86, 82, .10);
  --text: #000000;
  --muted: #555;
  --border: rgba(16, 86, 82, .75);
  --shadow-card: 0px 105px 63px rgba(0, 0, 0, 0.05),
                 0px 47px 47px rgba(0, 0, 0, 0.09),
                 0px 12px 26px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0px 120px 72px rgba(0, 0, 0, 0.06),
                  0px 60px 60px rgba(0, 0, 0, 0.10),
                  0px 20px 36px rgba(0, 0, 0, 0.12);
  --transition: 0.3s cubic-bezier(0.15, 0.83, 0.66, 1);
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ============================================
   Header
   ============================================ */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 36px 0 28px;
}

.header-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.site-title {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.site-subtitle {
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 200px;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--primary-75);
  pointer-events: none;
}

.search-input {
  width: 300px;
  height: 48px;
  padding: 0 16px 0 40px;
  border-radius: 8px;
  border: 1px solid var(--primary);
  background-color: var(--soft-bg);
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}

.search-input::placeholder {
  color: rgba(16, 86, 82, 0.45);
}

.search-input:focus {
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--soft-bg), 0 0 0 3px var(--primary);
  background-color: rgb(201, 193, 178);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color var(--transition), transform var(--transition), box-shadow var(--transition);
  border: 1px solid transparent;
  background: var(--primary-55);
  border-color: var(--primary);
  color: var(--text);
  box-shadow: 0px 0.5px 0.5px var(--primary-25), 0px 1px 0.5px rgba(239, 239, 239, 0.5);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn:hover {
  background: var(--primary-75);
  transform: translateY(-1px);
}

.btn-fav-toggle {
  background: transparent;
  border-color: var(--border);
}

.btn-fav-toggle:hover {
  background: var(--soft-bg);
}

.btn-fav-toggle.active {
  background: var(--primary-55);
  border-color: var(--primary);
}

.btn-edge-link {
  background: transparent;
  border-color: var(--border);
  text-decoration: none;
  color: var(--text);
}

.btn-edge-link:hover {
  background: var(--soft-bg);
}

.btn-clear {
  background: transparent;
  border-color: var(--border);
  font-size: 14px;
  padding: 8px 14px;
  margin-top: 8px;
}

.btn-clear:hover {
  background: var(--soft-bg);
}

/* ============================================
   Filter Bar
   ============================================ */
.filter-bar {
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
  contain: layout style;
}

.filter-group {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.filter-group:last-child {
  margin-bottom: 0;
}

.filter-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-75);
  letter-spacing: 0.08em;
  padding-top: 8px;
  width: 52px;
  flex-shrink: 0;
  text-align: right;
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1;
}

.filter-btn {
  padding: 8px 18px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color var(--transition), transform var(--transition), box-shadow var(--transition);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-btn:hover {
  background: var(--soft-bg);
}

.filter-btn.active {
  background: var(--primary-55);
  border-color: var(--primary);
  font-weight: 600;
}

/* ============================================
   Card Grid (Masonry Layout via CSS columns)
   ============================================ */
.card-grid-section {
  padding: 40px 0 80px;
}

.card-grid {
  column-count: 3;
  column-gap: 32px;
}

.card-grid .prompt-card {
  break-inside: avoid;
  margin-bottom: 32px;
  width: 100%;
}

/* Prompt Card */
.prompt-card {
  width: 100%;
  min-width: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
  contain: layout style paint;
  display: flex;
  flex-direction: column;
}

.prompt-card:hover {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.10), 0 6px 20px rgba(0, 0, 0, 0.08);
  transform: translateY(-3px);
}

.card-image {
  position: relative;
  width: 100%;
  background: var(--soft-bg);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.card-image img {
  width: 100%;
  height: auto;
  display: block;
}

.card-fav-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--transition), transform var(--transition), box-shadow var(--transition);
  z-index: 2;
  color: var(--muted);
}

.card-fav-btn:hover {
  background: var(--soft-bg);
  transform: scale(1.1);
}

.card-fav-btn.favorited {
  color: var(--primary);
  background: var(--soft-bg);
}

.card-fav-btn.favorited svg {
  fill: var(--primary);
  stroke: var(--primary);
}

.card-content {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.3;
}

.card-desc {
  font-size: 15px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.meta-tag {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 5px;
  background: var(--soft-bg);
  border: 1px solid var(--primary-25);
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  font-size: 14px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 5px;
  background: transparent;
  border: 1px solid var(--primary-25);
  color: var(--muted);
}

.card-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.btn-detail {
  flex: 1;
  height: 48px;
  font-size: 15px;
  font-weight: 600;
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 86, 82, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  padding: 20px;
}

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

.modal {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.08);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transform: translateY(20px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.15, 0.83, 0.66, 1);
  will-change: transform;
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--transition), transform var(--transition);
  z-index: 10;
  color: var(--text);
}

.modal-close:hover {
  background: var(--soft-bg);
}

.modal-body {
  overflow: hidden;
  max-height: 90vh;
}

.modal-info {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  max-height: 90vh;
  overscroll-behavior: contain;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.3;
  padding-right: 36px;
}

.modal-desc {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.6;
}

.modal-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.meta-badge {
  font-size: 14px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 5px;
  background: var(--soft-bg);
  border: 1px solid var(--primary-25);
  color: var(--primary);
}

.modal-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.prompt-box {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: var(--soft-bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.prompt-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-75);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.prompt-text {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  max-height: 200px;
  overflow-y: auto;
}

.prompt-field {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--primary-10);
  line-height: 1.6;
}

.prompt-field:last-child {
  border-bottom: none;
}

.prompt-field-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-75);
  min-width: 36px;
  flex-shrink: 0;
  padding-top: 1px;
}

.prompt-field-value {
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
}

.btn-copy {
  align-self: flex-start;
  height: 40px;
  font-size: 14px;
}

.btn-copy.copied {
  background: var(--primary);
  color: var(--bg);
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
  padding: 24px 0 32px;
}

.footer-line {
  height: 1px;
  background-color: var(--border);
  border: none;
  margin-bottom: 16px;
}

.footer-text {
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  text-align: center;
  opacity: 0.7;
}

.footer-beian {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.footer-beian a {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.footer-beian a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* ============================================
   Responsive: Tablet (768px - 1023px)
   ============================================ */
@media (max-width: 1023px) {
  .card-grid {
    column-count: 2;
    column-gap: 24px;
  }

  .card-grid .prompt-card {
    margin-bottom: 24px;
  }

  .modal-body {
    grid-template-columns: 1fr;
    max-height: 85vh;
  }

  .modal-image-wrap {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .modal-info {
    max-height: 50vh;
  }
}

/* ============================================
   Responsive: Mobile (< 768px)
   ============================================ */
@media (max-width: 767px) {
  .container {
    padding: 0 16px;
  }

  .site-header {
    padding: 20px 0 16px;
  }

  .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .brand {
    align-items: center;
    text-align: center;
  }

  .site-title {
    font-size: 32px;
  }

  .header-actions {
    width: 100%;
    flex-direction: column;
    gap: 10px;
  }

  .search-box {
    width: 100%;
    min-width: auto;
  }

  .search-input {
    width: 100%;
  }

  .btn-fav-toggle {
    width: 100%;
    height: 40px;
  }

  .filter-bar {
    padding: 16px 0;
  }

  .filter-group {
    flex-direction: row;
align-items: center;
    gap: 8px;
    margin-bottom: 16px;
  }

  .filter-label {
    padding-top: 0;
    font-size: 13px;
    width: 60px;
    flex-shrink: 0;
    text-align: right;
    padding-top: 0;
    font-size: 14px;
  }

  .filter-tags {
    flex: 1;
    gap: 6px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .filter-tags::-webkit-scrollbar {
    display: none;
  }

  .filter-btn {
    font-size: 14px;
    padding: 6px 12px;
    flex-shrink: 0;
  }

  .btn-clear {
    width: 100%;
    height: 36px;
    margin-top: 4px;
  }

  .card-grid {
    column-count: 2;
    column-gap: 16px;
  }

  .card-grid .prompt-card {
    margin-bottom: 16px;
  }

  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal {
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    max-width: 100%;
  }

  .modal-body {
    grid-template-columns: 1fr;
    max-height: 92vh;
  }

  .modal-image-wrap {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .modal-info {
    padding: 16px;
    max-height: 55vh;
    gap: 10px;
  }

  .modal-title {
    font-size: 20px;
    padding-right: 40px;
  }

  .modal-desc {
    font-size: 14px;
  }

  .prompt-text {
    max-height: 120px;
    font-size: 14px;
  }

  .btn-copy {
    width: 100%;
    height: 40px;
  }
}

/* ============================================
   Responsive: Small Mobile (< 374px)
   ============================================ */
@media (max-width: 374px) {
  .container {
    padding: 0 12px;
  }

  .site-title {
    font-size: 28px;
  }

  .card-grid {
    column-count: 1;
    column-gap: 12px;
  }

  .card-grid .prompt-card {
    margin-bottom: 12px;
  }

  .card-content {
    padding: 12px 14px 14px;
  }

  .modal-image-wrap {
    min-height: 180px;
    max-height: 35vh;
  }

  .modal-image {
    min-height: 180px;
    max-height: 35vh;
  }

  .modal-info {
    padding: 14px;
  }
}
