:root {
  --bg: #0f1419;
  --bg-elev: #171d25;
  --bg-soft: #1c2430;
  --line: #2a3441;
  --text: #e7edf5;
  --muted: #93a0b3;
  --accent: #d4a017;
  --accent-2: #6cb6ff;
  --match: #ffe08a;
  --match-bg: rgba(212, 160, 23, 0.18);
  --zh: #f0f3f7;
  --en: #b7c3d4;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  --sidebar-w: 260px;
  --topbar-h: 72px;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 10% -10%, #1a2433 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(280px, 2fr) auto;
  gap: 16px;
  align-items: center;
  padding: 12px 20px;
  background: rgba(15, 20, 25, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #c9971a, #8a6410);
  color: #1a1405;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-text strong {
  font-size: 15px;
  letter-spacing: 0.02em;
}

.brand-text span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-wrap input {
  width: 100%;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  padding: 0 44px 0 18px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.18);
}

.search-wrap .ghost {
  position: absolute;
  right: 8px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.search-wrap .ghost:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--topbar-h) - 48px);
}

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow: auto;
  border-right: 1px solid var(--line);
  background: rgba(15, 20, 25, 0.55);
  padding: 12px 10px 24px;
}

.sidebar-head {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 10px;
}

.toc {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toc button {
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  display: grid;
  gap: 2px;
}

.toc button:hover {
  background: var(--bg-soft);
}

.toc button.active {
  background: linear-gradient(90deg, rgba(212, 160, 23, 0.18), transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.toc .num {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.toc .zh {
  font-size: 14px;
}

.toc .en {
  font-size: 11px;
  color: var(--muted);
}

.main {
  padding: 20px 24px 48px;
  max-width: 1100px;
}

.panel-head h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 700;
}

.muted {
  color: var(--muted);
  margin: 0;
  font-size: 13px;
}

.badge {
  display: inline-block;
  min-width: 1.6em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--match-bg);
  color: var(--match);
  font-size: 14px;
  vertical-align: middle;
}

.units {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}

.unit {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.unit-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.unit-head button {
  border: 0;
  background: transparent;
  color: var(--accent-2);
  cursor: pointer;
  font-size: 12px;
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.col {
  padding: 14px 16px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.col + .col {
  border-left: 1px solid var(--line);
}

.col.en {
  color: var(--en);
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 15px;
}

.col.zh {
  color: var(--zh);
  font-size: 15px;
}

.lang-tag {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-family: system-ui, sans-serif;
}

mark {
  background: var(--match-bg);
  color: var(--match);
  padding: 0 2px;
  border-radius: 3px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 80px 20px;
}

.footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  padding: 14px 20px 24px;
  text-align: center;
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr;
    height: auto;
    gap: 10px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    top: 0;
    height: auto;
    max-height: 180px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .pair {
    grid-template-columns: 1fr;
  }

  .col + .col {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .main {
    padding: 16px;
  }
}
