:root,
[data-theme='dark'] {
  --bg: #07090c;
  --panel: #12181f;
  --panel-2: #181f28;
  --line: #2a3542;
  --line-strong: #3d4d5e;
  --text: #e8edf2;
  --muted: #8b97a5;
  --dim: #5c6978;
  --phosphor: #7dffb3;
  --phosphor-ink: #06110a;
  --amber: #ffb020;
  --cyan: #4ad4e8;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --input: #0b1015;
  --wash: radial-gradient(1200px 600px at 8% -10%, rgba(125, 255, 179, 0.08), transparent 50%),
    linear-gradient(180deg, #0a0e12 0%, var(--bg) 40%);
  --topbar: rgba(10, 14, 18, 0.92);
  --radius: 12px;
  --radius-sm: 8px;
}

[data-theme='light'] {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-2: #f7f9fb;
  --line: #d7dee6;
  --line-strong: #bec8d4;
  --text: #1b2430;
  --muted: #5b6774;
  --dim: #7a8694;
  --phosphor: #1f8a57;
  --phosphor-ink: #ffffff;
  --amber: #c47b00;
  --cyan: #157f93;
  --shadow: 0 12px 32px rgba(27, 36, 48, 0.08);
  --input: #f4f7fa;
  --wash: radial-gradient(1000px 500px at 8% -10%, rgba(31, 138, 87, 0.08), transparent 50%),
    linear-gradient(180deg, #fbfcfd 0%, var(--bg) 36%);
  --topbar: rgba(255, 255, 255, 0.94);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Noto Sans SC', 'Noto Sans', 'IBM Plex Mono', sans-serif;
  background: var(--wash);
  color: var(--text);
  letter-spacing: 0.01em;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

.mono {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

h1,
h2,
.display {
  font-family: 'Syne', 'Noto Sans SC', sans-serif;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}

.brand-mark .icon,
.brand-mark svg,
.brand-mark img {
  width: 24px;
  height: 24px;
  display: block;
}

.icon {
  width: 1em;
  height: 1em;
  display: block;
  flex: 0 0 auto;
}

.brand-copy {
  min-width: 0;
}

.brand-copy strong {
  display: block;
  font-family: 'Syne', 'Noto Sans SC', sans-serif;
  font-size: 14px;
  letter-spacing: 0.06em;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.brand-copy span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.crumb a {
  color: var(--cyan);
  text-decoration: none;
}

.crumb-sep {
  width: 12px;
  height: 12px;
  color: var(--dim);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.crumb-sep .icon {
  width: 12px;
  height: 12px;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 14px;
  font-size: 14px;
}

.article-body th,
.article-body td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
}

.article-body blockquote {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--phosphor);
  color: var(--muted);
}

.nav {
  min-width: 0;
}

.nav-scroll {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.nav-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.nav-group-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 700;
  margin-right: 2px;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 7px 11px;
  min-height: 34px;
  border-radius: var(--radius);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.nav a:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

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

.chip-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 10px;
  min-height: 34px;
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lang-switch {
  position: relative;
}

.lang-trigger {
  min-width: 108px;
}

.lang-globe {
  display: inline-flex;
  width: 14px;
  height: 14px;
  color: var(--text);
}

.lang-globe .icon {
  width: 14px;
  height: 14px;
}

.region-caret {
  color: var(--muted);
  transition: transform 0.16s ease;
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
}

.region-caret .icon {
  width: 14px;
  height: 14px;
}

.region-caret.open {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 132px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 6px;
  display: grid;
  gap: 4px;
}

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

.lang-option {
  width: 100%;
  display: block;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  font-size: 13px;
}

.lang-option:hover,
.lang-option.active {
  background: var(--panel-2);
  color: var(--phosphor);
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  align-items: start;
  gap: 16px;
  padding: 14px 20px 24px;
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  flex: 1;
}

.side-ad {
  order: 2;
  position: sticky;
  top: 64px;
}

.stage {
  order: 1;
  min-width: 0;
  max-width: none;
  padding: 0;
}

.stage-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.stage-head h1 {
  font-size: 28px;
  letter-spacing: -0.03em;
  margin-top: 8px;
}

.stage-head .meta {
  color: var(--muted);
  font-size: 13px;
}

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

.panel-body {
  padding: 22px 24px 28px;
}

.pill {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  padding: 4px 8px;
  font-size: 11px;
  color: var(--muted);
  border-radius: 999px;
}

.row.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

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

.article-body h2,
.article-body h3 {
  margin: 22px 0 10px;
}

.article-body p,
.article-body ul,
.article-body ol,
.article-body pre {
  margin: 0 0 14px;
}

.article-body a {
  color: var(--cyan);
}

.article-body code,
.article-body pre {
  font-family: ui-monospace, monospace;
  background: var(--input);
  border-radius: var(--radius-sm);
}

.article-body code {
  padding: 1px 5px;
  font-size: 13px;
}

.article-body pre {
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line);
}

.article-body .tip,
.article-body .warn {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
}

.article-body .tip {
  border: 1px solid var(--cyan);
  background: color-mix(in srgb, var(--cyan) 10%, var(--panel-2));
}

.article-body .warn {
  border: 1px solid var(--amber);
  background: color-mix(in srgb, var(--amber) 12%, var(--panel-2));
}

.article-body .tip ul,
.article-body .warn ul {
  margin: 8px 0 0;
}

.related-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 0 14px;
}

.related-card {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  text-decoration: none;
  color: inherit;
}

.related-card:hover {
  border-color: var(--line-strong);
}

.related-dir {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.related-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

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

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

.ad-stack {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
}

.ad-stack.compact {
  margin: 0;
}

.ad-card {
  border: 1px dashed var(--line-strong);
  background: var(--input);
  padding: 12px;
  cursor: pointer;
  border-radius: var(--radius);
}

.ad-kicker {
  display: block;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--amber);
  margin-bottom: 6px;
}

.ad-card h4 {
  font-size: 14px;
  margin-bottom: 4px;
}

.ad-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.ad-card img {
  width: 100%;
  max-height: 120px;
  object-fit: cover;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.adsense-card {
  cursor: default;
}

.adsense-card ins.adsbygoogle {
  min-height: 90px;
  display: block;
}

.site-footer {
  margin-top: auto;
  padding: 8px 0 max(18px, env(safe-area-inset-bottom, 0px));
  color: var(--muted);
  font-size: 13px;
  width: 100%;
  background: transparent;
}

.footer-inner {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  gap: 8px;
}

.footer-brand,
.footer-col {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-width: 0;
}

.footer-brand {
  display: grid;
  gap: 8px;
}

.footer-brand > p {
  color: var(--muted);
  line-height: 1.7;
  font-size: 13px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-mark {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}

.footer-mark .icon,
.footer-mark svg,
.footer-mark img {
  width: 28px;
  height: 28px;
  display: block;
}

.footer-logo strong {
  display: block;
  font-family: 'Syne', 'Noto Sans SC', sans-serif;
  font-size: 15px;
  letter-spacing: 0.06em;
  color: var(--text);
  line-height: 1.2;
  font-weight: 800;
}

.footer-logo span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.footer-col {
  display: grid;
  gap: 0;
}

.footer-col strong {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
  padding: 0 0 4px;
}

.footer-ico {
  width: 18px;
  height: 18px;
  color: var(--phosphor);
  display: grid;
  place-items: center;
}

.footer-ico .icon,
.footer-ico svg {
  width: 16px;
  height: 16px;
}

.footer-col a {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font-size: 14px;
  min-height: 44px;
  padding: 10px 0;
  text-decoration: none;
  overflow-wrap: anywhere;
}

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

.footer-col a:hover {
  color: var(--phosphor);
}

.footer-col a .icon {
  color: var(--dim);
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.footer-legal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.footer-legal-row a {
  min-width: 0;
  min-height: 44px;
}

.footer-legal-row a + a {
  border-top: 0;
}

.footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 4px 0;
}

.footer-meta p {
  color: var(--muted);
  letter-spacing: 0;
  font-size: 12px;
}

.footer-meta .note {
  margin-top: 2px;
  letter-spacing: 0;
  color: var(--dim);
  font-size: 12px;
}

.footer-bottom {
  width: 100%;
}

.back-to-top {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 0;
  background: color-mix(in srgb, var(--phosphor) 72%, #6ec8c0);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  box-shadow: 0 6px 14px rgba(31, 138, 87, 0.18);
  text-decoration: none;
  display: grid;
  place-items: center;
}

.back-to-top .icon {
  width: 18px;
  height: 18px;
}

.back-to-top:hover {
  filter: brightness(1.06);
}

[data-theme='dark'] .back-to-top {
  background: color-mix(in srgb, var(--phosphor) 55%, #2d8a58);
  color: var(--phosphor-ink);
}

@media (min-width: 981px) {
  .footer-legal-row {
    display: contents;
  }

  .footer-inner {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 16px;
    align-items: stretch;
  }

  .footer-brand {
    grid-column: 1;
    grid-row: 1;
  }

  .footer-col:not(.footer-legal) {
    grid-column: 2;
    grid-row: 1;
  }

  .footer-legal {
    grid-column: 3;
    grid-row: 1;
  }

  .footer-meta {
    grid-column: 1 / 4;
    grid-row: 2;
  }

  .footer-bottom {
    grid-column: 1 / 4;
    grid-row: 3;
  }
}

@media (min-width: 1101px) {
  .footer-inner {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 1fr) 220px;
  }
}

.la-slot {
  min-height: 1px;
}

.article-body,
.ad-card,
.stage-head h1 {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 1100px) {
  .workbench {
    grid-template-columns: 1fr;
  }
  .side-ad,
  .stage {
    order: 0;
  }
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: auto auto;
    grid-template-areas:
      'brand actions'
      'nav nav';
    padding: 8px 10px;
  }
  .brand {
    grid-area: brand;
  }
  .nav {
    grid-area: nav;
    margin: 0 -10px;
  }
  .nav-scroll {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 10px 6px;
  }
  .nav-scroll::-webkit-scrollbar {
    display: none;
  }
  .top-actions {
    grid-area: actions;
    justify-self: end;
  }
  .workbench {
    padding-left: 10px;
    padding-right: 10px;
  }
  .footer-inner {
    padding-left: 10px;
    padding-right: 10px;
  }
  .stage-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .stage-head h1 {
    font-size: 22px;
  }
}

@media (max-width: 640px) {
  .theme-label {
    display: none;
  }
}

.btn,
.btn.ghost,
.copy {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn {
  background: var(--phosphor);
  color: var(--phosphor-ink);
  border-color: transparent;
}

.btn.ghost {
  background: transparent;
  color: var(--text);
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 5px 10px 5px 5px;
  cursor: pointer;
}

.theme-knob {
  width: 28px;
  height: 18px;
  border-radius: 999px;
  background: var(--line);
  position: relative;
}

.theme-knob::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--amber);
  transition: 0.16s ease;
}

.theme-knob.dark::after,
[data-theme='dark'] .theme-knob::after {
  left: 12px;
  background: var(--phosphor);
}

.theme-label {
  font-size: 12px;
  color: var(--muted);
}

.consent-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: var(--panel);
  border-top: 1px solid var(--line-strong);
  box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.3);
}

.consent-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.consent-text {
  max-width: 640px;
}

.consent-text strong {
  display: block;
  margin-bottom: 4px;
}

.consent-text p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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