/* Top navigation, shell layout, iframe container, and shell overlay styles belong here. */

:root { --site-header-height: 61px; }

.site-shell {
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  display: grid;
  box-sizing: border-box;
  height: var(--site-header-height);
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.site-brand-button {
  display: grid;
  width: 123px;
  height: 48px;
  margin-left: 24px;
  padding: 8px 4px;
  place-items: center;
  border: 0;
  border-radius: var(--radius-card);
  background: transparent;
  cursor: pointer;
}

.site-brand-button:hover { background: var(--bg-soft); }
.site-brand-button img { display: block; width: 115px; height: 32px; }
:root[data-theme="dark"] .site-brand-button img:not([data-theme-src-dark]) { filter: brightness(0) invert(1); }

.site-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.site-nav .btn-text {
  min-width: auto;
  height: 36px;
  font-size: 15px;
  line-height: 24px;
  padding-inline: 12px;
  white-space: nowrap;
}

.site-nav .btn-text[aria-current="true"] {
  background: var(--bg-soft);
  color: var(--ink);
}

.site-header-actions {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 8px;
  margin-right: 24px;
  overflow: visible;
}

.site-header-actions .site-header-doc {
  gap: 4px;
  font-size: 15px;
}
.site-header-doc img { display: block; width: 16px; height: 16px; object-fit: contain; }
:root[data-theme="dark"] .site-header-doc img { filter: brightness(0) invert(1); }

/* 登录按钮：复用 Design System 文字按钮（.btn-text），仅此按钮调整字号、字重与文字色。 */
.site-header-actions .site-header-login,
.standalone-actions .site-header-login,
.site-auth .site-header-login { font-size: 15px; font-weight: 500; color: var(--ink-soft); }
.site-auth { display: inline-flex; align-items: center; flex: 0 0 auto; }
.site-auth .site-header-login.is-loading { opacity: 0.45; cursor: wait; }

/* 操作区按钮不收缩不折行，超宽时由断点规则收起次要项。 */
.site-header-actions > *,
.standalone-actions > * { flex: 0 0 auto; }
.site-header-actions .btn-text,
.site-header-actions .btn,
.site-header-actions .btn-primary,
.standalone-actions .btn-text,
.standalone-actions .btn,
.standalone-actions .btn-primary { white-space: nowrap; }
.site-header-login[hidden] { display: none; }

/* 用户头像：36×36 圆形，--ink 底 + 浅色首字 / 远程头像。 */
.user-cta { position: relative; display: inline-flex; }
.user-cta[hidden] { display: none; }
.site-header-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font: 500 15px/15px "Noto Serif SC", "InkStone Han Serif SC Common", serif;
  text-align: center;
  cursor: pointer;
  user-select: none;
}
.site-header-avatar-img {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 50%;
}
.site-header-avatar-text { display: block; line-height: 1; }

/* 用户菜单：头像 hover / 键盘 focus 展开。 */
.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: none;
  box-sizing: border-box;
  width: 185px;
  padding: 8px;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: 0 8px 16px color-mix(in srgb, var(--ink) 12%, transparent);
}
.user-cta:hover .user-menu,
.user-cta:focus-within .user-menu { display: flex; }
.user-cta:hover::before,
.user-cta:focus-within::before {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  height: 8px;
  content: "";
}
.user-menu-name { display: block; padding: 8px 12px; color: var(--ink); font: 500 14px/20px var(--font-sans); }
.user-menu-item {
  display: flex;
  box-sizing: border-box;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  align-items: center;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-soft);
  font: 400 14px/20px var(--font-sans);
  text-align: left;
  cursor: pointer;
}
.user-menu-item:hover,
.user-menu-item:focus-visible { background: var(--bg-soft-1); outline: none; }
.site-header-actions .site-header-action {
  height: 32px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 24px;
}
.site-header-actions .site-header-download {
  height: 32px;
  padding: 8px 12px;
  border-radius: var(--radius-card);
  font-size: 14px;
  line-height: 16px;
}

.site-header .site-header-action {
  justify-self: end;
}

.site-header .site-menu-button { display: none; justify-self: end; margin-right: 12px; }

.site-main {
  position: fixed;
  inset: var(--site-header-height) 0 0;
  height: auto;
  overflow: hidden;
}

.site-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--bg);
}

.tm-panel.cooperation-panel { max-width: 800px; }
.cooperation-panel .tm-body { gap: 16px; }
.cooperation-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.tm-error-message { min-height: 18px; margin: 0; color: var(--state-danger); font-size: 12px; line-height: 18px; }

/* SCP-Lab 申请使用弹窗：静态邮件申请提示（shell 与 Home 本地弹窗共用）。 */
.tm-panel.scplab-panel {
  max-width: 480px;
  padding: 16px 20px;
  gap: 16px;
  box-shadow: 0 12px 28px 0 rgb(26 35 50 / 12%);
}
:root[data-theme="dark"] .tm-panel.scplab-panel { box-shadow: 0 12px 28px 0 rgb(0 0 0 / 56%); }
.scplab-panel .scplab-header { display: flex; align-items: center; justify-content: space-between; }
.scplab-panel .scplab-title { margin: 0; color: var(--ink); font: 500 16px/24px var(--font-sans); }
.scplab-panel .tm-close svg { width: 16px; height: 16px; }
.scplab-panel .scplab-body { display: flex; min-height: 0; flex-direction: column; gap: 24px; overflow-y: auto; }
.scplab-panel .scplab-hint { margin: 0; color: var(--ink-soft); font-size: 16px; line-height: 24px; }
.scplab-panel .scplab-template { display: flex; flex-direction: column; gap: 16px; padding: 16px 0; border: 1px solid var(--line-soft); border-radius: var(--radius-card); background: var(--bg); }
.scplab-panel .scplab-template-part { display: flex; padding: 0 16px; align-items: flex-start; gap: 8px; }
.scplab-panel .scplab-part-text { display: flex; min-width: 0; flex: 1 1 auto; flex-direction: column; gap: 4px; }
.scplab-panel .scplab-part-label { color: var(--muted); font-size: 14px; line-height: 24px; }
.scplab-panel .scplab-part-content { margin: 0; color: var(--ink-soft); font: 400 14px/24px var(--font-sans); white-space: pre-wrap; word-break: break-word; }
.scplab-panel .scplab-template-divider { height: 0; border-top: 1px solid var(--line-soft); }
.scplab-panel .scplab-copy { display: inline-flex; height: 32px; padding: 6px 12px; align-items: center; justify-content: center; gap: 4px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); color: var(--ink-soft); font: 400 13px/20px var(--font-sans); cursor: pointer; transition: background-color var(--component-motion-fast), color var(--component-motion-fast); flex: 0 0 auto; }
.scplab-panel .scplab-copy:hover { background: var(--component-button-bg-hover); color: var(--ink); }
.scplab-panel .scplab-copy:focus-visible { outline: 2px solid var(--component-focus-ring); outline-offset: 2px; }
.scplab-panel .scplab-copy img { display: block; width: 16px; height: 16px; }
:root[data-theme="dark"] .scplab-panel .scplab-copy img { filter: brightness(0) invert(1); }
.scplab-panel .scplab-footer { display: flex; justify-content: flex-end; gap: 12px; padding-top: 16px; }
.scplab-panel .scplab-footer .tm-btn { height: 32px; padding: 6px 12px; border-radius: var(--radius); font-size: 13px; line-height: 20px; letter-spacing: 0; }

#home-local-scp-lab-dialog { width: min(460px, calc(100% - 32px)); }

/* MVSP 提交问题表单（内容来源：MVSP 科学问题提交表单.pdf；shell 与 Home 本地弹窗共用）。 */
.mvsp-panel .tm-body { gap: 24px; padding-top: 0; }
.mvsp-intro { margin: 20px 0 0; padding: 12px 16px; border: 1px solid var(--line-soft); border-radius: var(--radius-card); background: var(--bg-soft-1); color: var(--ink-soft); font-size: 13px; line-height: 1.7; }
.mvsp-intro-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.mvsp-intro-title { color: var(--ink); font-weight: 600; }
.mvsp-intro-link { min-height: 20px; flex: 0 0 auto; font-size: 13px; }
.mvsp-section { display: flex; padding-top: 24px; border-top: 1px solid var(--line-soft); flex-direction: column; gap: 24px; }
.mvsp-section[data-mvsp-section="team"] { border-top: 0; }
.mvsp-section-title { display: flex; margin: 0; align-items: baseline; gap: 8px; color: var(--ink); font: 600 16px/24px var(--font-sans); }
.mvsp-section-title > span { color: var(--muted-2); font: 500 16px/24px var(--font-sans); letter-spacing: .08em; }
.mvsp-field-hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 18px; }

/* 锚点条：介绍与 01 分区之间，滚动时在表单滚动区吸顶；左右贯通填满滚动区内边距。 */
.mvsp-anchor-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-inline: -22px;
  padding: 6px 22px 8px;
  background: var(--paper);
}
.mvsp-panel .mvsp-anchor { height: 32px; min-height: 32px; padding: 4px 10px; font-size: 13px; }
.mvsp-anchor[aria-current="true"] { background: var(--bg-soft); color: var(--ink); }

@media (max-width: 599px) {
  .mvsp-anchor-bar { margin-inline: -16px; padding-inline: 16px; }
}

/* MVSP「了解详情」底部抽屉：自下而上弹出，叠在页面与其他弹窗之上（Figma 1289:40516）。 */
.mvsp-drawer { position: fixed; inset: 0; z-index: 300; visibility: hidden; transition: visibility 0s linear .34s; }
.mvsp-drawer.is-open { visibility: visible; transition-delay: 0s; }
dialog.mvsp-drawer { display: block; width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; }
dialog.mvsp-drawer:not([open]) { display: none; }
.mvsp-drawer-mask { position: absolute; inset: 0; background: var(--component-overlay-bg); opacity: 0; backdrop-filter: blur(2.5px); -webkit-backdrop-filter: blur(2.5px); transition: opacity .24s ease; }
.mvsp-drawer.is-open .mvsp-drawer-mask { opacity: 1; }
.mvsp-drawer-panel { position: absolute; right: 0; bottom: 0; left: 0; display: flex; height: calc(100vh - 40px); height: calc(100dvh - 40px); flex-direction: column; border-radius: 12px 12px 0 0; background: var(--bg); box-shadow: var(--component-dialog-shadow); transform: translateY(100%); transition: transform .32s cubic-bezier(.32, .72, .35, 1); }
.mvsp-drawer.is-open .mvsp-drawer-panel { transform: translateY(0); }
body.has-open-mvsp-drawer { overflow: hidden; }
.mvsp-drawer-top { display: flex; height: 24px; margin: 16px 40px 0; align-items: center; justify-content: flex-end; flex: 0 0 auto; }
.mvsp-drawer-close svg { width: 16px; height: 16px; }
.mvsp-drawer-body { min-height: 0; margin-top: 16px; padding: 0 40px; overflow-y: auto; flex: 1 1 auto; }
.mvsp-drawer-content { display: flex; max-width: 880px; margin: 0 auto; padding-bottom: 40px; flex-direction: column; gap: 40px; }
.mvsp-drawer-hero { display: flex; flex-direction: column; gap: 24px; }
.mvsp-drawer-hero-title { display: flex; flex-direction: column; gap: 8px; }
.mvsp-drawer-hero h2 { margin: 0; color: var(--ink); font-family: var(--font-serif-cjk); font-size: 28px; font-weight: 700; letter-spacing: .02em; line-height: 1.35; }
.mvsp-drawer-subtitle { margin: 0; color: var(--ink); font: 600 16px/1.45 var(--font-sans); }
.mvsp-drawer-lead { margin: 0; color: var(--ink); font-size: 14px; line-height: 24px; }
.mvsp-drawer-section { display: flex; flex-direction: column; gap: 12px; }
.mvsp-drawer-section > h3 { display: flex; margin: 0; align-items: center; gap: 8px; color: var(--ink); font: 500 18px/28px var(--font-sans); }
.mvsp-drawer-section > h3 > i { width: 4px; height: 20px; border-radius: 2px; background: var(--ink-soft); }
.mvsp-drawer-section p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 24px; }
.mvsp-drawer-section strong { font-weight: 500; }
.mvsp-drawer-block { display: flex; flex-direction: column; gap: 4px; }
.mvsp-drawer-section p.mvsp-drawer-formula { color: var(--ink); font-weight: 500; }
.mvsp-drawer-levels { display: flex; margin: 0; padding: 0 0 0 20px; flex-direction: column; gap: 4px; }
.mvsp-drawer-levels li { padding-left: 2px; color: var(--ink-soft); font-size: 14px; line-height: 24px; }
.mvsp-drawer-levels li::marker { color: var(--muted-2); }
.mvsp-drawer-actions { display: flex; justify-content: flex-start; }
.mvsp-drawer-actions .btn-primary { height: 32px; padding: 6px 12px; border-radius: 6px; font-size: 13px; font-weight: 500; }

@media (max-width: 599px) {
  .mvsp-drawer-panel { height: calc(100vh - 24px); height: calc(100dvh - 24px); }
  .mvsp-drawer-top { margin-inline: 16px; }
  .mvsp-drawer-body { padding-inline: 16px; }
  .mvsp-drawer-hero h2 { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .mvsp-drawer,
  .mvsp-drawer-mask,
  .mvsp-drawer-panel { transition: none; }
}

/* MVSP 提交前二次确认弹窗：层级高于表单弹窗（200）、低于了解详情抽屉（300）。 */
.mvsp-confirm-overlay { z-index: 260; }
dialog.mvsp-confirm-overlay { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; border: 0; background: transparent; }
.mvsp-confirm-panel { max-width: 400px; }
.mvsp-confirm-desc { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 24px; }

/* 字段外壳对齐 Storybook FormField 规范（label/必填星/弱提示/错误文字）。 */
.mvsp-panel .tm-field { gap: 6px; }
/* 项目之间 32px（分区标题到首个项目仍由 .mvsp-section 的 gap 保持 24px）。 */
.mvsp-panel .mvsp-section > .tm-field + .tm-field { margin-top: 8px; }
.mvsp-panel .tm-label { font-size: 14px; font-weight: 600; }
.mvsp-panel fieldset.tm-field { display: block; }
.mvsp-panel fieldset.tm-field > legend { float: left; width: 100%; margin: 0 0 6px; padding: 0; }
.mvsp-panel fieldset.tm-field > .tm-checks,
.mvsp-panel fieldset.tm-field > .tm-radios,
.mvsp-panel fieldset.tm-field > .tm-field-error,
.mvsp-panel fieldset.tm-field > .mvsp-subfield,
.mvsp-panel fieldset.tm-field > .mvsp-field-hint { clear: both; }
.mvsp-panel fieldset.tm-field > .mvsp-field-hint { margin: 0 0 12px; }
.mvsp-panel .mvsp-subfield { margin-top: 6px; }
.mvsp-panel .tm-radios > .mvsp-subfield { margin-top: 0; }
.mvsp-panel .tm-checks,
.mvsp-panel .tm-radios { margin-top: 0; }
.mvsp-panel [data-mvsp-group="cooperationContext"] > .tm-checks { gap: 24px; }
.mvsp-panel .tm-input { height: 36px; padding-block: 6px; border-radius: 6px; }
.mvsp-panel .tm-textarea { border-radius: 6px; }
/* 覆盖浏览器自动填充的蓝底，保持白底。 */
.mvsp-panel .tm-input:-webkit-autofill,
.mvsp-panel .tm-input:-webkit-autofill:hover,
.mvsp-panel .tm-input:-webkit-autofill:focus { -webkit-box-shadow: 0 0 0 1000px var(--paper) inset; -webkit-text-fill-color: var(--ink); caret-color: var(--ink); transition: background-color 9999s ease-out; }
.mvsp-panel .tm-input::placeholder,
.mvsp-panel .tm-textarea::placeholder { color: var(--muted-2); font-size: 13px; font-weight: 400; }
.mvsp-panel .tm-req { margin-left: 2px; }
.mvsp-panel .tm-opt { margin-left: 8px; font-size: 12px; font-weight: 400; letter-spacing: 0; }
.mvsp-panel .tm-field-error { margin: 0; font-size: 12px; line-height: 1.5; }

/* 选项内信息图标的提示右对齐，避免浮层被弹窗边缘裁掉。 */
.tm-radio .mvsp-info { flex: 0 0 auto; margin-left: 0; align-self: center; }

.mvsp-subfield[hidden] { display: none; }

/* 信息图标 hover 提示。 */
.mvsp-info { position: relative; display: inline-grid; width: 16px; height: 16px; margin-left: 4px; place-items: center; color: var(--muted-2); cursor: help; vertical-align: -2px; }
.mvsp-info svg { width: 14px; height: 14px; }
.mvsp-tooltip {
  position: absolute;
  top: 50%;
  bottom: auto;
  left: calc(100% + 8px);
  z-index: 40;
  transform: translateY(-50%);
  display: none;
  box-sizing: border-box;
  width: max-content;
  max-width: 380px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: var(--component-dialog-shadow);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.7;
  text-align: left;
}
.mvsp-tooltip strong { color: var(--ink); }
.mvsp-info:hover .mvsp-tooltip,
.mvsp-info:focus-within .mvsp-tooltip { display: block; }

/* ZIP 任务包上传（模拟上传过程）。 */
/* 上传组件：默认/悬浮/上传中/成功/失败五态，还原 Figma 节点 1288:40000（虚线 1px、圆角 6px、底色 --bg-soft-1）。 */
.mvsp-upload { --mvsp-upload-accent: #1554a8; display: flex; padding: 32px 24px; border: 1px dashed var(--line); border-radius: 6px; background: var(--bg-soft-1); flex-direction: column; transition: border-color var(--component-motion-fast); }
:root[data-theme="dark"] .mvsp-upload { --mvsp-upload-accent: #7aa5e8; }
.mvsp-upload:has([data-mvsp-upload-btn]:not([hidden])):hover,
.mvsp-upload.is-dragover { border-color: var(--mvsp-upload-accent); }
.mvsp-upload:has([data-mvsp-upload-btn]:not([hidden])) { cursor: pointer; }
.mvsp-upload.is-error { border-color: var(--state-danger); }
.mvsp-upload-state { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.mvsp-upload-state[hidden] { display: none; }
.mvsp-upload-ico { width: 48px; height: 48px; flex: 0 0 48px; }
.mvsp-upload-idle .mvsp-upload-ico { color: var(--muted-2); }
.mvsp-upload-loading .mvsp-upload-ico { color: var(--ink-soft); }
.mvsp-upload-done .mvsp-upload-ico { color: var(--success); }
.mvsp-upload-failed .mvsp-upload-ico { color: var(--state-danger); }
.mvsp-upload-idle:focus-visible { outline: 2px solid var(--component-focus-ring); outline-offset: 2px; border-radius: 6px; }
.mvsp-upload-spin { animation: mvsp-upload-spin .9s linear infinite; transform-origin: 50% 50%; }
@keyframes mvsp-upload-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .mvsp-upload-spin { animation: none; } }
.mvsp-upload-title { margin: 0; color: var(--ink); font: 600 16px/24px var(--font-sans); }
.mvsp-upload-hint { margin: 0; color: var(--muted); font-size: 13px; line-height: 20px; }
.mvsp-upload-text { margin: 0; color: var(--ink); font-size: 14px; line-height: 24px; word-break: break-all; }
.mvsp-upload-meta { margin: 0; color: var(--muted); font-size: 13px; line-height: 20px; }
.mvsp-upload-action { padding: 0; border: 0; background: none; color: var(--mvsp-upload-accent); font: 400 14px/1.6 var(--font-sans); cursor: pointer; }
.mvsp-upload-action:hover { text-decoration: underline; }

/* 任务包说明折叠区。 */
.mvsp-details { border: 1px solid var(--line-soft); border-radius: var(--radius-card); background: var(--bg-soft-1); }
.mvsp-details summary { display: flex; padding: 10px 14px; align-items: center; gap: 6px; color: var(--ink-soft); font-size: 13px; cursor: pointer; list-style: none; }
.mvsp-details summary::-webkit-details-marker { display: none; }
.mvsp-details summary::before { content: ""; display: block; width: 6px; height: 6px; border-top: 1.5px solid var(--muted); border-right: 1.5px solid var(--muted); transform: rotate(45deg); transition: transform var(--component-motion-fast); }
.mvsp-details[open] summary::before { transform: rotate(135deg); }
.mvsp-details-body { display: flex; padding: 0 14px 12px; flex-direction: column; gap: 8px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.mvsp-details-body p { margin: 0; }
.mvsp-details-body pre { margin: 0; padding: 10px 12px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); color: var(--ink-soft); font: 400 12px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.rex-task-package-guide {
  --rex-template-button-width: 184px;
  position: relative;
}
.rex-task-package-guide .mvsp-details summary {
  box-sizing: border-box;
  width: calc(100% - var(--rex-template-button-width) - 10px);
  min-height: 48px;
  color: var(--ink);
}
.rex-task-package-guide .mvsp-details summary::before { flex-shrink: 0; }
.rex-task-package-guide .mvsp-details-body { color: var(--ink-soft); }
.rex-task-package-guide .rex-task-package-download {
  position: absolute;
  inset-block-start: 6px;
  inset-inline-end: 6px;
  box-sizing: border-box;
  width: var(--rex-template-button-width);
  white-space: nowrap;
}
.rex-task-package-link { gap: 6px; }
.rex-download-icon {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  background: currentColor;
  mask: url("../assets/icons/download.svg") center / contain no-repeat;
}


/* 窄桌面优先收起帮助中心与下载 CTA（Footer 与导航锚点可达），保证操作区不挤压折行。 */
@media (max-width: 1259px) {
  .site-header-actions .site-header-doc,
  .site-header-actions .site-header-download,
  .site-header-actions [data-download-cta] { display: none; }
}

@media (max-width: 959px) {
  .site-header { grid-template-columns: 1fr auto auto; }
  .site-header-actions { margin-right: 12px; }
  .site-nav {
    position: absolute;
    top: calc(100% + 1px);
    right: 12px;
    display: none;
    width: min(280px, calc(100vw - 24px));
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    background: var(--paper);
    box-shadow: var(--component-dialog-shadow);
    flex-direction: column;
    align-items: stretch;
  }
  .site-nav.is-open { display: flex; }
  .site-nav .btn-text { justify-content: flex-start; }
  .site-header .site-menu-button { display: inline-grid; }
}

@media (max-width: 599px) {
  .site-brand-button { width: 112px; margin-left: 8px; }
  .site-brand-button img { width: 105px; height: auto; }
  /* 窄屏收起次要操作，保留登录/头像可达 */
  .site-header-actions {
    display: flex;
    margin-right: 4px;
  }
  .site-header-actions > *:not([data-site-auth]) { display: none !important; }
}
