:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --ink: #202124;
  --muted: #5f6368;
  --line: #dadce0;
  --line-strong: #bdc1c6;
  --hover: #f1f3f4;
  --active: #202124;
  --active-ink: #ffffff;
  --preview-bg: #f8f9fa;
  --radius: 4px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Roboto", "Helvetica Neue", sans-serif;
  --mono: "Roboto Mono", ui-monospace, monospace;
  /* Match home brand title (Syne / Noto Serif SC) */
  --font-brand: "Syne", "Noto Serif SC", "Songti SC", serif;
  --header-h: 56px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* Hide until applyI18n() — also injected by i18n-boot.js for first paint */
html.i18n-pending,
html.i18n-pending body {
  visibility: hidden;
}

html.i18n-ready,
html.i18n-ready body {
  visibility: visible;
}

body {
  display: flex;
  flex-direction: column;
}

a {
  color: var(--ink);
}

.top {
  height: var(--header-h);
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  flex-shrink: 0;
  box-sizing: border-box;
}

.top h1 {
  display: flex;
  align-items: flex-start;
  margin: 0;
  font-family: var(--font-brand);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
  position: relative;
}

.top h1 .brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
  color: inherit;
  text-decoration: none;
  padding-top: 2px;
}

.top h1 .brand-link:hover {
  text-decoration: none;
}

.top h1 .brand-link:hover .brand-text {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.brand-mark {
  display: block;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.brand-text {
  display: block;
  line-height: 22px;
  height: 22px;
}

.top .meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 28vw;
}

.top-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.top .nav-link {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 20px;
  border: 0;
  line-height: 1.2;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.top .nav-link:hover {
  color: var(--ink);
  background: rgba(60, 64, 67, 0.08);
}

.top .nav-link.is-active {
  color: var(--ink);
  background: rgba(60, 64, 67, 0.12);
}

/* Corner mark on brand title (top-right of Geometry Lab) */
.badge {
  flex-shrink: 0;
  margin: -2px 0 0 3px;
  padding: 0 4px;
  font-family: var(--font);
  font-size: 8px;
  font-weight: 500;
  line-height: 1.45;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.search {
  margin-left: auto;
  width: min(420px, 36vw);
}

.search input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 24px;
  font: inherit;
  font-size: 14px;
  background: var(--preview-bg);
  outline: none;
}

.search input:focus {
  border-color: var(--ink);
  background: var(--panel);
}

/* Header account chip — same voice as .nav-link / soft header controls */
.auth-user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  height: 30px;
  margin: 0;
  padding: 0 4px 0 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--preview-bg);
  font-size: 13px;
  line-height: 1.2;
}

.auth-user:has(> .auth-login-btn:only-child) {
  padding: 0;
  border: 0;
  background: transparent;
}

.auth-user-label {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.actions .auth-logout-btn,
.actions .auth-login-btn,
.auth-logout-btn,
.auth-login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  margin: 0;
  padding: 0 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.actions .auth-login-btn,
.auth-login-btn {
  height: 30px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
  font-size: 13px;
  color: var(--muted);
}

.actions .auth-logout-btn:hover,
.actions .auth-login-btn:hover,
.auth-logout-btn:hover,
.auth-login-btn:hover {
  color: var(--ink);
  background: rgba(60, 64, 67, 0.08);
  border-color: var(--line);
}

.actions .auth-login-btn:hover,
.auth-login-btn:hover {
  border-color: var(--line-strong);
  background: var(--hover);
}

.auth-gate-error {
  padding: 16px 20px;
  background: #fce8e6;
  color: #c5221f;
  font-size: 13px;
}

.auth-gate-error a {
  color: #c5221f;
  font-weight: 500;
}

/* Language slider — 中文 | EN segmented switch */
.lang-toggle {
  display: inline-flex;
  flex-shrink: 0;
  margin-left: 4px;
  align-items: center;
}

.lang-switch {
  --lang-switch-h: 30px;
  --lang-switch-pad: 2px;
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  height: var(--lang-switch-h);
  min-width: 92px;
  padding: var(--lang-switch-pad);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--preview-bg, #f1f3f4);
  box-sizing: border-box;
  user-select: none;
}

.lang-switch-thumb {
  position: absolute;
  top: var(--lang-switch-pad);
  left: var(--lang-switch-pad);
  z-index: 0;
  width: calc(50% - var(--lang-switch-pad));
  height: calc(100% - 2 * var(--lang-switch-pad));
  border-radius: 999px;
  background: var(--panel, #fff);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.18);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.lang-switch.is-en .lang-switch-thumb {
  transform: translateX(100%);
}

.lang-switch-opt {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease;
}

.lang-switch-opt.is-active {
  color: var(--ink);
  font-weight: 600;
}

.lang-switch-opt:hover:not(.is-active) {
  color: var(--ink);
}

.lang-switch-opt:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .lang-switch-thumb {
    transition: none;
  }
}

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  /* Tree · List · Preview · Parameters */
  grid-template-columns:
    minmax(160px, 14%) minmax(260px, 24%) minmax(360px, 1fr) minmax(280px, 26%);
  gap: 0;
}

.panel-params {
  background: var(--panel);
}

.params-panel {
  padding: 12px 14px 24px;
  overflow: auto;
  height: calc(100% - 45px);
}

.params-panel.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 20px 16px;
}

.panel {
  min-height: 0;
  overflow: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.panel:last-child {
  border-right: none;
}

.panel h2 {
  margin: 0;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}

.panel h2 #count {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 6px;
}

.tree {
  padding: 8px 10px 16px;
  font-size: 13px;
}

.tree details {
  margin-left: 8px;
}

.tree > details {
  margin-left: 0;
}

.tree summary {
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius);
  list-style-position: outside;
  color: var(--ink);
}

.tree summary:hover,
.tree .doc:hover,
.list-item:hover {
  background: var(--hover);
}

.tree .doc,
.list-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  cursor: pointer;
  padding: 4px 8px 4px 18px;
  border-radius: var(--radius);
}

.tree .doc.active,
.list-item.active {
  background: var(--active);
  color: var(--active-ink);
}

.list {
  padding: 8px 10px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.list-item {
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.list-item .name {
  font-weight: 500;
  font-size: 13px;
}

.list-item .desc {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.list-item.active .desc {
  color: rgba(255, 255, 255, 0.72);
}

.list-item .tags {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.tag {
  font-size: 10px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.list-item.active .tag {
  border-color: rgba(255, 255, 255, 0.35);
  color: rgba(255, 255, 255, 0.85);
}

.detail {
  padding: 16px 20px 28px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.detail.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 24px 20px;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.detail h3 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 400;
}

.detail .desc {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.thumb-wrap {
  display: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 1;
  justify-content: flex-end;
  max-width: 100%;
}

.actions button,
.actions .btn-link {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--ink);
  border-radius: 2px;
  padding: 7px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  letter-spacing: 0.01em;
}

.actions button:hover,
.actions .btn-link:hover {
  background: var(--hover);
  border-color: var(--ink);
}

.actions .btn-link.primary {
  background: var(--ink);
  color: var(--active-ink);
  border-color: var(--ink);
}

.top-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.top-check input {
  width: 14px;
  height: 14px;
  accent-color: var(--ink);
}

.actions .btn-link.primary:hover {
  background: #000;
}

.download-menu {
  position: relative;
  display: inline-flex;
}

.actions .download-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px 0 11px;
  border: none;
  border-radius: 15px;
  background: #1a73e8;
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.actions .download-trigger:hover {
  background: #1765cc;
  border-color: transparent;
}

.actions .download-trigger:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}

.actions .download-trigger:active {
  background: #1558b0;
}

.download-menu.is-open .download-trigger {
  background: #1558b0;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.2);
}

.download-trigger .download-icon {
  flex-shrink: 0;
  opacity: 0.95;
}

.download-trigger .download-caret {
  flex-shrink: 0;
  margin-left: 0;
  opacity: 0.85;
  transition: transform 0.15s ease;
}

.download-menu.is-open .download-caret {
  transform: rotate(180deg);
}

.download-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 11.5rem;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow:
    0 1px 2px rgba(60, 64, 67, 0.1),
    0 4px 16px rgba(60, 64, 67, 0.14);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.download-dropdown[hidden] {
  display: none !important;
}

.actions .download-dropdown button {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  letter-spacing: 0.01em;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.actions .download-dropdown button:hover {
  background: rgba(26, 115, 232, 0.08);
  color: #174ea6;
  border-color: transparent;
}

.actions .download-dropdown button:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: -2px;
}

.actions .download-dropdown .dl-fmt {
  font-weight: 500;
}

.actions .download-dropdown .dl-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}

.actions .download-dropdown button:hover .dl-hint {
  color: #174ea6;
  opacity: 0.75;
}

.actions .download-dropdown button[hidden] {
  display: none !important;
}

.geo-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--preview-bg);
  padding: 12px;
  margin-bottom: 16px;
  min-height: 420px;
  height: clamp(420px, 58vh, 720px);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.geo-preview.hidden {
  display: none !important;
}

.geo-preview svg {
  width: 100%;
  height: 100%;
  max-height: 100%;
}

.geo-preview .placeholder {
  color: var(--muted);
  font-size: 13px;
}

.kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 6px 12px;
  font-size: 12px;
  margin-bottom: 16px;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  word-break: break-all;
}

.section-title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title .hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--line-strong);
}

table.params {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 12px;
}

table.params th,
table.params td {
  border-bottom: 1px solid var(--line);
  padding: 8px 6px;
  text-align: left;
  vertical-align: top;
}

table.params th {
  color: var(--muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

table.params td.mono {
  font-family: var(--mono);
  font-size: 11px;
}

.status-pill {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 2px;
  border: 1px solid var(--line);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.status-pill.both {
  border-color: var(--ink);
  color: var(--ink);
}

.status-pill.catalog_only {
  border-color: var(--line-strong);
  color: var(--muted);
}

.status-pill.generator_only {
  background: var(--preview-bg);
  color: var(--ink);
}

.note {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--preview-bg);
  font-size: 12px;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

/* Author `display:` rules (e.g. .canvas-bar-check) beat the UA [hidden]
   stylesheet — keep the HTML hidden attribute authoritative. */
[hidden] {
  display: none !important;
}

/* Parametric Studio: tree | preview | parameters */
.studio-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, 280px) 1fr minmax(280px, 300px);
}

.studio-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
}

.studio-side .section-title {
  padding: 0;
  margin-bottom: 0;
}

.studio-nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 0 16px;
  flex-shrink: 0;
}

.nav-mode {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.nav-mode-btn {
  border: 1px solid var(--line);
  background: var(--preview-bg);
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: var(--radius);
}

.nav-mode-btn + .nav-mode-btn {
  margin-left: 0;
}

.nav-mode-btn.is-active {
  background: var(--active);
  border-color: var(--active);
  color: var(--active-ink);
}

.nav-mode-btn:hover:not(.is-active) {
  background: var(--hover);
  color: var(--ink);
}

.studio-search {
  display: block;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.studio-side .picker-nav {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 4px 0 12px;
}

.studio-search input {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 24px;
  font: inherit;
  font-size: 13px;
  background: var(--preview-bg);
  outline: none;
}

.studio-search input:focus {
  border-color: var(--ink);
  background: var(--panel);
}

.studio-side .tree {
  flex: 1;
  min-height: 0;
  overflow: auto;
  /* Keep left pad so <details> disclosure markers are not clipped */
  padding: 4px 10px 12px 14px;
}

.studio-side .tree summary {
  list-style-position: inside;
  padding-left: 2px;
}

.studio-side .tree .doc {
  padding-left: 22px;
}

.studio-head {
  display: none !important;
}

.scheme-status {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 160px;
  margin-right: 4px;
  padding: 0 8px;
  height: 24px;
  line-height: 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scheme-status.is-active {
  color: var(--ink);
  background: var(--preview-bg);
  border-color: var(--line);
}

.studio-app .scheme-status {
  max-width: 140px;
}

.inspector-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  flex-shrink: 0;
  min-height: 36px;
}

.inspector-bar-label {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.inspector-bar .pick-inspector {
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.inspector-bar-opts {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 4px;
  margin-left: auto;
}

.inspector-bar-opts .top-check {
  margin-left: 0;
  white-space: nowrap;
}

.studio-params .empty,
.preview .canvas.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 16px;
}

/* Studio / param panels: catalog | preview | parameters */
.lab-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 300px) 1fr minmax(280px, 320px);
}

.lab-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
}

.lab-picker {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.picker-current {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--preview-bg);
}

.picker-crumb {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}

.picker-title {
  font-size: 16px;
  font-weight: 400;
  color: var(--ink);
}

.picker-id {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.picker-search {
  display: block;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.picker-search input {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 24px;
  font: inherit;
  font-size: 13px;
  background: var(--preview-bg);
  outline: none;
}

.picker-search input:focus {
  border-color: var(--ink);
  background: var(--panel);
}

.picker-nav {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 4px 0 12px;
}

.picker-major {
  margin-top: 4px;
}

.picker-major-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px 6px;
  border: 0;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  text-align: left;
}

.picker-major-head:hover {
  background: var(--hover);
}

.picker-major-head .count {
  font-weight: 400;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.picker-major.collapsed .picker-mid {
  display: none;
}

.picker-mid {
  margin: 0 0 6px;
  padding: 0 0 6px;
  border-bottom: 1px solid var(--line);
}

.picker-mid:last-child {
  border-bottom: none;
}

.picker-mid-head {
  padding: 6px 14px 4px 18px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.picker-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 7px 14px 7px 22px;
  cursor: pointer;
  border-radius: 0;
}

.picker-item:hover {
  background: var(--hover);
}

.picker-item.active {
  background: var(--active);
  color: var(--active-ink);
}

.picker-item .sub {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
  font-family: var(--mono);
}

.picker-item-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
}

.picker-item-label {
  min-width: 0;
}

.picker-zh-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  align-items: center;
}

.picker-zh-tag {
  display: inline-block;
  padding: 0 5px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: var(--preview-bg, #f8f9fa);
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0;
  white-space: nowrap;
}

.picker-item.active .picker-zh-tag {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  opacity: 0.9;
}

.picker-item.active .sub {
  color: rgba(255, 255, 255, 0.65);
}

.picker-empty {
  padding: 20px 16px;
  font-size: 13px;
  color: var(--muted);
}

.lab-params {
  --params-ctrl-h: 28px;
  --params-gap: 8px;
  --params-ease: cubic-bezier(0.22, 1, 0.36, 1);
  min-height: 0;
  overflow: auto;
  /* No top padding — sticky tabs own the top edge so scrolled text cannot leak above */
  padding: 0 12px 16px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
}

.params-sheets {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  flex: 1;
}

/* Underline tabs — Google density, no boxed chrome */
.params-sheet-tabs {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 0;
  padding: 8px 0 0;
  margin: 0 0 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 4;
  /* Seal any sub-pixel gap above the sticky bar while content scrolls */
  box-shadow: 0 -12px 0 0 var(--panel);
}

.params-sheet-tab {
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin: 0 0 -1px;
  padding: 7px 4px 6px;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.params-sheet-tab--primary {
  font-weight: 500;
}

.params-sheet-tab:hover:not(.is-active) {
  color: var(--ink);
  background: transparent;
}

.params-sheet-tab.is-active {
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  border-bottom-color: var(--ink);
  font-weight: 500;
}

.params-sheet-tab:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}

.params-sheet-panels {
  min-height: 0;
}

.params-sheet[hidden] {
  display: none !important;
}

.params-sheet.is-active {
  display: block;
}

.params-sheet-note {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.params-sheet-hint,
.params-sheet-lead {
  margin: 4px 0 8px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.display-fold {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 4px;
}

.display-fold-summary {
  list-style: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 0;
  user-select: none;
}

html[lang^="zh"] .display-fold-summary {
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
}

.display-fold-summary::-webkit-details-marker {
  display: none;
}

.display-fold-summary::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-right: 6px;
  border-left: 4px solid var(--muted);
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  vertical-align: 1px;
}

.display-fold[open] > .display-fold-summary::before {
  transform: rotate(90deg);
  transform-origin: 35% 50%;
}

.display-fold-body {
  padding: 2px 0 4px;
}

.lab-params .section-title {
  margin-bottom: 2px;
}

.picker-prov {
  display: none;
}

.lab-params .param-field {
  margin: 0;
  min-width: 0;
}

.lab-params .param-field[hidden],
.lab-params .param-field.param-filter-hide {
  display: none !important;
}

/* Field labels — quiet, compact (Material settings density) */
.lab-params .param-field > label,
.studio-tools label:not(.top-check) > span {
  display: block;
  font-size: 11px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  margin: 0 0 4px;
  line-height: 1.25;
}

.lab-params .param-field > label.is-zh {
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  font-weight: 400;
}

.lab-params input:not([type="range"]):not([type="checkbox"]):not([type="file"]),
.lab-params select,
.studio-tools input:not([type="checkbox"]):not([type="range"]):not([type="file"]),
.studio-tools select {
  width: 100%;
  height: var(--params-ctrl-h, 28px);
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  background: var(--preview-bg, #f8f9fa);
  color: var(--ink);
  transition:
    border-color 0.15s var(--params-ease, ease),
    background 0.15s var(--params-ease, ease),
    box-shadow 0.15s var(--params-ease, ease);
}

.lab-params input:not([type="range"]):hover,
.lab-params select:hover,
.studio-tools input:hover,
.studio-tools select:hover {
  border-color: var(--line-strong);
  background: var(--panel);
}

.lab-params input:not([type="range"]):focus,
.lab-params select:focus,
.studio-tools input:focus,
.studio-tools select:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--panel);
  box-shadow: 0 0 0 1px var(--ink);
}

/* Number + scrubber */
.param-num {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.param-num-value {
  width: 100%;
}

.param-range {
  --param-range-pct: 0%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  touch-action: none;
}

.param-range:focus {
  outline: none;
}

.param-range:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 4px;
}

.param-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--ink) 0%,
    var(--ink) var(--param-range-pct),
    #e8eaed var(--param-range-pct),
    #e8eaed 100%
  );
}

.param-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ink);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.22);
  transition:
    transform 0.18s var(--params-ease, ease),
    box-shadow 0.18s var(--params-ease, ease),
    border-width 0.12s ease;
}

.param-range:hover::-webkit-slider-thumb,
.param-range.is-scrubbing::-webkit-slider-thumb {
  transform: scale(1.12);
  box-shadow: 0 2px 6px rgba(60, 64, 67, 0.28);
}

.param-range.is-scrubbing::-webkit-slider-thumb {
  border-width: 3px;
  transform: scale(1.18);
}

.param-range:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.param-range::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: #e8eaed;
}

.param-range::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--ink);
}

.param-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ink);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.22);
  transition: transform 0.18s var(--params-ease, ease);
}

.param-range:hover::-moz-range-thumb,
.param-range.is-scrubbing::-moz-range-thumb {
  transform: scale(1.12);
}

/* Binary enum → sliding thumb (same motion language as lang switch) */
.param-seg {
  --param-seg-pad: 2px;
  --param-seg-n: 2;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--param-seg-n), minmax(0, 1fr));
  gap: 0;
  padding: var(--param-seg-pad);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--preview-bg, #f1f3f4);
  min-height: var(--params-ctrl-h, 28px);
  overflow: hidden;
  box-sizing: border-box;
}

.param-seg-thumb {
  position: absolute;
  top: var(--param-seg-pad);
  left: var(--param-seg-pad);
  z-index: 0;
  width: calc((100% - 2 * var(--param-seg-pad)) / var(--param-seg-n));
  height: calc(100% - 2 * var(--param-seg-pad));
  border-radius: 999px;
  background: var(--panel, #fff);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.18);
  transition: transform 0.22s var(--params-ease, ease);
  pointer-events: none;
}

.param-seg[data-i="1"] .param-seg-thumb {
  transform: translateX(100%);
}

.param-seg[data-i="2"] .param-seg-thumb {
  transform: translateX(200%);
}

.param-seg[data-i="3"] .param-seg-thumb {
  transform: translateX(300%);
}

.param-seg-btn {
  position: relative;
  z-index: 1;
  appearance: none;
  border: 0;
  margin: 0;
  padding: 4px 6px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s ease;
}

.param-seg-btn + .param-seg-btn {
  border-left: 0;
}

.param-seg-btn:hover:not(:disabled):not(.is-active) {
  color: var(--ink);
  background: transparent;
}

.param-seg-btn.is-active {
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  font-weight: 600;
}

.param-seg-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
  z-index: 2;
}

.param-seg-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

html[lang^="zh"] .param-seg-btn {
  font-size: 11px;
  letter-spacing: 0;
}

/* Native boolean → compact Material-like switch, label+control on one row */
.param-field--switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: var(--params-ctrl-h, 28px);
}

.param-field--switch > label {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.param-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  flex-shrink: 0;
  width: auto;
}

.param-switch:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.param-switch-track {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 999px;
  background: #e8eaed;
  border: 0;
  transition: background 0.22s var(--params-ease, ease);
}

.param-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.32);
  transition: transform 0.22s var(--params-ease, ease);
  will-change: transform;
}

.param-switch.is-on .param-switch-track {
  background: var(--active);
  border-color: transparent;
}

.param-switch.is-on .param-switch-thumb {
  transform: translateX(16px);
  border-color: transparent;
  background: #fff;
}

.param-switch:active:not(:disabled) .param-switch-thumb {
  width: 18px;
}

.param-switch.is-on:active:not(:disabled) .param-switch-thumb {
  transform: translateX(14px);
}

.param-switch-status {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  min-width: 1.25em;
  transition: color 0.15s ease;
}

.param-switch.is-on .param-switch-status {
  color: var(--ink);
}

.param-switch:focus-visible .param-switch-track {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.param-field--seg .param-seg {
  width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .param-seg-thumb,
  .param-switch-track,
  .param-switch-thumb,
  .param-range::-webkit-slider-thumb,
  .param-range::-moz-range-thumb {
    transition: none;
  }
}

/* Parent switch + nested dependent params (N→Ec…, Ch→wFL…) */
.param-cluster {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.param-cluster-kids {
  margin: 4px 0 2px;
  padding: 8px 10px 8px 12px;
  border-left: 2px solid var(--line-strong);
  background: var(--preview-bg, #f8f9fa);
  border-radius: 0 var(--radius) var(--radius) 0;
  gap: 8px;
}

.param-cluster-kids[hidden] {
  display: none !important;
}

.param-cluster.has-open-kids > .param-field {
  margin-bottom: 0;
}

.param-field--nested > label {
  font-size: 10px;
  color: var(--muted);
}

.param-filter {
  display: block;
  margin: 0 0 6px;
}

.param-filter input {
  width: 100%;
  height: var(--params-ctrl-h, 28px);
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  font-size: 12px;
  background: var(--panel);
  color: var(--ink);
}

.param-filter input:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--panel);
}

/* Group headers: same voice as .picker-major-head / .section-title */
.param-group {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.param-group + .param-group {
  margin-top: 0;
  padding-top: 0;
  border-top: 1px solid var(--line);
}

.param-group-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0 4px;
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.param-group-summary::-webkit-details-marker {
  display: none;
}

.param-group-summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid var(--muted);
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  transition: transform 0.1s ease;
  flex-shrink: 0;
}

.param-group[open] > .param-group-summary::before {
  transform: rotate(90deg);
}

.param-group-title {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--muted);
}

html[lang^="zh"] .param-group-title {
  letter-spacing: 0;
}

.param-group-count {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
  padding: 0 4px;
  min-width: 1.25em;
  text-align: center;
  border: 0;
  background: var(--hover);
  border-radius: 8px;
}

.param-group .param-grid {
  padding: 0 0 8px;
  border-top: none;
}

.param-grid {
  display: grid;
  gap: var(--params-gap, 6px) 6px;
}

.param-grid--dims {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.param-grid--pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.param-grid--stack {
  grid-template-columns: 1fr;
}

.param-field--wide {
  grid-column: 1 / -1;
}

.lab-params .param-group--primary {
  margin-bottom: 0;
  padding-bottom: 2px;
}

.lab-params .param-group--primary .param-grid {
  background: transparent;
}

@media (max-width: 360px) {
  .param-grid--dims,
  .param-grid--pair {
    grid-template-columns: 1fr;
  }
}

.impose-flags {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 8px 0 4px;
  width: 100%;
}

.impose-native-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.impose-sheet {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.impose-section {
  padding: 4px 0 8px;
}

.impose-section + .impose-section {
  border-top: 1px solid var(--line);
  margin-top: 2px;
  padding-top: 8px;
}

.impose-section[hidden] {
  display: none !important;
}

.impose-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 !important;
  min-width: 0;
  position: relative;
}

.impose-field > span {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.25;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
}

.impose-field--wide {
  grid-column: 1 / -1;
}

.impose-grid {
  display: grid;
  gap: 8px 8px;
  margin-top: 6px;
}

.impose-grid--pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.impose-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
  padding: 2px 0;
  position: relative;
}

.impose-switch-row > span {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.3;
}

.impose-switch-row:hover > span {
  color: var(--ink);
}

.impose-sheet .param-seg {
  width: 100%;
}

.impose-sheet .impose-field > .param-seg,
.impose-sheet .impose-field > select:not(.impose-native-hidden),
.impose-sheet .impose-field > .param-num {
  width: 100%;
}

@media (max-width: 360px) {
  .impose-grid--pair {
    grid-template-columns: 1fr;
  }
}

.impose-sol-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.impose-sol-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.impose-solution-select {
  flex: 1;
  min-width: 0;
  max-width: 58%;
}

.impose-solution-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 0;
  max-height: 220px;
  overflow: auto;
}

.impose-solution-list[hidden] {
  display: none !important;
}

.impose-sol-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--preview-bg);
  text-align: left;
  font: inherit;
  cursor: pointer;
  color: var(--ink);
}

.impose-sol-card:hover {
  border-color: var(--line-strong);
  background: var(--hover);
}

.impose-sol-card.is-active {
  border-color: var(--ink);
  background: var(--panel);
  box-shadow: inset 2px 0 0 var(--ink);
}

.impose-sol-thumb {
  flex-shrink: 0;
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 2px;
}

.impose-sol-sheet {
  fill: #f1f3f4;
  stroke: #5f6368;
  stroke-width: 1;
}

.impose-sol-nest {
  fill: #202124;
  fill-opacity: 0.55;
  stroke: none;
}

.impose-sol-meta {
  min-width: 0;
  flex: 1;
}

.impose-sol-title {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.impose-sol-sub {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.impose-stats {
  margin: 10px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--preview-bg);
}

.impose-stats[hidden] {
  display: none !important;
}

.impose-stats-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.impose-stats-head strong {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.impose-eff-bar {
  margin: 8px 0;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.impose-eff-fill {
  height: 100%;
  background: var(--ink);
  border-radius: inherit;
  min-width: 0;
  transition: width 0.15s ease;
}

.impose-stats-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: var(--ink);
  line-height: 1.45;
}

.impose-stats-list li + li {
  margin-top: 2px;
  color: var(--muted);
}

.impose-stats-warn {
  margin: 0;
  font-size: 12px;
  color: #5d4037;
}

.studio-tools label {
  margin-top: 6px;
}

/* Tools-panel checkboxes: same voice as Visibility LT chips / Inspector opts */
.studio-tools .top-check,
.studio-tools .lt-vis .top-check,
.studio-tools .group-vis .top-check,
.studio-tools .impose-flags .top-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.studio-tools .top-check > span,
.studio-tools .lt-vis .top-check span,
.studio-tools .group-vis .top-check span,
.studio-tools .impose-flags .top-check span {
  display: inline;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  font-weight: 400;
  color: inherit;
}

.studio-tools .top-check input {
  width: 13px;
  height: 13px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--ink);
}

.studio-tools .top-check:hover {
  color: var(--ink);
}

.studio-tools input[type="file"] {
  height: auto;
  padding: 4px 0;
  border: none;
  background: transparent;
  font-size: 12px;
}

.studio-tool-btn {
  margin-top: 0;
  width: 100%;
  height: var(--params-ctrl-h, 28px);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--ink);
  transition:
    border-color 0.15s var(--params-ease, ease),
    background 0.15s var(--params-ease, ease),
    color 0.15s ease;
}

.studio-tool-btn:hover {
  border-color: var(--ink);
  background: var(--hover);
}

.studio-tool-btn--primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--active-ink, #fff);
}

.studio-tool-btn--primary:hover {
  background: #3c4043;
  border-color: #3c4043;
  color: #fff;
}

.studio-tool-btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.studio-tool-btn--ghost:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--hover);
}

/* Source sheet — same density language as impose */
.source-sheet {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.source-lead {
  margin: 0 0 10px;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
  background: var(--preview-bg, #f8f9fa);
  border-radius: var(--radius);
  border-left: 2px solid var(--line-strong);
}

.source-section {
  padding: 4px 0 10px;
}

.source-section + .source-section {
  border-top: 1px solid var(--line);
  margin-top: 2px;
  padding-top: 10px;
}

.source-section--map:has(#import-layer-map[hidden]) {
  display: none;
}

.source-drop {
  position: relative;
  display: block;
  min-height: 96px;
  padding: 14px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--preview-bg, #f8f9fa);
  cursor: pointer;
  transition:
    border-color 0.18s var(--params-ease, ease),
    background 0.18s var(--params-ease, ease),
    box-shadow 0.18s var(--params-ease, ease);
}

.source-drop:hover,
.source-drop.is-dragover {
  border-color: var(--ink);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.source-drop.is-active {
  border-style: solid;
  border-color: var(--ink);
  background: var(--panel);
}

.source-drop:focus-within {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.source-drop-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  pointer-events: none;
}

.source-drop-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.source-drop-hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.source-drop-name {
  margin-top: 6px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--ink);
  word-break: break-all;
  line-height: 1.35;
}

.source-drop:not(.is-active) .source-drop-name {
  color: var(--muted);
  font-family: inherit;
}

.param-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.param-chip {
  appearance: none;
  border: 1px solid var(--line);
  margin: 0;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--preview-bg, #f8f9fa);
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition:
    background 0.15s var(--params-ease, ease),
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.param-chip:hover:not(:disabled):not(.is-active) {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--panel);
}

.param-chip.is-active {
  background: var(--panel);
  border-color: var(--ink);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
  font-weight: 600;
}

.param-chip:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.source-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.source-sheet .impose-field {
  margin-top: 0 !important;
}

.studio-suggest-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 8px 0 6px;
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
  background: var(--hover);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.studio-suggest-bar[hidden] {
  display: none !important;
}

.studio-suggest-bar span {
  flex: 1 1 140px;
}

.studio-suggest-bar button {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--panel);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.studio-suggest-bar button:hover {
  border-color: var(--ink);
  background: var(--hover);
}

.studio-banner {
  margin: 8px 0 6px;
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--ink);
  background: var(--hover);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.studio-params #params.is-locked {
  opacity: 0.45;
  pointer-events: none;
  user-select: none;
}

.import-layer-map {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--preview-bg, #f8f9fa);
  max-height: 220px;
  overflow: auto;
}

.import-layer-map .ilm-title {
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  margin-bottom: 8px;
}

.import-layer-map .ilm-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 8px;
  margin-bottom: 6px;
  align-items: center;
  padding: 4px 6px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}

.import-layer-map .ilm-row:last-child {
  margin-bottom: 0;
}

.import-layer-map .ilm-row span {
  font-size: 11px;
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.import-layer-map select {
  width: 100%;
  height: var(--params-ctrl-h, 28px);
  font-size: 11px;
  border-radius: 999px;
  background: var(--preview-bg, #f8f9fa);
}

.mono {
  font-family: var(--mono);
}

.preview {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--preview-bg);
}

.canvas-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  flex-shrink: 0;
}

.canvas-bar button {
  height: 28px;
  min-width: 28px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--panel);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.canvas-bar button:hover {
  border-color: var(--ink);
  background: var(--hover);
}

.canvas-bar .zoom-label {
  min-width: 3.5rem;
  font-size: 12px;
  color: var(--muted);
}

.canvas-bar-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
}

.canvas-bar-check input {
  width: 14px;
  height: 14px;
  accent-color: var(--ink);
}

.canvas-bar-hint {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}

.canvas-bar-sep {
  width: 1px;
  height: 18px;
  background: var(--line);
  margin: 0 2px;
}

.canvas-bar-btn {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel, #fff);
  color: var(--ink);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.canvas-bar-btn:hover {
  background: var(--hover);
  border-color: var(--ink);
}

.studio-app .canvas-bar-btn {
  height: 26px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.canvas-bar button.is-active {
  border-color: var(--ink);
  background: var(--hover);
  font-weight: 600;
}

.tools-block {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.tools-block-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.lt-vis {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.group-vis {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 10px;
  width: 100%;
}

.group-vis .tools-block-title {
  flex: 1 0 100%;
  margin-bottom: 4px;
}

.lt-vis .top-check,
.group-vis .top-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.pick-inspector {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  min-height: 2.6em;
  white-space: pre-wrap;
}

.pick-inspector.is-active {
  color: var(--ink);
}

.canvas-viewport {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  cursor: grab;
  touch-action: none;
  /* Infinite-canvas feel: quiet dot grid */
  background-color: var(--preview-bg);
  background-image: radial-gradient(rgba(60, 64, 67, 0.14) 1px, transparent 1px);
  background-size: 18px 18px;
  background-position: 0 0;
}

.canvas-viewport.is-space-pan {
  cursor: grab;
}

.canvas-viewport.is-space-pan.is-panning,
.canvas-viewport.is-panning {
  cursor: grabbing;
}

.canvas-viewport.is-measure {
  cursor: crosshair;
}

.canvas-viewport.is-measure.is-space-pan {
  cursor: grab;
}

.canvas-viewport.is-3d {
  cursor: default;
  background-image: none;
  background-color: #f3f3f3;
}

.canvas-viewport.is-3d .canvas-stage {
  pointer-events: none;
}

.canvas-stage {
  width: 100%;
  height: 100%;
}

.canvas-3d {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: auto;
  background: #f3f3f3;
}

.canvas-3d canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

.canvas-bar-check input[type="range"] {
  width: 88px;
  vertical-align: middle;
  accent-color: var(--ink);
}

.preview .canvas {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  box-sizing: border-box;
}

.preview .canvas.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
}

.preview .canvas svg {
  width: 100%;
  height: 100%;
  display: block;
  /* Transparent so viewport dot-grid reads as infinite canvas */
  background: transparent;
  border: none;
  border-radius: 0;
  pointer-events: none;
}

/* Vector zoom: keep stroke weight in screen px while viewBox camera moves */
.preview .canvas svg :is(line, path, polyline, circle, ellipse, rect) {
  vector-effect: non-scaling-stroke;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 16px;
  row-gap: 6px;
  padding: 10px 20px 16px;
  font-size: 12px;
  color: var(--muted);
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.legend #stats {
  flex: 1 1 12rem;
  min-width: 0;
  text-align: right;
}

/* Match geometry/core.js STROKE palette */
.legend .cut::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 2px;
  margin-right: 6px;
  vertical-align: middle;
  background: #c62828;
}

.legend .crease::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 0;
  margin-right: 6px;
  vertical-align: middle;
  background: transparent;
  border-top: 2px dashed #1565c0;
}

.legend .perfo::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 0;
  margin-right: 6px;
  vertical-align: middle;
  background: transparent;
  border-top: 2px dotted #6a1b9a;
}

.legend .cotation::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 2px;
  margin-right: 6px;
  vertical-align: middle;
  background: #2e7d32;
}

/* ── Studio app: Google-minimal tool density (align with right params) ── */
.studio-app {
  --studio-ctrl-h: 28px;
  --studio-ease: var(--ease);
}

.studio-app .studio-grid {
  grid-template-columns: minmax(240px, 260px) 1fr minmax(280px, 300px);
}

/* Left: catalog chrome */
.studio-app .studio-nav-head {
  padding: 10px 10px 0 12px;
  gap: 8px;
}

.studio-app .studio-nav-head .section-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.studio-app .nav-mode {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--preview-bg);
}

.studio-app .nav-mode-btn {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  min-height: 24px;
  line-height: 1.2;
  transition:
    color 0.15s ease,
    background 0.15s var(--studio-ease),
    box-shadow 0.15s var(--studio-ease);
}

.studio-app .nav-mode-btn.is-active {
  background: var(--panel);
  border-color: transparent;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.18);
  font-weight: 600;
}

.studio-app .nav-mode-btn:hover:not(.is-active) {
  background: transparent;
  color: var(--ink);
}

.studio-app .studio-search {
  padding: 8px 10px;
}

.studio-app .studio-search input,
.studio-app .picker-search input {
  height: var(--studio-ctrl-h);
  padding: 0 10px;
  font-size: 12px;
  border-radius: 999px;
  background: var(--preview-bg);
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.studio-app .studio-search input:focus,
.studio-app .picker-search input:focus {
  border-color: var(--ink);
  background: var(--panel);
  box-shadow: 0 0 0 1px var(--ink);
}

.studio-app .picker-major-head {
  padding: 8px 12px 4px;
  font-size: 10px;
  letter-spacing: 0.06em;
}

.studio-app .picker-mid-head {
  padding: 4px 12px 2px 16px;
  font-size: 10px;
}

.studio-app .picker-item {
  font-size: 12px;
  padding: 5px 12px 5px 16px;
  border-radius: 0 16px 16px 0;
  margin-right: 8px;
  transition: background 0.12s ease, color 0.12s ease;
}

.studio-app .picker-item:hover {
  background: var(--hover);
}

.studio-app .picker-item.active {
  background: var(--hover);
  color: var(--ink);
  box-shadow: inset 3px 0 0 var(--ink);
  font-weight: 500;
}

.studio-app .picker-item .sub {
  font-size: 10px;
  margin-top: 0;
}

.studio-app .picker-zh-tag {
  font-size: 9px;
  padding: 0 4px;
  border-radius: 2px;
  line-height: 1.45;
}

.studio-app .picker-item.active .picker-zh-tag {
  border-color: var(--line);
  background: var(--panel, #fff);
  color: var(--muted);
  opacity: 1;
}

.studio-app .picker-item.active .sub {
  color: var(--muted);
}

.studio-app .studio-side .tree .doc,
.studio-app .studio-side .tree summary {
  font-size: 12px;
  padding-top: 4px;
  padding-bottom: 4px;
  border-radius: 0 16px 16px 0;
}

.studio-app .studio-side .tree .doc.active {
  background: var(--hover);
  color: var(--ink);
  box-shadow: inset 3px 0 0 var(--ink);
}

/* Center: scheme head + inspector + canvas tools */
.studio-app .studio-head {
  padding: 8px 14px 6px;
  background: var(--panel);
}

.studio-app .studio-head .picker-crumb {
  font-size: 10px;
  margin-bottom: 2px;
  letter-spacing: 0;
}

.studio-app .studio-head .picker-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink);
}

.studio-app .studio-head .picker-id {
  margin-top: 1px;
  font-size: 10px;
}

.studio-app .inspector-bar {
  gap: 8px;
  padding: 4px 14px;
  min-height: 32px;
  background: var(--preview-bg);
}

.studio-app .inspector-bar-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.studio-app .pick-inspector {
  font-size: 11px;
  min-height: 0;
  line-height: 1.35;
}

.studio-app .inspector-bar-opts .top-check {
  font-size: 11px;
  gap: 4px;
}

.studio-app .inspector-bar-opts .top-check input {
  width: 13px;
  height: 13px;
}

.studio-app .canvas-bar {
  gap: 6px 8px;
  padding: 6px 12px;
  row-gap: 6px;
}

.studio-app .canvas-tool-group {
  display: inline-flex;
  align-items: stretch;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--preview-bg);
  gap: 0;
}

.studio-app .canvas-tool-group[hidden] {
  display: none !important;
}

.studio-app .canvas-tool-group button {
  height: 24px;
  min-width: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  box-shadow: none;
  transition:
    color 0.15s ease,
    background 0.15s var(--studio-ease),
    box-shadow 0.15s var(--studio-ease);
}

.studio-app .canvas-tool-group button:hover:not(.is-active):not(:disabled) {
  color: var(--ink);
  background: transparent;
  border-color: transparent;
}

.studio-app .canvas-tool-group button.is-active {
  background: var(--panel);
  color: var(--ink);
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.18);
  font-weight: 600;
}

.studio-app .canvas-tool-group button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.studio-app .canvas-bar > button {
  height: var(--studio-ctrl-h);
  min-width: var(--studio-ctrl-h);
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--preview-bg);
  font-size: 12px;
  color: var(--ink);
}

.studio-app .canvas-bar > button:hover {
  border-color: var(--line-strong);
  background: var(--panel);
}

.studio-app .canvas-bar > button.is-active {
  border-color: var(--ink);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.studio-app .canvas-bar .zoom-label {
  min-width: 2.75rem;
  font-size: 11px;
  color: var(--muted);
}

.studio-app .canvas-bar-check {
  gap: 4px;
  font-size: 11px;
  height: var(--studio-ctrl-h);
}

.studio-app .canvas-bar-check input[type="checkbox"] {
  width: 13px;
  height: 13px;
}

.studio-app .canvas-bar-check select,
.studio-app .canvas-bar-check input[type="number"] {
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--preview-bg);
  font: inherit;
  font-size: 11px;
  color: var(--ink);
}

.studio-app .canvas-bar-check select:focus,
.studio-app .canvas-bar-check input[type="number"]:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
  background: var(--panel);
}

.studio-app .canvas-range,
.studio-app .canvas-bar-check input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 72px;
  height: 16px;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  accent-color: var(--ink);
}

.studio-app .canvas-range::-webkit-slider-runnable-track,
.studio-app .canvas-bar-check input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 999px;
  background: #e8eaed;
}

.studio-app .canvas-range::-webkit-slider-thumb,
.studio-app .canvas-bar-check input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ink);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.2);
}

.studio-app .canvas-bar-sep {
  height: 16px;
  background: var(--line);
  margin: 0 1px;
}

.studio-app .canvas-bar-hint {
  font-size: 10px;
  opacity: 0.85;
}

.studio-app .legend {
  padding: 6px 14px 8px;
  gap: 12px;
  row-gap: 4px;
  font-size: 11px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.studio-app .legend #stats {
  font-size: 11px;
}

.studio-app .studio-banner,
.studio-app .studio-suggest-bar {
  border-radius: 8px;
  border-color: var(--line);
  background: var(--preview-bg);
}

.studio-app .studio-suggest-bar button {
  height: 26px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}

.studio-app .lab-params {
  padding: 0 10px 14px;
}

.studio-app .params-sheet-tabs {
  padding-right: 28px;
  padding-top: 6px;
}

.studio-app .display-fold-summary {
  font-size: 11px;
  padding: 6px 0;
}

.studio-app .lt-vis .top-check,
.studio-app .group-vis .top-check {
  font-size: 11px;
}

/* Desktop panel collapse / expand rails */
.panel-toggle {
  appearance: none;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition:
    background 0.15s var(--ease, ease),
    border-color 0.15s ease,
    color 0.15s ease;
}

.panel-toggle:hover {
  color: var(--ink);
  background: var(--hover);
  border-color: var(--line);
}

.panel-toggle:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.panel-toggle-icon {
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 4px 0 4px 6px;
  border-color: transparent transparent transparent currentColor;
}

.panel-toggle--params .panel-toggle-icon {
  border-width: 4px 6px 4px 0;
  border-color: transparent currentColor transparent transparent;
}

.studio-app .studio-nav-head {
  position: relative;
}

.studio-app .studio-nav-head .panel-toggle {
  margin-left: auto;
}

.studio-params {
  position: relative;
}

.studio-params > .panel-toggle--params {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 5;
}

/* Desktop: collapse to a slim edge rail (mobile keeps drawer rules below) */
@media (min-width: 721px) {
  .studio-app .studio-grid.is-side-collapsed {
    grid-template-columns: 32px 1fr minmax(280px, 300px);
  }

  .studio-app .studio-grid.is-params-collapsed {
    grid-template-columns: minmax(240px, 260px) 1fr 32px;
  }

  .studio-app .studio-grid.is-side-collapsed.is-params-collapsed {
    grid-template-columns: 32px 1fr 32px;
  }

  .studio-app .studio-grid.is-side-collapsed .studio-side {
    overflow: hidden;
    border-right: 1px solid var(--line);
    background: var(--panel);
  }

  .studio-app .studio-grid.is-side-collapsed .studio-side > :not(.panel-toggle):not(.studio-nav-head),
  .studio-app .studio-grid.is-side-collapsed .studio-nav-head > :not(.panel-toggle) {
    display: none !important;
  }

  .studio-app .studio-grid.is-side-collapsed .studio-nav-head {
    padding: 0;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8px;
  }

  .studio-app .studio-grid.is-side-collapsed .panel-toggle {
    margin: 0;
  }

  .studio-app .studio-grid.is-side-collapsed .panel-toggle .panel-toggle-icon {
    border-width: 4px 6px 4px 0;
    border-color: transparent currentColor transparent transparent;
  }

  .studio-app .studio-grid.is-params-collapsed .studio-params {
    overflow: hidden;
    padding: 0;
    border-left: 1px solid var(--line);
  }

  .studio-app .studio-grid.is-params-collapsed .studio-params > :not(.panel-toggle) {
    display: none !important;
  }

  .studio-app .studio-grid.is-params-collapsed .panel-toggle--params {
    position: static;
    margin: 8px auto 0;
    display: flex;
  }

  .studio-app .studio-grid.is-params-collapsed .panel-toggle--params .panel-toggle-icon {
    border-width: 4px 0 4px 6px;
    border-color: transparent transparent transparent currentColor;
  }
}

@media (max-width: 720px) {
  .panel-toggle {
    display: none !important;
  }
}

@media (max-width: 1100px) {
  .studio-app .canvas-bar-hint {
    display: none;
  }
}

@media (max-width: 1280px) {
  .layout {
    grid-template-columns:
      minmax(140px, 16%) minmax(220px, 26%) minmax(280px, 1fr) minmax(240px, 28%);
  }

  .lab-grid,
  .studio-grid {
    grid-template-columns: minmax(240px, 260px) 1fr minmax(240px, 280px);
  }

  .studio-app .studio-grid.is-side-collapsed {
    grid-template-columns: 32px 1fr minmax(240px, 280px);
  }

  .studio-app .studio-grid.is-params-collapsed {
    grid-template-columns: minmax(240px, 260px) 1fr 32px;
  }

  .studio-app .studio-grid.is-side-collapsed.is-params-collapsed {
    grid-template-columns: 32px 1fr 32px;
  }
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 160px 220px 1fr 240px;
  }

  .layout .panel:nth-child(1) {
    grid-column: 1;
  }

  .layout .panel:nth-child(2) {
    grid-column: 2;
  }

  .layout .panel-preview {
    grid-column: 1 / -1;
  }

  .layout .panel-params {
    grid-column: 1 / -1;
  }

  .lab-grid,
  .studio-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 240px 1fr 260px;
  }

  .lab-params,
  .studio-params {
    border-left: none;
    border-top: 1px solid var(--line);
  }

  .panel {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .geo-preview {
    height: 280px;
    min-height: 240px;
  }
}

/* —— Mobile chrome (≤720px) —— */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
}

.nav-toggle:hover {
  background: var(--hover);
}

.nav-toggle:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle-bars {
  position: relative;
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle-bars::before {
  top: -6px;
}

.nav-toggle-bars::after {
  top: 6px;
}

body.nav-open .nav-toggle-bars {
  background: transparent;
}

body.nav-open .nav-toggle-bars::before {
  top: 0;
  transform: rotate(45deg);
}

body.nav-open .nav-toggle-bars::after {
  top: 0;
  transform: rotate(-45deg);
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(32, 33, 36, 0.4);
}

/* Drawer lives on <body> while mobile — keep above backdrop, below nothing critical */
.top-nav.is-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 95;
  width: min(300px, 86vw);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  /* --mobile-header-h set by nav-mobile.js (accounts for wrapped search row) */
  top: var(--mobile-header-h, var(--header-h));
  padding: 12px 16px 24px;
  padding-right: max(16px, env(safe-area-inset-right));
  height: auto;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 24px rgba(32, 33, 36, 0.12);
  transform: translateX(105%);
  transition: transform 0.22s ease, visibility 0.22s ease;
  overflow-y: auto;
  visibility: hidden;
  pointer-events: none;
}

body.nav-open .top-nav.is-drawer {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

/* Beat page-specific header rules (e.g. html.home .top.home-top { z-index: 50 }) */
html body.nav-open header.top,
html.home body.nav-open header.top.home-top {
  z-index: 100 !important;
}

.catalog-mobile-bar,
.studio-mobile-bar {
  display: none;
}

.mobile-bar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.mobile-bar-btn:hover {
  background: var(--hover);
}

.mobile-bar-btn[aria-expanded="true"] {
  background: rgba(60, 64, 67, 0.12);
  border-color: var(--ink);
}

.top .actions {
  margin-left: auto;
  margin-bottom: 0;
}

.top > .lang-toggle {
  margin-left: 4px;
}

.top:not(:has(.actions)):not(:has(.search)) > .lang-toggle {
  margin-left: auto;
}

@media (max-width: 720px) {
  html,
  body {
    overflow-x: hidden;
  }

  .top {
    position: sticky;
    top: 0;
    z-index: 60;
    height: auto;
    min-height: var(--header-h);
    flex-wrap: wrap;
    gap: 8px 10px;
    padding: 8px max(12px, env(safe-area-inset-right)) 8px
      max(12px, env(safe-area-inset-left));
    padding-top: max(8px, env(safe-area-inset-top));
  }

  .top h1 {
    flex: 1 1 auto;
    min-width: 0;
  }

  .top .badge {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
    order: 5;
  }

  .top > .lang-toggle {
    order: 4;
    margin-left: 0;
  }

  .top:not(:has(.actions)) > .lang-toggle {
    margin-left: auto;
  }

  .top .actions {
    order: 3;
    margin-left: auto;
  }

  .top .search {
    order: 10;
    flex: 1 1 100%;
    width: 100%;
    margin-left: 0;
  }

  .top .search input {
    font-size: 16px;
    height: 40px;
  }

  body.nav-open {
    overflow: hidden;
  }

  .top-nav.is-drawer .nav-link {
    display: block;
    padding: 14px 14px;
    border-radius: 10px;
    font-size: 15px;
    color: var(--muted);
    font-weight: 500;
    text-decoration: none;
    line-height: 1.2;
    white-space: nowrap;
  }

  .top-nav.is-drawer .nav-link:hover {
    color: var(--ink);
    background: rgba(60, 64, 67, 0.08);
  }

  .top-nav.is-drawer .nav-link.is-active {
    color: var(--ink);
    background: rgba(60, 64, 67, 0.12);
  }

  .auth-user-label {
    max-width: 72px;
  }

  .catalog-mobile-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    padding: 8px max(12px, env(safe-area-inset-right)) 8px
      max(12px, env(safe-area-inset-left));
    border-bottom: 1px solid var(--line);
    background: var(--panel);
  }

  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(42vh, 1fr) auto;
  }

  .layout .panel:nth-child(1),
  .layout .panel:nth-child(2),
  .layout .panel-preview,
  .layout .panel-params {
    grid-column: 1;
  }

  .layout .panel:nth-child(1) {
    max-height: 28vh;
  }

  .layout .panel:nth-child(2) {
    max-height: 32vh;
  }

  .layout.is-filters-collapsed {
    grid-template-rows: minmax(48vh, 1fr) auto;
  }

  .layout.is-filters-collapsed .panel:nth-child(1),
  .layout.is-filters-collapsed .panel:nth-child(2) {
    display: none;
  }

  .layout .panel-params {
    max-height: 36vh;
  }

  .geo-preview {
    height: min(48vh, 380px);
    min-height: 220px;
  }

  .studio-mobile-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    padding: 8px max(12px, env(safe-area-inset-right)) 10px
      max(12px, env(safe-area-inset-left));
    border-bottom: 1px solid var(--line);
    background: var(--preview-bg);
  }

  .studio-mobile-hint {
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--muted);
  }

  .studio-mobile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .studio-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    min-height: 0;
  }

  .studio-grid.is-side-collapsed .studio-side {
    display: none;
  }

  .studio-grid.is-params-collapsed .studio-params {
    display: none;
  }

  .studio-grid.is-side-collapsed.is-params-collapsed .preview {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .studio-grid:not(.is-side-collapsed) .preview,
  .studio-grid:not(.is-params-collapsed) .preview {
    display: none;
  }

  .studio-grid:not(.is-side-collapsed).is-params-collapsed .studio-side,
  .studio-grid.is-side-collapsed:not(.is-params-collapsed) .studio-params {
    min-height: 0;
    max-height: none;
    height: 100%;
  }

  .canvas-bar {
    flex-wrap: wrap;
    gap: 6px;
    max-height: none;
  }

  .canvas-bar-hint {
    display: none;
  }

  .inspector-bar {
    flex-wrap: wrap;
  }
}

/* —— Sample verification (打样核验) · Google dialog + industrial minimal —— */
body.verify-open {
  overflow: hidden;
}

.actions .verify-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 1;
  min-width: 0;
}

.actions .verify-status-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: min(240px, 36vw);
  height: 30px;
  padding: 0 6px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition:
    background 0.12s var(--ease),
    border-color 0.12s var(--ease),
    color 0.12s var(--ease);
}

.actions .verify-status-btn:hover {
  background: var(--hover);
  border-color: var(--ink);
}

.actions .verify-status-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.actions .verify-status-btn.has-pass {
  border-color: #b7d4c0;
  background: #eef7f0;
  color: #1b5e2a;
}

.actions .verify-status-btn.has-pass:hover {
  background: #e0f0e4;
  border-color: #8fbf9c;
}

.actions .verify-status-btn.has-sample {
  border-color: var(--line-strong);
  background: var(--preview-bg);
  color: var(--ink);
}

.actions .verify-status-btn.has-sample:hover {
  border-color: var(--ink);
  background: var(--hover);
}

.actions .verify-status-btn.has-fail-only {
  border-color: #f5c6c2;
  background: #fce8e6;
  color: #c5221f;
}

.actions .verify-status-btn .verify-status-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions .verify-status-btn .verify-em {
  font-weight: 700;
}

.actions .verify-status-btn .verify-status-chevron {
  flex-shrink: 0;
  opacity: 0.65;
}

.actions .verify-status-btn:hover .verify-status-chevron {
  opacity: 1;
}

.actions .verify-badge {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  height: 28px;
  border-radius: var(--radius);
  border: 1px solid #b7d4c0;
  background: #eef7f0;
  color: #1b5e2a;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.actions .verify-badge:hover {
  background: #e0f0e4;
}

.actions .verify-badge .verify-em,
.gallery-verify-tag .verify-em {
  font-weight: 700;
}

.verify-scene-tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 2px;
  border: 1px solid var(--line-strong);
  background: var(--preview-bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.verify-scene-tag--machine {
  border-color: #b7d4c0;
  background: #eef7f0;
  color: #1b5e2a;
}

#verify-root {
  position: relative;
  z-index: 80;
}

.verify-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.verify-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 33, 36, 0.4);
  animation: verify-fade 0.18s var(--ease);
}

.verify-modal {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  max-height: min(88vh, 680px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow:
    0 1px 2px rgba(60, 64, 67, 0.12),
    0 8px 24px rgba(60, 64, 67, 0.16);
  animation: verify-rise 0.22s var(--ease);
  overflow: hidden;
}

.verify-modal--history {
  width: min(440px, 100%);
}

/* Submit dialog: denser layout so default path fits one viewport */
.verify-modal--submit {
  width: min(460px, 100%);
  max-height: min(92vh, 640px);
}

.verify-modal--submit .verify-modal-head {
  padding: 14px 16px 0;
  align-items: center;
}

.verify-modal--submit .verify-modal-head h2 {
  font-size: 16px;
}

.verify-modal--submit .verify-close {
  width: 32px;
  height: 32px;
  margin: 0 -4px 0 0;
}

.verify-modal--submit .verify-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 16px 0;
  padding: 6px 10px;
}

.verify-modal--submit .verify-meta-title {
  font-size: 12px;
}

.verify-modal--submit .verify-meta-key {
  margin-top: 0;
  font-size: 10px;
}

.verify-modal--submit .verify-form-scroll {
  padding: 10px 16px 0;
  overflow: auto;
  flex: 1 1 auto;
}

.verify-modal--submit .verify-section,
.verify-modal--submit .verify-field {
  margin-bottom: 10px;
}

.verify-modal--submit .verify-label {
  margin-bottom: 4px;
  font-size: 11px;
}

.verify-modal--submit .verify-seg-opt {
  min-height: 32px;
  padding: 4px 8px;
}

.verify-modal--submit .verify-seg-opt span {
  font-size: 11px;
}

.verify-modal--submit .verify-field textarea {
  min-height: 44px;
  padding: 7px 10px;
  font-size: 12px;
  resize: none;
}

.verify-modal--submit .verify-chip span {
  height: 24px;
  padding: 0 8px;
  font-size: 11px;
}

.verify-modal--submit .verify-chips {
  gap: 4px;
}

.verify-modal--submit .verify-upload-body {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
}

.verify-modal--submit .verify-upload-title {
  font-size: 12px;
}

.verify-modal--submit .verify-field-hint {
  font-size: 10px;
}

.verify-modal--submit .verify-thumbs {
  margin-top: 6px;
  gap: 6px;
}

.verify-modal--submit .verify-thumb {
  width: 40px;
  height: 40px;
}

.verify-modal--submit .verify-section--photos {
  margin-bottom: 6px;
}

.verify-modal--submit .verify-error {
  margin: 0 0 4px;
}

.verify-modal--submit .verify-actions {
  padding: 10px 16px 12px;
}

.verify-modal--submit .verify-btn {
  height: 32px;
  padding: 0 14px;
  font-size: 12px;
}

/* History dialog: match submit density */
.verify-modal--history {
  max-height: min(88vh, 620px);
  position: relative;
}

.verify-official-seal {
  --seal-ink: #c62828;
  --seal-rot: -14deg;
  position: relative;
  width: 84px;
  height: 84px;
  flex: 0 0 auto;
  color: var(--seal-ink);
  transform: rotate(var(--seal-rot));
  opacity: 0.92;
  pointer-events: none;
  isolation: isolate;
  mix-blend-mode: multiply;
  filter: contrast(1.08) saturate(1.05);
}

.verify-official-seal-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.verify-official-seal-arc {
  fill: currentColor;
  font-family: "Syne", "DIN Alternate", "Helvetica Neue", sans-serif;
  font-size: 5.6px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.verify-official-seal-arc--bot {
  font-size: 4.7px;
  letter-spacing: 0.12em;
}

.verify-official-seal-status {
  fill: currentColor;
  font-family: "Syne", "Helvetica Neue", sans-serif;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-anchor: middle;
  dominant-baseline: middle;
}

.verify-official-seal-status--cjk {
  font-family: var(--font-brand), "Noto Serif SC", "Songti SC", serif;
  font-size: 10.5px;
  letter-spacing: 0.12em;
}

.verify-official-seal-sub {
  fill: currentColor;
  font-size: 4.2px;
  text-anchor: middle;
  opacity: 0.85;
}

.verify-official-seal-grain {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: multiply;
  background:
    radial-gradient(1.2px 1.2px at 18% 28%, rgba(160, 20, 20, 0.75) 48%, transparent 52%),
    radial-gradient(1px 1px at 72% 22%, rgba(160, 20, 20, 0.55) 48%, transparent 52%),
    radial-gradient(1.4px 1px at 42% 76%, rgba(160, 20, 20, 0.65) 48%, transparent 52%),
    radial-gradient(1px 1.3px at 81% 58%, rgba(160, 20, 20, 0.5) 48%, transparent 52%),
    radial-gradient(1.1px 1px at 30% 52%, rgba(160, 20, 20, 0.45) 48%, transparent 52%),
    radial-gradient(0.9px 0.9px at 58% 38%, rgba(160, 20, 20, 0.55) 48%, transparent 52%),
    radial-gradient(1px 1px at 48% 18%, rgba(140, 12, 12, 0.4) 48%, transparent 52%),
    radial-gradient(circle at 35% 40%, transparent 52%, rgba(198, 40, 40, 0.12) 68%, transparent 78%),
    radial-gradient(circle at 68% 62%, transparent 48%, rgba(120, 16, 16, 0.14) 70%, transparent 82%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 62%, transparent 74%);
  mask-image: radial-gradient(circle at 50% 50%, #000 62%, transparent 74%);
}

.verify-official-seal--pending {
  --seal-ink: #d32f2f;
  opacity: 0.78;
}

.verify-official-seal--pending .verify-official-seal-ring {
  stroke-dasharray: 3.2 2.1;
}

.verify-official-seal--optimized {
  --seal-ink: #b71c1c;
  opacity: 0.9;
}

.verify-official-seal--confirmed {
  --seal-ink: #b71c1c;
  opacity: 0.95;
}

.verify-modal--history .verify-modal-head {
  padding: 14px 16px 0;
  align-items: center;
}

.verify-modal--history .verify-modal-head h2 {
  font-size: 16px;
}

.verify-modal--history .verify-close {
  width: 32px;
  height: 32px;
  margin: 0 -4px 0 0;
}

.verify-modal--history .verify-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 16px 0;
  padding: 6px 10px;
}

.verify-modal--history .verify-meta-title {
  font-size: 12px;
}

.verify-modal--history .verify-meta-key {
  margin-top: 0;
  font-size: 10px;
}

.verify-modal--history .verify-history-body {
  padding: 10px 16px 0;
}

.verify-modal--history .verify-stats {
  margin: 0 0 8px;
  padding-bottom: 8px;
  font-size: 11px;
}

.verify-modal--history .verify-item {
  padding: 10px 0;
}

.verify-modal--history .verify-item--sealed .verify-official-seal {
  /* ~3/4 visible: clip top-right against the row edge */
  top: -18px;
  right: -22px;
}

.verify-modal--history .verify-item-note {
  margin-top: 6px;
  font-size: 12px;
}

.verify-modal--history .verify-item-photos img {
  width: 48px;
  height: 48px;
}

.verify-modal--history .verify-actions {
  padding: 10px 16px 12px;
}

.verify-modal--history .verify-btn {
  height: 32px;
  padding: 0 14px;
  font-size: 12px;
}

@keyframes verify-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes verify-rise {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.verify-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 0;
  flex-shrink: 0;
}

.verify-modal-head-text {
  min-width: 0;
  flex: 1;
}

.verify-modal-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.3;
}

.verify-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.verify-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: -6px -8px 0 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.verify-close:hover {
  background: var(--hover);
  color: var(--ink);
}

.verify-close:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.verify-meta {
  margin: 14px 20px 0;
  padding: 10px 12px;
  background: var(--preview-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  flex-shrink: 0;
}

.verify-meta-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.35;
}

.verify-meta-key {
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.verify-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

.verify-form-scroll,
.verify-history-body {
  padding: 16px 20px 0;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.verify-section {
  margin-bottom: 16px;
}

.verify-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.verify-field {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.verify-field select,
.verify-field textarea {
  width: 100%;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
}

.verify-field select {
  height: 36px;
  padding: 0 10px;
}

.verify-field textarea {
  padding: 10px 12px;
  resize: vertical;
  min-height: 72px;
  line-height: 1.45;
}

.verify-field select:hover,
.verify-field textarea:hover {
  border-color: var(--ink);
}

.verify-field select:focus,
.verify-field textarea:focus {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.verify-field-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

/* Segmented verdict — Material-like choice */
.verify-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
}

.verify-seg-opt {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  min-height: 40px;
  padding: 8px 10px;
  cursor: pointer;
  background: var(--panel);
  border-right: 1px solid var(--line-strong);
  text-align: center;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}

.verify-seg-opt:last-child {
  border-right: 0;
}

.verify-seg-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.verify-seg-opt span {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.3;
}

.verify-seg-opt:hover {
  background: var(--hover);
}

.verify-seg-opt:has(input:checked) {
  background: var(--ink);
}

.verify-seg-opt:has(input:checked) span {
  color: var(--active-ink);
}

.verify-seg-opt--fail:has(input:checked) {
  background: #5f2120;
}

.verify-seg-opt:focus-within {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
  z-index: 1;
}

/* Issue chips */
.verify-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.verify-chip {
  position: relative;
  display: inline-flex;
  margin: 0;
  cursor: pointer;
}

.verify-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.verify-chip span {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  font-size: 12px;
  color: var(--ink);
  transition:
    background 0.12s var(--ease),
    border-color 0.12s var(--ease),
    color 0.12s var(--ease);
}

.verify-chip:hover span {
  border-color: var(--ink);
  background: var(--hover);
}

.verify-chip:has(input:checked) span {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--active-ink);
}

.verify-chip:focus-within span {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

/* Photo upload */
.verify-upload {
  display: block;
  cursor: pointer;
}

.verify-upload input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.verify-upload-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--preview-bg);
  transition:
    border-color 0.12s var(--ease),
    background 0.12s var(--ease);
}

.verify-upload:hover .verify-upload-body,
.verify-upload:focus-within .verify-upload-body {
  border-color: var(--ink);
  border-style: solid;
  background: var(--panel);
}

.verify-upload-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.verify-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.verify-thumb {
  margin: 0;
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--preview-bg);
}

.verify-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.verify-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 14px 20px 18px;
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.verify-btn {
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.01em;
}

.verify-btn-primary {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--active-ink);
}

.verify-btn-primary:hover {
  background: #000;
  border-color: #000;
}

.verify-btn-primary:disabled {
  opacity: 0.45;
  cursor: wait;
}

.verify-btn-secondary {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
}

.verify-btn-secondary:hover {
  background: var(--hover);
}

.verify-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.verify-error {
  color: #b3261e;
  font-size: 12px;
  margin: 0 0 8px;
  line-height: 1.4;
}

.verify-stats {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.verify-empty,
.verify-loading {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin: 8px 0 12px;
}

.verify-history-body {
  padding-bottom: 8px;
}

.verify-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.verify-item {
  position: relative;
  display: block;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.verify-item:last-child {
  border-bottom: 0;
}

.verify-item-body {
  position: relative;
  z-index: 0;
  min-width: 0;
}

.verify-item--sealed {
  overflow: hidden;
}

.verify-item--sealed .verify-item-body {
  /* keep content clear of the visible seal core */
  padding-right: 58px;
}

.verify-item .verify-official-seal {
  position: absolute;
  top: -16px;
  right: -20px;
  z-index: 1;
  margin: 0;
}

.verify-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.verify-who {
  color: var(--ink);
}

.verify-pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid transparent;
}

.verify-pill--pass {
  background: #e6f4ea;
  color: #137333;
  border-color: #ceead6;
}

.verify-pill--fail {
  background: #fce8e6;
  color: #c5221f;
  border-color: #f5c6c2;
}

.verify-item-note {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
}

.verify-item-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.verify-item-photos img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  display: block;
}

.verify-photo-link:focus-visible img {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.verify-toast {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 18px;
  background: var(--ink);
  color: var(--active-ink);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(60, 64, 67, 0.28);
  animation: verify-toast-in 0.22s var(--ease);
}

@keyframes verify-toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@media (max-width: 520px) {
  .verify-layer {
    padding: 0;
    align-items: flex-end;
  }

  .verify-modal,
  .verify-modal--history {
    width: 100%;
    max-height: 92vh;
    border-radius: var(--radius) var(--radius) 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }

  .verify-modal--submit .verify-form-scroll {
    overflow: auto;
  }

  .verify-seg {
    grid-template-columns: 1fr;
  }

  .verify-seg-opt {
    border-right: 0;
    border-bottom: 1px solid var(--line-strong);
  }

  .verify-seg-opt:last-child {
    border-bottom: 0;
  }
}

/* WeChat group QR — home, catalog, gallery, studio, community */
.wechat-fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 60;
  width: 52px;
  height: 52px;
}

.wechat-fab-btn {
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #07c160;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(7, 193, 96, 0.35), 0 1px 2px rgba(32, 33, 36, 0.16);
}

.wechat-fab-btn:hover,
.wechat-fab-btn:focus-visible {
  background: #06ad56;
}

.wechat-fab-btn:focus-visible {
  outline: 2px solid #07c160;
  outline-offset: 3px;
}

.wechat-fab-pop {
  position: absolute;
  right: 0;
  bottom: 100%;
  padding-bottom: 10px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.16s var(--ease), transform 0.16s var(--ease), visibility 0.16s;
}

.wechat-fab:hover .wechat-fab-pop,
.wechat-fab:focus-within .wechat-fab-pop,
.wechat-fab.is-open .wechat-fab-pop,
.sample-fab:hover .wechat-fab-pop,
.sample-fab:focus-within .wechat-fab-pop,
.sample-fab.is-open .wechat-fab-pop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

.wechat-fab-card {
  width: 204px;
  padding: 12px 12px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(32, 33, 36, 0.16);
  text-align: center;
}

.wechat-fab-qr {
  display: block;
  width: 180px;
  height: auto;
  border-radius: 4px;
}

.wechat-fab-label {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink);
}

@media (max-width: 420px) {
  .wechat-fab-card {
    width: 168px;
  }

  .wechat-fab-qr {
    width: 144px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wechat-fab-pop {
    transition: none;
  }
}

.sample-fab-note {
  margin: 4px 0 0;
  font-size: 10px;
  line-height: 1.35;
  color: var(--muted);
}

.sample-fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 64px);
  z-index: 60;
  width: 52px;
  height: 52px;
}

.sample-fab-btn {
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(160deg, #ffb03a 0%, #f26a1b 100%);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(242, 106, 27, 0.38), 0 1px 2px rgba(32, 33, 36, 0.16);
}

.sample-fab-btn:hover,
.sample-fab-btn:focus-visible {
  background: linear-gradient(160deg, #ff9f1a 0%, #e25712 100%);
}

.sample-fab-btn:focus-visible {
  outline: 2px solid #f26a1b;
  outline-offset: 3px;
}

.sample-fab-card {
  width: 220px;
}

@media (max-width: 420px) {
  .sample-fab-card {
    width: 176px;
  }
}

@media print {
  .wechat-fab,
  .sample-fab,
  .proof-fab {
    display: none !important;
  }
}
