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

.tab-list {
  display: flex;
  max-width: 100%;
  align-items: center;
  gap: 6px;
  margin-bottom: 28px;
  padding: 6px;
  overflow-x: auto;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-menu);
  background: var(--color-panel-soft);
  color: var(--color-ink);
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.tab-list [role="tab"] {
  min-height: 44px;
  flex: 0 0 auto;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-card);
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  font-weight: 650;
}

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

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

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

.toc-tabs {
  display: flex;
  max-width: 100%;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 44px;
  padding: 10px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-menu);
  background: var(--color-panel-soft);
  color: var(--color-ink);
}

.toc-tabs a {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  color: var(--color-muted);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.toc-tabs a:hover {
  background: var(--color-canvas);
  color: var(--color-accent-deep);
}

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

.faq-item {
  border: 1px solid var(--color-line);
  border-radius: var(--radius-card);
  background: var(--color-canvas);
  color: var(--color-ink);
  box-shadow: var(--shadow-card);
}

.faq-item summary {
  position: relative;
  min-height: 56px;
  padding: 16px 52px 16px 20px;
  cursor: pointer;
  color: var(--color-ink);
  font-weight: 700;
  list-style: none;
}

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

.faq-item summary::before,
.faq-item summary::after {
  position: absolute;
  top: 27px;
  right: 20px;
  width: 14px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--color-accent-deep);
  content: "";
  transition: transform var(--transition-fast);
}

.faq-item summary::after {
  transform: rotate(90deg);
}

.faq-item[open] summary::after {
  transform: rotate(0);
}

.faq-answer {
  padding: 0 20px 20px;
  color: var(--color-muted);
}

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

.term-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 18px;
}

.term-card {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-card);
  background: var(--color-canvas);
  color: var(--color-ink);
  box-shadow: var(--shadow-card);
}

.term-card dt {
  margin-bottom: 9px;
  color: var(--color-ink);
  font-size: 18px;
  font-weight: 750;
}

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

.term-meta {
  display: block;
  margin-bottom: 10px;
  color: var(--color-accent-deep);
  font: 650 12px/1.4 var(--font-mono);
  letter-spacing: 0.08em;
}

.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 18px;
}

.download-card {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 25px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-card);
  background: var(--color-canvas);
  color: var(--color-ink);
  box-shadow: var(--shadow-card);
}

.download-card.is-primary {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-card), 0 0 0 3px var(--color-accent-ring);
}

.download-card-head {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 14px;
}

.download-card-head img {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}

.download-card-title {
  min-width: 0;
}

.download-card-title h3 {
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

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

.download-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
}

.version-slot:empty {
  display: none;
}

.badge-row,
.tag-row {
  display: flex;
  max-width: 100%;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.badge,
.tag {
  display: inline-flex;
  max-width: 100%;
  min-height: 27px;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  overflow: hidden;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-panel-soft);
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}

.badge-primary {
  border-color: var(--color-accent);
  background: var(--color-panel);
  color: var(--color-accent-deep);
}

.badge-recommended {
  border-color: var(--color-success);
  background: var(--color-panel);
  color: var(--color-success);
}

.badge-archived {
  border-color: var(--color-warning);
  background: var(--color-panel-soft);
  color: var(--color-warning);
}

.badge-error {
  border-color: var(--color-error);
  background: var(--color-panel-soft);
  color: var(--color-error);
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 20px;
}

.post-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 26px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-card);
  background: var(--color-canvas);
  color: var(--color-ink);
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.post-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-accent);
  box-shadow: var(--shadow-float);
}

.post-card time {
  margin-bottom: 12px;
  color: var(--color-muted);
  font: 12px/1.4 var(--font-mono);
}

.post-card h3 {
  font-size: 21px;
}

.post-card h3 a {
  color: var(--color-ink);
  text-decoration: none;
}

.post-card h3 a:hover {
  color: var(--color-accent-deep);
}

.post-card p {
  color: var(--color-muted);
}

.post-card-link {
  margin-top: auto;
  font-weight: 700;
}

.callout {
  position: relative;
  margin: 26px 0;
  padding: 20px 22px 20px 26px;
  border: 1px solid var(--color-line);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius-card);
  background: var(--color-panel);
  color: var(--color-ink);
}

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

.callout-title {
  display: block;
  margin-bottom: 6px;
  color: var(--color-ink);
  font-weight: 750;
}

.callout-warning {
  border-left-color: var(--color-warning);
  background: var(--color-panel-soft);
  color: var(--color-ink);
}

.callout-error {
  border-left-color: var(--color-error);
  background: var(--color-panel-soft);
  color: var(--color-ink);
}

.prose {
  min-width: 0;
  color: var(--color-muted);
}

.prose h2,
.prose h3,
.prose h4,
.prose strong {
  color: var(--color-ink);
}

.prose h2 {
  margin-top: 2.1em;
  scroll-margin-top: 100px;
}

.prose h3 {
  margin-top: 1.7em;
  scroll-margin-top: 100px;
}

.prose img {
  height: auto;
  margin: 28px auto;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-card);
}

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

.download-cta-card {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 52px;
  padding: 26px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-card);
  background: var(--color-panel);
  color: var(--color-ink);
  box-shadow: var(--shadow-card);
}

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

.dl-fab {
  position: fixed;
  z-index: 70;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: flex;
  max-width: min(310px, calc(100vw - 32px));
  min-height: 58px;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 10px 11px;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-menu);
  background: var(--color-canvas);
  color: var(--color-ink);
  box-shadow: var(--shadow-float);
  text-decoration: none;
}

.dl-fab:hover {
  background: var(--color-panel-soft);
  color: var(--color-ink);
}

.dl-fab-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  place-items: center;
  border-radius: var(--radius-card);
  background: var(--color-accent);
  color: var(--color-canvas);
}

.dl-fab-icon svg {
  width: 18px;
  height: 18px;
}

.dl-fab-copy {
  min-width: 0;
}

.dl-fab-copy strong,
.dl-fab-copy span {
  display: block;
}

.dl-fab-copy strong {
  color: var(--color-ink);
  font-size: 14px;
}

.dl-fab-copy span {
  color: var(--color-muted);
  font-size: 12px;
}

.line-device {
  min-height: 340px;
  padding: 28px;
  overflow: hidden;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-card);
  background: var(--color-panel-soft);
  color: var(--color-ink);
  box-shadow: var(--shadow-card);
}

.code-sheet {
  max-width: 520px;
  margin: 34px auto 0;
  padding: 22px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-card);
  background: var(--color-canvas);
  color: var(--color-ink);
  box-shadow: var(--shadow-float);
}

.code-sheet pre {
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--color-canvas);
  color: var(--color-ink);
  box-shadow: none;
}

@media (max-width: 640px) {
  .tab-list {
    flex-wrap: nowrap;
  }

  .toc-tabs {
    flex-direction: row;
  }

  .download-cta-card {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .dl-fab {
    right: 16px;
    bottom: 16px;
    left: 16px;
    max-width: none;
  }

  .line-device {
    min-height: 280px;
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .post-card:hover {
    transform: none;
  }
}