/* 历代异名典文大聚 — 公共样式 */
:root {
  --ink-deep: #1a1a2e;
  --ink-medium: #2d2d44;
  --paper: #f5f0e8;
  --paper-light: #faf7f2;
  --gold: #c9a96e;
  --gold-light: #e8d5a8;
  --vermillion: #c23b22;
  --vermillion-light: #e85d44;
  --jade: #5a8f7b;
  --jade-light: #7bb8a3;
  --indigo: #4a5899;
  --text-primary: #2c2c2c;
  --text-secondary: #6b6b6b;
  --text-light: #999;
  --border: #e0d8cc;
  --shadow: rgba(26, 26, 46, 0.08);
  --radius: 12px;
}

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

body {
  background: var(--paper);
  color: var(--text-primary);
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 80px;
  overflow-x: hidden;
}

/* SVG Icon Container */
.icon-svg { display: inline-block; vertical-align: middle; }
.icon-svg svg { display: block; }

/* Bottom Tab Bar */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  background: var(--paper-light);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 6px 0 env(safe-area-inset-bottom, 8px);
  z-index: 100;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  padding: 4px 12px;
  text-decoration: none;
}

.tab-item .tab-icon svg { stroke: var(--text-light); fill: none; }
.tab-label { font-size: 10px; color: var(--text-light); }

.tab-item.active .tab-icon svg { stroke: var(--vermillion); }
.tab-item.active .tab-label { color: var(--vermillion); font-weight: 600; }

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  margin-bottom: 12px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-deep);
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 16px;
  background: linear-gradient(to bottom, var(--vermillion), var(--gold));
  border-radius: 2px;
}

.section-more {
  font-size: 12px;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Tags */
.entry-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 400;
  display: inline-block;
}
.tag-yiming { background: rgba(201,169,110,0.15); color: var(--gold); }
.tag-dianwen { background: rgba(194,59,34,0.1); color: var(--vermillion); }
.tag-story { background: rgba(90,143,123,0.1); color: var(--jade); }
.tag-dynasty { background: rgba(74,88,153,0.1); color: var(--indigo); }

/* Cards */
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px var(--shadow);
}

/* Back Navigation */
.page-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--paper-light);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-nav-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-deep);
}

.page-nav-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}

.page-nav-actions .icon-svg svg { stroke: var(--text-secondary); fill: none; }

/* Source/Quote Block */
.source-block {
  font-size: 12px;
  color: var(--jade);
  background: rgba(90,143,123,0.08);
  padding: 8px 12px;
  border-radius: 8px;
  border-left: 3px solid var(--jade);
  line-height: 1.6;
}

.source-block em { color: var(--jade); font-style: normal; font-weight: 600; }

/* Author Note (康按) */
.author-note {
  background: rgba(194,59,34,0.06);
  border-left: 3px solid var(--vermillion);
  padding: 8px 12px;
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin: 8px 0;
}

/* Filter Tags */
.filter-row {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

.filter-tag {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all 0.2s;
}

.filter-tag.active {
  background: var(--vermillion);
  color: #fff;
  border-color: var(--vermillion);
}

/* Sub Tabs — 胶囊式古风双联 */
.sub-tabs {
  display: flex;
  padding: 12px 16px 0;
  gap: 0;
  margin-bottom: 12px;
}

.sub-tab {
  flex: 1;
  padding: 10px 16px;
  font-size: 14px;
  letter-spacing: 1px;
  text-align: center;
  color: var(--text-secondary);
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--border);
  transition: all 0.25s ease;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}

.sub-tab:first-child {
  border-radius: 24px 0 0 24px;
  border-right: none;
}

.sub-tab:last-child {
  border-radius: 0 24px 24px 0;
}

.sub-tab:active {
  opacity: 0.7;
}

.sub-tab.active {
  color: #fff;
  font-weight: 600;
  background: linear-gradient(135deg, var(--ink-deep) 0%, var(--ink-medium) 100%);
  border-color: var(--ink-deep);
  cursor: default;
  box-shadow: 0 2px 8px rgba(26, 26, 46, 0.15);
}

.sub-tab.active + .sub-tab {
  border-left: 1px solid var(--border);
}

.sub-tab .count {
  font-size: 11px;
  color: var(--text-light);
  margin-left: 2px;
}

.sub-tab.active .count {
  color: var(--gold-light);
}

/* Entry List Item */
.entry-list-item {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 16px 8px;
  box-shadow: 0 2px 8px var(--shadow);
  cursor: pointer;
  transition: transform 0.2s;
}

.entry-list-item:active { transform: scale(0.98); }

.entry-list-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-deep);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.entry-list-excerpt {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.entry-list-meta {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-light);
}

/* Word cards (词目) */
.word-card {
  display: inline-block;
  padding: 6px 12px;
  background: var(--paper);
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-deep);
  margin: 4px;
  border: 1px solid var(--border);
}

/* Detail Section */
.detail-section {
  padding: 16px;
  margin-bottom: 4px;
}

.detail-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-deep);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-section-title::before {
  content: '';
  width: 3px;
  height: 14px;
  background: linear-gradient(to bottom, var(--vermillion), var(--gold));
  border-radius: 2px;
}

.detail-section-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* Bottom Action Bar */
.bottom-action-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  background: var(--paper-light);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 10px 16px env(safe-area-inset-bottom, 8px);
  z-index: 100;
}

.bottom-action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-secondary);
}

.bottom-action-item .icon-svg svg { stroke: var(--text-secondary); fill: none; }

/* Status Bar */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--paper-light);
}

/* Time line */
.timeline { padding: 0 16px; }
.timeline-item {
  display: flex;
  gap: 14px;
  padding-bottom: 20px;
  position: relative;
}
.timeline-line {
  position: absolute;
  left: 7px;
  top: 18px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item:last-child .timeline-line { display: none; }
.timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  border: 3px solid var(--paper);
}
.timeline-content { flex: 1; }
.timeline-year {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 2px;
}
.timeline-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}