:root {
  color-scheme: light;
  --bg: #fbfbfe;
  --surface: #fff;
  --text: #18182b;
  --muted: #595a70;
  --line: #dedfeb;
  --hero: #eeedff;
  --tint: #e8e5ff;
  --accent: #4535d5;
  --button: #4334d2;
  --button-hover: #3526b4;
  --danger: #a02d38;
  --shadow: 0 16px 44px #28236314;
  font: 16px/1.55 "Instrument Sans", "PingFang SC", system-ui, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141421; --surface: #202033; --text: #f3f2ff; --muted: #bbb9d1;
  --line: #3b3a54; --hero: #242242; --tint: #343057; --accent: #b3a9ff;
  --button: #6454e4; --button-hover: #5444d2; --danger: #ffa9af; --shadow: 0 16px 44px #0004;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #141421; --surface: #202033; --text: #f3f2ff; --muted: #bbb9d1;
    --line: #3b3a54; --hero: #242242; --tint: #343057; --accent: #b3a9ff;
    --button: #6454e4; --button-hover: #5444d2; --danger: #ffa9af; --shadow: 0 16px 44px #0004;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: inherit; }
button, textarea { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.shell { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }
.masthead, nav, .brand { display: flex; align-items: center; }
.masthead { min-height: 72px; justify-content: space-between; gap: 14px; }
.brand { gap: 10px; font-weight: 850; font-size: 22px; text-decoration: none; }
.brand-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--button); color: #fff; font: 800 24px/1 system-ui; }
nav { gap: 10px; }
.nav-link { padding: 8px 10px; color: var(--muted); text-decoration: none; font-weight: 650; font-size: 14px; }
.nav-link:hover { color: var(--accent); }
.menu { position: relative; }
summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
.menu summary { display: flex; align-items: center; gap: 7px; padding: 7px 10px; min-height: 38px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); white-space: nowrap; font-weight: 650; font-size: 14px; }
.menu summary.theme-trigger { width: 38px; padding: 0; justify-content: center; }
#theme-icon { font-size: 18px; line-height: 1; }
.menu summary .language-flag { min-width: 0; }
.menu[open] summary, .menu summary:hover { border-color: var(--accent); }
.menu-panel { position: absolute; top: calc(100% + 8px); right: 0; z-index: 2; display: grid; gap: 3px; min-width: 150px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.menu-panel a, .menu-panel label { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 7px; text-decoration: none; white-space: nowrap; cursor: pointer; }
.menu-panel a:hover, .menu-panel label:hover, .menu-panel [aria-current], .menu-panel label:has(:checked) { background: var(--tint); color: var(--accent); }
.language-panel { min-width: 172px; max-height: min(440px, calc(100dvh - 72px)); overflow-y: auto; }
.language-panel a { min-height: 42px; gap: 16px; }
.language-flag { display: inline-block; min-width: 1.4em; text-align: center; }
.language-panel [aria-current] { background: var(--tint); color: var(--text); }
input[type="radio"], progress { accent-color: var(--accent); }
.hero { background: radial-gradient(ellipse at 50% 0%, var(--tint), transparent 72%), var(--hero); border-block: 1px solid var(--line); }
.hero-inner { text-align: center; padding: clamp(40px, 6vw, 82px) 0 clamp(34px, 4vw, 58px); }
h1 { margin: 0 auto; max-width: 860px; font-size: clamp(32px, 5vw, 64px); line-height: 1.13; letter-spacing: -.035em; }
.intro { margin: 15px 0 26px; color: var(--muted); font-size: clamp(15px, 1.8vw, 19px); }
form { max-width: 800px; margin: auto; padding: clamp(14px, 2vw, 22px); text-align: start; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.link-label { display: block; font-size: 14px; font-weight: 750; margin-bottom: 8px; }
textarea { display: block; width: 100%; min-height: 52px; padding: 12px 14px; resize: vertical; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; }
textarea::placeholder { color: color-mix(in srgb, var(--muted) 68%, var(--bg)); opacity: 1; }
button, .save { background: var(--button); color: #fff; border: 0; border-radius: 10px; padding: 11px 20px; font-weight: 750; text-decoration: none; cursor: pointer; }
button:hover, .save:hover { background: var(--button-hover); }
button:disabled { opacity: .7; cursor: wait; }
fieldset { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 0; margin: 12px 0 0; border: 0; }
fieldset label { cursor: pointer; color: var(--muted); font-size: 14px; }
.result { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; overflow-wrap: anywhere; }
.result p { margin: 0 0 8px; }
.result[data-state="error"] { color: var(--danger); }
progress { width: 100%; }
.save { display: inline-block; }
.platforms, .platforms ul { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.platforms { margin-top: 22px; font-size: 14px; color: var(--muted); }
.platforms ul { list-style: none; padding: 0; margin: 0; }
.platforms li { padding: 3px 11px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); color: var(--text); font-weight: 650; }
.content { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.75fr); gap: clamp(22px, 5vw, 72px); padding-block: clamp(36px, 5vw, 68px); }
.content section { scroll-margin-top: 20px; }
h2 { font-size: clamp(22px, 2.6vw, 31px); line-height: 1.2; margin: 0 0 18px; }
h3 { font-size: 16px; margin: 0 0 3px; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 0 0 17px 41px; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--tint); color: var(--accent); font-size: 13px; font-weight: 800; }
.steps p, .faq p, .usage li { color: var(--muted); margin: 0; font-size: 15px; }
.usage { margin-top: 10px; padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.usage h2 { font-size: 17px; margin-bottom: 8px; }
.usage ul { margin: 0; padding-inline-start: 20px; }
.usage li + li { margin-top: 7px; }
.faq details { margin-bottom: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; }
.faq summary { display: flex; justify-content: space-between; gap: 12px; font-weight: 720; padding: 13px 16px; }
.faq summary::after { content: '+'; color: var(--accent); font-size: 18px; line-height: 1.3; }
.faq details[open] summary::after { content: '−'; }
.faq p { padding: 0 16px 15px; }
footer { border-top: 1px solid var(--line); padding-block: 21px; color: var(--muted); font-size: 14px; }
@media (max-width: 720px) {
  .shell { width: calc(100% - 32px); }
  .masthead { min-height: 62px; }
  .nav-link { display: none; }
  .content { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .brand { font-size: 18px; gap: 6px; }
  .brand-icon { width: 27px; height: 27px; }
}

[lang="zh-TW"] > .language-flag, html[lang="zh-TW"] .menu summary > .language-flag {
  display: inline-grid;
  place-items: center;
  width: 1.4em;
  height: 1.4em;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
}

#batch-hint { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.batch-state { display: block; overflow-wrap: anywhere; }
.batch-state[data-state="error"] { color: var(--danger); }

.link-actions { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; }
button.secondary-button { background: var(--surface); color: var(--accent); border: 1px solid var(--line); padding: 5px 10px; font-size: 13px; }
button.secondary-button:hover { background: var(--tint); }

#download-links { display: grid; gap: 9px; }
.download-row-input { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.download-row-input textarea { grid-column: 1; }
.download-row-input textarea:only-child,
.download-row-input:has(.remove-link[hidden]) textarea { grid-column: 1 / -1; }
.download-row-input .remove-link { align-self: start; min-width: 40px; min-height: 52px; font-size: 21px; }
.download-row-result { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 2px; padding: 6px 8px; background: var(--bg); border-radius: 8px; font-size: 14px; }
#download-form .save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px;
  background: #344b82;
  color: #fff;
  font-size: 15px;
}
#download-form .save:hover { background: #293c6a; }
.download-row-result .save { flex-shrink: 0; }
.download-row-result { flex-wrap: wrap; }
.download-row-result .batch-state { flex: 1 1 160px; }
#batch-zip { border: 1px solid #344b82; }
.start-download[data-state="complete"]:disabled {
  background: var(--line);
  color: var(--muted);
  opacity: 1;
  cursor: default;
}
.link-actions { margin-top: 8px; }
.start-download {
  display: block;
  width: min(100%, 300px);
  min-height: 52px;
  margin: 20px auto 0;
  font-size: 17px;
}
