/* ===== ArchiPrompt 樣式 ===== */
:root {
  --bg: #101216;
  --bg-soft: #171a20;
  --card: #1d212a;
  --card-hover: #232833;
  --border: #2c3240;
  --text: #e8eaf0;
  --text-dim: #9aa3b5;
  --accent: #d8b06a;      /* 建築感的暖金色 */
  --accent-ink: #17130a;
  --type-gen: #6aa8d8;    /* 文生圖 藍 */
  --type-edit: #7fbf8e;   /* 修圖 綠 */
  --radius: 14px;
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  line-height: 1.6;
}
.container { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(16, 18, 22, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.logo { display: flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--text); white-space: nowrap; }
.logo-mark { color: var(--accent); font-size: 1.2rem; }
.logo-text { font-weight: 700; font-size: 1.25rem; letter-spacing: 0.5px; }
.logo-sub { color: var(--text-dim); font-size: 0.8rem; }
.search-wrap { flex: 1; max-width: 480px; margin-left: auto; }
.search-wrap input {
  width: 100%; padding: 9px 16px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 99px;
  color: var(--text); outline: none; transition: border-color .2s;
}
.search-wrap input:focus { border-color: var(--accent); }

/* ===== 登入區 ===== */
.auth-area { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.auth-avatar { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); }
.auth-name { color: var(--text-dim); font-size: 0.85rem; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.auth-admin { color: var(--text-dim); text-decoration: none; font-size: 1.1rem; }
.auth-admin:hover { color: var(--accent); }
.auth-area .btn { text-decoration: none; display: inline-block; }

/* 檢舉按鈕 */
.btn-report { margin-left: auto; color: var(--text-dim); border-color: transparent; font-size: 0.82rem; }
.btn-report:hover { color: #e07a8a; border-color: #e07a8a; }

/* ===== Hero ===== */
.hero {
  padding: 56px 0 40px;
  background:
    radial-gradient(ellipse 60% 80% at 70% 0%, rgba(216, 176, 106, 0.08), transparent),
    linear-gradient(var(--bg-soft), var(--bg));
  text-align: center;
}
.hero h1 { margin: 0 0 10px; font-size: 2rem; letter-spacing: 1px; }
.hero p { margin: 0; color: var(--text-dim); }

/* ===== 篩選列 ===== */
.filter-bar {
  position: sticky; top: 64px; z-index: 40;
  background: rgba(16, 18, 22, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.filter-inner { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.filter-group { display: flex; gap: 8px; align-items: center; }
.sort-group { margin-left: auto; }
.tab, .chip {
  background: var(--bg-soft); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 99px;
  padding: 6px 16px; font-size: 0.9rem; transition: all .15s;
}
.tab:hover, .chip:hover { color: var(--text); border-color: var(--text-dim); }
.tab.active {
  background: var(--accent); color: var(--accent-ink);
  border-color: var(--accent); font-weight: 600;
}
.chip.active { background: var(--card-hover); color: var(--text); border-color: var(--accent); }
#sort-select, #lang-select {
  background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; outline: none;
}
#lang-select { flex-shrink: 0; }

/* ===== 卡片瀑布流 ===== */
.result-count { color: var(--text-dim); font-size: 0.85rem; padding: 18px 4px 4px; }
.masonry { column-count: 4; column-gap: 18px; padding: 10px 0 40px; }
@media (max-width: 1100px) { .masonry { column-count: 3; } }
@media (max-width: 800px)  { .masonry { column-count: 2; } }
@media (max-width: 520px)  { .masonry { column-count: 1; } }

.card {
  break-inside: avoid; margin-bottom: 18px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
  transition: transform .15s, border-color .15s, background .15s;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); background: var(--card-hover); }
.card-img { position: relative; }
.card-img img { display: block; width: 100%; height: auto; }
.card-badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }
.badge {
  font-size: 0.72rem; font-weight: 600; padding: 3px 10px; border-radius: 99px;
  backdrop-filter: blur(6px);
}
.badge-type { color: #0e1621; }
.badge-type.t-gen  { background: var(--type-gen); }
.badge-type.t-edit { background: var(--type-edit); }
.badge-cat { background: rgba(14, 16, 20, 0.7); color: var(--text); border: 1px solid rgba(255,255,255,0.15); }
.card-body { padding: 12px 14px 14px; }
.card-title { margin: 0 0 6px; font-size: 0.98rem; font-weight: 600; line-height: 1.4; }
.card-meta { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 0.78rem; }
.card-model { color: var(--accent); }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.card-stats { display: flex; gap: 12px; color: var(--text-dim); font-size: 0.8rem; }
.btn-copy-mini {
  background: transparent; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 8px;
  padding: 4px 12px; font-size: 0.8rem; transition: all .15s;
}
.btn-copy-mini:hover { background: var(--accent); color: var(--accent-ink); }

/* ===== 按鈕 ===== */
.btn { border-radius: 10px; border: 1px solid transparent; padding: 9px 18px; font-size: 0.92rem; transition: all .15s; }
.btn-primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--text-dim); }
.btn-small { padding: 5px 14px; font-size: 0.82rem; border-radius: 8px; }

/* ===== 空狀態 / Footer ===== */
.empty-state { text-align: center; padding: 70px 0; color: var(--text-dim); }
.site-footer { border-top: 1px solid var(--border); padding: 26px 0; color: var(--text-dim); font-size: 0.85rem; text-align: center; }

/* ===== 彈窗 ===== */
.modal-backdrop[hidden], .toast[hidden] { display: none; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8, 9, 12, 0.75); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  position: relative; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 18px;
  max-width: 960px; width: 100%; max-height: 90vh; overflow-y: auto;
  padding: 26px;
}
.modal-form { max-width: 640px; }
.modal-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; color: var(--text-dim); font-size: 1.6rem; line-height: 1;
}
.modal-close:hover { color: var(--text); }

/* 詳細頁 */
.detail-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 760px) { .detail-layout { grid-template-columns: 1fr; } }
.detail-image img { width: 100%; border-radius: 12px; border: 1px solid var(--border); }
.detail-badges { display: flex; gap: 8px; margin-bottom: 10px; }
.detail-info h2 { margin: 0 0 8px; font-size: 1.3rem; }
.detail-meta { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 16px; }
.detail-model { display: inline-block; margin-left: 10px; color: var(--accent); }
.prompt-box { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.prompt-box-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  color: var(--text-dim); font-size: 0.85rem;
}
.prompt-box pre {
  margin: 0; padding: 14px; white-space: pre-wrap; word-break: break-word;
  font-family: inherit; font-size: 0.9rem; max-height: 300px; overflow-y: auto;
}
.detail-stats { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
.detail-stats .stat { color: var(--text-dim); font-size: 0.85rem; }
#d-like.liked { color: #e07a8a; border-color: #e07a8a; }

/* 表單 */
.form-hint { color: var(--text-dim); font-size: 0.88rem; margin-top: -6px; }
.form-hint-mod { font-size: 0.8rem; color: #b08d55; margin-top: 2px; }
#share-form label { display: block; margin-bottom: 14px; font-size: 0.88rem; color: var(--text-dim); }
#share-form input[type="text"], #share-form select, #share-form textarea {
  display: block; width: 100%; margin-top: 5px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; font-size: 0.95rem; outline: none; transition: border-color .2s;
}
#share-form input:focus, #share-form select:focus, #share-form textarea:focus { border-color: var(--accent); }
#share-form textarea { resize: vertical; }
.form-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .form-row.two-col { grid-template-columns: 1fr; } }
.upload-label input[type="file"] { margin-top: 6px; color: var(--text-dim); }
.upload-preview { margin-top: 10px; }
.upload-preview img { max-width: 240px; max-height: 180px; border-radius: 10px; border: 1px solid var(--border); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.form-error { color: #e07a8a; font-size: 0.88rem; text-align: right; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 24px; border-radius: 99px; font-weight: 600; font-size: 0.9rem;
  z-index: 200; box-shadow: 0 6px 24px rgba(0,0,0,0.4);
  animation: toast-in .25s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* 手機版 header 調整 */
@media (max-width: 680px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0; }
  .search-wrap { order: 3; max-width: none; width: 100%; }
  .logo-sub { display: none; }
  .hero h1 { font-size: 1.5rem; }
}
