/* 赤月传奇 网站样式 */

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

:root {
  --primary: #8b0000;
  --primary-light: #c41e3a;
  --primary-dark: #5c0000;
  --accent: #d4a017;
  --bg: #f5f0e8;
  --card-bg: #fff;
  --text: #333;
  --text-light: #888;
  --border: #e0d5c5;
  --radius: 6px;
}

html { font-size: 16px; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-light); text-decoration: underline; }

/* ---------- Header ---------- */
.site-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: 56px;
  flex-wrap: wrap;
}

.site-logo {
  color: #fff;
  font-size: 1.3rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
}
.site-logo:hover { text-decoration: none; color: #fff; }

.sword-icon::before {
  content: "⚔";
  font-size: 1.2rem;
}

.main-nav {
  display: flex;
  gap: 4px;
  flex: 1;
  flex-wrap: wrap;
}

.main-nav a {
  color: rgba(255,255,255,.85);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: .9rem;
  transition: all .2s;
  text-decoration: none;
}
.main-nav a:hover { background: rgba(255,255,255,.15); color: #fff; text-decoration: none; }
.main-nav a.active { background: rgba(255,255,255,.2); color: #fff; font-weight: 600; }

.top-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.auth-area { display: flex; align-items: center; gap: 8px; }

.welcome-text { font-size: .85rem; color: rgba(255,255,255,.9); }
.welcome-text .nick { font-weight: 600; }
.pm-badge {
  background: #ff4444;
  color: #fff;
  font-size: .7rem;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 4px;
}

.my-info-link {
  color: #fff;
  font-size: .85rem;
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,.4);
  border-radius: var(--radius);
  text-decoration: none;
}
.my-info-link:hover { background: rgba(255,255,255,.15); text-decoration: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: .9rem;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  font-family: inherit;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-light); }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-outline-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.btn-outline-light:hover { background: rgba(255,255,255,.15); }
.btn-light { background: #fff; color: var(--primary); border-color: #fff; }
.btn-light:hover { background: #f5f5f5; }
.btn-danger-outline { background: transparent; color: #d32f2f; border-color: #d32f2f; }
.btn-danger-outline:hover { background: #d32f2f; color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 4px 10px; font-size: .8rem; }
.btn-lg { padding: 10px 24px; font-size: 1rem; }

/* ---------- Main ---------- */
.page-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px;
  flex: 1;
  width: 100%;
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 48px 16px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary), var(--primary-light));
  border-radius: 12px;
  margin-bottom: 24px;
  color: #fff;
}
.hero h1 { font-size: 2.5rem; margin-bottom: 8px; text-shadow: 0 2px 4px rgba(0,0,0,.3); }
.hero p { font-size: 1.1rem; opacity: .9; margin-bottom: 20px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero .btn-outline { color: #fff; border-color: rgba(255,255,255,.6); }
.hero .btn-outline:hover { background: rgba(255,255,255,.15); }

/* ---------- Quick Links ---------- */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.quick-link-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 8px;
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: all .2s;
  text-decoration: none;
  color: var(--text);
}
.quick-link-item:hover { box-shadow: 0 2px 12px rgba(0,0,0,.08); transform: translateY(-2px); text-decoration: none; color: var(--primary); }
.ql-icon { font-size: 1.8rem; }

/* ---------- Home Grid ---------- */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
}

.home-col {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
}

/* ---------- Section Title ---------- */
.section-title {
  font-size: 1.1rem;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.section-title .sub { font-size: .8rem; color: var(--text-light); font-weight: normal; }
.section-title .more-link { margin-left: auto; font-size: .85rem; }

/* ---------- Article List ---------- */
.article-list { display: flex; flex-direction: column; gap: 8px; }
.article-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  gap: 8px;
}
.article-list-item:last-child { border-bottom: none; }
.article-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: .9rem;
}
.article-title:hover { color: var(--primary); }
.article-date { color: var(--text-light); font-size: .8rem; white-space: nowrap; }

/* ---------- Article Detail ---------- */
.breadcrumb { font-size: .85rem; color: var(--text-light); margin-bottom: 12px; }
.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { color: var(--text); }

.article-detail, .topic-detail {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 20px;
}

.article-h1 { font-size: 1.5rem; margin-bottom: 12px; color: var(--primary-dark); line-height: 1.4; }
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: .85rem;
  color: var(--text-light);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.article-meta .item-author { color: var(--primary); cursor: pointer; font-weight: 600; }

.article-content { line-height: 1.8; font-size: .95rem; }
.article-content h2 { margin: 20px 0 10px; color: var(--primary-dark); font-size: 1.2rem; }
.article-content h3 { margin: 16px 0 8px; color: var(--primary); font-size: 1.05rem; }
.article-content p { margin-bottom: 10px; }
.article-content ul, .article-content ol { margin: 10px 0 10px 24px; }
.article-content li { margin-bottom: 4px; }
.article-content a { color: var(--primary); }
.article-content img { max-width: 100%; border-radius: var(--radius); }

.article-actions { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ---------- Comments ---------- */
.comment-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
}
.comment-form { margin-bottom: 16px; }
.comment-textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .9rem;
  resize: vertical;
  margin-bottom: 8px;
}
.comment-textarea:focus { outline: none; border-color: var(--primary); }

.comment-list { display: flex; flex-direction: column; gap: 12px; }
.comment-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #faf8f5;
}
.comment-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: .85rem;
}
.comment-author { color: var(--primary); font-weight: 600; cursor: pointer; }
.comment-date { color: var(--text-light); }
.comment-content-text { font-size: .9rem; line-height: 1.6; }

/* ---------- Pager ---------- */
.pager {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 16px 0;
  flex-wrap: wrap;
}
.pager a, .pager span {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .85rem;
  color: var(--text);
  cursor: pointer;
}
.pager a:hover, .pager span.active { background: var(--primary); color: #fff; border-color: var(--primary); text-decoration: none; }
.pager span.disabled { color: var(--text-light); cursor: default; opacity: .5; }

/* ---------- Search Bar ---------- */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-bar input {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .9rem;
}
.search-bar input:focus { outline: none; border-color: var(--primary); }

/* ---------- Post List (forum) ---------- */
.post-list { display: flex; flex-direction: column; gap: 8px; }
.post-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: box-shadow .2s;
}
.post-list-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.post-list-item .pin-badge {
  background: var(--accent);
  color: #fff;
  font-size: .7rem;
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
}
.post-list-item .item-main { flex: 1; min-width: 0; }
.post-list-item .item-title {
  font-size: .95rem;
  color: var(--text);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.post-list-item .item-title:hover { color: var(--primary); }
.post-list-item .item-meta {
  display: flex;
  gap: 12px;
  font-size: .8rem;
  color: var(--text-light);
  margin-top: 2px;
}
.post-list-item .item-meta .item-author { color: var(--primary); cursor: pointer; }
.post-list-item .item-stats {
  display: flex;
  gap: 12px;
  font-size: .8rem;
  color: var(--text-light);
  white-space: nowrap;
}

/* ---------- Video Grid ---------- */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.video-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow .2s;
}
.video-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); }
.video-embed { width: 100%; aspect-ratio: 16/9; border: none; }
.video-info { padding: 12px; }
.video-info h3 { font-size: 1rem; margin-bottom: 6px; color: var(--text); }
.video-info p { font-size: .85rem; color: var(--text-light); }
.video-meta { display: flex; gap: 12px; font-size: .8rem; color: var(--text-light); margin-top: 6px; }
.video-meta .item-author { color: var(--primary); cursor: pointer; }

/* ---------- Screenshot Grid ---------- */
.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.screenshot-item {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform .2s;
  background: var(--card-bg);
}
.screenshot-item:hover { transform: scale(1.02); }
.screenshot-item img { width: 100%; display: block; aspect-ratio: 4/3; object-fit: cover; }
.screenshot-title { padding: 8px; font-size: .85rem; color: var(--text); }

/* ---------- Download ---------- */
.download-list { display: flex; flex-direction: column; gap: 12px; }
.download-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.download-icon { font-size: 2.5rem; }
.download-info { flex: 1; min-width: 200px; }
.download-info h3 { font-size: 1.1rem; margin-bottom: 4px; }
.download-info p { font-size: .85rem; color: var(--text-light); }
.download-meta { display: flex; gap: 16px; font-size: .8rem; color: var(--text-light); margin-top: 4px; }

/* ---------- My Info ---------- */
.my-info-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 20px;
}
.info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.info-row:last-child { border-bottom: none; }
.info-label { width: 100px; color: var(--text-light); font-size: .9rem; }
.info-value { font-size: .9rem; flex: 1; min-width: 150px; }
.info-value input {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .9rem;
  width: 100%;
  max-width: 300px;
}
.info-value input:focus { outline: none; border-color: var(--primary); }
.info-value input[readonly] { background: #f5f5f5; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  text-align: center;
}
.stat-card .stat-num { font-size: 1.5rem; font-weight: bold; color: var(--primary); }
.stat-card .stat-label { font-size: .8rem; color: var(--text-light); margin-top: 4px; }

.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
  flex-wrap: wrap;
}
.tab-item {
  padding: 8px 16px;
  cursor: pointer;
  font-size: .9rem;
  color: var(--text-light);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ---------- Form ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .85rem; color: var(--text-light); margin-bottom: 4px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .9rem;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); }
.form-tip { font-size: .8rem; color: var(--text-light); }
.required { color: #d32f2f; }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }

/* ---------- Modal ---------- */
.modal-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  justify-content: center;
  align-items: flex-start;
  padding: 5vh 16px;
  overflow-y: auto;
}
.modal-mask.show { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  max-width: 420px;
  width: 100%;
  position: relative;
}
.modal-box-wide { max-width: 600px; }
.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-box h3 { margin-bottom: 16px; font-size: 1.1rem; }

/* ---------- PM ---------- */
.pm-view-header { margin-bottom: 12px; }
.pm-title { font-size: 1rem; font-weight: 600; }
.pm-messages {
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px;
  background: #f9f7f4;
  border-radius: var(--radius);
}
.pm-message { max-width: 75%; }
.pm-message.mine { align-self: flex-end; }
.pm-bubble {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: .9rem;
  word-break: break-word;
}
.pm-message:not(.mine) .pm-bubble { background: #fff; border: 1px solid var(--border); }
.pm-message.mine .pm-bubble { background: var(--primary); color: #fff; }
.pm-time { font-size: .7rem; color: var(--text-light); margin-top: 2px; }
.pm-message.mine .pm-time { text-align: right; }
.pm-send-area { display: flex; gap: 8px; }
.pm-send-area textarea {
  flex: 1;
  min-height: 60px;
  max-height: 120px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .9rem;
  resize: vertical;
}

/* ---------- Author Card ---------- */
.author-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #faf8f5;
  border-radius: var(--radius);
}
.author-info h2 { font-size: 1.2rem; color: var(--primary-dark); }
.author-stats { display: flex; gap: 16px; font-size: .8rem; color: var(--text-light); margin-top: 4px; flex-wrap: wrap; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.8);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: .9rem;
  z-index: 300;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,.8);
  padding: 20px 16px;
  text-align: center;
  font-size: .85rem;
  margin-top: auto;
}
.site-footer a { color: rgba(255,255,255,.7); }
.site-footer a:hover { color: #fff; }
.footer-line { margin-top: 8px; }
.footer-line a { color: rgba(255,255,255,.7); }

/* ---------- Loading / Empty ---------- */
.loading-tip, .empty-tip { text-align: center; color: var(--text-light); padding: 24px; }

/* ---------- Category Bar ---------- */
.category-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.category-bar a {
  padding: 4px 12px;
  border-radius: var(--radius);
  font-size: .85rem;
  color: var(--text);
  background: var(--card-bg);
  border: 1px solid var(--border);
  text-decoration: none;
}
.category-bar a:hover, .category-bar a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Lightbox ---------- */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.9);
  z-index: 300;
  justify-content: center;
  align-items: center;
  cursor: zoom-out;
}
.lightbox.show { display: flex; }
.lightbox img { max-width: 90%; max-height: 90vh; border-radius: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .header-inner { height: auto; padding: 8px 12px; gap: 8px; }
  .main-nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .main-nav a { white-space: nowrap; padding: 4px 8px; font-size: .85rem; }
  .top-actions { order: 4; }
  .auth-area { order: 2; }

  .hero { padding: 32px 12px; }
  .hero h1 { font-size: 1.8rem; }
  .hero p { font-size: .95rem; }

  .home-grid { grid-template-columns: 1fr; }
  .quick-links { grid-template-columns: repeat(3, 1fr); }

  .video-grid { grid-template-columns: 1fr; }
  .screenshot-grid { grid-template-columns: repeat(2, 1fr); }

  .post-list-item { flex-direction: column; align-items: flex-start; }
  .post-list-item .item-stats { gap: 8px; }
  .download-card { flex-direction: column; text-align: center; }

  .article-detail, .topic-detail { padding: 16px; }
  .article-h1 { font-size: 1.2rem; }
  .article-meta { gap: 8px; font-size: .8rem; }

  .info-label { width: 80px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .modal-box { padding: 16px; }
  .breadcrumb { font-size: .8rem; }
}
