:root {
  color-scheme: dark;
  --bg: #0e1117;
  --paper: #171c24;
  --paper-2: #202734;
  --ink: #edf2f7;
  --muted: #9aa7b7;
  --line: #2f3948;
  --accent: #37d39b;
  --accent-2: #f4b860;
  --accent-3: #8db7ff;
  --soft: #18352f;
  --warn: #2a2418;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #121722 0, var(--bg) 360px),
    var(--bg);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.65;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px max(18px, calc((100vw - 1120px) / 2));
  background: rgba(14, 17, 23, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

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

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #06140f;
  font-weight: 800;
  letter-spacing: 0;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

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

.icon-button,
.tool-button,
.dialog-close {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--ink);
  cursor: pointer;
}

.icon-button {
  min-height: 40px;
  padding: 0 12px;
  white-space: nowrap;
}

.icon-button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #06140f;
}

main {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 24px 18px 96px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: stretch;
  min-height: 320px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(55, 211, 155, 0.15), rgba(141, 183, 255, 0.12)),
    var(--paper);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent-2);
  font-weight: 800;
}

.hero h2 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(30px, 6vw, 58px);
  line-height: 1.08;
}

.hero p {
  max-width: 680px;
  color: var(--muted);
  font-size: 17px;
}

.hero-panel {
  align-self: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(32, 39, 52, 0.78);
}

.countdown {
  display: grid;
  gap: 2px;
  margin-bottom: 14px;
}

.countdown span {
  color: var(--accent);
  font-size: 54px;
  font-weight: 900;
  line-height: 1;
}

.countdown small {
  color: var(--muted);
}

.section {
  margin-top: 36px;
  scroll-margin-top: 84px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--accent);
  font-weight: 900;
}

.section-title h2 {
  margin: 0;
  font-size: 26px;
}

.tip-box {
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(244, 184, 96, 0.34);
  border-radius: 8px;
  background: var(--warn);
}

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

.card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.card {
  overflow: hidden;
}

.card summary {
  list-style: none;
  cursor: pointer;
}

.card summary::-webkit-details-marker {
  display: none;
}

.card-head {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.card-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.card h3 {
  margin: 0;
  font-size: 19px;
  line-height: 1.32;
}

.card-desc {
  margin: 0;
  color: var(--muted);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.card-body {
  padding: 0 16px 16px;
}

.card-body h4 {
  margin: 16px 0 6px;
  font-size: 15px;
}

.card-body ul,
.card-body ol {
  margin: 8px 0 0;
  padding-left: 22px;
}

.card-body li + li {
  margin-top: 5px;
}

.quote {
  margin: 10px 0;
  padding: 10px 12px;
  border-left: 4px solid var(--accent);
  background: var(--soft);
  font-weight: 700;
}

.mine-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.panel {
  padding: 16px;
}

.panel h3 {
  margin: 0 0 12px;
}

.check-item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.check-item input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--accent);
}

.sources {
  color: var(--muted);
}

.sources a {
  color: var(--accent-3);
}

.exam-mode .card-body .deep,
.exam-mode .card-body .explain {
  display: none;
}

.exam-mode .card {
  box-shadow: none;
}

.hidden {
  display: none !important;
}

.floating-tools {
  position: fixed;
  right: max(18px, calc((100vw - 1120px) / 2));
  bottom: 18px;
  z-index: 40;
  display: flex;
  gap: 8px;
}

.tool-button {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  padding: 0;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.38);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.tool-button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #06140f;
}

.popup-dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: min(680px, calc(100vh - 48px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

.menu-dialog {
  width: min(640px, calc(100vw - 32px));
  border-color: var(--line);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

.popup-dialog::backdrop {
  background: rgba(3, 6, 12, 0.68);
  backdrop-filter: blur(4px);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.menu-dialog .dialog-head {
  border-bottom-color: var(--line);
}

.dialog-head h2 {
  margin: 0;
  font-size: 20px;
}

.dialog-close {
  width: 36px;
  height: 36px;
  font-size: 24px;
  line-height: 1;
}

.menu-dialog .dialog-close {
  border-color: var(--line);
  background: var(--paper);
  color: var(--ink);
}

.search-results {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.search-results a {
  display: grid;
  gap: 4px;
  min-height: 48px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-2);
  text-decoration: none;
}

.menu-tree {
  max-height: min(640px, calc(100vh - 136px));
  padding: 8px 24px 24px;
  overflow: auto;
}

.menu-section {
  border-bottom: 1px solid var(--line);
}

.menu-section summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  list-style: none;
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
}

.menu-section summary::-webkit-details-marker {
  display: none;
}

.menu-section summary span,
.menu-section summary a {
  min-width: 0;
}

.menu-section summary a {
  color: inherit;
  text-decoration: none;
}

.menu-section summary::after {
  content: "+";
  color: var(--muted);
  font-size: 18px;
}

.menu-section[open] summary::after {
  content: "-";
}

.menu-children {
  display: grid;
  padding: 0 0 10px 28px;
}

.menu-child {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  min-height: 44px;
  align-items: center;
  border-top: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.menu-child span {
  color: var(--accent);
  text-align: right;
  font-weight: 800;
}

.menu-child strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.menu-child:hover,
.menu-section summary:hover {
  color: var(--accent);
}

.search-field {
  display: grid;
  gap: 8px;
  padding: 16px 16px 0;
}

.search-field span,
.search-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.search-field input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f141c;
  color: var(--ink);
  outline: none;
}

.search-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(55, 211, 155, 0.18);
}

.search-meta {
  padding: 10px 16px 0;
}

.search-results {
  max-height: 360px;
  overflow: auto;
}

.search-results a strong {
  line-height: 1.35;
}

.search-results a span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .topbar {
    padding: 10px 12px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand h1 {
    font-size: 15px;
  }

  .brand p {
    display: none;
  }

  .icon-button {
    min-height: 36px;
    padding: 0 10px;
    font-size: 13px;
  }

  main {
    padding: 14px 12px 84px;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 18px;
  }

  .hero h2 {
    font-size: 32px;
  }

  .hero p {
    font-size: 15px;
  }

  .hero-panel {
    align-self: stretch;
  }

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

  .section-title h2 {
    font-size: 22px;
  }

  .floating-tools {
    right: 12px;
    bottom: 12px;
  }

  .tool-button {
    width: 44px;
    height: 44px;
    font-size: 23px;
  }

  .menu-tree {
    padding: 6px 18px 18px;
  }

  .menu-section summary {
    min-height: 54px;
    font-size: 17px;
  }

  .menu-child {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .menu-child strong {
    font-size: 15px;
  }
}
