﻿/* ============================================================
   AI漫剧提示词库 - 主样式 (古风墨韵)
   ============================================================ */
:root {
  --bg: #f6f3ec;
  --card: #fffdf8;
  --ink: #2b2823;
  --ink-soft: #4a453c;
  --muted: #8b857a;
  --gold: #b8860b;
  --gold-2: #c9a227;
  --gold-dark: #8f6b0e;
  --cinnabar: #a33b2e;
  --line: #e6dfd0;
  --line-2: #d8cfba;
  --shadow: 0 2px 10px rgba(60, 50, 30, .08);
  --shadow-lg: 0 10px 34px rgba(60, 50, 30, .18);
  --radius: 12px;
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-sans: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
a { color: var(--gold-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-serif); line-height: 1.35; }
.container { width: min(1240px, 100% - 32px); margin: 0 auto; }
.muted { color: var(--muted); font-size: .9em; }
[hidden] { display: none !important; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 20px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; cursor: pointer; transition: all .18s; font-family: inherit;
  text-decoration: none !important; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #fff; box-shadow: 0 3px 10px rgba(184, 134, 11, .35); }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-gold { background: #fff; color: var(--gold-dark); border-color: var(--gold-2); }
.btn-gold:hover { background: #fdf6e0; }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-dark); background: #fff; }
.btn-danger { background: #fff; color: var(--cinnabar); border-color: #e8b9b2; }
.btn-danger:hover { background: #fdeeed; border-color: var(--cinnabar); }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---------- 头部 ---------- */
.site-header {
  background: linear-gradient(180deg, #2b2720, #373129);
  color: #efe9dc;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 14px rgba(0,0,0,.25);
}
.header-inner { display: flex; align-items: center; gap: 26px; height: 62px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #fff; font-family: var(--font-serif); font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 -2px 6px rgba(0,0,0,.25);
}
.logo-text { font-family: var(--font-serif); font-size: 19px; font-weight: 700; letter-spacing: 1px; }
.main-nav { display: flex; gap: 4px; flex: 1; }
.main-nav a {
  color: #cfc8b8; padding: 7px 13px; border-radius: 8px; font-size: 14.5px;
  transition: all .15s; text-decoration: none;
}
.main-nav a:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.main-nav a.active { color: #fff; background: rgba(201,162,39,.25); }
.nav-badge {
  font-size: 10px; background: rgba(255,255,255,.14); color: #ffd77a;
  border-radius: 4px; padding: 1px 5px; margin-left: 4px; vertical-align: 1px;
}
.user-area { display: flex; gap: 8px; align-items: center; }
.user-area .btn-ghost { color: #d9d2c2; border-color: rgba(255,255,255,.22); }
.user-area .btn-ghost:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.4); color: #fff; }

.notice-bar { background: #fdf3d7; border-bottom: 1px solid #ecd9a0; color: #7a5b12; font-size: 13.5px; padding: 7px 0; }

/* ---------- Flash ---------- */
.flash { padding: 11px 16px; border-radius: 10px; margin: 14px 0; font-size: 14px; border: 1px solid; }
.flash-success { background: #eef7ea; border-color: #bfe0b2; color: #2f6b22; }
.flash-error { background: #fdeeed; border-color: #f2c2bd; color: #a33b2e; }
.flash-warning { background: #fdf6e0; border-color: #ecd9a0; color: #7a5b12; }
.flash-info { background: #e8f1fa; border-color: #bcd4ea; color: #2b5d8a; }

/* ---------- Hero ---------- */
.hero {
  margin: 22px 0 0;
  background:
    radial-gradient(1200px 300px at 20% -40%, rgba(201,162,39,.16), transparent 60%),
    linear-gradient(160deg, #f0e9d8, #faf6ec);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 46px 40px;
  position: relative; overflow: hidden;
}
.hero-inner { position: relative; z-index: 1; }
.hero h1 { font-size: 34px; margin: 0 0 10px; letter-spacing: 1px; }
.hero p { color: var(--ink-soft); margin: 0 0 22px; font-size: 15.5px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- 工具栏/分类 ---------- */
.gallery-toolbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  flex-wrap: wrap; margin: 22px 0 6px;
}
.cat-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-tab {
  padding: 7px 16px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--card); color: var(--ink-soft); font-size: 13.5px; cursor: pointer;
  transition: all .15s; text-decoration: none;
}
.cat-tab:hover { border-color: var(--gold); color: var(--gold-dark); text-decoration: none; }
.cat-tab.active { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #fff; border-color: transparent; box-shadow: 0 2px 8px rgba(184,134,11,.3); }
.search-box { display: flex; gap: 0; border: 1px solid var(--line-2); border-radius: 999px; overflow: hidden; background: var(--card); }
.search-box input { border: none; outline: none; padding: 8px 16px; width: 240px; font-size: 13.5px; background: transparent; }
.search-box button { border: none; background: var(--ink); color: #fff; padding: 0 18px; cursor: pointer; font-size: 13.5px; }
.gallery-count { color: var(--muted); font-size: 13px; margin: 8px 0 14px; }

/* ---------- 瀑布流 ---------- */
.masonry {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(252px, 1fr));
  gap: 18px;
}
.card {
  break-inside: avoid; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card-link { display: block; color: inherit; text-decoration: none; }
.card-link:hover { color: inherit; }
.card-img {
  position: relative; overflow: hidden; background: #eee7d8;
  aspect-ratio: 16 / 9; /* 参考图为 1672x941(16:9), 所有卡片图片统一此比例 */
}
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s; }
.card:hover .card-img img { transform: scale(1.04); }
.card-hover {
  position: absolute; inset: 0; background: rgba(43,40,35,.35); color: #fff;
  display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s;
  font-size: 14px; letter-spacing: 2px;
}
.card:hover .card-hover { opacity: 1; }
.badge {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  vertical-align: middle; font-weight: 500;
}
.badge-ref { background: #e9eef7; color: #3b5b93; }
.badge-user { background: #fdeee8; color: #b05c2e; }
.badge-hot { background: #fdeaea; color: #c0352c; }
.card-img .badge { position: absolute; top: 10px; left: 10px; z-index: 2; box-shadow: 0 1px 6px rgba(0,0,0,.15); }
.card-body { padding: 12px 14px 13px; }
.card-title {
  margin: 0 0 4px; font-size: 15.5px; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.card-tag {
  display: inline-block; background: #f4eddc; color: #8a6a1a; font-size: 11.5px;
  padding: 1px 9px; border-radius: 999px; margin-bottom: 6px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-tag:empty { display: none; }
.card-meta { display: flex; gap: 12px; color: var(--muted); font-size: 12px; }

/* ---------- 分页 ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 26px 0 10px; }
.pagination a { padding: 7px 16px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--card); font-size: 13.5px; }
.pagination a:hover { border-color: var(--gold); color: var(--gold-dark); }
.page-info { color: var(--muted); font-size: 13px; }

/* ---------- 空状态 ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .btn { margin: 8px; }
.coming-soon .cs-icon { font-size: 64px; margin-bottom: 8px; }
.coming-soon h2 { color: var(--ink); }

/* ---------- 作品详情 ---------- */
.breadcrumb { margin: 16px 0; font-size: 13px; color: var(--muted); }
.work-detail { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); gap: 26px; margin: 10px 0 30px; }
.work-detail-img {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; align-items: flex-start; justify-content: center; padding: 14px;
}
.work-detail-img img { border-radius: 8px; }
.work-detail-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; align-self: start; }
.work-detail-head h1 { margin: 0 0 8px; font-size: 23px; }
.work-detail-head .card-tag { margin-right: 6px; }
.work-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin: 10px 0 16px; align-items: center; }
.like-btn { border: 1px solid var(--line-2); background: #fff; border-radius: 999px; padding: 3px 12px; cursor: pointer; color: var(--cinnabar); font-size: 13px; }
.like-btn.liked { background: #fdeaea; }
.prompt-block { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; background: #fdfbf5; }
.prompt-tabs { display: flex; align-items: center; gap: 2px; background: #f3ede0; border-bottom: 1px solid var(--line); padding: 0 6px; }
.prompt-tab {
  border: none; background: transparent; padding: 9px 14px; font-size: 13.5px; cursor: pointer;
  color: var(--ink-soft); font-family: inherit; border-bottom: 2px solid transparent;
}
.prompt-tab.active { color: var(--gold-dark); border-bottom-color: var(--gold); font-weight: 600; }
.copy-btn, .auto-translate {
  margin-left: auto; border: 1px solid var(--line-2); background: #fff; color: var(--muted);
  border-radius: 6px; padding: 3px 10px; font-size: 12px; cursor: pointer;
}
.auto-translate { margin-left: 4px; }
.tr-status { margin-left: auto; font-size: 12px; color: var(--muted); padding: 0 6px; }
.tr-status.err { color: var(--cinnabar); }
.copy-btn:hover, .auto-translate:hover { color: var(--gold-dark); border-color: var(--gold); }
.prompt-content { padding: 14px 16px; font-size: 13.5px; color: var(--ink-soft); max-height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.prompt-textarea {
  width: 100%; border: none; outline: none; resize: vertical; padding: 14px 16px;
  font-size: 13.5px; font-family: var(--font-sans); background: #fdfbf5; color: var(--ink); line-height: 1.7;
}
.prompt-negative .prompt-content { color: var(--cinnabar); }
.work-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.related { margin: 30px 0 40px; }
.related h2 { font-size: 20px; border-left: 4px solid var(--gold); padding-left: 12px; }

/* ---------- 预览弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(25, 22, 16, .72); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(3px);
}
.modal-box {
  background: var(--card); border-radius: 16px; width: min(1060px, 100%);
  max-height: 92vh; overflow: auto; position: relative; box-shadow: var(--shadow-lg);
}
.modal-close {
  position: absolute; top: 12px; right: 12px; z-index: 5; width: 34px; height: 34px;
  border-radius: 50%; border: 1px solid var(--line-2); background: rgba(255,255,255,.92);
  cursor: pointer; font-size: 15px; color: var(--ink-soft);
}
.modal-loading { padding: 60px; text-align: center; color: var(--muted); }
.modal-work { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(340px, .8fr); }
.modal-img { background: #201d17; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-img img { max-height: 84vh; max-width: 100%; border-radius: 8px; }
.modal-info { padding: 20px; overflow: auto; max-height: 92vh; }
.modal-actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.modal-work .prompt-content { max-height: 190px; }

/* ---------- 表单 ---------- */
.form-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; max-width: 860px; margin: 0 auto 40px;
}
.form-card h2 { font-size: 18px; margin: 22px 0 10px; padding-top: 16px; border-top: 1px dashed var(--line); }
.form-card h2:first-child { margin-top: 0; border-top: none; padding-top: 0; }
.form-card label { display: block; margin: 14px 0; font-size: 14px; font-weight: 600; }
.form-card input[type=text], .form-card input[type=password], .form-card input[type=url], .form-card select, .form-card input[type=number], .form-card input[type=file] {
  width: 100%; margin-top: 6px; padding: 10px 13px; border: 1px solid var(--line-2);
  border-radius: 9px; font-size: 14px; background: #fff; font-family: inherit; outline: none;
}
.form-card input:focus, .form-card select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,134,11,.12); }
.form-card .check-row { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.form-card .check-row input { width: auto; margin-top: 4px; }
.file-upload-label { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 18px; text-align: center; cursor: pointer; }
.file-upload-label:hover { border-color: var(--gold); }
.file-hint { display: block; color: var(--muted); font-size: 12.5px; margin-top: 8px; font-weight: 400; }
.generated-preview { border: 1px solid #cfe3c4; background: #f2f9ee; border-radius: var(--radius); padding: 14px; margin: 14px 0; }
.generated-preview img { max-height: 320px; border-radius: 8px; margin: 10px 0; }
.form-actions { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.form-actions .btn { flex: 1; min-width: 160px; }
.form-inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; max-width: 100%; }
.form-inline input, .form-inline select { width: auto; margin: 0; }
.auth-wrap { display: flex; justify-content: center; padding: 50px 0; }
.auth-card { width: min(400px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 32px; }
.auth-card h1 { text-align: center; margin: 0 0 18px; font-size: 24px; }
.auth-card label { display: block; margin: 14px 0; font-size: 14px; }
.auth-card input { width: 100%; margin-top: 6px; padding: 10px 13px; border: 1px solid var(--line-2); border-radius: 9px; font-size: 14px; outline: none; font-family: inherit; }
.auth-card input:focus { border-color: var(--gold); }
.auth-alt { text-align: center; margin-top: 16px; font-size: 13.5px; color: var(--muted); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 22px 0 10px; }
.page-head h1 { margin: 0; font-size: 26px; }
.page-head p { color: var(--muted); margin: 4px 0 0; width: 100%; }

/* ---------- 在线创作 ---------- */
.studio-layout { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; gap: 22px; margin: 16px 0 40px; align-items: start; }
.studio-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; position: sticky; top: 80px; }
.studio-opts { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.studio-opts label { font-size: 13px; color: var(--muted); }
.studio-opts select { margin-top: 4px; padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; font-size: 13px; }
#stStatus { font-size: 13px; margin-left: 4px; }
#stStatus.err { color: var(--cinnabar); }
.studio-results h2 { font-size: 18px; border-left: 4px solid var(--gold); padding-left: 12px; }
.gen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.gen-grid.has-results .empty-state { display: none; }
.gen-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.gen-img img { width: 100%; display: block; cursor: zoom-in; }
/* 生成结果大图预览 */
.lightbox {
  position: fixed; inset: 0; z-index: 3000; background: rgba(10, 9, 7, .82);
  display: flex; align-items: center; justify-content: center; padding: 26px; cursor: zoom-out;
  animation: fadeIn .18s ease;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 14px 50px rgba(0,0,0,.55); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.gen-actions { display: flex; gap: 8px; padding: 10px; }

/* ---------- 数据表格 ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; margin: 14px 0 30px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th { background: #f3ede0; text-align: left; padding: 10px 13px; font-weight: 600; white-space: nowrap; }
.data-table td { padding: 9px 13px; border-top: 1px solid var(--line); vertical-align: middle; }
.data-table tr:hover td { background: #fdfaf2; }
.tbl-thumb { width: 58px; height: 58px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); }
.row-actions a, .row-actions button {
  margin-right: 8px; color: var(--gold-dark); background: none; border: none; cursor: pointer;
  font-size: 13px; padding: 2px 0; text-decoration: none; font-family: inherit;
}
.row-actions a:hover, .row-actions button:hover { text-decoration: underline; }
.td-clip { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-pending { background: #fdf3d7; color: #8a6a1a; }
.st-pub { background: #eef7ea; color: #2f6b22; }
.st-down { background: #fdeeed; color: #a33b2e; }
.st-draft { background: #eef1f7; color: #44506b; }
.stats-row { display: flex; gap: 20px; margin: 14px 0; color: var(--muted); font-size: 13px; }

/* ---------- 页脚 ---------- */
.site-footer { margin-top: auto; background: #2b2720; color: #b9b2a2; padding: 30px 0 0; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding-bottom: 20px; }
.footer-inner strong { color: #efe9dc; font-family: var(--font-serif); font-size: 17px; }
.footer-inner p { margin: 6px 0 0; font-size: 13px; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.footer-links a { color: #cfc8b8; font-size: 13.5px; }
.footer-copy { border-top: 1px solid rgba(255,255,255,.08); text-align: center; padding: 14px; font-size: 12.5px; color: #8f8878; }

/* ---------- 提示 Toast ---------- */
#toast {
  position: fixed; bottom: 34px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(30, 27, 22, .92); color: #fff; padding: 10px 22px; border-radius: 999px;
  font-size: 13.5px; opacity: 0; transition: all .25s; pointer-events: none; z-index: 2000;
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .work-detail, .modal-work, .studio-layout { grid-template-columns: 1fr; }
  .studio-panel { position: static; }
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 10px; }
  .main-nav { order: 3; width: 100%; overflow-x: auto; }
  .hero { padding: 30px 22px; }
  .hero h1 { font-size: 26px; }
  .search-box input { width: 160px; }
  .masonry { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
@media (max-width: 560px) {
  .masonry { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .user-area { margin-left: auto; }
}

  /* ---------- 三级分类导航 ---------- */
  .cat-nav { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
  .cat-tabs-sub .cat-tab { padding: 5px 12px; font-size: 12.5px; background: var(--bg); }
  .cat-tabs-sub .cat-tab.active { background: linear-gradient(135deg, var(--gold), var(--gold-2)); }
  .cat-path { font-size: 12.5px; color: var(--muted); margin: 6px 0 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
  .cat-path a { color: var(--ink-soft); text-decoration: none; }
  .cat-path a:hover { color: var(--gold-dark); }
  .cat-path b { color: var(--ink); }