:root {
  --bg: #e9edf3;
  --surface: #ffffff;
  --surface-alt: #f5f8fc;
  --text: #14181f;
  --muted: #5f6876;
  --line: #d4dce7;
  --accent: #47aab2;
  --accent-strong: #2f8f97;
  --accent-soft: rgba(71, 170, 178, 0.12);
  --radius: 14px;
  --shadow: 0 10px 24px rgba(30, 41, 56, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141c;
    --surface: #171e28;
    --surface-alt: #1d2531;
    --text: #eef3f8;
    --muted: #9aa8bb;
    --line: #2d394a;
    --accent: #66b9bf;
    --accent-strong: #4ba4ac;
    --accent-soft: rgba(102, 185, 191, 0.18);
    --shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.56;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

h1,
h2,
h3,
p,
li,
a,
summary,
td,
th {
  overflow-wrap: anywhere;
  hyphens: auto;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

.wrap {
  width: min(960px, calc(100% - 1.4rem));
  margin: 1.2rem auto 2rem;
}

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

.top {
  padding: 1rem 1rem 0.85rem;
  border-bottom: 1px solid var(--line);
}

.title {
  margin: 0;
  font-size: clamp(1.8rem, 3.1vw, 2.2rem);
  line-height: 1.1;
}

.subtitle {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.nav {
  padding: 0.78rem 1rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.44rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 2.05rem;
  padding: 0.34rem 0.72rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text);
  background: transparent;
  font-size: 0.88rem;
  font-weight: 600;
}

.pill.active {
  border-color: #88cad0;
  background: var(--accent-soft);
  color: var(--text);
}

.language-switcher {
  position: relative;
  margin-left: auto;
}

[dir="rtl"] .language-switcher {
  margin-right: auto;
  margin-left: 0;
}

.language-switcher summary {
  display: inline-flex;
  align-items: center;
  min-height: 2.05rem;
  padding: 0.34rem 0.72rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

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

.language-switcher-list {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 20;
  width: min(18rem, calc(100vw - 1.4rem));
  max-height: min(28rem, 70vh);
  overflow: auto;
  display: grid;
  gap: 0.12rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 0.45rem;
  box-shadow: var(--shadow);
}

[dir="rtl"] .language-switcher-list {
  right: auto;
  left: 0;
}

.language-switcher-list a {
  border-radius: 8px;
  padding: 0.5rem 0.58rem;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 650;
}

.language-switcher-list a:hover {
  background: var(--surface-alt);
  text-decoration: none;
}

.content {
  padding: 1rem;
}

.summary {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-alt);
  padding: 0.85rem;
  margin-bottom: 1rem;
}

.summary h2 {
  margin-top: 0;
}

h2 {
  margin: 1.22rem 0 0.55rem;
  font-size: 1.22rem;
  line-height: 1.22;
}

h3 {
  margin: 0.95rem 0 0.4rem;
  font-size: 1.02rem;
  line-height: 1.3;
}

p,
ul,
ol {
  margin: 0.45rem 0;
}

ul,
ol {
  padding-left: 1.2rem;
}

.note {
  margin: 0.9rem 0;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 9px;
  background: var(--surface-alt);
  padding: 0.72rem 0.8rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.7rem;
  font-size: 0.95rem;
}

.table th,
.table td {
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  padding: 0.62rem;
}

.table th {
  background: var(--accent-soft);
  font-weight: 700;
}

pre {
  margin: 0.85rem 0;
  padding: 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  overflow: auto;
  font-size: 0.84rem;
  line-height: 1.5;
}

.footer {
  margin-top: 1.2rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 700px) {
  .wrap {
    width: calc(100% - 0.9rem);
    margin-top: 0.75rem;
  }

  .top,
  .nav,
  .content {
    padding-left: 0.78rem;
    padding-right: 0.78rem;
  }
}
