/* SKP viewer (specs/030-skp-viewer, contracts/viewer-client-api.md §5): light grey window chrome in the
   manner of SketchUp 2026 on Windows — menu bar, compact toolbar with blue pressed state, scene tabs,
   the Default Tray with collapsible panels, and a status bar with the 「측정」 (Measurements) box.
   The page CSP has no 'unsafe-inline': every rule lives here; JS sets only positions, sizes and colours
   through the CSSOM (style.left/top/width, --sv-tray-width). 3D overlays use the sv-3d- prefix (bottom).
   Small screens (`.sv-app.is-compact`, set by sv/ui from (max-width: 900px)) and touch pointers are near the end. */

:root {
  --sv-font: "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, -apple-system, sans-serif;
  --sv-chrome: #f0f0f0;
  --sv-chrome-dark: #e3e3e3;
  --sv-panel-head: #e6e6e6;
  --sv-surface: #ffffff;
  --sv-border: #d0d0d0;
  --sv-border-strong: #a9a9a9;
  --sv-text: #1f1f1f;
  --sv-muted: #6b6b6b;
  --sv-disabled: #a0a0a0;
  --sv-accent: #0067c0;
  --sv-hover: #e5f1fb;
  --sv-hover-border: #cce4f7;
  --sv-pressed: #cce4f7;
  --sv-pressed-border: #7eb4ea;
  --sv-selected: #cce8ff;
  --sv-selected-strong: #0078d7;
  --sv-danger: #c42b1c;
  --sv-warn: #9d5d00;
  --sv-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  --sv-tray-width: 300px;
  color-scheme: light;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--sv-chrome);
  color: var(--sv-text);
  font: 12px/1.4 var(--sv-font);
}

.sv-app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--sv-chrome);
  user-select: none;
  -webkit-user-select: none;
}

.sv-app.is-resizing,
.sv-app.is-resizing * {
  cursor: col-resize !important;
}

.sv-app button,
.sv-app input,
.sv-app select {
  font: inherit;
  color: inherit;
}

.sv-icon {
  display: block;
  flex: none;
}

.sv-muted {
  color: var(--sv-muted);
}

.sv-boot-error {
  margin: 40px;
  font-size: 14px;
}

.sv-file-input {
  display: none;
}

/* ---------------------------------------------------------------- menu bar --- */

.sv-menubar {
  display: flex;
  align-items: stretch;
  gap: 0;
  height: 24px;
  padding: 0 4px;
  background: var(--sv-surface);
  border-bottom: 1px solid var(--sv-chrome-dark);
}

.sv-menu-title {
  padding: 0 9px;
  border: 1px solid transparent;
  background: transparent;
  cursor: default;
  font-size: 12px;
}

.sv-menu-title:hover,
.sv-menu-title:focus-visible {
  background: var(--sv-hover);
  border-color: var(--sv-hover-border);
  outline: none;
}

.sv-menu-title.is-open {
  background: var(--sv-pressed);
  border-color: var(--sv-pressed-border);
}

.sv-menu {
  position: fixed;
  z-index: 1000;
  /* sv/ui sets max-height to the room left on the screen: padding and border are inside it (R8-UX: 4 px past the edge). */
  box-sizing: border-box;
  min-width: 230px;
  max-width: min(360px, calc(100vw - 8px));
  padding: 3px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #f9f9f9;
  border: 1px solid var(--sv-border-strong);
  box-shadow: var(--sv-shadow);
}

/* A submenu opened under its item (small screens). */
.sv-menu-inline {
  margin: 0 0 3px 18px;
  padding-left: 4px;
  border-left: 2px solid var(--sv-hover-border);
}

/* 더 보기: toolbar buttons in a menu keep their icon; a pressed one shows pressed. */
.sv-menu-icon {
  display: grid;
  place-items: center;
  justify-self: center;
  width: 22px;
  height: 22px;
  border: 1px solid transparent;
  border-radius: 2px;
}

.sv-menu-item.is-checked .sv-menu-icon {
  background: var(--sv-pressed);
  border-color: var(--sv-pressed-border);
}

.sv-menu-item:disabled .sv-menu-icon .sv-icon {
  opacity: 0.38;
  filter: grayscale(1);
}

.sv-overflow-menu .sv-menu-item {
  grid-template-columns: 30px minmax(0, 1fr) auto 14px;
}

.sv-menu-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto 14px;
  align-items: center;
  width: 100%;
  min-height: 24px;
  padding: 0 4px 0 0;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  cursor: default;
  white-space: nowrap;
}

.sv-menu-item:hover:not(:disabled),
.sv-menu-item:focus:not(:disabled),
.sv-menu-item.is-open {
  background: var(--sv-hover);
  border-color: var(--sv-hover-border);
  outline: none;
}

.sv-menu-item:disabled {
  color: var(--sv-disabled);
}

.sv-menu-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sv-menu-shortcut {
  padding-left: 24px;
  color: var(--sv-muted);
}

.sv-menu-item:disabled .sv-menu-shortcut {
  color: var(--sv-disabled);
}

.sv-menu-check {
  justify-self: center;
  width: 12px;
  height: 12px;
}

.sv-menu-item.is-checked .sv-menu-check {
  width: 5px;
  height: 9px;
  margin-top: -3px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.sv-menu-item.is-checked .sv-menu-check.is-radio {
  width: 7px;
  height: 7px;
  margin-top: 0;
  border: 0;
  border-radius: 50%;
  background: currentColor;
  transform: none;
}

.sv-menu.is-compact .sv-menu-item-sub.is-open .sv-menu-arrow {
  transform: rotate(90deg);
}

.sv-menu-item-sub .sv-menu-arrow {
  justify-self: end;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid currentColor;
}

.sv-menu-separator {
  height: 1px;
  margin: 3px 4px 3px 26px;
  background: var(--sv-border);
}

/* ----------------------------------------------------------------- toolbar --- */

/* One row: buttons that do not fit go into the 더 보기 menu (sv/ui fitToolbar). */
.sv-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 2px 0;
  min-width: 0;
  min-height: 36px;
  padding: 2px 4px;
  overflow: hidden;
  background: var(--sv-chrome);
  border-bottom: 1px solid var(--sv-border);
}

.sv-tool-more {
  flex: none;
  margin-left: auto;
}

.sv-toolbar-group {
  display: flex;
  flex: none;
  align-items: center;
  gap: 1px;
  padding: 0 5px 0 7px;
  border-left: 1px solid var(--sv-border);
  box-shadow: inset 1px 0 0 #fafafa;
}

.sv-toolbar-group:first-child {
  border-left: 0;
  box-shadow: none;
  padding-left: 2px;
}

.sv-tool {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  cursor: default;
}

.sv-tool:hover:not(:disabled) {
  background: var(--sv-hover);
  border-color: var(--sv-hover-border);
}

.sv-tool:focus-visible {
  outline: 1px dotted var(--sv-text);
  outline-offset: -3px;
}

.sv-tool.is-active,
.sv-tool[aria-pressed="true"] {
  background: var(--sv-pressed);
  border-color: var(--sv-pressed-border);
}

.sv-tool:disabled .sv-icon {
  opacity: 0.38;
  filter: grayscale(1);
}

.sv-tool:disabled.is-active {
  background: #e4ecf4;
  border-color: #c9d7e6;
}

.sv-noscript {
  margin: 40px;
  font: 14px/1.5 var(--sv-font);
}

/* -------------------------------------------------------------- scene tabs --- */

/* The scene bar: one line of tabs (.sv-scene-strip scrolls sideways) between two scroll arrows. */
.sv-scene-tabs {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  min-width: 0;
  min-height: 25px;
  padding: 3px 4px 0;
  background: var(--sv-chrome);
  border-bottom: 1px solid var(--sv-border-strong);
}

.sv-scene-strip {
  display: flex;
  flex: 1;
  align-items: flex-end;
  gap: 2px;
  min-width: 0;
  margin-bottom: -1px;
  padding: 0 2px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.sv-scene-strip::-webkit-scrollbar {
  display: none;
}

.sv-scene-scroll {
  display: grid;
  flex: none;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-bottom: 1px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
}

.sv-scene-scroll:hover:not(:disabled) {
  background: var(--sv-hover);
  border-color: var(--sv-hover-border);
}

.sv-scene-scroll:disabled .sv-icon {
  opacity: 0.3;
}

.sv-scene-tab {
  flex: none;
  max-width: 180px;
  height: 22px;
  padding: 0 14px;
  overflow: hidden;
  border: 1px solid var(--sv-border-strong);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(#f4f4f4, #dedede);
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: default;
}

.sv-scene-tab:hover {
  background: linear-gradient(#fbfbfb, #e8f2fc);
}

.sv-scene-tab.is-active {
  height: 24px;
  background: var(--sv-surface);
  font-weight: 600;
}

/* -------------------------------------------------------------------- main --- */

.sv-menubar,
.sv-toolbar,
.sv-scene-tabs,
.sv-statusbar {
  flex: none;
}

.sv-main {
  position: relative;
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) 5px var(--sv-tray-width);
  min-width: 0;
  min-height: 0;
}

.sv-app.is-tray-hidden .sv-main {
  grid-template-columns: minmax(0, 1fr);
}

.sv-viewport {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--sv-surface);
}

/* The 3D host is its own stacking context: model labels (.sv-3d-label z-index 2), tooltips and the
   selection rectangle stay under the empty/progress/error/drop cards of the layer above it. */
.sv-viewport-host {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  isolation: isolate;
}

.sv-viewport-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.sv-splitter {
  cursor: col-resize;
  background: var(--sv-chrome);
  border-left: 1px solid var(--sv-border);
  border-right: 1px solid var(--sv-border);
}

.sv-splitter:hover,
.sv-splitter:focus-visible {
  background: var(--sv-hover-border);
  outline: none;
}

/* Empty, progress, error and drop cards sit over the viewport. */
.sv-empty,
.sv-progress,
.sv-error,
.sv-drop {
  position: absolute;
  inset: 0;
  display: grid;
  /* One column as wide as the layer: a card's width: min(420px, 100%) then never outgrows a phone screen. */
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 16px;
}

.sv-empty {
  background: linear-gradient(#e7f0f8 0%, #f6f9fc 55%, #ffffff 100%);
}

.sv-empty-card,
.sv-progress-card,
.sv-error-card {
  display: grid;
  box-sizing: border-box;
  justify-items: center;
  gap: 8px;
  width: min(420px, 100%);
  padding: 28px 28px 24px;
  background: var(--sv-surface);
  border: 1px solid var(--sv-border);
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  text-align: center;
  pointer-events: auto;
}

.sv-empty-title,
.sv-error-title {
  margin: 4px 0 0;
  font-size: 15px;
  font-weight: 600;
}

.sv-empty-or {
  margin: 0;
  color: var(--sv-muted);
}

.sv-empty-families,
.sv-empty-limit {
  margin: 0;
  color: var(--sv-muted);
}

.sv-empty-families {
  margin-top: 6px;
}

.sv-progress {
  background: rgba(255, 255, 255, 0.55);
  pointer-events: auto;
}

/* The picture SketchUp saved in the file (sv/preview), shown while the model goes up and is read. */
.sv-progress-preview {
  display: block;
  max-width: 100%;
  max-height: 200px;
  margin-bottom: 4px;
  object-fit: contain;
  background: var(--sv-surface);
  border: 1px solid var(--sv-border);
  border-radius: 4px;
}

.sv-progress-file {
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--sv-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sv-progress-text {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.sv-progress-bar {
  position: relative;
  width: 100%;
  height: 6px;
  overflow: hidden;
  background: #e1e4e8;
  border-radius: 3px;
}

.sv-progress-fill {
  height: 100%;
  width: 0;
  background: var(--sv-selected-strong);
  border-radius: 3px;
  transition: width 0.15s linear;
}

.sv-progress-bar.is-indeterminate .sv-progress-fill {
  position: absolute;
  width: 35%;
  animation: sv-indeterminate 1.1s ease-in-out infinite;
}

@keyframes sv-indeterminate {
  from {
    left: -35%;
  }
  to {
    left: 100%;
  }
}

.sv-error {
  background: linear-gradient(#f7eeee 0%, #ffffff 70%);
}

.sv-error-text {
  margin: 0;
  white-space: pre-line;
}

.sv-error-code {
  margin: 0;
  color: var(--sv-muted);
  font: 11px/1.3 ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.sv-error-code:empty {
  display: none;
}

.sv-drop {
  background: rgba(0, 103, 192, 0.1);
  border: 2px dashed var(--sv-selected-strong);
}

.sv-drop-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 22px;
  background: var(--sv-surface);
  border-radius: 6px;
  box-shadow: var(--sv-shadow);
  font-size: 14px;
  font-weight: 600;
}

/* ------------------------------------------------------------------ toasts --- */

/* Over the builder's extension windows (.sv-builder-layer 900): a toast's own button (「PDF로 인쇄」,
   「내려받기」) must not be covered by the window that caused it. Under menus (1000) and dialogs. */
.sv-toasts {
  position: absolute;
  top: 8px;
  left: 50%;
  z-index: 950;
  display: grid;
  gap: 6px;
  width: min(560px, calc(100% - 24px));
  transform: translateX(-50%);
  pointer-events: none;
}

.sv-toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 10px;
  background: var(--sv-surface);
  border: 1px solid var(--sv-border);
  border-left: 4px solid var(--sv-selected-strong);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
  pointer-events: auto;
}

.sv-toast.is-warn {
  border-left-color: #e0a100;
}

.sv-toast.is-error {
  border-left-color: var(--sv-danger);
}

.sv-toast-text {
  flex: 1;
  min-width: 0;
}

.sv-toast-action {
  padding: 2px 8px;
  border: 1px solid var(--sv-pressed-border);
  border-radius: 3px;
  background: var(--sv-hover);
  white-space: nowrap;
}

.sv-toast-close {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
}

/* --------------------------------------------- cloud projects (specs/033) --- */

/* A view built on the Service: a band over the top of the view while that model is open (no close button). */
.sv-cloud-band {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  box-sizing: border-box;
  min-height: 24px;
  padding: 4px 12px;
  overflow: hidden;
  background: rgba(255, 244, 214, 0.94);
  border-bottom: 1px solid #e3c77a;
  color: #5a4300;
  font-weight: 600;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  /* The 3D tools keep the whole view: the band only shows. */
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.sv-cloud-band[hidden] {
  display: none;
}

.sv-app.has-cloud-band .sv-toasts {
  top: 32px;
}

.sv-empty-cloud {
  margin-top: 2px;
}

.sv-cloud-dialog {
  width: min(720px, 100%);
}

.sv-cloud-picker {
  display: grid;
  gap: 10px;
}

.sv-cloud-intro,
.sv-cloud-note,
.sv-cloud-status {
  margin: 0;
  white-space: pre-line;
}

.sv-cloud-note {
  color: var(--sv-warn);
}

.sv-cloud-status {
  color: var(--sv-muted);
}

.sv-cloud-status[hidden] {
  display: none;
}

.sv-cloud-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.sv-cloud-list:empty {
  display: none;
}

.sv-cloud-card {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 4px;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--sv-border);
  border-radius: 4px;
  background: var(--sv-surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.sv-cloud-card:hover {
  background: var(--sv-hover);
  border-color: var(--sv-hover-border);
}

.sv-cloud-card:focus-visible {
  outline: 2px solid var(--sv-selected-strong);
  outline-offset: 1px;
}

/* specs/033 A1: a revision without a view snapshot is listed, not openable. */
.sv-cloud-card.is-unavailable,
.sv-cloud-card.is-unavailable:hover {
  background: var(--sv-surface);
  border-color: var(--sv-border);
  cursor: default;
}

.sv-cloud-card.is-unavailable .sv-cloud-thumb-box,
.sv-cloud-card.is-unavailable .sv-cloud-name {
  opacity: 0.55;
}

.sv-cloud-noview {
  color: var(--sv-muted);
  font-size: 11px;
  line-height: 1.35;
  white-space: normal;
}

.sv-cloud-thumb-box {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f4f6f8;
  border-radius: 3px;
}

.sv-cloud-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sv-cloud-thumb[hidden] {
  display: none;
}

.sv-cloud-thumb-none {
  color: var(--sv-muted);
  font-size: 11px;
}

.sv-cloud-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sv-cloud-meta {
  overflow: hidden;
  color: var(--sv-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sv-cloud-meta:empty {
  display: none;
}

.sv-cloud-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sv-cloud-actions .sv-button[hidden] {
  display: none;
}

.sv-cloud-spacer {
  flex: 1;
}

@media (max-width: 480px) {
  .sv-cloud-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* New model from a template (specs/033 US4): the purposes, each with its unit cards and pictures. */
.sv-empty-template {
  margin-top: 2px;
}

/* After .sv-dialog-wide in the cascade: the chooser needs room for four pictures in a row. */
.sv-dialog.sv-template-dialog {
  width: min(880px, 100%);
}

.sv-template-chooser {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.sv-template-intro,
.sv-template-status,
.sv-template-detail {
  margin: 0;
}

.sv-template-status {
  color: var(--sv-muted);
}

.sv-template-groups {
  display: grid;
  gap: 12px;
  max-height: min(60vh, 560px);
  overflow: auto;
  padding: 2px;
}

.sv-template-group {
  display: grid;
  gap: 6px;
}

.sv-template-group-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--sv-muted);
}

.sv-template-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.sv-template-card {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 2px;
  min-width: 0;
  padding: 5px 5px 6px;
  border: 1px solid var(--sv-border);
  border-radius: 4px;
  background: var(--sv-surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.sv-template-card:hover {
  background: var(--sv-hover);
  border-color: var(--sv-hover-border);
}

.sv-template-card.is-selected {
  background: var(--sv-selected);
  border-color: var(--sv-selected-strong);
  box-shadow: inset 0 0 0 1px var(--sv-selected-strong);
}

.sv-template-card:focus-visible {
  outline: 2px solid var(--sv-selected-strong);
  outline-offset: 1px;
}

.sv-template-thumb-box {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  margin-bottom: 3px;
  overflow: hidden;
  background: #f4f6f8;
  border-radius: 3px;
}

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

.sv-template-thumb[hidden],
.sv-template-thumb-none[hidden] {
  display: none;
}

.sv-template-thumb-none {
  color: var(--sv-muted);
  font-size: 11px;
}

.sv-template-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sv-template-unit {
  overflow: hidden;
  color: var(--sv-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sv-template-detail {
  min-height: 2.8em;
  color: var(--sv-text);
}

.sv-template-actions {
  display: flex;
  gap: 8px;
}

@media (max-width: 480px) {
  .sv-template-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ------------------------------------------------------------------- tray --- */

.sv-tray {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--sv-chrome);
}

.sv-tray-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 26px;
  padding: 0 4px 0 10px;
  background: var(--sv-chrome-dark);
  border-bottom: 1px solid var(--sv-border);
  font-weight: 600;
}

/* Panels stack in a column; the tray scrolls only when their natural heights do not fit. The last open
   list panel (`.is-flex`, set by sv/trays) takes the free height and its list scrolls inside, so a tall
   tray shows more rows instead of empty space (SketchUp's browsers grow with the tray). */
.sv-tray-body {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

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

.sv-panel.is-flex.is-open {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  min-height: 200px;
}

.sv-panel.is-flex.is-open > .sv-panel-head {
  flex: none;
}

.sv-panel.is-flex.is-open > .sv-panel-body {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  min-height: 0;
}

.sv-panel.is-flex .sv-panel-body > * {
  flex: none;
}

.sv-panel.is-flex .sv-panel-body > .sv-swatches,
.sv-panel.is-flex .sv-panel-body > .sv-list,
.sv-panel.is-flex .sv-panel-body > .sv-tag-table,
.sv-panel.is-flex .sv-panel-body > .sv-outline {
  flex: 1 1 0;
  min-height: 96px;
  max-height: none;
}

.sv-panel-head {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  height: 26px;
  padding: 0 8px;
  border: 0;
  background: var(--sv-panel-head);
  text-align: left;
  font-weight: 600;
  cursor: default;
}

.sv-panel-head:hover {
  background: #dcdcdc;
}

.sv-panel-head:focus-visible {
  outline: 1px dotted var(--sv-text);
  outline-offset: -2px;
}

.sv-panel-arrow {
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid #4a4f57;
  transition: transform 0.12s ease;
}

.sv-panel.is-open .sv-panel-arrow {
  transform: rotate(90deg);
}

.sv-panel-body {
  padding: 8px 10px 10px;
  background: var(--sv-chrome);
  user-select: text;
  -webkit-user-select: text;
}

.sv-panel-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.sv-bar-label {
  font-weight: 600;
}

.sv-empty-note {
  margin: 4px 0;
  color: var(--sv-muted);
}

.sv-note {
  margin: 4px 0 0;
}

.sv-section-title {
  margin: 10px 0 4px;
  font-size: 12px;
  font-weight: 600;
}

.sv-section-title:first-child {
  margin-top: 0;
}

.sv-props {
  display: grid;
  grid-template-columns: minmax(64px, max-content) minmax(0, 1fr);
  gap: 3px 10px;
  margin: 0;
}

.sv-props dt {
  color: var(--sv-muted);
  white-space: nowrap;
}

.sv-props dd {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sv-props dd .sv-swatch-face {
  display: inline-block;
  margin-right: 6px;
  vertical-align: -2px;
}

/* A default material's inherited colour and its source (R7-UX P3-13) wrap. */
.sv-props dd.is-inherited {
  overflow-wrap: anywhere;
  white-space: normal;
}

/* A long description wraps to three lines; 펼치기 shows all of it. */
.sv-props dd.sv-prop-long {
  overflow: visible;
  white-space: normal;
}

.sv-prop-long .sv-prop-text {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  white-space: pre-line;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.sv-prop-long.is-expanded .sv-prop-text {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: none;
}

.sv-link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--sv-accent);
  cursor: pointer;
}

.sv-link-button:hover {
  text-decoration: underline;
}

.sv-entity-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-weight: 600;
}

.sv-entity-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 8px;
}

.sv-check {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
}

.sv-check input {
  margin: 0;
}

.sv-check.is-readonly {
  color: var(--sv-muted);
}

.sv-attributes {
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--sv-border);
}

.sv-attributes > summary,
.sv-attribute-dict > summary {
  cursor: default;
  font-weight: 600;
  padding: 2px 0;
}

.sv-attribute-dict {
  margin: 4px 0 4px 10px;
}

.sv-attribute-dict > summary {
  display: list-item;
  font-weight: 500;
}

.sv-attribute-name {
  margin-right: 6px;
}

.sv-attribute-list {
  margin: 4px 0 6px 12px;
  max-height: 260px;
  overflow: auto;
}

.sv-attribute-list dd {
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 4.2em;
}

/* Inputs inside panels. */
.sv-search-box {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 4px;
  min-width: 0;
  height: 24px;
  padding: 0 6px;
  background: var(--sv-surface);
  border: 1px solid var(--sv-border-strong);
  border-radius: 2px;
}

.sv-search-box:focus-within {
  border-color: var(--sv-selected-strong);
}

.sv-search {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
}

.sv-button {
  min-height: 24px;
  padding: 2px 14px;
  border: 1px solid var(--sv-border-strong);
  border-radius: 3px;
  background: #fdfdfd;
  cursor: default;
}

.sv-button:hover:not(:disabled) {
  background: var(--sv-hover);
  border-color: var(--sv-pressed-border);
}

.sv-button:focus-visible {
  outline: 2px solid var(--sv-selected-strong);
  outline-offset: 1px;
}

.sv-button.is-primary {
  background: var(--sv-accent);
  border-color: var(--sv-accent);
  color: #ffffff;
}

.sv-button.is-primary:hover:not(:disabled) {
  background: #005ba8;
  border-color: #005ba8;
}

.sv-button.is-small {
  min-height: 22px;
  padding: 1px 8px;
}

.sv-button:disabled {
  color: var(--sv-disabled);
}

.sv-icon-button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
}

.sv-icon-button:hover:not(:disabled) {
  background: var(--sv-hover);
  border-color: var(--sv-hover-border);
}

.sv-icon-button.is-active {
  background: var(--sv-pressed);
  border-color: var(--sv-pressed-border);
}

.sv-tray-close {
  width: 22px;
  height: 22px;
}

.sv-number {
  width: 46px;
  height: 22px;
  border: 1px solid var(--sv-border-strong);
  border-radius: 2px;
  padding: 0 4px;
}

.sv-select {
  height: 22px;
  border: 1px solid var(--sv-border-strong);
  border-radius: 2px;
  background: var(--sv-surface);
}

.sv-color {
  width: 34px;
  height: 22px;
  padding: 0 1px;
  border: 1px solid var(--sv-border-strong);
  border-radius: 2px;
  background: var(--sv-surface);
}

.sv-color:disabled {
  opacity: 0.45;
}

/* Lists (components, scenes). */
/* Rows keep their height when the list box grows with the tray (align-content: start) and never shrink below their
   content when it is shorter than the rows (R5 P1-3: 17+ scenes squeezed 38 px picture rows to 31 px — an `auto`
   track only gets its minimum size, here the row's min-height, when the box has no free space). */
.sv-list {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 1px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--sv-surface);
  border: 1px solid var(--sv-border);
}

.sv-list-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 30px;
  padding: 3px 8px;
  border: 0;
  background: var(--sv-surface);
  text-align: left;
  cursor: default;
}

.sv-list-row:hover {
  background: var(--sv-hover);
}

.sv-list-row.is-selected {
  background: var(--sv-selected);
}

.sv-list-text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.sv-list-name,
.sv-list-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sv-list-sub {
  color: var(--sv-muted);
  font-size: 11px;
}

.sv-list-count {
  min-width: 26px;
  padding: 0 6px;
  border-radius: 9px;
  background: #e4e8ee;
  text-align: center;
  font-size: 11px;
}

.sv-scene-number {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 3px;
  background: #e4e8ee;
  font-size: 11px;
  font-weight: 600;
}

/* A row with a scene picture is at least the picture's box tall (64 px wide, 256:145, plus its border and padding). */
.sv-scene-row.has-thumbnail {
  min-height: 45px;
}

.sv-scene-detail {
  display: grid;
  gap: 2px;
  margin-top: 6px;
}

/* Scene pictures (skp-view v1.10): a fixed box per row (SketchUp's thumbnails are 256 × 145) so rows line up
   and nothing moves while a picture decodes; scenes without a picture keep the empty box. */
.sv-scene-thumb {
  display: block;
  flex: none;
  width: 64px;
  aspect-ratio: 256 / 145;
  overflow: hidden;
  border: 1px solid var(--sv-border);
  border-radius: 2px;
  background: #f2f2f2;
}

.sv-scene-thumb-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* The card under a scene tab while the mouse rests on it. */
.sv-scene-preview {
  position: fixed;
  z-index: 30;
  display: grid;
  gap: 2px;
  width: max-content;
  max-width: 272px;
  padding: 6px;
  border: 1px solid var(--sv-border-strong);
  border-radius: 4px;
  background: var(--sv-surface);
  box-shadow: var(--sv-shadow);
  pointer-events: none;
}

.sv-scene-preview[hidden] {
  display: none;
}

.sv-scene-preview-image {
  display: block;
  width: 256px;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--sv-border);
  background: #f2f2f2;
}

.sv-scene-preview-name {
  font-weight: 600;
}

.sv-scene-preview-text {
  color: var(--sv-muted);
  overflow-wrap: anywhere;
}

.sv-field-label {
  color: var(--sv-muted);
}

/* Materials. */
.sv-swatches {
  display: grid;
  align-content: start;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
  background: var(--sv-surface);
  border: 1px solid var(--sv-border);
}

.sv-swatch {
  display: grid;
  place-items: center;
  padding: 2px;
  border: 2px solid transparent;
  border-radius: 3px;
  background: transparent;
}

.sv-swatch:hover {
  border-color: var(--sv-hover-border);
}

.sv-swatch.is-selected {
  border-color: var(--sv-selected-strong);
}

.sv-swatch.is-unused {
  opacity: 0.6;
}

.sv-swatch-face {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 2px;
  background: var(--sv-surface);
}

.sv-swatch-face.is-translucent {
  background-color: #ffffff;
  background-image: linear-gradient(45deg, #cfcfcf 25%, transparent 25%, transparent 75%, #cfcfcf 75%), linear-gradient(45deg, #cfcfcf 25%, transparent 25%, transparent 75%, #cfcfcf 75%);
  background-size: 10px 10px;
  background-position: 0 0, 5px 5px;
}

.sv-swatch-color,
.sv-swatch-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.sv-swatch-image {
  object-fit: cover;
}

.sv-material-detail {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.sv-material-text {
  display: grid;
  flex: 1;
  gap: 4px;
  min-width: 0;
}

.sv-material-text strong,
.sv-material-text .sv-props dd {
  overflow-wrap: anywhere;
  white-space: normal;
}

/* Styles. */
.sv-style-group {
  display: grid;
  gap: 2px;
  margin: 0 0 8px;
  padding: 6px 8px 8px;
  border: 1px solid var(--sv-border);
  border-radius: 3px;
  background: #f7f7f7;
}

.sv-style-group legend {
  padding: 0 4px;
  font-weight: 600;
}

.sv-style-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.sv-style-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 4px;
}

.sv-color-row,
.sv-style-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
}

.sv-style-reset {
  margin-top: 2px;
}

/* Tags. */
.sv-tag-table {
  background: var(--sv-surface);
  border: 1px solid var(--sv-border);
  max-height: 360px;
  overflow-y: auto;
}

.sv-tag-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px 42px 56px;
  align-items: center;
  min-height: 24px;
  padding: 0 4px;
  border-bottom: 1px solid #f0f0f0;
}

.sv-tag-row:hover:not(.sv-tag-header) {
  background: var(--sv-hover);
}

.sv-tag-header {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 22px;
  background: #f5f5f5;
  color: var(--sv-muted);
  border-bottom: 1px solid var(--sv-border);
}

.sv-tag-row.is-dim .sv-tag-text {
  color: var(--sv-disabled);
}

.sv-tag-name {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.sv-tag-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sv-tag-row.is-folder .sv-tag-text {
  font-weight: 600;
}

.sv-tag-eye,
.sv-tag-color {
  display: grid;
  place-items: center;
}

.sv-tag-dash {
  overflow: hidden;
  color: var(--sv-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sv-eye {
  display: grid;
  place-items: center;
  width: 24px;
  height: 20px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
}

.sv-eye:hover {
  border-color: var(--sv-hover-border);
  background: var(--sv-surface);
}

.sv-tag-swatch {
  width: 16px;
  height: 14px;
  border: 1px solid rgba(0, 0, 0, 0.35);
  border-radius: 2px;
}

.sv-tree-toggle,
.sv-tree-spacer {
  display: grid;
  place-items: center;
  flex: none;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  background: transparent;
}

/* Outliner. */
.sv-outline {
  position: relative;
  max-height: 420px;
  overflow: auto;
  padding: 2px 0;
  background: var(--sv-surface);
  border: 1px solid var(--sv-border);
}

.sv-outline-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding-right: 6px;
  white-space: nowrap;
  cursor: default;
}

.sv-outline-row:hover:not(.is-root):not(.is-more) {
  background: var(--sv-hover);
}

.sv-outline-row.is-selected {
  background: var(--sv-selected);
}

.sv-outline-row.is-dim .sv-outline-text {
  color: var(--sv-disabled);
  font-style: italic;
}

.sv-outline-row.is-root {
  padding-left: 4px;
  font-weight: 600;
}

.sv-outline-row.is-more {
  color: var(--sv-muted);
}

.sv-outline-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sv-outline-count {
  margin: 0 0 4px;
}

/* Model info. */
.sv-warnings {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sv-warnings li {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px;
}

.sv-warning-text {
  white-space: normal;
}

/* 메모: the model's texts. */
.sv-notes-filter {
  width: 100%;
  margin-bottom: 6px;
}

.sv-note-row {
  align-items: flex-start;
}

.sv-note-row > .sv-icon {
  margin-top: 2px;
}

.sv-note-row.is-dim .sv-list-name {
  color: var(--sv-disabled);
}

.sv-notes-count {
  margin-top: 4px;
}

/* 간섭 검사 (viewer-client-api §7): run button and contact tolerance, status, a filter, the pair rows. */
.sv-check-bar {
  flex-wrap: wrap;
}

.sv-check-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.sv-check-filter {
  flex: 1;
  min-width: 0;
}

.sv-check-status {
  margin: 0 0 6px;
}

.sv-check-stale {
  margin: 0 0 6px;
  color: var(--sv-warn);
}

/* The pair list is a tree (rows are `div role=treeitem`, one tab stop): rows measure their offsetTop from it, so a
   group just opened can scroll the list (only) to show its pairs. */
.sv-check-list {
  position: relative;
}

.sv-check-list > .sv-list-row:focus-visible {
  outline: 1px dotted var(--sv-text);
  outline-offset: -2px;
}

.sv-check-row {
  align-items: flex-start;
}

.sv-check-row > .sv-icon {
  margin-top: 2px;
  color: var(--sv-danger);
}

/* Pairs of the same two definitions folded into one row; its pairs open under it. */
.sv-check-grouping {
  white-space: nowrap;
}

.sv-check-group {
  align-items: flex-start;
  font-weight: 600;
}

.sv-check-group > .sv-icon {
  margin-top: 2px;
}

.sv-check-group .sv-list-sub {
  font-weight: normal;
}

.sv-check-row.is-nested {
  padding-left: 26px;
}

/* 두 개체 사이 under 선택 객체 정보. */
.sv-measure-block {
  margin-top: 8px;
}

/* -------------------------------------------------------------- status bar --- */

.sv-statusbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 28px;
  padding: 0 4px 0 10px;
  background: var(--sv-chrome);
  border-top: 1px solid var(--sv-border);
}

.sv-status-hint {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: #333333;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Warning count (opens 모델 정보) and 측정 기록, left of the 측정 box. */
.sv-status-button {
  display: flex;
  flex: none;
  align-items: center;
  gap: 3px;
  height: 22px;
  min-width: 24px;
  padding: 0 4px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: #333333;
}

.sv-status-button:hover {
  background: var(--sv-hover);
  border-color: var(--sv-hover-border);
}

/* specs/034 US3: the builder session's changes not saved to the cloud. */
.sv-status-unsaved {
  display: flex;
  flex: none;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 6px;
  color: var(--sv-warn);
  font-weight: 600;
  white-space: nowrap;
}

.sv-status-unsaved::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.sv-status-unsaved[hidden] {
  display: none;
}

.sv-status-warnings .sv-status-count {
  color: var(--sv-warn);
  font-weight: 600;
}

.sv-history-menu {
  min-width: 220px;
}

.sv-vcb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding-left: 10px;
  border-left: 1px solid var(--sv-border);
}

.sv-vcb-label {
  color: #333333;
  white-space: nowrap;
}

.sv-vcb-input {
  width: 170px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--sv-border-strong);
  border-radius: 2px;
  background: var(--sv-surface);
  text-align: right;
  user-select: text;
  -webkit-user-select: text;
}

.sv-vcb-input:focus {
  border-color: var(--sv-selected-strong);
  outline: 1px solid var(--sv-selected-strong);
}

/* ----------------------------------------------------------------- dialogs --- */

.sv-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.22);
}

.sv-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(440px, 100%);
  max-height: calc(100vh - 40px);
  background: var(--sv-surface);
  border: 1px solid var(--sv-border-strong);
  box-shadow: var(--sv-shadow);
  user-select: text;
  -webkit-user-select: text;
}

.sv-dialog-wide {
  width: min(560px, 100%);
}

.sv-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 30px;
  padding: 0 4px 0 12px;
  background: var(--sv-chrome);
  border-bottom: 1px solid var(--sv-border);
}

.sv-dialog-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
}

.sv-dialog-close {
  display: grid;
  place-items: center;
  width: 26px;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
}

.sv-dialog-close:hover {
  background: #e81123;
}

.sv-dialog-close:hover .sv-icon path {
  stroke: #ffffff;
}

.sv-dialog-body {
  overflow: auto;
  padding: 14px 16px;
}

.sv-dialog-message {
  margin: 0;
  white-space: pre-line;
}

.sv-dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px;
  background: var(--sv-chrome);
  border-top: 1px solid var(--sv-border);
}

.sv-shortcut-table {
  width: 100%;
  border-collapse: collapse;
  /* Every table of the 단축키 dialog (keys, mouse, trackpad, touch) puts its second column at the same place (R5 P3-12). */
  table-layout: fixed;
}

.sv-shortcut-table th,
.sv-shortcut-table td {
  padding: 3px 6px;
  border-bottom: 1px solid #eeeeee;
  text-align: left;
  font-weight: normal;
  overflow-wrap: anywhere;
}

.sv-shortcut-table th {
  width: 52%;
}

.sv-shortcut-table td {
  color: var(--sv-muted);
}

/* ---------------------------------------------------- 3D overlays (sv/scene) --- */
/* Rules the 3D modules ask for (skp-handoff/STATUS-S-3D.md); positions come from JS. */

.sv-3d-root {
  background: #ffffff;
}

.sv-3d-canvas {
  outline: none;
}

/* Model texts and dimension values; JS puts left/top at the anchor point (STATUS-S-3D request). */
.sv-3d-label {
  z-index: 2;
  padding: 0 2px;
  color: #000000;
  font: 12px/1.25 var(--sv-font);
  white-space: pre;
  pointer-events: none;
  transform: translate(-50%, -100%);
}

/* SketchUp text: black on a light veil so it reads over edges. */
.sv-3d-label-text {
  background: rgba(255, 255, 255, 0.72);
}

/* Dimension text: like SketchUp, no box — sv/annotations sets it beside its dimension line on the offset's side
   (centred on the line only when the payload has no offset), so the line and the model stay visible. */
.sv-3d-label-dimension {
  background: transparent;
  transform: translate(-50%, -50%);
}

/* The file's font and colour (skp-view v1.9) come as inline style from sv/annotations. Light ink (white, pale
   yellow…) would vanish on the light veil, so it gets a dark one. */
.sv-3d-label-text.is-light-ink {
  background: rgba(0, 0, 0, 0.6);
}

.sv-3d-label-dimension.is-light-ink {
  background: #2b2b2b;
}

/* A note that would overlap another collapses into a numbered pin (sv/annotations); pressing it shows the note
   in the 메모 panel. Notes behind geometry fade (occlusion "fade"); the note picked in the panel is marked. */
.sv-3d-label-pin {
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 1px solid #5a4a00;
  border-radius: 9px;
  background: #ffd84d;
  color: #1f1f1f;
  font: 600 11px/16px var(--sv-font);
  text-align: center;
  cursor: pointer;
  transform: translate(-50%, -50%);
  box-sizing: border-box;
}

.sv-3d-label.is-occluded {
  opacity: 0.35;
}

.sv-3d-label.is-focused {
  outline: 2px solid var(--sv-selected-strong);
  outline-offset: 1px;
}

/* specs/034 (T043): an extension tool's screen-space drawing (draw2d, markers, text) over the model labels, below the
   drag rectangle and the tooltip. */
.sv-3d-tool-layer {
  position: absolute;
  z-index: 3;
  pointer-events: none;
}

.sv-3d-tooltip {
  position: absolute;
  z-index: 5;
  padding: 2px 6px;
  background: #ffffe1;
  border: 1px solid #767676;
  color: #000000;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
}

.sv-3d-selection-rect {
  position: absolute;
  z-index: 4;
  border: 1px solid #000000;
  pointer-events: none;
}

.sv-3d-selection-rect.is-crossing {
  border-style: dashed;
}

/* --------------------------------------------------- small screens (sv/ui) --- */
/* Below 900 px the tray floats over the 3D view: a sheet from the bottom when the screen is upright, a drawer
   from the right when it lies on its side. The toolbar keeps the buttons that fit (더 보기 holds the rest). */

.sv-app.is-compact .sv-menubar {
  overflow-x: auto;
  scrollbar-width: none;
}

.sv-app.is-compact .sv-menubar::-webkit-scrollbar {
  display: none;
}

.sv-app.is-compact .sv-menu-title {
  flex: none;
}

.sv-app.is-compact .sv-main {
  grid-template-columns: minmax(0, 1fr);
}

.sv-app.is-compact .sv-splitter {
  display: none;
}

.sv-app.is-compact .sv-tray {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: min(var(--sv-tray-width), 86vw);
  border-left: 1px solid var(--sv-border-strong);
  box-shadow: -6px 0 18px rgba(0, 0, 0, 0.18);
}

@media (orientation: portrait) {
  .sv-app.is-compact .sv-tray {
    top: auto;
    left: 0;
    width: auto;
    height: min(58%, 540px);
    border-left: 0;
    border-top: 1px solid var(--sv-border-strong);
    border-radius: 10px 10px 0 0;
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.2);
    overflow: hidden;
  }

  .sv-app.is-compact .sv-tray-head {
    position: relative;
    height: 34px;
  }

  /* A grab bar reads as a sheet that closes with the × at its right. */
  .sv-app.is-compact .sv-tray-head::before {
    position: absolute;
    top: 5px;
    left: 50%;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: #b5b8bd;
    transform: translateX(-50%);
    content: "";
  }
}

/* While a model opens (or scene pictures are made) and after a failed open, the progress / error card and its
   취소 sit above an open tray sheet (the layer's backdrop dims the sheet). */
.sv-app.is-compact[data-state="loading"] .sv-viewport-layer,
.sv-app.is-compact[data-state="error"] .sv-viewport-layer {
  z-index: 40;
}

.sv-app.is-compact .sv-statusbar {
  gap: 6px;
  padding-left: 8px;
}

.sv-app.is-compact .sv-vcb {
  gap: 4px;
  padding-left: 6px;
}

.sv-app.is-compact .sv-vcb-input {
  width: 96px;
}

/* A phone's status bar: the way-around hint may take two smaller lines rather than end in "…" (R5 P2-5). */
.sv-app.is-compact .sv-statusbar {
  height: auto;
  min-height: 28px;
  padding-top: 2px;
  padding-bottom: 2px;
}

.sv-app.is-compact .sv-status-hint {
  display: -webkit-box;
  font-size: 11px;
  line-height: 13px;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

@media (max-width: 480px) {
  .sv-app.is-compact .sv-vcb-input {
    width: 80px;
  }
}

.sv-app.is-compact .sv-toasts {
  width: calc(100% - 16px);
}

.sv-app.is-compact .sv-empty-card,
.sv-app.is-compact .sv-progress-card,
.sv-app.is-compact .sv-error-card {
  padding: 20px 16px 16px;
}

/* A short small screen (a phone on its side, sv/ui `is-short`): the menu titles and the toolbar share one row and the
   scene tabs fold into the 「장면」 button at the end of the menu titles, so the 3D view keeps the height. */
.sv-scene-menu {
  display: flex;
  flex: none;
  align-items: center;
  gap: 3px;
  max-width: 160px;
  margin: 3px 0 3px 4px;
  padding: 0 7px;
  border: 1px solid var(--sv-border);
  border-radius: 3px;
  background: var(--sv-surface);
  color: inherit;
  font: inherit;
  font-size: 12px;
  cursor: default;
}

.sv-scene-menu:hover,
.sv-scene-menu:focus-visible,
.sv-scene-menu[aria-expanded="true"] {
  background: var(--sv-hover);
}

.sv-scene-menu[hidden] {
  display: none;
}

.sv-scene-menu-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sv-scene-menu .sv-icon {
  flex: none;
}

.sv-app.is-short {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.sv-app.is-short > .sv-menubar {
  grid-row: 1;
  grid-column: 1;
  max-width: 62vw;
  height: auto;
  border-bottom: 1px solid var(--sv-border);
}

.sv-app.is-short > .sv-toolbar {
  grid-row: 1;
  grid-column: 2;
}

.sv-app.is-short > .sv-scene-tabs {
  display: none;
}

.sv-app.is-short > .sv-main {
  grid-row: 3;
  grid-column: 1 / -1;
}

.sv-app.is-short > .sv-statusbar {
  grid-row: 4;
  grid-column: 1 / -1;
}

.sv-app.is-short .sv-menu-title {
  padding: 0 7px;
}

/* Fingers need bigger targets than a mouse. */
@media (pointer: coarse) {
  .sv-menubar {
    height: 32px;
  }

  .sv-menu-title {
    padding: 0 12px;
    font-size: 13px;
  }

  .sv-menu-item {
    min-height: 38px;
    font-size: 13px;
  }

  .sv-tool {
    width: 38px;
    height: 38px;
  }

  .sv-scene-tab {
    height: 30px;
  }

  .sv-scene-tab.is-active {
    height: 32px;
  }

  .sv-scene-scroll {
    width: 30px;
    height: 30px;
  }

  .sv-panel-head {
    height: 36px;
  }

  .sv-list-row,
  .sv-outline-row,
  .sv-tag-row {
    min-height: 36px;
  }

  .sv-status-button {
    min-width: 32px;
    height: 26px;
  }
}

/* A phone on its side: less chrome height so the 3D view keeps most of the screen. */
@media (pointer: coarse) and (max-height: 500px) {
  .sv-menubar {
    height: 28px;
  }

  .sv-tool {
    width: 34px;
    height: 34px;
  }

  .sv-scene-tab {
    height: 26px;
  }

  .sv-scene-tab.is-active {
    height: 28px;
  }

  .sv-scene-scroll {
    width: 26px;
    height: 26px;
  }
}

/* ------------------------------------------------ 장면 재생, 발표 화면 (R7-UX P2-6) --- */
/* The scene controls float over the bottom of the 3D view while scenes play and in 발표 화면; 발표 화면 hides the chrome
   (menus, toolbar, scene tabs, tray, status bar) and the controls fade when the pointer rests. */

.sv-player {
  position: absolute;
  bottom: 14px;
  left: 50%;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 2px;
  max-width: calc(100% - 24px);
  padding: 4px 6px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--sv-border);
  border-radius: 6px;
  box-shadow: var(--sv-shadow);
  transform: translateX(-50%);
  transition: opacity 0.4s ease;
}

.sv-player.is-idle {
  opacity: 0;
}

.sv-player.is-idle:hover,
.sv-player.is-idle:focus-within {
  opacity: 1;
}

.sv-player-button {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
}

.sv-player-button:hover:not(:disabled) {
  background: var(--sv-hover);
  border-color: var(--sv-hover-border);
}

.sv-player-button:disabled {
  opacity: 0.4;
}

.sv-player-button.is-toggle[aria-pressed="true"] {
  background: var(--sv-pressed);
  border-color: var(--sv-pressed-border);
}

.sv-player-title {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  padding: 0 6px;
}

.sv-player-name {
  max-width: 40vw;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sv-player-position {
  color: var(--sv-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sv-app.is-presenting {
  display: flex !important;
}

.sv-app.is-presenting > .sv-menubar,
.sv-app.is-presenting > .sv-toolbar,
.sv-app.is-presenting > .sv-scene-tabs,
.sv-app.is-presenting > .sv-statusbar,
.sv-app.is-presenting .sv-splitter,
.sv-app.is-presenting .sv-tray {
  display: none !important;
}

.sv-app.is-presenting .sv-main {
  grid-template-columns: minmax(0, 1fr);
}

.sv-app.is-presenting .sv-player {
  bottom: 20px;
  padding: 6px 10px;
}

.sv-app.is-presenting .sv-player-name {
  font-size: 15px;
}

@media (pointer: coarse) {
  .sv-player-button {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  .sv-player-name {
    max-width: 34vw;
  }
}

/* ------------------------------------------ web furniture builder (sv/builder) --- */
/* specs/034: the extension's dialogs float over the whole window, under the menus and the shell's own dialogs. sv/builder
   sets only each window's left/top/width, its body's height and its z-index through the CSSOM. While a window is dragged
   or resized the frames take no pointer (an iframe would swallow the pointer moves). */

.sv-builder-layer {
  position: absolute;
  inset: 0;
  z-index: 900;
  overflow: hidden;
  pointer-events: none;
}

.sv-builder-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.12);
  pointer-events: auto;
}

.sv-builder-window {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: var(--sv-surface);
  border: 1px solid var(--sv-border-strong);
  box-shadow: var(--sv-shadow);
  pointer-events: auto;
}

.sv-builder-window.is-front {
  border-color: #7a7a7a;
}

.sv-builder-head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 30px;
  box-sizing: border-box;
  padding: 0 4px 0 10px;
  background: var(--sv-chrome);
  border-bottom: 1px solid var(--sv-border);
  touch-action: none;
}

.sv-builder-window.is-front .sv-builder-head {
  background: var(--sv-chrome-dark);
}

.sv-builder-title {
  overflow: hidden;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sv-builder-close {
  display: grid;
  flex: none;
  place-items: center;
  width: 26px;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
}

.sv-builder-close:hover {
  background: #e81123;
}

.sv-builder-close:hover .sv-icon path {
  stroke: #ffffff;
}

.sv-builder-body {
  position: relative;
  flex: none;
  overflow: hidden;
  background: #ffffff;
}

.sv-builder-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.sv-builder-note {
  margin: 0;
  padding: 16px;
  color: var(--sv-muted);
  user-select: text;
  -webkit-user-select: text;
}

/* The print frame of an HTML file the extension saved (contracts §18): laid out off screen at A4 width. */
.sv-builder-print {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 794px;
  height: 1123px;
  border: 0;
}

/* A web page window (contracts §17): opened in a new browser tab on the user's click. */
.sv-builder-link {
  margin: 0 16px 16px;
  padding: 6px 12px;
  border: 1px solid var(--sv-border);
  border-radius: 6px;
  background: var(--sv-surface);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.sv-builder-grip {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, transparent 0 55%, var(--sv-border-strong) 55% 62%, transparent 62% 75%, var(--sv-border-strong) 75% 82%, transparent 82%);
  cursor: nwse-resize;
  touch-action: none;
}

.sv-builder-layer.is-dragging .sv-builder-frame {
  pointer-events: none;
}

.sv-builder-inputbox {
  display: grid;
  gap: 10px;
}

.sv-builder-field {
  display: grid;
  gap: 4px;
}

.sv-builder-input {
  min-height: 24px;
  padding: 2px 6px;
  border: 1px solid var(--sv-border-strong);
  border-radius: 2px;
  font: inherit;
}

.sv-builder-input[aria-invalid="true"] {
  border-color: var(--sv-danger);
}

.sv-builder-invalid {
  margin: 0;
  color: var(--sv-danger);
}

.sv-builder-hint {
  margin: 0;
  color: var(--sv-muted);
}

/* The hidden viewer that draws the builder's pictures (View#write_image): laid out off screen, never seen. */
.sv-builder-picture {
  position: fixed;
  left: -100000px;
  top: 0;
  overflow: hidden;
  pointer-events: none;
}

/* ------------------------------------------------------- print (sv/export) --- */
/* 파일 › 인쇄 prints one picture of the view: while that print block is on the page, everything else stays off the
   paper. The browser's own print (its menu) has no block and prints the window as it is. */

.sv-print {
  display: none;
}

@media print {
  body:has(> .sv-print) {
    height: auto;
    overflow: visible;
    background: #ffffff;
  }

  html:has(> body > .sv-print) {
    height: auto;
    overflow: visible;
    background: #ffffff;
  }

  body:has(> .sv-print) > :not(.sv-print) {
    display: none !important;
  }

  .sv-print {
    display: block;
  }

  .sv-print-title {
    margin: 0 0 4mm;
    font: 10pt/1.3 var(--sv-font);
  }

  .sv-print-image {
    display: block;
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
  }
}
