:root {
  --bg: #eef2f6;
  --panel-bg: #f8fafc;
  --panel-border: #d9e2eb;
  --text-strong: #1d2a36;
  --text-muted: #5d6f81;
  --btn-bg: #ffffff;
  --btn-border: #aebed0;
  --btn-hover: #edf3f9;
  --btn-focus: #a11b11;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text-strong);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.app-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
}

#model {
  display: block;
  width: 100%;
  height: 100%;
  background: #ffffff;
}

.viewer-pane {
  position: relative;
  flex: 1 1 50%;
  min-width: 0;
  background: #ffffff;
}

.side-pane {
  flex: 1 1 50%;
  width: 50%;
  min-width: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  background-color: #fff;
}

.text-panel h2 {
  margin: 0 0 10px;
  font-size: 24pt;
  line-height: 1.25;
  color: #221e1f;
}

.text-panel p {
  margin: 0;
  line-height: 1.5;
  font-size: 24pt;
  color: #221e1f;
}

.controls-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.control-btn {
  border: 1px solid rgb(227, 25, 34);
  background: rgb(227, 25, 34);
  color: #ffffff;
  border-radius: 0;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.control-btn:hover {
  background: rgb(196, 21, 30);
  border-color: rgb(196, 21, 30);
}

.control-btn:active {
  transform: translateY(1px);
}

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

.checkbox-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.checkbox-btn input {
  margin: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--btn-focus);
}

.dot {
  display: none;
}

.dim {
  background: #ffffff;
  border: none;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
  color: rgba(0, 0, 0, 0.8);
  display: block;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  max-width: 128px;
  overflow-wrap: break-word;
  padding: 0.5em 0.9em;
  pointer-events: none;
  position: absolute;
  transform: translate3d(-50%, -50%, 0);
  width: max-content;
  height: max-content;
  --min-hotspot-opacity: 0;
}

.dimensionLineContainer {
  pointer-events: none;
  display: block;
}

.dimensionLine {
  stroke: #000;
  stroke-width: 2;
  stroke-dasharray: 2;
}

.hide {
  display: none;
}

/* Keep child nodes hidden while model-viewer custom element loads. */
:not(:defined) > * {
  display: none;
}

@media (max-width: 920px) {
  .side-pane {
    min-width: 260px;
    padding: 18px;
  }

  .dim {
    font-size: clamp(0.72rem, 1.8vw, 0.9rem);
  }
}

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

  .app-layout {
    flex-direction: column;
    width: 100%;
    height: 100vh;
    height: 100svh;
    min-height: 0;
  }

  .viewer-pane {
    flex: 1 1 50%;
    width: 100%;
    min-height: 0;
    height: auto;
  }

  .side-pane {
    flex: 1 1 50%;
    width: 100%;
    min-width: 0;
    max-width: none;
    position: relative;
    bottom: auto;
    border-left: none;
    border-top: 1px solid var(--panel-border);
  }
}
