.tab-set {
  min-width: 0;
}

.tab-list {
  display: flex;
  max-width: 100%;
  align-items: center;
  gap: 8px;
  margin: 0 0 28px;
  padding: 7px;
  overflow-x: auto;
  border-radius: var(--radius-pill);
  background: var(--color-panel);
  list-style: none;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.tab-list [role="tab"] {
  display: inline-flex;
  min-width: max-content;
  min-height: 44px;
  flex: 1 0 auto;
  align-items: center;
  justify-content: center;
  padding: 9px 20px;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  font-weight: 700;
}

.tab-list [role="tab"]:hover {
  color: var(--color-text);
}

.tab-list [role="tab"][aria-selected="true"],
.tab-list [role="tab"].is-active {
  background: var(--color-bg);
  color: var(--color-text);
  box-shadow: var(--shadow-card);
}

[role="tabpanel"][hidden] {
  display: none;
}

.tab-panel {
  min-width: 0;
  border-radius: var(--radius-xl);
  background: var(--color-panel);
  color: var(--color-text);
  padding: clamp(24px, 4vw, 44px);
}

.toc {
  position: sticky;
  z-index: 20;
  top: 12px;
  display: flex;
  max-width: 100%;
  gap: 8px;
  margin-bottom: 42px;
  padding: 8px;
  overflow-x: auto;
  border-radius: var(--radius-pill);
  background: var(--color-panel);
  color: var(--color-text);
  box-shadow: var(--shadow-card);
  -webkit-overflow-scrolling: touch;
}

.toc a {
  display: inline-flex;
  min-width: max-content;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  color: var(--color-muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.toc a:hover,
.toc a[aria-current="true"] {
  background: var(--color-bg);
  color: var(--color-text);
}

.faq-list {
  display: grid;
  gap: 14px;
}

.faq-item {
  overflow: clip;
  border-radius: var(--radius-md);
  background: var(--color-panel);
  color: var(--color-text);
}

.faq-item summary {
  position: relative;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 22px;
  cursor: pointer;
  color: var(--color-text);
  font-weight: 800;
  list-style: none;
}

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

.faq-item summary::after {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  border-right: 2px solid var(--color-muted);
  border-bottom: 2px solid var(--color-muted);
  content: "";
  transform: rotate(45deg) translateY(-3px);
  transition: transform 180ms var(--ease-standard);
}

.faq-item[open] summary::after {
  transform: rotate(225deg) translate(-2px, -2px);
}

.faq-item__answer {
  padding: 0 22px 22px;
  color: var(--color-muted);
}

.faq-item__answer > :last-child {
  margin-bottom: 0;
}

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

.term-card {
  min-width: 0;
  padding: 26px;
  border-radius: var(--radius-lg);
  background: var(--color-panel);
  color: var(--color-text);
}

.term-card__name {
  margin-bottom: 10px;
  font-size: 20px;
  font-weight: 850;
}

.term-card__alias {
  margin-left: 8px;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.term-card p {
  margin-bottom: 0;
  color: var(--color-muted);
}

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

.download-card {
  position: relative;
  min-width: 0;
  padding: 28px;
  border-radius: var(--radius-xl);
  background: var(--color-panel);
  color: var(--color-text);
  box-shadow: var(--shadow-card);
}

.download-card--featured {
  background: var(--color-bg);
  color: var(--color-text);
  box-shadow: var(--shadow-accent);
}

.download-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.download-card__identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
}

.download-card__identity img {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
}

.download-card__title {
  margin: 0;
  font-size: 22px;
  overflow-wrap: anywhere;
}

.download-card__description {
  color: var(--color-muted);
}

.download-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.download-card [data-ver] {
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.download-card [data-ver]:empty {
  display: none;
}

.badge,
.tag {
  display: inline-flex;
  max-width: 100%;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 5px 11px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.badge--primary {
  background: var(--color-accent);
  color: var(--color-white);
}

.badge--recommended {
  background: var(--color-text);
  color: var(--color-white);
}

.badge--success {
  background: var(--color-success);
  color: var(--color-text);
}

.badge--warning {
  background: var(--color-warning);
  color: var(--color-text);
}

.badge--retired {
  background: var(--color-line);
  color: var(--color-text);
}

.tag {
  background: var(--color-panel);
  color: var(--color-text);
}

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

.article-card {
  display: flex;
  min-width: 0;
  min-height: 100%;
  flex-direction: column;
  padding: 26px;
  border-radius: var(--radius-xl);
  background: var(--color-panel);
  color: var(--color-text);
  text-decoration: none;
  transition: transform 180ms var(--ease-standard), background-color 180ms var(--ease-standard);
}

.article-card:hover {
  background: var(--color-panel-hover);
  color: var(--color-text);
  transform: translateY(-3px);
}

.article-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 18px;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.article-card h3 {
  margin-bottom: 14px;
  font-size: 22px;
}

.article-card p {
  margin-bottom: 22px;
  color: var(--color-muted);
}

.article-card__more {
  margin-top: auto;
  color: var(--color-accent-dark);
  font-weight: 750;
}

.callout {
  position: relative;
  margin: 28px 0;
  padding: 22px 24px 22px 30px;
  border-radius: var(--radius-md);
  background: var(--color-panel);
  color: var(--color-text);
}

.callout::before {
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 10px;
  width: 5px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  content: "";
}

.callout--warning::before {
  background: var(--color-warning);
}

.callout--success::before {
  background: var(--color-success);
}

.callout__title {
  margin-bottom: 7px;
  color: var(--color-text);
  font-weight: 850;
}

.callout > :last-child {
  margin-bottom: 0;
}

.dl-fab {
  position: fixed;
  z-index: 80;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: inline-flex;
  max-width: min(320px, calc(100vw - 36px));
  min-height: 64px;
  align-items: center;
  gap: 13px;
  padding: 10px 18px 10px 11px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-white);
  box-shadow: var(--shadow-accent);
  text-decoration: none;
}

.dl-fab:hover {
  background: var(--color-accent-dark);
  color: var(--color-white);
}

.dl-fab__icon {
  display: inline-flex;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-bg);
  color: var(--color-accent-dark);
}

.dl-fab__icon svg {
  width: 20px;
  height: 20px;
}

.dl-fab__text {
  min-width: 0;
  line-height: 1.25;
}

.dl-fab__text strong,
.dl-fab__text span {
  display: block;
  color: var(--color-white);
}

.dl-fab__text span {
  margin-top: 3px;
  font-size: 12px;
}

.end-download-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  margin-top: 52px;
  padding: 28px;
  border-radius: var(--radius-xl);
  background: var(--color-yellow);
  color: var(--color-text);
}

.end-download-card h2,
.end-download-card h3,
.end-download-card p {
  color: var(--color-text);
}

.end-download-card p {
  margin-bottom: 0;
}

.settings-fragment {
  width: min(100%, 480px);
  padding: 14px;
  border-radius: var(--radius-xl);
  background: var(--color-bg);
  color: var(--color-text);
  box-shadow: var(--shadow-soft);
}

.settings-fragment__title {
  padding: 10px 12px 16px;
  font-size: 13px;
  font-weight: 800;
}

.settings-row {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 12px;
  border-top: 1px solid var(--color-line);
  color: var(--color-text);
}

.settings-row > span:first-child {
  min-width: 0;
}

.switch {
  position: relative;
  width: 46px;
  height: 28px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--color-line);
}

.switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-bg);
  box-shadow: var(--shadow-card);
  content: "";
}

.switch.is-on {
  background: var(--color-accent);
}

.switch.is-on::after {
  left: 21px;
}

.data-table {
  min-width: 680px;
}

.prose > .data-table {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

.swatch {
  overflow: clip;
  border-radius: var(--radius-md);
  background: var(--color-panel);
  color: var(--color-text);
}

.swatch__color {
  height: 104px;
}

.swatch__color--bg {
  background: var(--color-bg);
}

.swatch__color--panel {
  background: var(--color-panel);
}

.swatch__color--yellow {
  background: var(--color-yellow);
}

.swatch__color--accent {
  background: var(--color-accent);
}

.swatch__color--accent-dark {
  background: var(--color-accent-dark);
}

.swatch__color--text {
  background: var(--color-text);
}

.swatch__color--muted {
  background: var(--color-muted);
}

.swatch__color--line {
  background: var(--color-line);
}

.swatch__label {
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.component-stack {
  display: grid;
  gap: 24px;
}

.demo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

@media (max-width: 900px) {
  .article-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .swatch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .term-grid,
  .download-grid,
  .article-grid {
    grid-template-columns: 1fr;
  }

  .end-download-card {
    grid-template-columns: 1fr;
  }

  .end-download-card .button {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .toc {
    position: static;
    border-radius: var(--radius-md);
  }

  .tab-list {
    border-radius: var(--radius-md);
  }

  .download-card,
  .article-card,
  .term-card {
    padding: 22px;
  }

  .dl-fab {
    right: 12px;
    bottom: 12px;
    max-width: calc(100vw - 24px);
  }

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