:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #5f6368;
  --accent: #4d3bb3;
  --accent-strong: #3f2e9a;
  --border: #e3e5ea;
  --blue-card: #edf2ff;
  --violet-card: #f2edff;
  --yellow-card: #fff7df;
  --green-card: #e7f4ea;
  color: var(--ink);
  background: #fff;
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: #fff; scroll-behavior: smooth; }
body { margin: 0; background: #fff; }
a { color: var(--accent); }
button, input { font: inherit; }
:where(a, button, summary, input):focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

main { width: min(100% - 64px, 1120px); margin: 0 auto; padding-bottom: 96px; }
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(36px, 4.7vw, 60px) 0 clamp(30px, 3.5vw, 44px);
  text-align: center;
}
.download-brand { width: 100%; }
.download-brand img {
  display: block;
  width: 68px;
  height: 68px;
  margin: 0 auto 16px;
  border-radius: 20px;
}
h1 {
  max-width: 820px;
  margin: 0 auto;
  font-size: clamp(32px, 4.6vw, 56px);
  font-weight: 750;
  line-height: 1.12;
  letter-spacing: -.025em;
  text-wrap: balance;
}
.meta { margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.download-intro { margin: 12px 0 0; color: var(--muted); font-size: 16px; }
#status {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}
#status:empty { margin: 0; }
#copy { margin-top: 12px; }
.primary {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  padding: 11px 24px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 5px 14px rgba(77, 59, 179, .22);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.primary:hover { color: #fff; background: var(--accent-strong); box-shadow: 0 7px 18px rgba(77, 59, 179, .28); transform: translateY(-1px); }
.primary.retry-link {
  min-height: 46px;
  padding: 0 3px;
  color: var(--accent);
  background: transparent;
  box-shadow: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.primary.retry-link:hover { color: var(--accent-strong); background: transparent; box-shadow: none; transform: none; }

.platform-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: #f4f3f8;
  text-align: center;
}
.platform-tabs a {
  padding: 8px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 650;
  text-decoration: none;
}
.platform-tabs a:hover { color: var(--accent); }
.platform-tabs a[aria-current] { color: var(--accent); background: #fff; box-shadow: 0 1px 4px #30234a1a; }

#version-choice { max-width: 100%; margin-top: 5px; color: var(--muted); font-size: 14px; }
#version-choice > summary {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 8px;
  color: var(--accent);
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}
#version-choice > summary:hover { background: #f6f3ff; }
#version-choice > summary::-webkit-details-marker { display: none; }
#version-choice > summary::after {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .18s ease;
}
#version-choice[open] > summary::after { transform: rotate(225deg) translate(-1px, -1px); }
.package-panel {
  width: min(360px, calc(100vw - 40px));
  margin: 4px auto 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 24px #30234a10;
  text-align: left;
}
.package-panel fieldset { display: grid; gap: 4px; min-width: 0; margin: 12px 0; padding: 0; border: 0; }
.chip-help { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.package-panel .primary { width: 100%; }
.package-panel label {
  position: relative;
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 11px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease;
}
.package-panel label:hover { border-color: #ded9fb; background: #fbfaff; }
.package-panel label:has(input:checked) { border-color: #d4ccfa; background: #f1eeff; }
.package-panel input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
.option-copy { display: grid; gap: 1px; min-width: 0; }
.option-copy strong { color: var(--ink); font-size: 14px; font-weight: 700; }
.option-copy small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.package-panel label:has(input:checked) .option-copy strong { color: var(--accent); }

.guide-heading { margin-bottom: 18px; }
.guide-heading h2 { margin: 0; font-size: clamp(25px, 3.2vw, 34px); font-weight: 750; line-height: 1.2; letter-spacing: -.025em; }
.cards, .mac-guide { display: grid; gap: 20px; align-items: stretch; }
.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mac-guide { grid-template-columns: repeat(3, minmax(0, 1fr)); list-style: none; padding: 0; margin: 0; }
.card { min-width: 0; padding: clamp(20px, 2.5vw, 28px); border-radius: 24px; }
#find-package { background: var(--blue-card); }
#run-package { background: var(--violet-card); }
.mac-guide .card:nth-child(1) { background: var(--blue-card); }
.mac-guide .card:nth-child(2) { background: var(--yellow-card); }
.mac-guide .card:nth-child(3) { background: var(--green-card); }
.card h3 { display: grid; gap: 7px; margin: 0; font-size: clamp(23px, 2.65vw, 30px); font-weight: 750; line-height: 1.2; letter-spacing: -.025em; }
.step-index { color: var(--muted); font-size: 14px; font-weight: 700; letter-spacing: .01em; }
.card p { margin: 12px 0 0; color: var(--muted); font-size: 15px; }
.cards .card { display: flex; flex-direction: column; }
.cards .card > p { min-height: 3.4em; }
.package-file {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-top: 3px;
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--ink);
  background: #ffffffa6;
  font-size: .86em;
  overflow-wrap: anywhere;
}
.demo { margin: auto 0 0; padding-top: 8px; }
.demo-media { overflow: hidden; border: 4px solid rgba(255, 255, 255, .82); border-radius: 14px; background: #fff; }
.demo-media img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.demo-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}
.demo-controls { display: flex; flex-wrap: wrap; gap: 6px; }
.demo-controls button, .demo-dialog button {
  min-height: 40px;
  padding: 5px 12px;
  border: 1px solid rgba(32, 33, 36, .15);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, .9);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: background-color .18s ease;
}
.demo-controls button:hover, .demo-dialog button:hover { background: #fff; color: var(--accent); }
.instructions { margin-top: 4px; color: var(--muted); font-size: 14px; }
.instructions summary { padding: 10px 0; color: var(--accent); font-weight: 650; cursor: pointer; }
.instructions p { margin-top: 2px; font-size: inherit; }
.instructions ol { margin: 6px 0 14px; padding-left: 1.6em; }
.instructions li + li { margin-top: 3px; }
.demo-dialog {
  width: min(980px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--ink);
  background: #fff;
}
.demo-dialog::backdrop { background: #18132fb8; }
.demo-dialog:not([open]) { display: none; }
.demo-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.demo-dialog h2 { margin: 0; font-size: 16px; }
.demo-dialog img { display: block; width: 100%; height: auto; max-height: calc(100dvh - 102px); object-fit: contain; }
.mac-guide .card { display: grid; grid-template-rows: auto 1fr auto; }
.mac-visual {
  display: grid;
  height: 188px;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  margin-top: 16px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .55);
}
.mac-screenshot img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  border-radius: 9px;
  box-shadow: 0 3px 10px #221c3226;
}
.mac-finder img { width: 100%; }
.mac-dmg img { border-radius: 0; box-shadow: none; filter: drop-shadow(0 3px 6px #221c321a); }
.mac-folder {
  display: grid;
  width: min(100%, 242px);
  overflow: hidden;
  border: 1px solid #d8d9dc;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 3px 10px #221c3226;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}
.mac-folder > span {
  padding: 7px 12px;
  border-bottom: 1px solid #dedee1;
  background: #f3f3f5;
}
.mac-folder > div { display: flex; align-items: center; gap: 9px; padding: 12px; }
.mac-folder img { flex: 0 0 36px; border-radius: 9px; }

@media (max-width: 860px) {
  main { width: min(100% - 40px, 760px); }
  .cards { grid-template-columns: 1fr; }
  .cards .card > p { min-height: 0; }
}
@media (max-width: 980px) {
  .mac-guide { grid-template-columns: 1fr; }
}
@media (min-width: 641px) and (max-width: 980px) {
  .mac-guide .card {
    grid-template-columns: minmax(0, 1fr) minmax(0, 38%);
    grid-template-rows: auto 1fr;
    column-gap: 24px;
    align-items: start;
  }
  .mac-guide h3 { grid-area: 1 / 1; }
  .mac-copy { grid-area: 2 / 1; }
  .mac-visual { grid-area: 1 / 2 / span 2; height: 150px; margin-top: 0; align-self: center; }
}
@media (max-width: 560px) {
  main { width: calc(100% - 32px); padding-bottom: 64px; }
  .hero { padding: 32px 0 30px; }
  h1 { font-size: clamp(30px, 8vw, 42px); }
  .download-intro { font-size: 14px; }
  .card { padding: 18px; border-radius: 20px; }
  .demo-media { margin-inline: -6px; }
  .demo-controls button, .demo-dialog button { min-height: 44px; }
  .mac-visual { height: 172px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
