/* ============================================================
   Abarsazan — interactive schematic (elevator / columnless)
   Dark luxury industrial UI. No dashboard look.

   Stacking:
   1. 3D stage          z=1
   2. viewer UI         z=2  (legend, toolbar, single info panel)
   3. info panel        z=3  (inside UI)
   4. modal portal      z=1100 (body-level, below header 1200)
   Chatbot 9999 is hidden while a modal is open.
   ============================================================ */

html:has(.s3d-page),
body:has(.s3d-page) {
  overflow-x: hidden;
  max-width: 100%;
  overscroll-behavior-x: none;
}

.s3d-page {
  --s3d-gold: #c9a227;
  --s3d-gold-soft: rgba(201, 162, 39, 0.16);
  --s3d-line: rgba(201, 162, 39, 0.28);
  --s3d-ink: #f3efe4;
  --s3d-muted: rgba(229, 229, 229, 0.62);
  --s3d-glass: rgba(12, 12, 14, 0.72);
  --s3d-header: calc(var(--header-h, 76px) + env(safe-area-inset-top, 0px));
  --s3d-toolbar-space: 72px;
  --z-stage: 1;
  --z-ui: 2;
  --z-info: 3;
  position: relative;
  min-height: calc(100dvh - var(--s3d-header));
  max-width: 100%;
  background:
    radial-gradient(1200px 520px at 50% 0%, rgba(201, 162, 39, 0.08), transparent 58%),
    linear-gradient(180deg, #0a0a0b 0%, #101011 42%, #080809 100%);
  overflow: hidden;
  overscroll-behavior-x: none;
}

.s3d-stage {
  position: relative;
  z-index: var(--z-stage);
  isolation: isolate;
  height: calc(100dvh - var(--s3d-header));
  min-height: 0;
  max-width: 100%;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.s3d-stage.is-dragging,
.s3d-canvas.is-dragging { cursor: grabbing; }

.s3d-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.s3d-world {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  transform-style: preserve-3d;
  transform:
    rotateX(var(--pitch, -18deg))
    rotateY(var(--yaw, -32deg))
    scale(calc(var(--frame, 1) * var(--zoom, 1)));
  transform-origin: 50% 48%;
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  touch-action: none;
}
.s3d-stage.is-dragging .s3d-world { transition: none; }

.s3d-page.has-info .s3d-intro,
.s3d-page.has-focus .s3d-intro { display: none; }

.s3d-floor {
  position: absolute;
  width: min(720px, 92vw);
  height: min(720px, 92vw);
  background:
    radial-gradient(circle at 50% 50%, rgba(201, 162, 39, 0.12), transparent 42%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 48px);
  transform: translate3d(0, 210px, 0) rotateX(90deg);
  pointer-events: none;
}

.s3d-safe {
  position: relative;
  width: 260px;
  height: 320px;
  transform-style: preserve-3d;
  transform: translate3d(var(--pan-x, 0px), var(--pan-y, 12px), 0);
}

.s3d-anchor {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-style: preserve-3d;
  pointer-events: none;
}

.s3d-box {
  position: absolute;
  width: var(--w);
  height: var(--h);
  left: calc(var(--w) / -2);
  top: calc(var(--h) / -2);
  transform-style: preserve-3d;
}

.s3d-face {
  position: absolute;
  background: var(--face, #1c1c20);
  border: 1px solid rgba(201, 162, 39, 0.14);
  backface-visibility: hidden;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.28);
  transition: filter 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.45s ease;
}
.s3d-face.front,
.s3d-face.back {
  width: var(--w);
  height: var(--h);
  left: 0;
  top: 0;
}
.s3d-face.front { transform: translateZ(calc(var(--d) / 2)); }
.s3d-face.back  { transform: rotateY(180deg) translateZ(calc(var(--d) / 2)); }
.s3d-face.left,
.s3d-face.right {
  width: var(--d);
  height: var(--h);
  left: calc((var(--w) - var(--d)) / 2);
  top: 0;
}
.s3d-face.left  { transform: rotateY(-90deg) translateZ(calc(var(--w) / 2)); }
.s3d-face.right { transform: rotateY(90deg) translateZ(calc(var(--w) / 2)); }
.s3d-face.top,
.s3d-face.bottom {
  width: var(--w);
  height: var(--d);
  left: 0;
  top: calc((var(--h) - var(--d)) / 2);
}
.s3d-face.top    { transform: rotateX(90deg) translateZ(calc(var(--h) / 2)); }
.s3d-face.bottom { transform: rotateX(-90deg) translateZ(calc(var(--h) / 2)); }

.s3d-mat-steel { --face: linear-gradient(165deg, #2c2c32 0%, #16161a 55%, #0f0f12 100%); }
.s3d-mat-steel .s3d-face { background: linear-gradient(165deg, #2c2c32 0%, #16161a 55%, #0f0f12 100%); }
.s3d-mat-gold .s3d-face {
  background: linear-gradient(160deg, #f2dd8f 0%, #c9a227 46%, #8a6d18 100%);
  border-color: rgba(242, 221, 143, 0.45);
}
.s3d-mat-inner .s3d-face { background: #121214; }
.s3d-mat-concrete .s3d-face {
  background: repeating-linear-gradient(135deg, #6f6d68 0 8px, #5c5a56 8px 16px);
}
.s3d-mat-panel .s3d-face { background: #0d1114; }
.s3d-mat-lock .s3d-face { background: linear-gradient(#2a2a22, #141410); }

.s3d-anchor.is-hot .s3d-face,
.s3d-anchor.is-active .s3d-face {
  box-shadow:
    inset 0 0 0 2px var(--s3d-gold),
    0 0 22px rgba(201, 162, 39, 0.35);
  filter: brightness(1.28);
}
.s3d-page.is-cutaway .s3d-shell .s3d-face { opacity: 0.22; }
.s3d-page.is-ghost .s3d-shell .s3d-face { opacity: 0.18; }

.s3d-fallback,
.s3d-status {
  position: absolute;
  z-index: 1;
  margin: 0;
  color: var(--s3d-muted);
  text-align: center;
  line-height: 1.9;
}
.s3d-fallback {
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 8, 9, 0.72);
}
.s3d-status {
  left: 50%;
  bottom: max(96px, calc(var(--s3d-toolbar-space) + 28px));
  transform: translateX(-50%);
  width: max-content;
  max-width: min(420px, calc(100% - 32px));
  padding: 10px 16px;
  border: 1px solid var(--s3d-line);
  border-radius: 999px;
  background: rgba(12, 12, 14, 0.82);
  backdrop-filter: blur(12px);
  font-size: 0.86rem;
  pointer-events: none;
}
.s3d-status[data-state="WEBGL_UNAVAILABLE"],
.s3d-status[data-state="MODEL_LOAD_ERROR"],
.s3d-status[data-state="MODEL_PARSE_ERROR"],
.s3d-status[data-state="UNKNOWN_ERROR"] {
  inset: 0;
  left: 0;
  bottom: 0;
  transform: none;
  width: auto;
  max-width: none;
  display: grid;
  place-items: center;
  place-content: center;
  gap: 14px;
  border: 0;
  border-radius: 0;
  padding: 24px;
  background: rgba(8, 8, 9, 0.55);
  pointer-events: auto;
}
.s3d-fallback[hidden],
.s3d-status[hidden],
.s3d-status[data-state="READY"] {
  display: none !important;
}
.s3d-retry {
  appearance: none;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--s3d-line);
  background: rgba(13, 13, 13, 0.88);
  color: #f7e7a1;
  font-size: 0.82rem;
  padding: 8px 16px;
  min-height: 44px;
  border-radius: 999px;
  pointer-events: auto;
}
.s3d-retry:hover {
  border-color: var(--s3d-gold);
  background: var(--s3d-gold-soft);
}
.s3d-retry[hidden] {
  display: none !important;
}

.s3d-ui {
  position: absolute;
  inset: 0;
  z-index: var(--z-ui);
  isolation: isolate;
  pointer-events: none;
}
.s3d-ui > * { pointer-events: auto; }
.s3d-ui > .s3d-hint { pointer-events: none; }
.s3d-ui > .s3d-info[hidden] { pointer-events: none; }

.s3d-intro {
  position: absolute;
  top: 22px;
  right: max(24px, env(safe-area-inset-right, 0px));
  max-width: min(380px, calc(100vw - 48px));
  padding: 18px 20px 16px;
  background: var(--s3d-glass);
  border: 1px solid var(--s3d-line);
  border-radius: 16px;
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}
.s3d-intro-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--s3d-gold);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}
.s3d-intro h1 {
  font-size: 1.28rem;
  font-weight: 800;
  color: var(--s3d-ink);
  margin: 0 0 8px;
  line-height: 1.45;
}
.s3d-intro p {
  margin: 0;
  color: var(--s3d-muted);
  font-size: 0.86rem;
  line-height: 1.75;
}

.s3d-toolbar {
  position: absolute;
  bottom: max(22px, env(safe-area-inset-bottom, 0px));
  right: max(24px, env(safe-area-inset-right, 0px));
  left: max(24px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 100%;
  touch-action: pan-x;
}
.s3d-tool {
  appearance: none;
  border: 1px solid var(--s3d-line);
  background: var(--s3d-glass);
  color: var(--s3d-ink);
  border-radius: 999px;
  padding: 10px 16px;
  min-height: 44px;
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: border-color 0.2s, background 0.2s, color 0.2s, box-shadow 0.2s;
}
.s3d-tool:hover,
.s3d-tool.is-on {
  border-color: var(--s3d-gold);
  background: var(--s3d-gold-soft);
  color: #f7e7a1;
}
.s3d-tool:focus-visible,
.s3d-legend-list button:focus-visible,
.s3d-card-close:focus-visible,
.s3d-legend-toggle:focus-visible {
  outline: 2px solid var(--s3d-gold);
  outline-offset: 2px;
}
.s3d-tool i { margin-left: 8px; color: var(--s3d-gold); }

.s3d-legend {
  position: absolute;
  top: 22px;
  left: max(24px, env(safe-area-inset-left, 0px));
  width: min(280px, calc(100vw - 48px));
  max-height: calc(100% - 120px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 14px 10px 12px 12px;
  background: var(--s3d-glass);
  border: 1px solid var(--s3d-line);
  border-radius: 16px;
  backdrop-filter: blur(16px);
}
.s3d-legend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 8px 10px;
}
.s3d-legend h2 {
  font-size: 0.78rem;
  color: var(--s3d-gold);
  margin: 0;
  font-weight: 700;
}
.s3d-legend-toggle {
  display: none;
  appearance: none;
  width: 44px;
  height: 44px;
  margin: -8px;
  border: 0;
  background: transparent;
  color: var(--s3d-gold);
  cursor: pointer;
  border-radius: 10px;
}
.s3d-legend-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: auto;
  min-height: 0;
  overscroll-behavior: contain;
}
.s3d-legend-list button {
  width: 100%;
  min-height: 40px;
  text-align: right;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--s3d-ink);
  font-family: inherit;
  font-size: 0.8rem;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.s3d-legend-list button:hover,
.s3d-legend-list button.is-on {
  background: var(--s3d-gold-soft);
  color: #f7e7a1;
}

.s3d-tip[hidden] { display: none !important; }
.s3d-tip {
  position: fixed;
  z-index: 9;
  display: block;
  transform: translate(-50%, -120%);
  padding: 6px 12px;
  border-radius: 999px;
  background: #111114;
  border: 1px solid var(--s3d-gold);
  color: #f7e7a1;
  font-size: 0.78rem;
  pointer-events: none;
  white-space: nowrap;
  max-width: min(90vw, 280px);
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

.s3d-modal-root {
  position: fixed;
  inset: 0;
  z-index: 1300;
  pointer-events: none;
}
.s3d-modal-root.is-active {
  pointer-events: auto;
}
.s3d-modal-backdrop,
.s3d-modal,
.s3d-info {
  display: none;
}
.s3d-modal-backdrop:not([hidden]),
.s3d-modal:not([hidden]),
.s3d-info:not([hidden]) {
  display: block;
}
.s3d-modal-backdrop[hidden],
.s3d-modal[hidden],
.s3d-modal-panel[hidden],
.s3d-info[hidden] {
  display: none !important;
}

.s3d-modal-backdrop {
  appearance: none;
  border: 0;
  padding: 0;
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.s3d-info,
.s3d-modal {
  isolation: isolate;
  background: linear-gradient(180deg, rgba(18, 18, 20, 0.94), rgba(10, 10, 12, 0.94));
  border: 1px solid var(--s3d-line);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
  color: var(--s3d-ink);
  overflow-wrap: anywhere;
}
.s3d-info {
  position: absolute;
  z-index: var(--z-info);
  top: 50%;
  right: max(24px, env(safe-area-inset-right, 0px));
  width: min(380px, calc(100vw - 48px));
  max-width: 100%;
  max-height: min(78dvh, 640px);
  overflow: auto;
  overscroll-behavior: contain;
  transform: translateY(-50%);
  padding: 22px 22px 18px;
}
.s3d-card-kicker {
  font-size: 0.7rem;
  color: var(--s3d-gold);
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.s3d-info h3 {
  margin: 0 0 14px;
  padding-left: 44px;
  font-size: 1.18rem;
  font-weight: 800;
}
.s3d-info h4 {
  margin: 0 0 6px;
  font-size: 0.78rem;
  color: var(--s3d-gold);
  font-weight: 700;
}
.s3d-info p,
.s3d-info li {
  color: var(--s3d-muted);
  font-size: 0.88rem;
  line-height: 1.85;
}
.s3d-info ul {
  margin: 0 0 14px;
  padding-right: 18px;
}
.s3d-note {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(201, 162, 39, 0.08);
  border: 1px dashed rgba(201, 162, 39, 0.35);
  color: #e8d48a;
  font-size: 0.78rem;
  line-height: 1.7;
}
.s3d-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.s3d-card-close {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--s3d-line);
  background: rgba(12, 12, 14, 0.9);
  color: var(--s3d-ink);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}
.s3d-card-close:hover {
  border-color: var(--s3d-gold);
  color: #f7e7a1;
}

.s3d-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(720px, calc(100vw - 40px));
  max-width: 100%;
  max-height: min(78dvh, 720px);
  overflow: auto;
  overscroll-behavior: contain;
  transform: translate(-50%, -50%);
  padding: 28px 28px 22px;
  padding-top: 52px;
}
.s3d-modal h2 {
  margin: 0 0 8px;
  font-size: 1.3rem;
  padding-left: 44px;
}
.s3d-modal > p {
  color: var(--s3d-muted);
  margin: 0 0 18px;
  font-size: 0.9rem;
  line-height: 1.8;
}
.s3d-benefits {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.s3d-benefits li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(201, 162, 39, 0.12);
  color: var(--s3d-ink);
  font-size: 0.9rem;
  line-height: 1.7;
}
.s3d-benefits li::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--s3d-gold);
  flex: 0 0 auto;
}
.s3d-benefits li.is-unconfirmed {
  border-style: dashed;
}
.s3d-timeline {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.s3d-timeline li {
  position: relative;
  padding: 0 0 16px 22px;
  border-right: 1px solid var(--s3d-line);
  margin-right: 10px;
  color: var(--s3d-ink);
  font-size: 0.9rem;
}
.s3d-timeline li:last-child { border-right-color: transparent; padding-bottom: 0; }
.s3d-timeline li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  right: -11px;
  top: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #111;
  border: 1px solid var(--s3d-gold);
  color: var(--s3d-gold);
  font-size: 0.65rem;
  display: grid;
  place-items: center;
}
.s3d-company-grid {
  display: grid;
  gap: 10px;
}
.s3d-company-grid p {
  margin: 0;
  color: var(--s3d-muted);
  font-size: 0.9rem;
  line-height: 1.8;
}
.s3d-phones {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.s3d-phones a {
  color: #f7e7a1;
  text-decoration: none;
  border: 1px solid var(--s3d-line);
  border-radius: 999px;
  padding: 10px 14px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-size: 0.88rem;
  direction: ltr;
}
.s3d-phones a:hover { border-color: var(--s3d-gold); }

.s3d-hint {
  position: absolute;
  bottom: 78px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--s3d-muted);
  font-size: 0.75rem;
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100% - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Chatbot on this page: keep it off the toolbar and modal close controls. */
body:has(.s3d-page) .cb-root {
  inset-inline-start: auto;
  inset-inline-end: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
}
@media (max-width: 860px) {
  body:has(.s3d-page) .cb-root {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
}
body.s3d-modal-open .cb-root {
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 1100px) {
  .s3d-intro { max-width: min(300px, calc(100vw - 320px)); }
}

@media (max-width: 860px) {
  .s3d-page { --s3d-toolbar-space: 64px; }
  .s3d-intro {
    top: 10px;
    right: max(12px, env(safe-area-inset-right, 0px));
    left: max(12px, env(safe-area-inset-left, 0px));
    max-width: none;
    padding: 10px 12px;
  }
  .s3d-intro p { display: none; }
  .s3d-hint { display: none; }
  .s3d-status[data-state="LOADING"] {
    bottom: calc(var(--s3d-toolbar-space) + 92px + env(safe-area-inset-bottom, 0px));
  }

  .s3d-legend {
    top: auto;
    bottom: calc(var(--s3d-toolbar-space) + env(safe-area-inset-bottom, 0px));
    left: max(12px, env(safe-area-inset-left, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    width: auto;
    max-height: none;
    padding: 8px 10px;
  }
  .s3d-legend-head { margin: 0 4px 0; }
  .s3d-legend-toggle { display: grid; place-items: center; }
  .s3d-legend.is-expanded .s3d-legend-toggle i { transform: rotate(180deg); }

  .s3d-legend:not(.is-expanded) .s3d-legend-list {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 6px;
    margin-top: 6px;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-x;
  }
  .s3d-legend:not(.is-expanded) .s3d-legend-list::-webkit-scrollbar { display: none; }
  .s3d-legend:not(.is-expanded) .s3d-legend-list button {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 44px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(201, 162, 39, 0.14);
  }

  .s3d-legend.is-expanded {
    max-height: min(42dvh, 340px);
  }
  .s3d-legend.is-expanded .s3d-legend-list {
    margin-top: 8px;
    max-height: calc(min(42dvh, 340px) - 52px);
    overflow: auto;
  }

  .s3d-info {
    top: auto;
    bottom: calc(var(--s3d-toolbar-space) + env(safe-area-inset-bottom, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    left: max(12px, env(safe-area-inset-left, 0px));
    width: auto;
    max-height: min(52dvh, 420px);
    transform: none;
  }
  .s3d-page.has-info .s3d-legend {
    display: none;
  }
  .s3d-page:has(.s3d-legend.is-expanded) .s3d-info:not([hidden]) {
    max-height: min(45dvh, 360px);
  }

  .s3d-toolbar {
    bottom: 0;
    right: 0;
    left: 0;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    padding: 10px max(12px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
    background: linear-gradient(180deg, transparent, rgba(8, 8, 9, 0.88) 36%);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-x;
  }
  .s3d-toolbar::-webkit-scrollbar { display: none; }
  .s3d-tool {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .s3d-modal {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: min(86dvh, 720px);
    transform: none;
    border-radius: 18px 18px 0 0;
    padding: 28px max(18px, env(safe-area-inset-right, 0px)) calc(22px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
    padding-top: 52px;
  }
}

@media (max-width: 430px) {
  .s3d-legend:not(.is-expanded) .s3d-legend-list button {
    font-size: 0.75rem;
    padding: 10px 10px;
  }
  .s3d-info h3,
  .s3d-modal h2 { font-size: 1.05rem; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .s3d-legend {
    top: 10px;
    bottom: auto;
    left: max(10px, env(safe-area-inset-left, 0px));
    width: min(220px, 38vw);
    max-height: calc(100% - 64px);
  }
  .s3d-info {
    top: 10px;
    bottom: auto;
    right: max(10px, env(safe-area-inset-right, 0px));
    left: auto;
    width: min(320px, 42vw);
    max-height: calc(100% - 64px);
    transform: none;
  }
  .s3d-toolbar {
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .s3d-world {
    transition: none;
  }
}
