/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #f5f3ee;
  color: #1a1208;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: #8b3a2a; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ── */
.navbar {
  background: #2c1f14;
  border-bottom: 2px solid #8b3a2a;
  position: sticky; top: 0; z-index: 100;
}
.nav-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 24px;
  display: flex; align-items: center; gap: 8px;
  height: 52px;
}
.nav-logo {
  font-size: 1.1rem; font-weight: 700;
  color: #e8d5b5; letter-spacing: 0.05em;
  margin-right: 16px;
  text-decoration: none;
}
.nav-links { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-link {
  padding: 6px 12px; border-radius: 4px;
  color: #c8b89a; font-size: 0.9rem;
  text-decoration: none; transition: background .15s;
}
.nav-link:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
.nav-link-primary {
  background: #8b3a2a; color: #fff !important;
}
.nav-link-primary:hover { background: #a04535; }
.nav-user { display: flex; align-items: center; gap: 4px; }
.nav-btn-link {
  background: none; border: none; cursor: pointer;
  padding: 6px 12px; border-radius: 4px;
  color: #c8b89a; font-size: 0.9rem;
  font-family: inherit;
}
.nav-btn-link:hover { background: rgba(255,255,255,0.08); }

/* ── Main ── */
.main-content { flex: 1; }

/* ── Messages ── */
.messages { padding: 12px 24px; max-width: 1200px; margin: 0 auto; }
.message {
  padding: 10px 16px; border-radius: 6px; margin-bottom: 8px;
  font-size: 0.9rem;
}
.message-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.message-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, #2c1f14 0%, #4a2c1a 100%);
  padding: 64px 24px;
}
.hero-inner { max-width: 700px; margin: 0 auto; text-align: center; }
.hero-title { font-size: 2rem; color: #e8d5b5; font-weight: 700; letter-spacing: 0.05em; margin-bottom: 12px; }
.hero-sub { color: #a89070; font-size: 1.1rem; margin-bottom: 28px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 20px; border-radius: 6px; border: none;
  font-size: 0.9rem; font-family: inherit; cursor: pointer;
  transition: opacity .15s, background .15s;
  text-decoration: none;
}
.btn:hover { opacity: 0.88; text-decoration: none; }
.btn-primary { background: #8b3a2a; color: #fff; }
.btn-ghost { background: rgba(139,58,42,0.1); color: #8b3a2a; border: 1px solid rgba(139,58,42,0.3); }
.btn-danger { background: #c0392b; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 0.82rem; }
.btn-xs { padding: 3px 8px; font-size: 0.78rem; }
.btn-block { width: 100%; }
.btn-link { background: none; border: none; cursor: pointer; color: #8b3a2a; font-size: 0.82rem; padding: 0; }
.btn-link-danger { background: none; border: none; cursor: pointer; color: #c0392b; font-size: 0.78rem; padding: 0; margin-left: 8px; }

/* ── Section ── */
.section { max-width: 1200px; margin: 40px auto; padding: 0 24px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.section-title { font-size: 1.2rem; font-weight: 600; color: #2c1f14; }
.section-more { font-size: 0.88rem; color: #8b3a2a; }

/* ── Answer Cards (grid layout - homepage) ── */
.answer-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px;
}
.answer-card {
  background: #fff; border-radius: 8px;
  border: 1px solid #e8ddd0;
  padding: 16px; position: relative;
  transition: box-shadow .15s, transform .12s;
  display: block; color: inherit;
}
.answer-card:hover {
  box-shadow: 0 4px 16px rgba(44,31,20,0.1);
  transform: translateY(-2px);
  text-decoration: none; color: inherit;
}
.card-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.card-preview {
  font-size: 0.88rem; color: #555; line-height: 1.6; margin-bottom: 12px;
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.card-footer { display: flex; justify-content: space-between; align-items: center; }
.card-author { font-size: 0.82rem; color: #8b3a2a; }
.card-stats { display: flex; gap: 10px; font-size: 0.8rem; color: #999; }

/* ── Answer List (row layout) ── */
.answer-list { display: flex; flex-direction: column; gap: 10px; }

.answer-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 10px;
  transition: transform .12s, box-shadow .12s;
}
.answer-card-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(44,31,20,0.12);
  text-decoration: none;
}
.answer-card-link:hover .answer-card-row {
  border-color: #c8a882;
}

.answer-card-row {
  background: #fff;
  border: 1px solid #e8ddd0;
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: border-color .12s;
}

/* 头像 */
.card-avatar { flex-shrink: 0; }
.card-avatar-img {
  width: 40px; height: 40px; border-radius: 50%;
  object-fit: cover;
}
.card-avatar-placeholder {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #8b3a2a, #c4614e);
  color: #fff; font-size: 1rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* 卡片内容区 */
.card-body { flex: 1; min-width: 0; }

.card-top {
  display: flex; align-items: center;
  justify-content: space-between;
  gap: 8px; margin-bottom: 8px; flex-wrap: wrap;
}
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.card-time { font-size: 0.78rem; color: #bbb; white-space: nowrap; margin-left: auto; }

.card-preview {
  font-size: 0.9rem; color: #444; line-height: 1.65;
  margin-bottom: 10px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-bottom {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.card-author-name {
  font-size: 0.82rem; color: #8b3a2a; font-weight: 500;
}
.card-stats { display: flex; gap: 10px; margin-left: auto; }
.card-stat { font-size: 0.8rem; color: #aaa; }

/* Tags */
.tag-gray { background: #f0ede8; color: #888; }
.tag-blue { background: #e8f4fd; color: #2980b9; }

/* list header */
.list-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 14px;
}
.list-count { font-size: 0.88rem; color: #888; }

/* ── Tags ── */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 12px;
  font-size: 0.75rem; font-weight: 500;
}
.tag-exam { background: #fdebd0; color: #8b3a2a; }
.tag-mock { background: #e8f4fd; color: #2980b9; }
.tag-anon { background: #f0f0f0; color: #666; }
.tag-lg { font-size: 0.85rem; padding: 4px 12px; }
.tag-sm { font-size: 0.7rem; }
.tag-public { background: #d4edda; color: #155724; }
.tag-private { background: #f0f0f0; color: #666; }
.tag-vis { font-size: 0.75rem; padding: 2px 8px; border-radius: 12px; }

/* ── Page Layout ── */
.page-layout {
  max-width: 1200px; margin: 0 auto; padding: 24px;
  display: flex; gap: 24px; align-items: flex-start;
}

/* ── Filter Panel ── */
.filter-panel {
  width: 220px; flex-shrink: 0;
  background: #fff; border-radius: 8px;
  border: 1px solid #e8ddd0; padding: 16px;
  position: sticky; top: 72px;
}
.filter-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 14px; color: #2c1f14; }
.filter-group { margin-bottom: 12px; }
.filter-label { display: block; font-size: 0.8rem; color: #666; margin-bottom: 4px; }
.list-main { flex: 1; min-width: 0; }
.list-header { margin-bottom: 12px; }
.list-count { font-size: 0.85rem; color: #666; }

/* ── Forms ── */
.form-input, .form-select {
  display: block; width: 100%;
  padding: 8px 12px; border-radius: 6px;
  border: 1px solid #d0c4b4;
  font-size: 0.9rem; font-family: inherit;
  background: #fff; color: #1a1208;
  transition: border-color .15s;
}
.form-input:focus, .form-select:focus {
  outline: none; border-color: #8b3a2a;
  box-shadow: 0 0 0 3px rgba(139,58,42,0.1);
}
.form-input-sm {
  padding: 5px 8px; border-radius: 4px;
  border: 1px solid #d0c4b4; font-size: 0.88rem;
  font-family: inherit; width: 80px;
}
.form-input-sm:focus { outline: none; border-color: #8b3a2a; }
.form-checkbox { width: 16px; height: 16px; cursor: pointer; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.85rem; color: #555; margin-bottom: 5px; }
.form-group-sm { display: flex; flex-direction: column; gap: 4px; }
.form-group-sm label { font-size: 0.82rem; color: #555; }
.form-group-check { flex-direction: row !important; align-items: center; gap: 8px !important; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; align-items: flex-end; }
.form-section { margin-bottom: 24px; padding: 16px; background: #faf8f5; border-radius: 8px; border: 1px solid #e8ddd0; }
.form-section-title { font-size: 0.9rem; font-weight: 600; color: #2c1f14; margin-bottom: 14px; }
.form-error { color: #c0392b; font-size: 0.8rem; margin-top: 4px; }
.form-actions { display: flex; gap: 12px; margin-top: 8px; }
.textarea-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.textarea-header label { margin-bottom: 0 !important; }
.answer-textarea { min-height: 220px; font-family: 'Songti SC', 'SimSun', serif; font-size: 0.95rem; line-height: 1.8; }

/* ── Auth Pages ── */
.auth-page { display: flex; justify-content: center; padding: 60px 24px; }
.auth-card { background: #fff; border-radius: 12px; border: 1px solid #e8ddd0; padding: 36px; width: 100%; max-width: 400px; }
.auth-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 24px; color: #2c1f14; }
.auth-switch { text-align: center; font-size: 0.88rem; color: #888; margin-top: 16px; }

/* ── Profile ── */
.profile-page { display: flex; justify-content: center; padding: 40px 24px; }
.profile-card { background: #fff; border-radius: 12px; border: 1px solid #e8ddd0; padding: 32px; width: 100%; max-width: 600px; }
.avatar-preview { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.answer-manage-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0ebe0; flex-wrap: wrap; }
.manage-preview { flex: 1; font-size: 0.85rem; color: #555; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-actions { display: flex; gap: 6px; }

/* ── User Detail ── */
.user-detail-page { max-width: 900px; margin: 0 auto; padding: 32px 24px; }
.user-profile-header { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 36px; background: #fff; border-radius: 12px; border: 1px solid #e8ddd0; padding: 24px; }
.user-avatar-lg { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.user-avatar-placeholder { display: flex; align-items: center; justify-content: center; background: #8b3a2a; color: #fff; font-size: 1.8rem; font-weight: 700; }
.user-name { font-size: 1.3rem; font-weight: 700; color: #2c1f14; }
.user-username { font-size: 0.85rem; color: #888; margin-top: 2px; }
.user-bio { font-size: 0.9rem; color: #555; margin-top: 8px; }
.user-joined { font-size: 0.82rem; color: #999; margin-top: 8px; }

/* ── Editor Layout ── */
.editor-layout { display: flex; gap: 0; min-height: calc(100vh - 52px); }
.editor-form-panel { width: 380px; flex-shrink: 0; background: #fff; border-right: 1px solid #e8ddd0; padding: 24px; overflow-y: auto; }
.editor-preview-panel { flex: 1; padding: 24px; background: #f5f3ee; overflow-x: auto; }
.panel-title { font-size: 1.1rem; font-weight: 700; color: #2c1f14; margin-bottom: 20px; }
.panel-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.preview-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.preview-title { font-size: 0.9rem; font-weight: 600; color: #555; }
.preview-stats { font-size: 0.82rem; color: #888; }

/* ── Answer Detail ── */
.detail-layout { max-width: 960px; margin: 0 auto; padding: 32px 24px; }
.detail-main { background: #fff; border-radius: 12px; border: 1px solid #e8ddd0; padding: 28px; }
.detail-header { margin-bottom: 24px; border-bottom: 1px solid #f0ebe0; padding-bottom: 20px; }
.detail-meta { display: flex; gap: 8px; margin-bottom: 10px; }
.detail-title { font-size: 1.3rem; font-weight: 700; color: #2c1f14; margin-bottom: 12px; }
.detail-author-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.author-link { display: flex; align-items: center; gap: 8px; color: #2c1f14; font-weight: 500; }
.author-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.author-avatar-placeholder { width: 32px; height: 32px; border-radius: 50%; background: #8b3a2a; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; font-weight: 700; }
.detail-time { font-size: 0.82rem; color: #999; }
.detail-note { margin-top: 12px; font-size: 0.88rem; color: #666; background: #faf8f5; padding: 8px 12px; border-radius: 4px; border-left: 3px solid #c8a882; }
.grid-section { margin-bottom: 24px; }
.grid-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.grid-info { font-size: 0.82rem; color: #888; }
.like-section { margin-bottom: 20px; }
.like-btn { background: none; border: 2px solid #e0c4c0; border-radius: 24px; padding: 8px 20px; cursor: pointer; font-size: 1rem; color: #999; transition: all .15s; display: flex; align-items: center; gap: 6px; }
.like-btn:hover, .like-btn.liked { border-color: #c0392b; color: #c0392b; background: #fdf0ef; }
.owner-actions { display: flex; gap: 8px; margin-bottom: 20px; }
.admin-actions {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 10px 14px;
  background: #fff8f0; border: 1px solid #f0d0b0;
  border-radius: 6px;
}
.admin-badge { font-size: 0.8rem; color: #8b5a2a; font-weight: 600; }

/* ── Comments ── */
.comments-section { border-top: 1px solid #f0ebe0; padding-top: 20px; }
.comments-title { font-size: 1rem; font-weight: 600; margin-bottom: 16px; color: #2c1f14; }
.comment-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.login-tip { font-size: 0.88rem; color: #888; margin-bottom: 16px; }
.comment { padding: 12px 0; border-bottom: 1px solid #f5f2ee; }
.comment.reply { padding: 8px 0 8px 20px; border-bottom: none; border-left: 2px solid #e8ddd0; margin-left: 12px; margin-top: 8px; }
.replies { margin-top: 4px; }
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-author { font-size: 0.85rem; font-weight: 600; color: #2c1f14; }
.comment-time { font-size: 0.78rem; color: #bbb; }
.comment-content { font-size: 0.88rem; color: #444; line-height: 1.6; margin-bottom: 4px; }

/* ── Grid/Sheet styles ── */
.sheet { background: #fdf8f0; padding: 20px 16px; border-radius: 6px; box-shadow: 0 2px 12px rgba(44,31,20,0.12); display: inline-block; min-width: fit-content; }
.sheet-title { text-align: center; font-family: 'Songti SC', 'SimSun', serif; font-size: 15px; font-weight: 700; letter-spacing: 6px; margin-bottom: 14px; color: #1a1208; }
.grid-row { display: flex; align-items: center; }
.row-num { width: 24px; font-size: 11px; color: #c8a882; text-align: right; padding-right: 6px; flex-shrink: 0; }
.cells-row { display: flex; }
.cell { width: 28px; height: 28px; border: 1px solid #c8a882; display: flex; align-items: center; justify-content: center; font-family: 'Songti SC', 'SimSun', serif; font-size: 13px; color: #1a1208; background: #fffef9; margin-left: -1px; margin-top: -1px; flex-shrink: 0; }
.cell.filled { background: #fdf5e4; }
.cell.indent { background: #f5ede0; }
.cell.merged { background: #fff3cd; }
.cell.over   { background: #ffe8e8; color: #c0392b; }
.cell.shared { font-size: 10px; }

/* ── Legend ── */
.legend { display: flex; gap: 14px; margin-top: 10px; font-size: 12px; color: #888; flex-wrap: wrap; }
.leg { display: flex; align-items: center; gap: 5px; }
.leg-dot { width: 14px; height: 14px; border: 1px solid #c8a882; border-radius: 2px; }

/* ── Pagination ── */
.pagination { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 24px; }
.page-btn { padding: 7px 16px; border-radius: 6px; background: #fff; border: 1px solid #d0c4b4; color: #2c1f14; font-size: 0.88rem; }
.page-info { font-size: 0.88rem; color: #888; }

/* ── Filter type buttons (真题/模拟题/全部) ── */
.filter-type-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-type-btn {
  flex: 1; text-align: center;
  padding: 5px 8px; border-radius: 6px;
  font-size: 0.82rem; border: 1px solid #d0c4b4;
  color: #666; background: #fff;
  text-decoration: none; transition: all .15s;
}
.filter-type-btn:hover { border-color: #8b3a2a; color: #8b3a2a; text-decoration: none; }
.filter-type-btn.active { background: #8b3a2a; color: #fff; border-color: #8b3a2a; }
.filter-search { padding: 6px 10px; font-size: 0.88rem; }

/* ── Mock toggle row ── */
.mock-toggle-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; background: #faf8f5;
  border-radius: 6px; border: 1px solid #e8ddd0;
  margin-bottom: 14px;
}
.mock-toggle-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.9rem; font-weight: 500; cursor: pointer;
}
.mock-toggle-hint { font-size: 0.8rem; color: #aaa; }

/* ── Field hints ── */
.field-hint { font-size: 0.78rem; color: #aaa; margin-top: 4px; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 48px 0; color: #888; }
.empty-tip { font-size: 0.88rem; color: #aaa; padding: 8px 0; }

/* ── Footer ── */
.footer { background: #2c1f14; padding: 16px 24px; margin-top: auto; }
.footer-inner { max-width: 1200px; margin: 0 auto; text-align: center; color: #6b5040; font-size: 0.82rem; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .page-layout { flex-direction: column; }
  .filter-panel { width: 100%; position: static; }
  .editor-layout { flex-direction: column; }
  .editor-form-panel { width: 100%; border-right: none; border-bottom: 1px solid #e8ddd0; }
  .hero-title { font-size: 1.5rem; }
  .answer-grid { grid-template-columns: 1fr; }
}
