/* Version entry and update details share the existing theme tokens. */
/* 对比表放在 .update-panel 下方，同一种卡片：边框、圆角与 28px 内边距对齐。 */
.update-components { margin-bottom:20px; border:1px solid var(--line); border-radius:calc(10px * var(--radius-scale)); background:var(--panel); overflow:hidden; }
.component-head { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; padding:22px 28px 0; }
.component-head h3 { font-size:16px; font-weight:600; margin:0; }
#component-read-status { margin:6px 28px 18px; color:var(--muted); font-size:12px; line-height:1.7; overflow-wrap:anywhere; }
.component-table { width:100%; border-collapse:collapse; table-layout:fixed; font-size:12px; line-height:1.7; border-top:1px solid var(--line); }
.component-table th,.component-table td { padding:14px 12px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top; overflow-wrap:anywhere; }
.component-table thead th { padding-block:10px; color:var(--muted); font-weight:500; background:color-mix(in srgb, var(--text) 2%, transparent); }
.component-table tbody tr:last-child > * { border-bottom:0; }
.component-table th:first-child { width:18%; padding-left:28px; }
.component-table :is(th,td):last-child { padding-right:28px; }
.component-table p { margin:0 0 9px; color:var(--muted); }
.component-table p:first-child { color:var(--text); }
.component-table a { color:var(--text); }
.component-version { white-space:pre-wrap; }
@media(max-width:760px) {
 .component-head { padding:18px 20px 0; }
 #component-read-status { margin:6px 20px 14px; }
 .component-table thead { display:none; }
 .component-table tr { display:block; border-bottom:1px solid var(--line); padding:12px 20px; }
 .component-table tbody tr:last-child { border-bottom:0; }
 .component-table th,.component-table td,.component-table th:first-child,.component-table :is(th,td):last-child { display:block; padding:4px 0; border:0; width:100%; }
 .component-table th:first-child { font-size:14px; }
}
.side-head:has(.version-badge:not(.hidden)) {
  display: grid; grid-template-columns: minmax(0, 1fr) 28px;
  grid-template-rows: 20px 22px; align-content: center;
  height: 76px; padding-inline: 12px; gap: 4px 10px;
}
.side-head:has(.version-badge:not(.hidden)) .side-brand {
  grid-area: 1 / 1; position: relative; display: block;
  padding-left: 50px; font-size: 15px; line-height: 20px; letter-spacing: .06em;
}
.side-head:has(.version-badge:not(.hidden)) .side-brand-name { display: block; overflow: hidden; text-overflow: ellipsis; }
.side-head:has(.version-badge:not(.hidden)) .side-mark { position: absolute; left: 0; top: 2px; width: 40px; height: 40px; }
.side-head:has(.version-badge:not(.hidden)) :is(.side-collapse, .side-close) { grid-area: 1 / 2 / 3 / 3; align-self: center; }
.version-badge {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  grid-area: 2 / 1; justify-self: start; margin-left: 50px;
  min-height: 22px; max-width: calc(100% - 50px); padding: 3px 6px;
  border: 1px solid transparent; border-radius: calc(6px * var(--radius-scale));
  background: var(--panel-2); color: var(--muted);
  font: 10px var(--mono); white-space: nowrap;
  transition: background .16s ease, color .16s ease;
}
#version-label { overflow: hidden; text-overflow: ellipsis; }
.version-badge > .ui-icon { width: 12px; height: 12px; }
.version-badge:hover { color: var(--text); border-color: var(--line); }
.version-badge.has-update { color: var(--amber); border-color: var(--amber-dim); background: color-mix(in srgb, var(--amber) 17%, var(--panel)); }
.version-dot { display: none; width: 5px; height: 5px; border-radius: 50%; background: var(--amber); flex: none; }
.has-update .version-dot { display: block; }
.version-menu {
  position: fixed; inset: auto; margin: 0; padding: 0;
  width: min(288px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto;
  border: 1px solid var(--line); border-radius: calc(10px * var(--radius-scale));
  background: var(--panel-solid); color: var(--text); box-shadow: var(--shadow-lg);
}
.version-menu header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.version-menu header strong { font-size: 12px; font-weight: 500; }
.version-check { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: calc(6px * var(--radius-scale)); background: transparent; color: var(--muted); }
.version-check:hover { color: var(--text); background: var(--panel-2); }
.version-menu-body { padding: 25px 16px; text-align: center; }
.version-number { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 16px; line-height: 1.5; font-weight: 500; overflow-wrap: anywhere; }
.version-number > [data-update-version] { min-width: 0; }
.version-current { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: var(--radius-round); flex: none; color: var(--green); background: color-mix(in srgb, var(--green) 13%, transparent); }
.version-current svg { width: 15px; height: 15px; }
.update-status { color: var(--muted); font-size: 13px; margin: 12px 0; line-height: 1.6; }
.update-status.available { color: var(--amber); }
#version-upgrade { margin: 6px auto 12px; }
.version-release { display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--muted); font-size: 12px; margin: 20px auto 0; text-decoration: none; }
.version-release:hover, .update-actions a:hover, .update-guide:hover { color: var(--text); }
.version-menu-footer { display: flex; align-items: center; justify-content: space-between; text-align: left; width: 100%; padding: 13px 16px; border: 0; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--text) 2%, transparent); color: var(--muted); font-size: 11px; line-height: 1.8; }
.version-menu-footer:hover { background: var(--panel-2); color: var(--text); }
.version-menu-footer [data-update-time] { display: block; }
.update-error { color: var(--red); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; margin: 12px 0 0; }
.update-panel { border: 1px solid var(--line); border-radius: calc(10px * var(--radius-scale)); margin-bottom: 20px; background: var(--panel); }
.update-product { display: flex; align-items: center; gap: 20px; padding: 28px; }
.update-product > .mark { width: 64px; height: 64px; flex: none; padding: 10px; border-radius: calc(14px * var(--radius-scale)); background: var(--panel-2); }
.update-panel h3 { margin: 0 0 10px; font-size: 16px; font-weight: 600; }
.update-product h3 { font-size: 22px; letter-spacing: .03em; }
.update-product p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.update-product [data-update-version] { color: var(--text); margin-left: 6px; }
.update-detail { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(0, 2fr); gap: 28px; padding: 26px 28px; border-top: 1px solid var(--line); }
.update-detail > div > p { color: var(--muted); font-size: 12px; line-height: 1.8; margin: 0; max-width: 230px; }
.update-detail-main { min-width: 0; }
.update-detail .update-detail-main > p { max-width: none; margin: 12px 0; }
.update-detail .update-detail-main > .available { color: var(--amber); }
.update-detail .update-detail-main > .update-error { color: var(--red); }
.update-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 22px; }
.update-actions a, .update-guide { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; text-decoration: none; }
.update-meta { color: var(--muted); font-size: 11px !important; overflow-wrap: anywhere; }
.upgrade-progress { padding: 14px; margin: 14px 0; border: 1px solid var(--line); border-radius: calc(8px * var(--radius-scale)); }
.upgrade-progress p { margin: 0 0 10px; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
/* 升级进度：状态文字与百分比一行，下面是进度条、下载字节和九个步骤 */
.upgrade-meter-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.upgrade-meter-head #upgrade-message { min-width: 0; }
#upgrade-pct { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.upgrade-meter { margin: 0 0 8px; }
#upgrade-detail { margin: 0 0 10px; font-variant-numeric: tabular-nums; }
.upgrade-steps {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  margin: 4px 0 12px; padding: 0; list-style: none;
  font-size: 11.5px; color: var(--muted);
}
.upgrade-steps li { display: inline-flex; align-items: center; gap: 6px; }
/* 步骤前的小圆点：做完实心、进行中带光圈、失败转红 */
.upgrade-steps li::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none;
  border: 1.5px solid var(--line); box-sizing: border-box;
  transition: background-color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}
.upgrade-steps li.done { color: var(--text); }
.upgrade-steps li.done::before { background: var(--green); border-color: var(--green); }
.upgrade-steps li.current { color: var(--amber); font-weight: 600; }
.upgrade-steps li.current::before { background: var(--amber); border-color: var(--amber); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 22%, transparent); }
.upgrade-steps li.failed { color: var(--red); font-weight: 600; }
.upgrade-steps li.failed::before { background: var(--red); border-color: var(--red); }
.update-notes { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; font-size: 12px; }
.update-notes summary { cursor: pointer; color: var(--muted); }
/* 版本说明来自 GitHub Release 的 Markdown，按面板字号排得紧凑，颜色只用主题令牌。 */
.update-notes-body { margin-top: 12px; max-height: 440px; overflow-y: auto; padding-right: 8px; font: 12.5px/1.8 var(--sans); color: var(--text); overflow-wrap: anywhere; }
.update-notes-body > :first-child { margin-top: 0; }
.update-notes-body > :last-child { margin-bottom: 0; }
.update-notes-body :is(p, ul, ol, pre, blockquote, table, details) { margin: 0 0 10px; }
.update-notes-body :is(h1, h2, h3, h4, h5, h6) { margin: 18px 0 6px; font-size: 13px; font-weight: 600; line-height: 1.5; }
.update-notes-body :is(h1, h2) { font-size: 14px; }
.update-notes-body :is(ul, ol) { padding-left: 20px; }
.update-notes-body li + li { margin-top: 4px; }
.update-notes-body a { color: var(--amber); text-decoration: underline; text-underline-offset: 2px; }
.update-notes-body a:not([href]) { color: inherit; text-decoration: none; }
.update-notes-body code { font: 11.5px var(--mono); padding: 1px 5px; border-radius: calc(4px * var(--radius-scale)); background: var(--panel-2); }
.update-notes-body pre { padding: 10px 12px; border-radius: calc(8px * var(--radius-scale)); background: var(--panel-2); overflow-x: auto; white-space: pre; overflow-wrap: normal; }
.update-notes-body pre code { padding: 0; background: none; line-height: 1.7; }
.update-notes-body blockquote { padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }
.update-notes-body hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.update-notes-body img { max-width: 100%; height: auto; }
.update-notes-body table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.update-notes-body :is(th, td) { padding: 4px 10px; border: 1px solid var(--line); text-align: left; }
[data-update-check].checking svg { animation: version-spin 1s linear infinite; }
@keyframes version-spin { to { transform: rotate(360deg); } }
@media (min-width: 761px) {
  /* 68px 窄栏放不下版本号，收起时整块不显示，标题栏回到只有展开按钮的样子；
   * 有新版本时只在展开按钮角上留一个琥珀点，展开后从版本入口查看。 */
  :root[data-sidebar-collapsed="true"] .side-head:has(.version-badge:not(.hidden)) { display: flex; padding: 0; justify-content: center; }
  :root[data-sidebar-collapsed="true"] .side-head:has(.version-badge:not(.hidden)) .side-brand,
  :root[data-sidebar-collapsed="true"] .version-badge { display: none; }
  :root[data-sidebar-collapsed="true"] .side-head:has(.version-badge.has-update:not(.hidden)) .side-collapse { position: relative; }
  :root[data-sidebar-collapsed="true"] .side-head:has(.version-badge.has-update:not(.hidden)) .side-collapse::after {
    content: ""; position: absolute; top: 5px; right: 5px;
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--amber); box-shadow: 0 0 0 2px var(--panel);
  }
}
@media (max-width: 760px) {
  .side-head:has(.version-badge:not(.hidden)) { padding-inline: 16px; grid-template-columns: minmax(0, 1fr) 36px; }
  .update-product { padding: 20px; gap: 14px; }
  .update-detail { grid-template-columns: 1fr; padding: 20px; gap: 18px; }
  .update-detail > div > p { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  [data-update-check].checking svg { animation: none; }
  .version-badge { transition: none; }
}
