:root {
  color-scheme: light;
  font-family: "Microsoft YaHei UI", "Segoe UI", sans-serif;
  background: #eef1f5;
  color: #20252c;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body, #app { width: 100%; height: var(--viewer-viewport-height, 100vh); margin: 0; overflow: hidden; }
button { font: inherit; }
select { font: inherit; }

#app {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.topbar {
  min-height: 58px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #202833;
  color: #f7f9fc;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
  z-index: 3;
}

.brand { display: flex; flex-direction: column; min-width: 220px; }
.brand strong { font-size: 17px; letter-spacing: .02em; }
.brand span { margin-top: 3px; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #aeb8c6; font-size: 12px; }
.toolbar { display: flex; flex-wrap: nowrap; justify-content: flex-end; gap: 7px; white-space: nowrap; }
.lighting-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #4c596a;
  border-radius: 5px;
  padding: 4px 7px 4px 10px;
  background: #303b49;
  color: #f7f9fc;
  font-size: 13px;
}
.lighting-control select {
  border: 1px solid #66758a;
  border-radius: 4px;
  padding: 3px 5px;
  background: #202833;
  color: #f7f9fc;
}
.runtime-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #4c596a;
  border-radius: 5px;
  padding: 5px 8px;
  background: #303b49;
  color: #f7f9fc;
  font-size: 12px;
  user-select: none;
}
.runtime-toggle input { margin: 0; accent-color: #4ea1f3; }
.toolbar button {
  border: 1px solid #4c596a;
  border-radius: 5px;
  padding: 7px 12px;
  background: #303b49;
  color: #f7f9fc;
  cursor: pointer;
}
.toolbar button:hover:not(:disabled) { background: #3e4b5d; border-color: #6e8097; }
.toolbar button:disabled { opacity: .42; cursor: not-allowed; }

.summary {
  min-height: 34px;
  padding: 7px 16px;
  display: flex;
  gap: 24px;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #d7dce3;
  color: #59616d;
  font-size: 13px;
  white-space: nowrap;
  overflow-x: auto;
  z-index: 2;
}
.summary b { color: #20252c; font-variant-numeric: tabular-nums; }

.workspace { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 370px; }
.viewport { position: relative; min-width: 0; min-height: 0; background: #d9dde3; }
.viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-touch-callout: none;
}
.search-display-drawer {
  position: absolute;
  left: 12px;
  top: 12px;
  bottom: 12px;
  z-index: 4;
  width: clamp(320px, 32vw, 356px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #c7d0da;
  border-radius: 9px;
  background: #f8f9fb;
  box-shadow: 0 12px 34px rgba(30, 42, 56, .22);
  color: #27313d;
}
.search-display-header { display: flex; align-items: center; justify-content: space-between; min-height: 45px; padding: 9px 12px 8px 14px; background: #eef3f8; border-bottom: 1px solid #d3dbe4; }
.search-display-header strong { font-size: 15px; }
.drawer-close-button { width: 28px; height: 28px; border: 0; border-radius: 5px; background: transparent; color: #566270; font-size: 20px; line-height: 1; cursor: pointer; }
.drawer-close-button:hover { background: #dfe7ef; }
.search-display-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid #d7dee7; background: #fff; }
.search-display-tabs button { padding: 10px 8px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #657180; cursor: pointer; }
.search-display-tabs button.active { border-bottom-color: #2477c9; color: #175e9f; font-weight: 700; }
.drawer-state { margin: auto 18px; padding: 18px 12px; color: #667282; text-align: center; font-size: 13px; }
.drawer-error { color: #a23a3a; }
.search-display-content { min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 12px; overscroll-behavior: contain; }
.search-display-content h3 { margin: 0 0 10px; font-size: 14px; }
.specification-search-box { display: grid; grid-template-columns: minmax(0, 1fr) 34px; border: 1px solid #c7d1dc; border-radius: 6px; overflow: hidden; background: #fff; }
.specification-search-box:focus-within { border-color: #3b87ce; box-shadow: 0 0 0 2px rgba(36, 119, 201, .12); }
.specification-search-box input { min-width: 0; padding: 8px 9px; border: 0; outline: 0; font: inherit; font-size: 12px; }
.specification-search-box button { border: 0; border-left: 1px solid #e2e6eb; background: #f5f7fa; color: #657180; cursor: pointer; }
.specification-speech-button { display: none; }
.specification-speech-button svg { width: 21px; height: 21px; fill: currentColor; }
.search-mode { display: flex; gap: 16px; margin: 9px 2px; color: #5e6977; font-size: 12px; }
.search-mode label { display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }
.search-mode input, .classification-row input { accent-color: #2477c9; }
.specification-suggestions { max-height: 240px; overflow-y: auto; border: 1px solid #d9e0e7; border-radius: 6px; background: #fff; }
.specification-suggestion-row { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 36px; padding: 7px 9px; border: 0; border-bottom: 1px solid #edf1f4; background: #fff; color: #27313d; text-align: left; cursor: pointer; }
.specification-suggestion-row:last-child { border-bottom: 0; }
.specification-suggestion-row:hover { background: #eef5fb; }
.specification-suggestion-row.active { background: #dcecf9; color: #165b96; }
.classification-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.classification-count { color: #7a8491; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.drawer-empty { padding: 14px 6px; color: #7b8592; text-align: center; font-size: 12px; }
.active-specification-card { margin-top: 10px; padding: 10px; border: 1px solid #cbd9e6; border-radius: 7px; background: #eef5fb; }
.active-specification-card > strong { display: block; color: #175e9f; overflow-wrap: anywhere; }
.active-specification-card > span { display: block; margin-top: 4px; color: #697584; font-size: 12px; }
.drawer-action-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 9px; }
.drawer-action-row button, .classification-section header button, .classification-reset-button { border: 1px solid #c5d0dc; border-radius: 5px; background: #fff; color: #34404d; cursor: pointer; }
.drawer-action-row button { min-height: 31px; padding: 5px 4px; font-size: 11px; }
.drawer-action-row button:hover:not(:disabled), .classification-section header button:hover, .classification-reset-button:hover { border-color: #6b99c7; background: #edf5fc; }
.drawer-action-row button:disabled { opacity: .45; cursor: not-allowed; }
.drawer-warning { margin-top: 7px; color: #a66a16 !important; font-size: 12px; }
.classification-section { margin-bottom: 13px; border: 1px solid #d7dee6; border-radius: 7px; overflow: hidden; background: #fff; }
.classification-section header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 9px; background: #edf2f7; }
.classification-section header strong { font-size: 12px; }
.classification-section header span { display: flex; gap: 5px; }
.classification-section header button { padding: 3px 6px; font-size: 10px; }
.classification-list { display: flex; flex-direction: column; }
.classification-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 7px; align-items: center; min-height: 36px; padding: 7px 9px; border-top: 1px solid #edf1f4; cursor: pointer; font-size: 12px; }
.classification-row:hover { background: #f4f8fb; }
.classification-row input { margin: 0; }
.classification-reset-button { width: 100%; padding: 8px; font-size: 12px; }
.viewport-hint {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 6px 10px;
  border-radius: 5px;
  background: rgba(28, 34, 42, .78);
  color: #f6f8fb;
  font-size: 12px;
  pointer-events: none;
}
.orbit-pivot-indicator {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, .92);
  border-radius: 50%;
  background: rgba(32, 118, 204, .76);
  box-shadow: 0 0 0 3px rgba(32, 118, 204, .18);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  transition: opacity .18s ease;
  will-change: opacity;
}
.orbit-pivot-indicator::before,
.orbit-pivot-indicator::after { content: ""; position: absolute; background: rgba(255, 255, 255, .95); }
.orbit-pivot-indicator::before { left: 4px; right: 4px; top: 8px; height: 1px; }
.orbit-pivot-indicator::after { top: 4px; bottom: 4px; left: 8px; width: 1px; }
.orbit-pivot-indicator.visible { opacity: .74; }

.loading { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(217, 221, 227, .94); }
.loading.hidden { display: none; }
.empty-view-state { position: absolute; inset: 50% auto auto 50%; z-index: 3; display: none; transform: translate(-50%, -50%); padding: 10px 14px; border-radius: 6px; background: rgba(255, 255, 255, .9); color: #566171; box-shadow: 0 6px 20px rgba(31, 39, 49, .14); pointer-events: none; }
.empty-view-state.visible { display: block; }
.loading-card { width: min(420px, calc(100% - 40px)); padding: 24px; border-radius: 10px; background: #fff; box-shadow: 0 14px 40px rgba(31, 39, 49, .18); text-align: center; }
.spinner { width: 34px; height: 34px; margin: 0 auto 14px; border: 3px solid #dce3eb; border-top-color: #2477c9; border-radius: 50%; animation: spin .8s linear infinite; }
.loading-card strong { display: block; }
.loading-card span { display: block; margin-top: 8px; color: #687382; font-size: 12px; }
.progress-track { height: 7px; margin-top: 16px; overflow: hidden; border-radius: 99px; background: #e8edf2; }
.progress-bar { width: 0; height: 100%; background: #2477c9; transition: width .16s ease; }
@keyframes spin { to { transform: rotate(360deg); } }

.properties { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: #f8f9fb; border-left: 1px solid #cfd5dd; }
.properties-heading { padding: 14px 16px 11px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; border-bottom: 1px solid #dce1e7; background: #fff; }
.properties-heading > div { min-width: 0; }
.properties-heading h2 { margin: 0; font-size: 16px; }
.properties-heading span { display: block; margin-top: 4px; color: #727c89; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.property-content { min-height: 0; overflow: auto; padding: 12px 14px 24px; }
.empty-state { display: grid; place-items: center; color: #7a8492; text-align: center; }
.property-section { margin: 0 0 10px; border: 1px solid #d9dee5; border-radius: 7px; background: #fff; overflow: hidden; }
.property-section summary { padding: 9px 11px; background: #eef2f6; cursor: pointer; font-weight: 600; font-size: 13px; }
.property-table { margin: 0; }
.property-row { display: grid; grid-template-columns: minmax(105px, 42%) minmax(0, 1fr); gap: 10px; padding: 7px 10px; border-top: 1px solid #edf0f3; font-size: 12px; }
.property-row dt { color: #6c7582; overflow-wrap: anywhere; }
.property-row dd { margin: 0; color: #20252c; overflow-wrap: anywhere; user-select: text; }

.debug-panel { border-top: 1px solid #d8dde4; background: #fff; }
.debug-panel summary { padding: 10px 14px; cursor: pointer; font-size: 13px; font-weight: 600; }
.debug-runtime-controls { display: flex; gap: 8px; padding: 0 14px 10px; }
.debug-runtime-controls .runtime-toggle { color: #27313d; background: #eef2f6; border-color: #cdd5df; }
.debug-panel dl { margin: 0; padding: 0 14px 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 14px; }
.debug-panel dl div { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; }
.debug-panel dt { color: #76808d; }
.debug-panel dd { margin: 0; font-variant-numeric: tabular-nums; }
.debug-panel dd.warning-value { color: #c33b3b; font-weight: 700; }

.mobile-top-more-button,
.mobile-toolbar,
.mobile-more-menu,
.mobile-bottom-sheet,
.mobile-sheet-drag-region,
.mobile-sheet-handle,
.mobile-sheet-close,
.loading-reload-button { display: none; }

.loading-reload-button {
  margin: 16px auto 0;
  padding: 8px 14px;
  border: 1px solid #b9c4d0;
  border-radius: 6px;
  background: #fff;
  color: #31404f;
  cursor: pointer;
}

@media (max-width: 900px) {
  body[data-layout-mode="Desktop"] .workspace { grid-template-columns: minmax(0, 1fr) 315px; }
  body[data-layout-mode="Desktop"] .topbar { align-items: flex-start; }
  body[data-layout-mode="Desktop"] .toolbar { overflow-x: auto; }
  body[data-layout-mode="Desktop"] .toolbar button { padding: 6px 8px; }
}

body[data-layout-mode^="Mobile"] {
  position: fixed;
  inset: 0;
  overscroll-behavior: none;
  background: #d9dde3;
}

body[data-layout-mode^="Mobile"] #app {
  height: var(--viewer-viewport-height, 100dvh);
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

body[data-layout-mode^="Mobile"] .topbar {
  min-height: calc(48px + env(safe-area-inset-top));
  padding: calc(7px + env(safe-area-inset-top)) calc(10px + env(safe-area-inset-right)) 7px calc(12px + env(safe-area-inset-left));
  gap: 8px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body[data-layout-mode^="Mobile"] .brand { min-width: 0; flex: 1; }
body[data-layout-mode^="Mobile"] .brand strong { font-size: 16px; }
body[data-layout-mode^="Mobile"] .brand span { max-width: 68vw; margin-top: 2px; font-size: 11px; }
body[data-layout-mode^="Mobile"] .toolbar,
body[data-layout-mode^="Mobile"] .summary { display: none; }

body[data-layout-mode^="Mobile"] .mobile-top-more-button {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid #4c596a;
  border-radius: 7px;
  background: #303b49;
  color: #fff;
  font-size: 12px;
}

body[data-layout-mode^="Mobile"] .workspace { display: block; min-height: 0; position: relative; }
body[data-layout-mode^="Mobile"] .viewport { width: 100%; height: 100%; }
body[data-layout-mode^="Mobile"] .viewport-hint {
  left: calc(8px + env(safe-area-inset-left));
  right: calc(8px + env(safe-area-inset-right));
  bottom: 8px;
  padding: 5px 8px;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
}

body[data-layout-mode^="Mobile"] .mobile-toolbar {
  z-index: 8;
  min-height: calc(58px + env(safe-area-inset-bottom));
  padding: 4px calc(4px + env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) calc(4px + env(safe-area-inset-left));
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  border-top: 1px solid #c8d0d9;
  background: rgba(248, 250, 252, .97);
  box-shadow: 0 -4px 16px rgba(30, 42, 56, .14);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body[data-layout-mode^="Mobile"] .mobile-toolbar button {
  min-width: 0;
  min-height: 48px;
  padding: 4px 2px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #30404f;
  font-size: 11px;
  line-height: 1.2;
}
body[data-layout-mode^="Mobile"] .mobile-toolbar button:active { background: #dce9f5; }
body[data-layout-mode^="Mobile"] .mobile-toolbar button:disabled { opacity: .38; }
body[data-layout-mode^="Mobile"] .mobile-toolbar button b { display: block; margin-top: 2px; color: #1767aa; font-size: 10px; }

body[data-layout-mode^="Mobile"] .properties { display: none; }

body[data-layout-mode^="Mobile"] .mobile-bottom-sheet {
  --mobile-sheet-drag-y: 0px;
  position: fixed;
  z-index: 12;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid #c8d0d9;
  border-radius: 14px 14px 0 0;
  background: #f8f9fb;
  box-shadow: 0 -12px 34px rgba(28, 39, 52, .24);
  transform: translateY(110%);
  opacity: 0;
  transition: transform 200ms cubic-bezier(.2, 0, 0, 1), opacity 150ms ease;
  visibility: hidden;
  overflow: hidden;
  max-height: none;
}
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet[hidden] { display: none; }
body[data-layout-mode="MobilePortrait"] .mobile-bottom-sheet {
  left: env(safe-area-inset-left);
  right: env(safe-area-inset-right);
  bottom: calc(58px + env(safe-area-inset-bottom));
  height: clamp(240px, calc(var(--viewer-viewport-height, 100dvh) * .34), 420px);
}
body[data-layout-mode="MobilePortrait"] .mobile-bottom-sheet[data-sheet-state="half"] {
  height: calc(var(--viewer-viewport-height, 100dvh) * .5);
}
body[data-layout-mode="MobilePortrait"] .mobile-bottom-sheet[data-sheet-state="full"] {
  top: 0;
  bottom: auto;
  height: var(--viewer-viewport-height, 100dvh);
  border-radius: 0;
}
body[data-layout-mode="MobileLandscape"] .mobile-bottom-sheet {
  top: calc(48px + env(safe-area-inset-top));
  right: env(safe-area-inset-right);
  bottom: calc(58px + env(safe-area-inset-bottom));
  width: clamp(300px, 42vw, 420px);
  height: auto;
  border-radius: 12px 0 0 12px;
  transform: translateX(110%);
}
body[data-layout-mode="MobileLandscape"] .mobile-bottom-sheet[data-sheet-state="full"] {
  inset: 0;
  width: var(--viewer-viewport-width, 100vw);
  height: var(--viewer-viewport-height, 100dvh);
  border-radius: 0;
}
body[data-layout-mode="MobilePortrait"] .mobile-bottom-sheet.mobile-sheet-open { transform: translate3d(0, var(--mobile-sheet-drag-y), 0); opacity: 1; visibility: visible; }
body[data-layout-mode="MobileLandscape"] .mobile-bottom-sheet.mobile-sheet-open { transform: translate3d(0, 0, 0); opacity: 1; visibility: visible; }
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet.mobile-sheet-dragging { transition: none; }
body[data-layout-mode^="Mobile"] .mobile-sheet-drag-region { display: flex; flex: 0 0 54px; min-height: 54px; flex-direction: column; background: #fff; border-radius: 14px 14px 0 0; touch-action: none; cursor: ns-resize; }
body[data-layout-mode^="Mobile"] .mobile-sheet-handle { display: flex; flex: 0 0 12px; height: 12px; align-items: flex-end; justify-content: center; background: transparent; border-radius: 14px 14px 0 0; pointer-events: none; }
body[data-layout-mode^="Mobile"] .mobile-sheet-handle span { width: 42px; height: 4px; border-radius: 99px; background: #b8c2cd; }
body[data-layout-mode^="Mobile"] .mobile-sheet-close { display: inline-flex; width: 36px; height: 36px; flex: 0 0 auto; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: #edf2f6; color: #4d5a68; font-size: 20px; }
body[data-layout-mode^="Mobile"] .mobile-sheet-heading {
  flex: 0 0 42px;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto) 36px;
  gap: 8px;
  align-items: center;
  padding: 1px 10px 2px 12px;
  border-bottom: 1px solid #dce1e7;
  background: #fff;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
body[data-layout-mode^="Mobile"] .mobile-sheet-heading strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
body[data-layout-mode^="Mobile"] .mobile-sheet-heading > span { min-width: 0; max-width: 48vw; overflow: hidden; color: #6c7784; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; text-align: right; }
body[data-layout-mode^="Mobile"] .mobile-sheet-content { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

body[data-layout-mode^="Mobile"] .mobile-bottom-sheet[data-panel-type="ElementInfo"] .property-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 7px 10px calc(10px + env(safe-area-inset-bottom));
  overscroll-behavior: contain;
}
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet[data-panel-type="ElementInfo"] .property-section { margin-bottom: 7px; }
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet[data-panel-type="ElementInfo"] .property-section summary { min-height: 40px; padding: 10px 11px; }
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet[data-panel-type="ElementInfo"] .property-row { min-height: 40px; padding: 8px 11px; }
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet[data-panel-type="ElementInfo"] .property-row[data-empty="true"] { display: none; }
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet[data-panel-type="ElementInfo"] .property-section > summary { touch-action: manipulation; }

body[data-layout-mode^="Mobile"] .mobile-bottom-sheet .search-display-drawer {
  position: static;
  z-index: auto;
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #f8f9fb;
}
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet .search-display-header { display: none; }
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet .search-display-tabs { flex: 0 0 40px; min-height: 40px; }
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet .search-display-tabs button { position: relative; min-height: 40px; padding: 7px; border-bottom: 0; }
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet .search-display-tabs button::after { content: ""; position: absolute; left: 18%; right: 18%; bottom: 0; height: 2px; border-radius: 2px; background: #2477c9; transform: scaleX(0); transition: transform 170ms cubic-bezier(.2, 0, 0, 1); }
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet .search-display-tabs button.active::after { transform: scaleX(1); }
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet .search-display-content { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding: 7px 9px 9px; }
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet .search-display-content > [data-search-panel]:not([hidden]) { flex: 1; min-height: 0; display: flex; flex-direction: column; animation: mobile-search-panel-fade 170ms ease; }
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet [data-search-panel="specification"] > h3,
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet .search-mode { display: none; }
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet .specification-search-box { flex: 0 0 44px; min-height: 44px; grid-template-columns: 44px minmax(0, 1fr) 44px; margin-bottom: 8px; }
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet .specification-search-box input { min-height: 42px; }
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet .specification-search-box button { min-width: 44px; min-height: 44px; }
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet .specification-speech-button { display: inline-flex; align-items: center; justify-content: center; border-left: 0; border-right: 1px solid #e2e6eb; color: #2477c9; }
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet .specification-speech-button[aria-disabled="true"] { color: #9aa5b1; background: #eef1f4; }
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet .specification-speech-button[data-speech-state="Listening"] { color: #c73939; animation: speech-listening-pulse 900ms ease-in-out infinite alternate; }
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet .specification-suggestions { flex: 1 1 auto; min-height: 88px; max-height: none; }

body[data-layout-mode^="Mobile"] .mobile-bottom-sheet[data-panel-type="DebugInfo"] .debug-panel-body {
  flex: 1;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet[data-panel-type="DebugInfo"] .debug-runtime-controls { flex: 0 0 auto; padding: 8px 10px; }
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet[data-panel-type="DebugInfo"] .debug-panel-body dl {
  flex: 1;
  min-height: 0;
  grid-template-columns: 1fr;
  overflow-y: auto;
  padding: 0 10px calc(12px + env(safe-area-inset-bottom));
  overscroll-behavior: contain;
}

body[data-layout-mode^="Mobile"] .drawer-close-button { width: 44px; height: 44px; }
body[data-layout-mode^="Mobile"] .search-display-tabs button,
body[data-layout-mode^="Mobile"] .drawer-action-row button,
body[data-layout-mode^="Mobile"] .classification-row { min-height: 44px; }
body[data-layout-mode^="Mobile"] .specification-search-box input { min-height: 44px; font-size: 16px; }

@keyframes mobile-sheet-content-snap { from { transform: translate3d(0, 6px, 0); opacity: .88; } to { transform: translate3d(0, 0, 0); opacity: 1; } }
@keyframes mobile-search-panel-fade { from { opacity: .72; } to { opacity: 1; } }
@keyframes speech-listening-pulse { from { transform: scale(.92); opacity: .7; } to { transform: scale(1.06); opacity: 1; } }
body[data-layout-mode^="Mobile"] .mobile-bottom-sheet.mobile-sheet-snapping .mobile-sheet-content { animation: mobile-sheet-content-snap 200ms cubic-bezier(.2, 0, 0, 1); }

@media (prefers-reduced-motion: reduce) {
  body[data-layout-mode^="Mobile"] .mobile-bottom-sheet,
  body[data-layout-mode^="Mobile"] .mobile-bottom-sheet .search-display-tabs button::after { transition-duration: 1ms; }
  body[data-layout-mode^="Mobile"] .mobile-bottom-sheet.mobile-sheet-snapping .mobile-sheet-content,
  body[data-layout-mode^="Mobile"] .mobile-bottom-sheet .search-display-content > [data-search-panel]:not([hidden]),
  body[data-layout-mode^="Mobile"] .mobile-bottom-sheet .specification-speech-button[data-speech-state="Listening"] { animation-duration: 1ms; animation-iteration-count: 1; }
}

body[data-layout-mode^="Mobile"] .mobile-more-menu {
  position: fixed;
  z-index: 13;
  left: calc(10px + env(safe-area-inset-left));
  right: calc(10px + env(safe-area-inset-right));
  bottom: calc(66px + env(safe-area-inset-bottom));
  display: block;
  padding: 10px;
  border: 1px solid #c8d0d9;
  border-radius: 12px;
  background: rgba(250, 251, 253, .98);
  box-shadow: 0 12px 34px rgba(28, 39, 52, .26);
}
body[data-layout-mode^="Mobile"] .mobile-more-menu[hidden] { display: none; }
body[data-layout-mode^="Mobile"] .mobile-more-menu header { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 8px; }
body[data-layout-mode^="Mobile"] .mobile-more-menu header button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #edf2f6; font-size: 20px; }
body[data-layout-mode^="Mobile"] .mobile-more-menu > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
body[data-layout-mode^="Mobile"] .mobile-more-menu > div button { min-height: 44px; border: 1px solid #cbd4de; border-radius: 7px; background: #fff; color: #344351; }
body[data-layout-mode^="Mobile"] .mobile-more-menu > div button:disabled { opacity: .4; }

@supports (height: 100dvh) {
  html, body, #app { height: var(--viewer-viewport-height, 100dvh); }
}
