:root {
  color-scheme: dark;
  --bg: #101316;
  --ink: #f5f7f8;
  --muted: #aeb8bd;
  --panel: rgba(18, 22, 25, 0.86);
  --line: rgba(255, 255, 255, 0.13);
  --accent: #49c16d;
  --warn: #ffc633;
  --danger: #ff4c38;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  width: 100vw;
  height: 100vh;
}

.viewport {
  position: relative;
  min-width: 0;
  background: #cfd7d7;
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
}

.title-layer {
  position: absolute;
  top: 24px;
  left: 28px;
  pointer-events: none;
  text-shadow: 0 2px 8px rgba(255, 255, 255, 0.42);
}

.title-layer h1 {
  margin: 0;
  color: #153241;
  font-size: 42px;
  line-height: 1;
  letter-spacing: 0;
}

.title-layer p {
  margin: 7px 0 0;
  color: #40545f;
  font-size: 15px;
  font-weight: 700;
}

.material-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.material-labels span {
  position: absolute;
  left: 0;
  top: 0;
  color: #ff1f1f;
  font-size: 18px;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0;
  white-space: nowrap;
  text-shadow:
    0 1px 0 #ffffff,
    0 3px 8px rgba(0, 0, 0, 0.42);
  transform: translate(-50%, -50%);
  transition: opacity 120ms ease;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: -18px 0 35px rgba(0, 0, 0, 0.28);
  z-index: 2;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.panel-header div {
  display: grid;
  gap: 4px;
}

.panel-header strong {
  font-size: 23px;
}

.panel-header span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.language-toggle {
  min-width: 48px;
  min-height: 40px;
  border-color: rgba(73, 193, 109, 0.58);
  color: #dff8e6;
  background: rgba(73, 193, 109, 0.14);
  font-size: 13px;
  font-weight: 900;
}

.control-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-block span,
.metrics span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.control-block strong {
  font-size: 24px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--warn);
}

.scale {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  height: 38px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
}

.scale span {
  display: grid;
  place-items: center;
  color: #111;
  font-size: 12px;
  font-weight: 800;
  border-right: 1px solid rgba(0, 0, 0, 0.22);
}

.scale span.active {
  outline: 3px solid #fff;
  outline-offset: -4px;
}

.floor-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.floor-title {
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
}

.floor-controls {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.floor-controls label {
  display: grid;
  grid-template-columns: 1fr 58px;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
}

.floor-controls span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.floor-controls input {
  width: 58px;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.24);
  font-weight: 800;
  text-align: center;
}

.camera-controls {
  display: grid;
  gap: 10px;
}

.camera-controls label {
  display: grid;
  gap: 6px;
}

.camera-controls span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

button {
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

button:first-child {
  color: #07110b;
  border-color: transparent;
  background: var(--accent);
  font-weight: 800;
}

.metrics {
  display: grid;
  gap: 10px;
}

.metrics div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.metrics strong {
  text-align: right;
}

.model-note {
  display: grid;
  gap: 6px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.model-note strong {
  color: var(--ink);
  font-size: 13px;
  text-transform: uppercase;
}

.model-note p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

@media (max-width: 860px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(520px, 68vh) auto;
    min-height: 100vh;
  }

  .panel {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .title-layer h1 {
    font-size: 34px;
  }
}
