:root {
  --page: #fff;
  --text: #444;
  --muted: #666;
  --quiet: #999;
  --line: #eee;
  --soft: #f6f6f6;
  --link: #3354aa;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { min-width: 320px; overflow-x: clip; background: var(--page); color: var(--text); }
button { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

#search input[type="search"] {
  width: 100%;
  padding: 5px 32px 5px 5px;
  border: 1px solid #e9e9e9;
  border-radius: 2px;
  background: var(--page);
  color: var(--text);
  font: inherit;
}
#search button { cursor: pointer; }
#nav-menu { position: relative; }
#nav-menu .theme-toggle {
  position: absolute;
  right: 0;
  bottom: 2px;
  padding: 4px 7px;
  border: 0;
  background: transparent;
  color: var(--link);
  cursor: pointer;
  font-size: 12px;
}
#nav-menu .theme-toggle:hover { text-decoration: underline; }
.post-title a { color: var(--link); }
.post-column, .post-column .container { min-width: 0; }
.post-column .container { max-width: none; padding: 0; }
.post-content, .section, .safety-band { overflow-wrap: anywhere; }
.post-content img { max-width: 100%; }
.hero-sub { margin: 1em 0; }
.section-head h2, .signing-layout h2 { margin: .83em 0; font-size: 1.4em; font-weight: 500; }
.section-head .section-desc { margin: 0 0 1em; color: var(--muted); }
.section-note, .illustration-note, .faq-note { color: var(--quiet); font-size: .92857em; }
.section-note { display: block; margin: 0 0 12px; }

.download-card { padding: 12px 0 18px; }
.download-name { margin: 0 0 3px; font-size: 1.14em; font-weight: bold; }
.download-version { margin-left: 5px; padding: 2px 5px; background: var(--soft); color: var(--muted); font: .8em Menlo, Consolas, monospace; }
.download-release { min-height: 20px; margin: 0 0 12px; color: var(--quiet); font-size: .92857em; }
.download-loading-spinner { display: inline-block; width: 13px; height: 13px; margin-right: 5px; border: 2px solid var(--line); border-top-color: var(--link); border-radius: 50%; vertical-align: -2px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.download-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border: 1px solid #ddd;
  border-radius: 2px;
  background: var(--page);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  line-height: 22px;
  text-align: center;
  text-decoration: none;
}
.btn:hover { border-color: #aaa; color: var(--text); }
.btn-primary { border-color: var(--link); background: var(--link); color: #fff; }
.btn-primary:hover { border-color: var(--link); background: #29448a; color: #fff; }
.download-dialog a.btn-primary { color: #fff; }
.download-skeleton-btn { width: 140px; height: 34px; background: var(--soft); }
.browser-banner { margin: 6px 0 14px; padding: 10px 13px; border-left: 3px solid var(--line); background: var(--soft); }
.browser-banner-icon { display: none; }
.browser-banner-title { margin: 0; font-weight: bold; }
.browser-banner p:last-child { margin: 2px 0 0; color: var(--muted); }
.safety-band { padding: 5px 0 0; }
.safety-item { margin: 6px 0; }
.safety-item h3, .safety-item p { display: inline; margin: 0; font-size: 1em; }
.safety-item h3::after { content: "："; }

.smart-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.smart-step { min-width: 0; margin: 0; }
.smart-step img { display: block; width: 100%; height: auto; border: 1px solid var(--line); }
.smart-step figcaption { margin-top: 6px; color: var(--muted); font-size: .92857em; }
.step-number { display: inline-block; min-width: 16px; margin-right: 5px; background: var(--link); color: #fff; font-size: 11px; line-height: 16px; text-align: center; }
.illustration-note { margin: 15px 0; }
.notice { margin: 15px 0 0; padding: 10px 13px; border-left: 3px solid #b87717; background: #fff8ea; }
.notice p { margin: 0; }
.signing-layout p { margin: 0 0 1em; }
.integrity { min-width: 0; margin-top: 18px; padding: 15px; background: var(--soft); }
.integrity h3 { margin: 0 0 8px; font-size: 1.14em; }
.integrity pre { margin: 10px 0; max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
.hash-row { display: flex; min-width: 0; align-items: center; gap: 8px; margin: 10px 0; }
.hash-value { min-width: 0; flex: 1; overflow-wrap: anywhere; font: .85em Menlo, Consolas, monospace; }
.hash-copy { flex: none; padding: 3px 6px; border: 1px solid var(--line); background: var(--page); color: var(--link); cursor: pointer; }
.text-link { color: var(--link); text-decoration: underline; }

.faq-card { padding: 12px 0; border-top: 1px solid var(--line); }
.faq-question { margin: 0 0 10px; font-size: 1.07em; }
.faq-badge { margin-right: 8px; padding: 2px 5px; background: var(--soft); color: var(--muted); font-size: .85em; }
.faq-steps { margin: 0; padding-left: 22px; }
.faq-steps li { margin: 5px 0; }
.faq-note { margin: 10px 0 0; }
.sponsor-note { margin: 0 0 18px; }
.sponsor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 150px)); gap: 18px; }
.sponsor-card { min-width: 0; margin: 0; border: 1px solid var(--line); text-align: center; }
.sponsor-image-button { display: block; width: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.sponsor-image-button img { display: block; width: 100%; height: auto; aspect-ratio: 642 / 677; object-fit: contain; }
.sponsor-card figcaption { padding: 5px; font-size: .92857em; }

.download-dialog {
  width: calc(100vw - 32px);
  max-width: 520px;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 22px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--line);
  background: var(--page);
  color: var(--text);
  box-shadow: 0 15px 50px #0004;
}
.download-dialog::backdrop { background: #0009; }
.dialog-header { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.dialog-header h2 { margin: 0 0 8px; font-size: 1.4em; }
.dialog-close { flex: none; width: 28px; height: 28px; border: 1px solid var(--line); background: var(--page); color: var(--text); cursor: pointer; font-size: 20px; line-height: 20px; }
.dialog-sub { margin: 0 0 14px; }
.dialog-list { margin: 0 0 14px; padding-left: 21px; }
.dialog-list li { margin: 7px 0; }
.dialog-checksum { min-width: 0; margin: 0 0 14px; padding: 10px; background: var(--soft); }
.dialog-checksum p { margin: 0 0 5px; }
.dialog-checksum code { display: block; padding: 0; overflow-wrap: anywhere; background: transparent; }
.dialog-check { display: flex; gap: 8px; align-items: flex-start; margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); cursor: pointer; }
.dialog-check input { flex: none; margin-top: 3px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dialog-actions .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }

.gallery-dialog { position: fixed; inset: 0; width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; overflow: hidden; background: #111; color: #fff; }
.gallery-dialog::backdrop { background: #000c; }
.gallery-shell { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
.gallery-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; }
.gallery-title { min-width: 0; margin: 0; font-size: 14px; }
.gallery-tools { display: flex; gap: 4px; }
.gallery-tools button { width: 34px; height: 34px; border: 1px solid #777; background: #222; color: #fff; cursor: pointer; font-size: 20px; }
.gallery-tools button:disabled { opacity: .4; cursor: not-allowed; }
.gallery-stage { display: flex; min-width: 0; min-height: 0; align-items: safe center; justify-content: safe center; padding: 12px; overflow: auto; }
.gallery-stage img { display: block; max-width: none; height: auto; flex: none; margin: auto; background: #fff; }
.gallery-footer { padding: 8px; text-align: center; }

#footer p { margin: 4px 0; }
.search-status { margin: 15px 0 0; padding: 8px; background: var(--soft); }
pre, code { background: var(--soft); }
pre code { color: var(--text); }

@media (max-width: 767px) {
  #nav-menu { padding-right: 52px; }
  #nav-menu a { padding: 0 10px; }
  #nav-menu .theme-toggle { bottom: 2px; }
  .smart-steps { grid-template-columns: 1fr; }
  .download-actions .btn { flex: 1 1 auto; }
  .download-dialog { padding: 15px; }
  .dialog-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dialog-actions .btn { min-width: 0; padding-inline: 5px; }
  .gallery-toolbar { flex-wrap: wrap; justify-content: center; }
  .gallery-title { width: 100%; text-align: center; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-color-mode="light"]) {
    color-scheme: dark;
    --page: #1b1d20; --text: #e6e6e6; --muted: #bbb; --quiet: #999;
    --line: #3d4148; --soft: #282b2f; --link: #9cb7f5;
  }
}
:root[data-color-mode="dark"] {
  color-scheme: dark;
  --page: #1b1d20; --text: #e6e6e6; --muted: #bbb; --quiet: #999;
  --line: #3d4148; --soft: #282b2f; --link: #9cb7f5;
}
:root[data-color-mode="dark"] body,
:root:not([data-color-mode="light"]) body { background: var(--page); color: var(--text); }
:root[data-color-mode="dark"] a,
:root:not([data-color-mode="light"]) a { color: var(--link); }
:root[data-color-mode="dark"] a.btn-primary,
:root:not([data-color-mode="light"]) a.btn-primary { color: #fff; }
:root[data-color-mode="dark"] #header,
:root:not([data-color-mode="light"]) #header,
:root[data-color-mode="dark"] .post,
:root:not([data-color-mode="light"]) .post { border-color: var(--line); }
:root[data-color-mode="dark"] #logo,
:root:not([data-color-mode="light"]) #logo,
:root[data-color-mode="dark"] #nav-menu a,
:root:not([data-color-mode="light"]) #nav-menu a { color: var(--text); }
:root[data-color-mode="dark"] #nav-menu a,
:root:not([data-color-mode="light"]) #nav-menu a { border-color: var(--line); }
:root[data-color-mode="dark"] #nav-menu .current,
:root:not([data-color-mode="light"]) #nav-menu .current { background: var(--soft); }
:root[data-color-mode="dark"] #search input,
:root:not([data-color-mode="light"]) #search input { border-color: var(--line); }
:root[data-color-mode="dark"] .notice { background: #352b1d; }
@media (prefers-color-scheme: dark) {
  :root:not([data-color-mode="light"]) .notice { background: #352b1d; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .download-loading-spinner { animation: none; } }

.post-content a.btn { border: 1px solid #ddd; color: var(--text); }
.post-content a.btn:hover { border-color: #aaa; color: var(--text); }
.post-content a.btn-primary { border-color: var(--link); background: var(--link); color: #fff; }
.post-content a.btn-primary:hover { border-color: var(--link); background: #29448a; color: #fff; }
