:root {
  color-scheme: dark;
  font-family: Arial, "Myanmar Text", sans-serif;
  color: #f8f7f1;
  background: #071a18;
  font-size: 16px;
  line-height: 1.5;
  --ink: #071a18;
  --forest: #0d312d;
  --paper: #f8f7f1;
  --gold: #f1b83f;
  --gold-dark: #8b5e09;
  --teal: #62c8bd;
  --line: rgba(248, 247, 241, 0.28);
  --panel: rgba(7, 26, 24, 0.94);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  overflow: hidden;
  background: var(--ink);
}

button,
select,
a {
  font: inherit;
  letter-spacing: 0;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
select:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
}

button {
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 50;
  transform: translateY(-160%);
  padding: 10px 14px;
  color: var(--ink);
  background: var(--paper);
  border-radius: 4px;
}

.skip-link:focus {
  transform: translateY(0);
}

#showroomCanvas {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.movement-vignette {
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: 0;
  background: rgba(2, 12, 11, 0.28);
  box-shadow: inset 0 0 120px rgba(2, 12, 11, 0.78);
}

body.is-entering .movement-vignette {
  animation: walkthrough-vignette 2.3s ease-in-out both;
}

@keyframes walkthrough-vignette {
  0%, 100% { opacity: 0; }
  54% { opacity: 0.62; }
}

.showroom-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 12px max(20px, env(safe-area-inset-right)) 12px max(20px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: rgba(7, 26, 24, 0.86);
  backdrop-filter: blur(12px);
}

.showroom-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--paper);
  font-weight: 800;
  text-decoration: none;
}

.showroom-brand img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.showroom-brand span {
  line-height: 1.1;
}

.showroom-brand small {
  display: block;
  margin-top: 6px;
  color: var(--gold);
  font-size: 0.66rem;
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-command,
.home-command,
.language-control select {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--paper);
  background: #143b36;
  text-decoration: none;
}

.header-command,
.home-command {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  font-weight: 700;
}

.header-command:hover,
.home-command:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.language-control select {
  min-width: 76px;
  padding: 0 10px;
}

.scene-ui {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.scene-ui button,
.scene-ui a,
.scene-ui select,
.scene-ui dialog,
.product-panel,
.showroom-intro,
.showroom-controls,
.webgl-fallback {
  pointer-events: auto;
}

.showroom-intro {
  position: absolute;
  left: max(40px, env(safe-area-inset-left));
  bottom: 88px;
  width: min(560px, calc(100vw - 80px));
  color: var(--paper);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.72);
  transition: opacity 260ms ease, transform 260ms ease;
}

.showroom-intro.is-hidden {
  opacity: 0;
  transform: translateY(18px);
  pointer-events: none;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
}

.showroom-intro h1 {
  max-width: 540px;
  margin: 0 0 16px;
  font-size: 3.6rem;
  line-height: 1.04;
  letter-spacing: 0;
}

.intro-copy {
  max-width: 510px;
  margin: 0 0 22px;
  color: #eef7f3;
  font-size: 1.05rem;
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-command,
.secondary-command,
.panel-contact,
.webgl-fallback button {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 6px;
  font-weight: 800;
}

.primary-command,
.panel-contact,
.webgl-fallback button {
  border: 1px solid var(--gold);
  color: var(--ink);
  background: var(--gold);
}

.secondary-command {
  border: 1px solid rgba(255, 255, 255, 0.62);
  color: var(--paper);
  background: rgba(7, 26, 24, 0.72);
}

.primary-command:hover,
.panel-contact:hover,
.webgl-fallback button:hover {
  background: #ffd36e;
}

.secondary-command:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.showroom-controls {
  position: absolute;
  left: 50%;
  bottom: max(26px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  padding: 6px;
  border: 1px solid rgba(248, 247, 241, 0.16);
  border-radius: 8px;
  background: rgba(7, 26, 24, 0.5);
  backdrop-filter: blur(10px);
}

.icon-command,
.exit-command {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--paper);
  background: rgba(7, 26, 24, 0.9);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.24);
}

.icon-command {
  width: 44px;
  padding: 0;
  font-size: 1.2rem;
}

.exit-command {
  padding: 0 14px;
  font-weight: 700;
}

.icon-command:hover,
.exit-command:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.product-panel {
  position: absolute;
  top: 92px;
  right: max(20px, env(safe-area-inset-right));
  z-index: 24;
  width: min(380px, calc(100vw - 40px));
  max-height: calc(100dvh - 188px);
  overflow-y: auto;
  border: 1px solid rgba(241, 184, 63, 0.55);
  border-radius: 8px;
  color: var(--paper);
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  transform: translateX(calc(100% + 40px));
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
}

.product-panel.is-open {
  transform: translateX(0);
  opacity: 1;
}

.panel-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--paper);
  background: #143b36;
  font-size: 1.45rem;
}

.product-panel > .panel-close {
  position: sticky;
  top: 12px;
  z-index: 2;
  float: right;
  margin: 12px 12px -54px 0;
}

.product-panel > img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center top;
  border-bottom: 1px solid var(--line);
  background: #e7e8e2;
}

.panel-copy {
  padding: 22px;
}

.panel-copy h2 {
  margin: 0 0 8px;
  font-size: 1.55rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.product-spec {
  margin: 0 0 18px;
  color: var(--teal);
  font-weight: 800;
}

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

.panel-copy dl div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.panel-copy dt {
  color: #b9cbc6;
}

.panel-copy dd {
  margin: 0;
  color: var(--paper);
  font-weight: 800;
  text-align: right;
}

.product-note {
  margin: 16px 0;
  color: #c9d8d4;
  font-size: 0.86rem;
}

.panel-contact {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.product-browser {
  width: min(960px, calc(100vw - 40px));
  max-height: min(760px, calc(100dvh - 40px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(241, 184, 63, 0.6);
  border-radius: 8px;
  color: var(--paper);
  background: #0b2421;
}

.product-browser::backdrop {
  background: rgba(1, 8, 7, 0.78);
  backdrop-filter: blur(6px);
}

.browser-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 86px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.browser-heading h2 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: 0;
}

.browser-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  max-height: calc(100dvh - 150px);
  overflow-y: auto;
  background: var(--line);
}

.browser-product {
  min-width: 0;
  padding: 0;
  border: 0;
  color: var(--paper);
  background: #0f302c;
  text-align: left;
}

.browser-product:hover,
.browser-product:focus-visible {
  background: #16453f;
}

.browser-product img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center top;
}

.browser-product span {
  display: block;
  min-height: 72px;
  padding: 12px 14px;
  font-weight: 800;
  line-height: 1.3;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--paper);
  background: #071a18;
  transition: opacity 300ms ease, visibility 300ms ease;
}

.loading-overlay.is-ready {
  opacity: 0;
  visibility: hidden;
}

.loading-overlay img {
  width: 124px;
  height: 124px;
  object-fit: contain;
}

.loading-overlay p {
  margin: 16px 0 12px;
  font-weight: 700;
}

.loading-bar {
  display: block;
  width: 180px;
  height: 4px;
  overflow: hidden;
  background: #214944;
}

.loading-bar span {
  display: block;
  width: 45%;
  height: 100%;
  background: var(--gold);
  animation: load 1.1s ease-in-out infinite alternate;
}

@keyframes load {
  from { transform: translateX(0); }
  to { transform: translateX(122%); }
}

.prototype-note {
  position: absolute;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  margin: 0;
  color: rgba(248, 247, 241, 0.72);
  font-size: 0.72rem;
  text-shadow: 0 2px 10px #000;
}

.webgl-fallback {
  position: fixed;
  inset: 0;
  z-index: 9;
  place-content: center;
  justify-items: center;
  padding: 30px;
  color: var(--paper);
  background: #071a18;
  text-align: center;
}

.webgl-fallback:not([hidden]) {
  display: grid;
}

.webgl-fallback:not([hidden]) ~ .scene-ui .showroom-intro {
  display: none;
}

.webgl-fallback img {
  width: 180px;
  max-width: 46vw;
}

.webgl-fallback h1 {
  margin: 18px 0 8px;
  font-size: 2rem;
  letter-spacing: 0;
}

.webgl-fallback p {
  max-width: 560px;
  margin: 0 0 22px;
  color: #c9d8d4;
}

@media (max-width: 820px) {
  .showroom-header {
    min-height: 66px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .showroom-brand img {
    width: 44px;
    height: 44px;
  }

  .showroom-brand span {
    font-size: 0.88rem;
  }

  .showroom-brand small {
    display: none;
  }

  .home-command {
    display: none;
  }

  .header-command,
  .language-control select {
    height: 40px;
  }

  .showroom-intro {
    left: 20px;
    bottom: max(34px, env(safe-area-inset-bottom));
    width: calc(100vw - 40px);
  }

  .showroom-intro h1 {
    max-width: 380px;
    font-size: 2.5rem;
  }

  .intro-copy {
    max-width: 440px;
    font-size: 0.94rem;
  }

  .prototype-note {
    display: none;
  }

  .showroom-controls {
    bottom: max(16px, env(safe-area-inset-bottom));
  }

  .product-panel {
    top: auto;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
    width: auto;
    max-height: 66dvh;
    transform: translateY(calc(100% + 30px));
  }

  .product-panel.is-open {
    transform: translateY(0);
  }

  .product-panel > img {
    aspect-ratio: 16 / 7;
  }

  body.has-product-panel .showroom-controls {
    visibility: hidden;
  }

  .browser-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 500px) {
  .showroom-header {
    gap: 8px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .showroom-brand span {
    display: none;
  }

  .header-actions {
    margin-left: auto;
  }

  .header-command {
    padding: 0 10px;
    font-size: 0.82rem;
  }

  .language-control select {
    min-width: 70px;
    padding: 0 6px;
  }

  .showroom-intro h1 {
    font-size: 2.1rem;
  }

  .intro-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .primary-command,
  .secondary-command {
    padding: 0 12px;
    font-size: 0.88rem;
  }

  .browser-grid {
    grid-template-columns: 1fr;
  }

  .browser-product {
    display: grid;
    grid-template-columns: 108px 1fr;
    align-items: center;
  }

  .browser-product img {
    width: 108px;
    height: 96px;
    aspect-ratio: auto;
  }

  .browser-product span {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
