html, body {
  background: #fafafa;
  min-height: 100vh;
  color-scheme: light;
  overscroll-behavior: none;
}

:root {
  --bg: #fafafa;
  --text: #111111;
  --text-dim: #999999;
  --card-bg: #dadada;
  --mono: "Share Tech Mono", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", ui-monospace, Menlo, monospace;
  --page-pad: 80px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
}

main, .site-header {
  max-width: clamp(320px, 100%, 800px);
  margin-left: auto;
  margin-right: auto;
}

a { color: inherit; text-decoration: none; }

/* ── Header ── */
.site-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px var(--page-pad) 0;
  gap: 12px;
}

#bikes.section {
  padding-top: 48px;
  padding-bottom: 28px;
}

#components.section {
  padding-top: 8px;
  padding-bottom: 28px;
}

#qa.section {
  padding-top: 8px;
}

.site-logo {
  width: 72px;
  height: auto;
}

.site-title {
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  gap: 40px;
  margin-top: 8px;
}

.site-nav a {
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.site-nav a:hover { color: var(--text); }

/* ── Sections ── */
.section {
  padding: 64px var(--page-pad);
}

.section-label {
  margin: 0 0 40px;
  font-size: 28px;
  font-weight: 400;
}

#components .section-label,
#qa .section-label {
  font-size: 14px;
  margin-bottom: 16px;
  font-weight: 600;
}

.qa-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: clamp(280px, 90%, 560px);
}

.qa-item .qa-q {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  color: #111;
}

.qa-item .qa-a {
  margin: 0;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.05em;
  line-height: 1.6;
  color: #111;
}

/* ── Carousel ── */
.carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }

/* ── Bike card ── */
.bike-card {
  flex: 0 0 144px;
  scroll-snap-align: start;
}

.bike-card[data-v="V0.2"] {
  opacity: 0;
  scroll-snap-align: none;
}

.bike-card.branch { opacity: 0.6; }

.bike-img {
  aspect-ratio: 1 / 1;
  background: var(--card-bg);
  overflow: hidden;
  margin-bottom: 8px;
}

.bike-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.version-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.1em;
  padding: 1px 3px;
  border: 1px solid #111;
  margin-bottom: 8px;
  font-family: var(--mono);
}

.version-tag.outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--text);
}

.bike-desc {
  margin: 0;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.05em;
  line-height: 1.5;
  color: #111;
}

.bike-card .bike-desc {
  display: -webkit-box;
  line-clamp: 3;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Component grid (横向滚动 carousel, 2 行) ── */
.component-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(2, auto);
  grid-auto-columns: 120px;
  column-gap: 32px;
  row-gap: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  margin-bottom: 12px;
}
.component-grid::-webkit-scrollbar { display: none; }

.component-card {
  display: flex;
  align-items: center;
  gap: 8px;
  scroll-snap-align: start;
}

.component-card .comp-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.component-card.is-active .comp-name::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #111;
  margin-right: 6px;
  vertical-align: middle;
}

.component-card img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.comp-name {
  font-size: 11px;
  letter-spacing: 0.04em;
  display: block;
  white-space: nowrap;
}

.comp-count {
  font-size: 11px;
  color: var(--text-dim);
  display: block;
  margin-top: 2px;
}

/* ── Variant card ── */
.variant-card {
  flex: 0 0 88px;
  scroll-snap-align: start;
}

.variant-img {
  width: 88px;
  height: 88px;
  background: var(--card-bg);
  overflow: hidden;
  margin-bottom: 14px;
}

.variant-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── About ── */
.about-text {
  max-width: 560px;
}

.about-text p {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.7;
}

/* ── Footer ── */
.site-footer {
  max-width: clamp(320px, 100%, 800px);
  margin-left: auto;
  margin-right: auto;
  padding: 0 var(--page-pad) 48px;
}

.contribute-link {
  display: block;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #998CFF;
  text-decoration: underline;
  cursor: pointer;
}

.site-footer p {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ── Responsive ── */
@media (max-width: 900px) {
  :root { --page-pad: 24px; }
}

@media (max-width: 600px) {
  .site-nav { gap: 24px; }
}

/* ── Upload modal ── */
.upload-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  z-index: 110;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
  overflow-y: auto;
}

.upload-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease, visibility 0s linear 0s;
}

.upload-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(280px, 90vw, 360px);
  aspect-ratio: 360 / 210;
}

.upload-cell {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) rotate(22.5deg);
  width: calc(100% * 210 / 360);
  aspect-ratio: 1 / 1;
  background: #fff;
  clip-path: polygon(
    29.3% 0,
    70.7% 0,
    100% 29.3%,
    100% 70.7%,
    70.7% 100%,
    29.3% 100%,
    0 70.7%,
    0 29.3%
  );
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-cell-left { left: -2.5px; z-index: 2; }
.upload-cell-right { right: -2.5px; z-index: 1; }

.upload-overlay {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: calc(100% * 210 / 360);
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10%;
  box-sizing: border-box;
  z-index: 10;
  pointer-events: none;
}

.upload-overlay-left { left: -2.5px; }
.upload-overlay-right { right: -2.5px; }

.upload-overlay a,
.upload-overlay {
  pointer-events: auto;
}

.upload-qr {
  width: 78%;
  height: auto;
  display: block;
}

.upload-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #111;
  text-align: center;
  white-space: nowrap;
}

.upload-or {
  margin: 10px 0;
}

.upload-link {
  color: #998CFF;
  text-decoration: underline;
}

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  overflow-y: auto;
}

.modal-backdrop.is-open {
  opacity: 1;
  pointer-events: all;
  overflow: hidden;
  touch-action: none;
}

.modal-card {
  position: absolute;
  --modal-corner: clamp(28px, 7vw, 42px);
  top: max(0px, calc((100svh - min(541px, 100vw * 541 / 390)) / 2));
  left: 50%;
  transform: translateX(-50%);
  width: min(390px, 100vw);
  min-height: min(541px, calc(100vw * 541 / 390));
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  clip-path: polygon(var(--modal-corner) 0, calc(100% - var(--modal-corner)) 0, 100% var(--modal-corner), 100% calc(100% - var(--modal-corner)), calc(100% - var(--modal-corner)) 100%, var(--modal-corner) 100%, 0 calc(100% - var(--modal-corner)), 0 var(--modal-corner));
}

.modal-strip {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.modal-strip::-webkit-scrollbar { display: none; }

.modal-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.modal-slide img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.modal-info {
  flex: 1;
  padding: clamp(16px, 4vw, 24px) clamp(16px, 4vw, 24px) 32px;
}

.modal-tags {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 20px;
}

.modal-tags::-webkit-scrollbar { display: none; }

.modal-tag {
  flex: 0 0 auto;
  background: none;
  border: 1px solid #111;
  color: #111;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.1em;
  cursor: pointer;
  padding: 2px 4px;
  opacity: 0.35;
}

.modal-tag.is-active {
  background: #111;
  color: #fff;
  opacity: 1;
}

.modal-version {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.1em;
  padding: 5px 9px;
  border: 1px solid #111;
  margin-bottom: 14px;
  font-family: var(--mono);
}

.modal-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: #111;
  font-family: var(--mono);
}

.modal-nav {
  display: flex;
  justify-content: space-between;
  padding: clamp(16px, 4vw, 24px);
}

.modal-nav button {
  background: none;
  border: none;
  color: #111;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  cursor: pointer;
  padding: 0;
  opacity: 0.6;
}

.modal-nav button:hover { opacity: 1; }

.modal-nav button[hidden] {
  visibility: hidden;
  pointer-events: none;
}