﻿:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --secondary: #06b6d4;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --bg: #f9fafb;
  --bg-card: #ffffff;
  --bg-soft: #eef2ff;
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #6b7280;
  --line: #e5e7eb;
  --radius: 14px;
  --shadow-sm: 0 2px 8px rgba(30, 41, 59, 0.08);
  --shadow-md: 0 10px 24px rgba(30, 41, 59, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

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

.shell {
  max-width: 1160px;
  margin: 0 auto;
  padding: 18px 16px 40px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.logo-dot {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
}

.brand-sub {
  display: block;
  color: var(--text-3);
  font-weight: 500;
  font-size: 12px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  border-color: var(--line);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.hero {
  margin-top: 18px;
  background: linear-gradient(135deg, #eef2ff 0%, #ffffff 52%, #ecfeff 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.hero h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.2;
}

.hero p {
  margin: 12px 0 0;
  color: var(--text-2);
  max-width: 720px;
}

.stats {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  background: var(--bg-soft);
  color: var(--primary);
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
}

.card {
  margin-top: 16px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-head h2 {
  margin: 0;
  font-size: 24px;
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--text-3);
  font-size: 14px;
}

.search {
  width: min(360px, 100%);
}

.search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 14px;
  background: #fff;
}

.filter-row {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-2);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 13px;
  cursor: pointer;
}

.filter-chip.active {
  border-color: #c7d2fe;
  color: var(--primary);
  background: var(--bg-soft);
}

.story-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.story-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: linear-gradient(160deg, #fff, #fbfdff);
  transition: 0.2s ease;
}

.story-card:hover {
  border-color: #c7d2fe;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.story-card h3 {
  margin: 0;
  font-size: 20px;
}

.story-meta {
  margin-top: 6px;
  color: var(--text-3);
  font-size: 13px;
}

.story-summary {
  margin-top: 8px;
  color: var(--text-2);
  font-size: 14px;
}

.story-tags {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.story-tags span {
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  font-size: 12px;
  padding: 4px 8px;
}

.story-foot {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.empty {
  margin-top: 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  color: var(--text-3);
  display: none;
}

.viewer-wrap {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 14px;
}

.article-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.article-head {
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f8faff, #fff);
}

.article-title {
  margin: 0;
  font-size: clamp(24px, 3.5vw, 34px);
  line-height: 1.25;
}

.article-meta {
  margin-top: 8px;
  color: var(--text-3);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.article-tools {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.article-body {
  padding: 18px;
  font-size: 18px;
  line-height: 1.85;
}

.article-body p {
  margin: 0 0 14px;
  text-align: justify;
  text-justify: inter-ideograph;
}

.vocab-unit {
  padding: 0 2px;
  border-radius: 6px;
  background: #eef2ff;
  color: #3730a3;
  cursor: pointer;
  border-bottom: 1px dashed #818cf8;
}

.inline-meaning {
  margin-left: 4px;
  font-size: 12px;
  color: #6d28d9;
}

.hide-meaning .inline-meaning {
  display: none;
}

.sidebar {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  height: fit-content;
  position: sticky;
  top: 80px;
}

.sidebar h4 {
  margin: 0 0 8px;
}

.highlight-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-2);
}

.highlight-list li {
  margin: 7px 0;
}

.highlight-list .side-word {
  display: block;
  font-weight: 600;
  color: var(--primary);
}

.highlight-list .side-ph {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-3);
}

.word-count {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-3);
}

.vocab-popover {
  position: fixed;
  z-index: 120;
  min-width: 240px;
  max-width: 340px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 12px;
  display: none;
}

.vocab-popover.show {
  display: block;
}

.vocab-popover h5 {
  margin: 0;
  font-size: 18px;
}

.vocab-popover .ph {
  color: var(--text-3);
  font-size: 13px;
  margin-top: 4px;
}

.vocab-popover .meaning {
  margin-top: 8px;
  color: var(--text-2);
}

.vocab-popover .pop-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.list-tools {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.word-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.word-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.word-main {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.word-ph {
  color: var(--text-3);
  font-size: 13px;
}

.word-meaning {
  color: var(--text-2);
  margin-top: 6px;
  font-size: 14px;
}

.word-example {
  color: var(--text-3);
  margin-top: 4px;
  font-size: 12px;
}

.word-item.hide-meaning .word-meaning,
.word-item.hide-meaning .word-example {
  display: none;
}

.word-actions {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.flash-shell {
  margin-top: 16px;
  border-radius: var(--radius);
  border: 1px solid #1f2937;
  background: radial-gradient(circle at 20% 0%, #0f172a 0, #111827 60%);
  color: #e5e7eb;
  min-height: 70vh;
  box-shadow: var(--shadow-md);
  padding: 16px;
}

.flash-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.flash-progress {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.25);
  color: #c7d2fe;
  font-size: 13px;
}

.flash-card-wrap {
  margin: 16px auto;
  width: min(640px, 100%);
  height: 380px;
  perspective: 1000px;
}

.flash-card {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.45s ease;
  cursor: pointer;
}

.flash-card.flipped {
  transform: rotateY(180deg);
}

.flash-face {
  position: absolute;
  inset: 0;
  border: 1px solid #374151;
  border-radius: 16px;
  background: linear-gradient(170deg, #111827, #1f2937);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  backface-visibility: hidden;
}

.flash-front .word-main {
  color: #a5b4fc;
  font-size: clamp(36px, 6vw, 58px);
}

.flash-front .word-ph {
  color: #94a3b8;
  font-size: 18px;
}

.flash-back {
  transform: rotateY(180deg);
}

.flash-back .word-meaning {
  color: #e5e7eb;
  font-size: 24px;
}

.flash-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.icp {
  margin-top: 26px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.footer-links a {
  color: var(--text-2);
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}

.footer-links a:hover,
.footer-links a.active {
  color: var(--primary);
  border-bottom-color: #c7d2fe;
}

.record-line {
  display: inline-block;
}

.icp a {
  text-decoration: none;
}

.record-line a {
  color: inherit;
}

.doc-wrap {
  max-width: 920px;
  margin: 16px auto 0;
}

.doc-head {
  margin-bottom: 8px;
}

.doc-head h1 {
  margin: 0;
  font-size: clamp(24px, 3.5vw, 34px);
}

.doc-head p {
  margin: 8px 0 0;
  color: var(--text-3);
  font-size: 14px;
}

.doc-section + .doc-section {
  margin-top: 16px;
}

.doc-section h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.doc-section p {
  margin: 0 0 10px;
  color: var(--text-2);
  line-height: 1.85;
}

.doc-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-2);
  line-height: 1.9;
}

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

  .viewer-wrap {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 760px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .article-body {
    font-size: 16px;
    line-height: 1.78;
  }

  .word-item {
    grid-template-columns: 1fr;
  }

  .word-actions {
    align-items: center;
  }

  .flash-card-wrap {
    height: 320px;
  }
}

