@import url('https://fonts.googleapis.cn/css2?family=Noto+Serif+SC:wght@400;500;600;700&display=swap');

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #FAF8F5;
  --card-bg: #FFFFFF;
  --text: #3D3929;
  --text-light: #6B6455;
  --sage: #7C9A8E;
  --sage-light: #dce8e1;
  --sage-dark: #4c665b;
  --amber: #D4A574;
  --amber-light: #E8C9A0;
  --amber-dark: #B8865A;
  --lavender: #B8A9C9;
  --lavender-light: #D8CEE6;
  --rose-soft: #E8B4B8;
  --border: #E8E2DA;
  --shadow-sm: 0 1px 3px rgba(61,57,41,0.06);
  --shadow-md: 0 4px 12px rgba(61,57,41,0.08);
  --shadow-lg: 0 8px 24px rgba(61,57,41,0.12);
  --radius: 12px;
  --radius-lg: 16px;
  --font-serif: 'Noto Serif SC', 'Songti SC', 'SimSun', Georgia, serif;
  --font-sans: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, -apple-system, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250,248,245,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(232,226,218,0.5);
}

.header-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.brand-icon { font-size: 24px; }

.brand-name {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text);
  transition: color 0.2s;
}

.brand:hover .brand-name { color: var(--sage); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 14px;
  color: var(--text-light);
}

.nav-links a {
  transition: color 0.2s;
  cursor: pointer;
}

.nav-links a:hover, .nav-links a.active { color: var(--sage); }

/* ===== Mobile Nav ===== */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(250,248,245,0.97);
    backdrop-filter: blur(12px);
    padding: 16px 24px;
    gap: 16px;
    border-bottom: 1px solid var(--border);
  }
  .mobile-menu-btn { display: block; }
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 24px;
  width: 100%;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid rgba(232,226,218,0.5);
  padding: 32px 24px;
  margin-top: 48px;
  text-align: center;
}

.footer-brand {
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--text-light);
}

.footer-tagline {
  font-size: 12px;
  color: var(--text-light);
  opacity: 0.6;
  margin-top: 8px;
}

/* ===== Typography ===== */
.font-serif { font-family: var(--font-serif); }

h1, h2, h3 { font-family: var(--font-serif); }

/* ===== Welcome Section ===== */
.welcome-section {
  text-align: center;
  margin-bottom: 48px;
}

.welcome-title {
  font-size: 40px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 16px;
  color: var(--text);
}

.welcome-title .highlight { color: var(--sage); }

.welcome-subtitle {
  font-size: 18px;
  color: var(--text-light);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.8;
}

.learned-count {
  margin-top: 12px;
  font-size: 14px;
  color: var(--sage);
}

/* ===== Section Title ===== */
.section-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title .icon { font-size: 16px; }

/* ===== Today's Recommendation Card ===== */
.today-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 32px;
  border: 1px solid rgba(232,226,218,0.6);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 48px;
}

.today-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.today-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.today-card-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.today-card-english {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 4px;
}

.today-card-icon { font-size: 32px; }

.today-card-quote {
  font-size: 18px;
  font-style: italic;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 16px;
}

.today-card-summary {
  color: var(--text-light);
  line-height: 1.8;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.today-card-footer {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.category-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.badge-emotion { background: #ecfdf5; color: #047857; }
.badge-relationship { background: #fff1f2; color: #be123c; }
.badge-workplace { background: #fffbeb; color: #b45309; }
.badge-self { background: #f5f3ff; color: #6d28d9; }

.read-more {
  font-size: 14px;
  color: var(--sage);
}

/* ===== Random Button ===== */
.random-section {
  text-align: center;
  margin-bottom: 48px;
}

.random-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 16px 32px;
  background: var(--amber);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
}

.random-btn:hover {
  background: var(--amber-dark);
  box-shadow: var(--shadow-lg);
}

.random-btn:active { transform: scale(0.95); }

@keyframes bounce-soft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.random-btn.bouncing { animation: bounce-soft 0.6s ease; }

.random-result {
  margin-top: 24px;
  display: inline-block;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px 24px;
  border: 1px solid rgba(212,165,116,0.3);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s;
  max-width: 480px;
  text-align: left;
}

.random-result:hover {
  box-shadow: var(--shadow-md);
}

.random-result-name {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.random-result-quote {
  font-size: 14px;
  color: var(--text-light);
  font-style: italic;
  margin-top: 4px;
}

.random-result-hint {
  font-size: 13px;
  color: var(--amber);
  margin-top: 8px;
}

/* ===== Category Grid ===== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 48px;
}

@media (max-width: 640px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); }
}

.category-card {
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.category-card .icon { font-size: 32px; display: block; margin-bottom: 8px; }
.category-card .label { font-weight: 500; font-size: 15px; }

.cat-emotion { background: #ecfdf5; border-color: #a7f3d0; }
.cat-emotion .label { color: #047857; }
.cat-relationship { background: #fff1f2; border-color: #fecdd3; }
.cat-relationship .label { color: #be123c; }
.cat-workplace { background: #fffbeb; border-color: #fde68a; }
.cat-workplace .label { color: #b45309; }
.cat-self { background: #f5f3ff; border-color: #ddd6fe; }
.cat-self .label { color: #6d28d9; }

/* ===== Law Cards Grid ===== */
.law-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 640px) {
  .law-grid { grid-template-columns: 1fr; }
}

.law-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid rgba(232,226,218,0.5);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.law-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.law-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.law-card-info { flex: 1; min-width: 0; }

.law-card-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.law-card-name {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  transition: color 0.2s;
}

.law-card:hover .law-card-name { color: var(--sage); }

.law-card-quote {
  font-size: 13px;
  color: var(--text-light);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.law-card-icon { font-size: 20px; flex-shrink: 0; margin-left: 12px; }

.status-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
  white-space: nowrap;
}

.status-learned { background: #ecfdf5; color: #047857; }
.status-fav { font-size: 12px; }

/* ===== Category Page ===== */
.category-header {
  text-align: center;
  margin-bottom: 40px;
}

.category-header .icon { font-size: 48px; display: block; margin-bottom: 16px; }

.category-header h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 12px;
}

.category-header p {
  font-size: 18px;
  color: var(--text-light);
}

.category-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.category-nav-btn {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
}

.category-nav-btn:hover {
  border-color: var(--sage);
  color: var(--sage-dark);
}

.category-nav-btn.active {
  background: var(--sage);
  color: #fff;
  border-color: var(--sage);
}

.category-laws-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

@media (max-width: 768px) {
  .category-laws-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .category-laws-grid { grid-template-columns: 1fr; }
}

.category-law-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid rgba(232,226,218,0.5);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.category-law-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.category-law-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
  transition: color 0.2s;
}

.category-law-card:hover h3 { color: var(--sage); }

.category-law-card .english { font-size: 12px; color: var(--text-light); margin-bottom: 12px; }

.category-law-card .quote {
  font-size: 14px;
  font-style: italic;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 12px;
}

.category-law-card .summary {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.category-law-card .read-link {
  margin-top: 16px;
  font-size: 14px;
  color: var(--sage);
  transition: color 0.2s;
}

.category-law-card:hover .read-link { color: var(--sage-dark); }

/* ===== Detail Page ===== */
.breadcrumb {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 32px;
}

.breadcrumb a { cursor: pointer; transition: color 0.2s; }
.breadcrumb a:hover { color: var(--sage); }
.breadcrumb .sep { margin: 0 8px; }
.breadcrumb .current { color: var(--text); }

.detail-header { margin-bottom: 32px; }

.detail-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.action-btn {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn:hover { border-color: var(--sage); }

.action-btn.active-learned {
  background: var(--sage);
  color: #fff;
  border-color: var(--sage);
}

.action-btn.active-fav {
  background: var(--amber);
  color: #fff;
  border-color: var(--amber);
}

.detail-name {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 4px;
}

.detail-english {
  font-size: 14px;
  color: var(--text-light);
}

.detail-quote-box {
  background: rgba(124,154,142,0.06);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid rgba(124,154,142,0.15);
  margin-bottom: 32px;
  text-align: center;
}

.detail-quote-box p {
  font-family: var(--font-serif);
  font-size: 20px;
  font-style: italic;
  color: var(--sage-dark);
  line-height: 1.7;
}

/* ===== Content Sections ===== */
.content-section { margin-bottom: 32px; }

.content-section h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.content-section h2 .dot { font-size: 14px; }

.content-box {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid rgba(232,226,218,0.5);
  box-shadow: var(--shadow-sm);
}

.content-box p {
  font-size: 16px;
  line-height: 1.9;
  color: var(--text);
}

.content-box.example {
  background: rgba(212,165,116,0.05);
  border-color: rgba(212,165,116,0.2);
}

.content-box.tip {
  background: rgba(184,169,201,0.06);
  border-color: rgba(184,169,201,0.2);
}

/* ===== Related Laws ===== */
.related-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid rgba(232,226,218,0.5);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 640px) {
  .related-grid { grid-template-columns: 1fr; }
}

.related-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid rgba(232,226,218,0.5);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.related-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.related-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.related-card-header .icon { font-size: 18px; }

.related-card-header h3 {
  font-size: 14px;
  font-weight: 600;
  transition: color 0.2s;
}

.related-card:hover h3 { color: var(--sage); }

.related-card .quote {
  font-size: 12px;
  color: var(--text-light);
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.detail-nav {
  margin-top: 40px;
  display: flex;
  justify-content: space-between;
}

.detail-nav a {
  font-size: 14px;
  color: var(--sage);
  cursor: pointer;
  transition: color 0.2s;
}

.detail-nav a:hover { color: var(--sage-dark); }

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.5s ease forwards; }
.fade-in-d1 { animation: fadeIn 0.5s ease 0.1s forwards; opacity: 0; }
.fade-in-d2 { animation: fadeIn 0.5s ease 0.2s forwards; opacity: 0; }
.fade-in-d3 { animation: fadeIn 0.5s ease 0.3s forwards; opacity: 0; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }
