:root {
  color-scheme: dark;
  --bg: #07101d;
  --bg-deep: #040a14;
  --surface: #0d1829;
  --surface-raised: #111f33;
  --surface-soft: #0a1524;
  --line: #22334a;
  --line-strong: #2d425c;
  --text: #f3f7fb;
  --text-soft: #b5c1d0;
  --text-muted: #8190a4;
  --teal: #11c4b0;
  --teal-soft: #0e8f88;
  --teal-wash: rgba(17, 196, 176, 0.12);
  --blue: #4c8dff;
  --amber: #f7b955;
  --coral: #f07b68;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.22);
  --radius: 8px;
  --radius-small: 6px;
  --content-width: 1480px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f7fb;
  --bg-deep: #e8eff7;
  --surface: #ffffff;
  --surface-raised: #f8fbff;
  --surface-soft: #eef4fa;
  --line: #d7e1ec;
  --line-strong: #c3d0df;
  --text: #152237;
  --text-soft: #526176;
  --text-muted: #708096;
  --teal: #079f92;
  --teal-soft: #08756f;
  --teal-wash: rgba(7, 159, 146, 0.1);
  --blue: #296edc;
  --amber: #bc7611;
  --coral: #c54d3d;
  --shadow: 0 18px 46px rgba(43, 65, 91, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(rgba(87, 133, 171, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(87, 133, 171, 0.055) 1px, transparent 1px),
    var(--bg);
  background-size: 58px 58px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

.site-shell {
  width: min(100%, var(--content-width));
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 30px 26px;
}

.topbar {
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(130, 158, 185, 0.14);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(17, 196, 176, 0.58);
  border-radius: 10px;
  color: var(--teal);
  background: var(--teal-wash);
  box-shadow: 0 8px 22px rgba(17, 196, 176, 0.12);
  font-size: 22px;
  font-weight: 800;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-size: 17px;
  line-height: 1.1;
}

.brand-copy small {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.02em;
}

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

.status-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px var(--teal-wash);
}

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.icon-button,
.language-button,
.reset-button {
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.icon-button:hover,
.language-button:hover,
.reset-button:hover {
  border-color: var(--teal-soft);
  background: var(--surface-raised);
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--text-soft);
}

.icon-button .icon-moon {
  display: none;
}

:root[data-theme="light"] .icon-button .icon-sun {
  display: none;
}

:root[data-theme="light"] .icon-button .icon-moon {
  display: block;
}

.language-control {
  position: relative;
}

.language-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: var(--text-soft);
  font-size: 12px;
}

.language-button[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.language-flag {
  display: inline-grid;
  min-width: 22px;
  height: 20px;
  place-items: center;
  border-radius: 4px;
  color: var(--teal);
  background: var(--teal-wash);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.chevron {
  width: 14px;
  height: 14px;
  transition: transform 160ms ease;
}

.language-menu {
  position: absolute;
  z-index: 5;
  top: calc(100% + 8px);
  right: 0;
  width: 174px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-raised);
  box-shadow: var(--shadow);
}

.language-menu[hidden] {
  display: none;
}

.language-menu button {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 0;
  color: var(--text-soft);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.language-menu button:hover,
.language-menu button[aria-checked="true"] {
  color: var(--text);
  background: var(--teal-wash);
}

.language-check {
  margin-left: auto;
  color: var(--teal);
  font-size: 18px;
}

.app-layout {
  display: grid;
  grid-template-columns: minmax(220px, 270px) minmax(0, 1fr);
  gap: 34px;
  padding: 48px 0 54px;
}

.sidebar {
  align-self: start;
  position: sticky;
  top: 22px;
}

.sidebar-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 22px;
}

.section-label {
  display: block;
  margin-bottom: 9px;
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.sidebar h1,
.content-heading h2 {
  margin: 0;
  font-size: clamp(22px, 2.2vw, 30px);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.count-badge {
  display: inline-grid;
  min-width: 30px;
  height: 26px;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-muted);
  background: var(--surface);
  font-size: 11px;
}

.search-box {
  display: flex;
  height: 42px;
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text-muted);
  background: var(--surface);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search-box:focus-within {
  border-color: var(--teal-soft);
  box-shadow: 0 0 0 3px var(--teal-wash);
}

.search-box input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 12px;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-key {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 11px;
}

.category-list {
  display: grid;
  gap: 4px;
  margin-top: 24px;
}

.category-button {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.category-button:hover {
  color: var(--text-soft);
  background: var(--surface);
}

.category-button.is-active {
  border-color: rgba(17, 196, 176, 0.3);
  color: var(--text);
  background: var(--teal-wash);
}

.category-marker {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}

.category-button.is-active .category-marker {
  background: var(--teal);
  box-shadow: 0 0 0 4px var(--teal-wash);
}

.category-total {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 11px;
}

.sidebar-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 30px;
  padding: 12px;
  border-left: 2px solid var(--teal-soft);
  color: var(--text-muted);
  background: var(--teal-wash);
  font-size: 11px;
  line-height: 1.65;
}

.sidebar-note .icon {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  color: var(--teal);
}

.content-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.content-heading h2 {
  font-size: clamp(26px, 3.2vw, 42px);
}

.content-heading p {
  max-width: 640px;
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.65;
}

.reset-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}

.reset-button .icon {
  width: 15px;
  height: 15px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(230px, 0.82fr) minmax(390px, 1.45fr);
  align-items: start;
  gap: 18px;
}

.article-list-panel,
.article-detail {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13, 24, 41, 0.84);
  box-shadow: var(--shadow);
}

:root[data-theme="light"] .article-list-panel,
:root[data-theme="light"] .article-detail {
  background: rgba(255, 255, 255, 0.88);
}

.list-toolbar {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.list-label {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.result-count {
  color: var(--text-muted);
  font-size: 11px;
}

.article-list {
  display: grid;
  gap: 1px;
  padding: 7px;
}

.article-row {
  display: block;
  width: 100%;
  padding: 14px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  color: inherit;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.article-row:hover {
  border-color: var(--line);
  background: var(--surface-soft);
  transform: translateY(-1px);
}

.article-row.is-active {
  border-color: rgba(17, 196, 176, 0.4);
  background: var(--teal-wash);
}

.article-row-meta,
.article-meta,
.article-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.article-row-meta {
  margin-bottom: 8px;
  color: var(--teal);
  font-size: 10px;
  font-weight: 700;
}

.article-row h3 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.article-row p {
  display: -webkit-box;
  overflow: hidden;
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.mini-tag,
.article-tag {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 10px;
}

.article-row .mini-tag {
  border-color: rgba(17, 196, 176, 0.25);
  color: var(--teal);
  background: rgba(17, 196, 176, 0.06);
}

.empty-state {
  padding: 48px 24px 56px;
  color: var(--text-muted);
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 42px;
  height: 42px;
  margin: 0 auto 14px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--teal);
  background: var(--teal-wash);
  font-weight: 800;
}

.empty-state h3 {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
}

.empty-state p {
  margin: 8px 0 0;
  font-size: 11px;
}

.article-detail {
  overflow: hidden;
}

.detail-header {
  padding: 28px 30px 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg, var(--teal-wash), transparent 58%);
}

.detail-category {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.detail-category::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  content: "";
}

.detail-header h2 {
  max-width: 760px;
  margin: 14px 0 10px;
  color: var(--text);
  font-size: clamp(24px, 3.1vw, 38px);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.detail-summary {
  max-width: 720px;
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.7;
}

.article-meta {
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 11px;
}

.meta-separator {
  color: var(--line-strong);
}

.article-body {
  padding: 26px 30px 34px;
}

.content-block + .content-block {
  margin-top: 23px;
}

.content-block p {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.85;
}

.content-block h3 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}

.step-list,
.check-list {
  display: grid;
  gap: 11px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: steps;
}

.step-list li,
.check-list li {
  position: relative;
  padding: 13px 14px 13px 45px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  color: var(--text-soft);
  background: var(--surface-soft);
  font-size: 13px;
  line-height: 1.7;
}

.step-list li::before {
  position: absolute;
  top: 13px;
  left: 14px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  color: var(--teal);
  background: var(--teal-wash);
  content: counter(steps);
  counter-increment: steps;
  font-size: 11px;
  font-weight: 800;
}

.check-list li {
  padding-left: 40px;
}

.check-list li::before {
  position: absolute;
  top: 14px;
  left: 14px;
  color: var(--teal);
  content: "✓";
  font-weight: 800;
}

.step-title {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
  font-weight: 700;
}

.code-block {
  overflow: auto;
  margin: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--teal);
  border-radius: var(--radius-small);
  color: #d7e9ef;
  background: #081321;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.75;
  white-space: pre;
}

:root[data-theme="light"] .code-block {
  color: #284154;
  background: #edf4f8;
}

.callout {
  padding: 15px 17px;
  border: 1px solid rgba(17, 196, 176, 0.28);
  border-left: 3px solid var(--teal);
  border-radius: var(--radius-small);
  background: var(--teal-wash);
}

.callout.warning {
  border-color: rgba(247, 185, 85, 0.32);
  border-left-color: var(--amber);
  background: rgba(247, 185, 85, 0.08);
}

.callout.danger {
  border-color: rgba(240, 123, 104, 0.32);
  border-left-color: var(--coral);
  background: rgba(240, 123, 104, 0.08);
}

.callout strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
  font-size: 13px;
}

.callout p {
  font-size: 13px;
}

.article-figure {
  margin: 0;
}

.article-figure img {
  display: block;
  width: 100%;
  max-height: 560px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  object-fit: contain;
  background: var(--surface-soft);
}

.article-figure figcaption {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.article-tags {
  margin-top: 18px;
}

.article-tag {
  color: var(--teal);
  border-color: rgba(17, 196, 176, 0.24);
  background: var(--teal-wash);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(130, 158, 185, 0.14);
  color: var(--text-muted);
  font-size: 10px;
}

@media (max-width: 1080px) {
  .site-shell {
    padding-right: 22px;
    padding-left: 22px;
  }

  .app-layout {
    gap: 24px;
  }

  .content-grid {
    grid-template-columns: minmax(210px, 0.7fr) minmax(360px, 1.3fr);
  }
}

@media (max-width: 820px) {
  .topbar {
    min-height: 78px;
  }

  .status-label {
    display: none;
  }

  .app-layout {
    display: block;
    padding-top: 32px;
  }

  .sidebar {
    position: static;
    margin-bottom: 30px;
  }

  .category-list {
    display: flex;
    overflow-x: auto;
    gap: 6px;
    margin-top: 18px;
    padding-bottom: 3px;
    scrollbar-width: thin;
  }

  .category-button {
    flex: 0 0 auto;
  }

  .sidebar-note {
    display: none;
  }

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

  .article-list-panel {
    box-shadow: none;
  }

  .article-detail {
    box-shadow: none;
  }
}

@media (max-width: 560px) {
  .site-shell {
    padding: 0 14px 18px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 19px;
  }

  .brand-copy strong {
    font-size: 15px;
  }

  .brand-copy small {
    font-size: 10px;
  }

  .top-actions {
    gap: 6px;
  }

  .language-button {
    padding: 0 8px;
  }

  .content-heading {
    align-items: flex-start;
    margin-bottom: 22px;
  }

  .content-heading p {
    font-size: 12px;
  }

  .reset-button span {
    display: none;
  }

  .reset-button {
    width: 36px;
    justify-content: center;
    padding: 0;
  }

  .detail-header,
  .article-body {
    padding-right: 18px;
    padding-left: 18px;
  }

  .detail-header h2 {
    font-size: 25px;
  }

  .content-block p,
  .step-list li,
  .check-list li {
    font-size: 13px;
  }

  .site-footer {
    display: grid;
    gap: 5px;
    line-height: 1.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
