@font-face {
  font-family: "Syne Rise";
  src: url("./fonts/syne-600.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: transparent;
  color: #e9e4d9;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  cursor: grab;
  touch-action: none;
}

#scene.dragging { cursor: grabbing; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

button {
  border: 1px solid #eee9df55;
  border-radius: 50%;
  background: #30291b55;
  color: #eee9df;
  cursor: pointer;
  font: inherit;
}

button:hover { border-color: #eee9dfaa; background: #eee9df22; }
button:focus-visible { outline: 2px solid #eee9df; outline-offset: 4px; }

#close-case {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top, 0px));
  right: max(1rem, env(safe-area-inset-right, 0px));
  left: auto;
  z-index: 3;
  width: 48px;
  height: 48px;
  padding: 0;
  transform: none;
  box-shadow: inset 0 2px 5px #0005, 0 1px 1px #fff3;
  font: 300 34px/1 "Helvetica Neue", Helvetica, Arial, sans-serif;
}

#case-ui {
  position: absolute;
  z-index: 2;
  max-width: 320px;
  transform: translate(-10%, -20%);
  color: #eee9dd;
  pointer-events: none;
}

#case-title {
  margin: 0 0 10px;
  font-family: "Syne Rise", "Helvetica Neue", Arial, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#case-description {
  max-height: min(24vh, 12rem);
  margin: 0 0 14px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto;
  font-size: 11px;
  line-height: 1.7;
}

#case-ui nav {
  display: flex;
  align-items: center;
  gap: 20px;
  font: 10px/1 "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: 0.1em;
}

#case-ui button {
  width: 36px;
  height: 36px;
  font-size: 21px;
  pointer-events: auto;
}

body[data-plateau-theme="dark"] #close-case,
body[data-plateau-theme="dark"] #case-ui { color: #f3d7b1; }

#loading {
  position: fixed;
  z-index: 4;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: #51483c;
  color: #e9e4d9;
  font-family: "Syne Rise", "Helvetica Neue", Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: opacity 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

#loading.done { opacity: 0; pointer-events: none; }

#loading i {
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #e9e4d9, transparent);
  animation: load 1s ease-in-out infinite alternate;
}

@keyframes load {
  to { transform: scaleX(0.2); opacity: 0.3; }
}

#failure {
  position: fixed;
  z-index: 5;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: start;
  justify-content: center;
  padding: 15vw;
  background: #3e382e;
}

#failure h1 {
  margin: 0 0 1rem;
  font-family: "Syne Rise", "Helvetica Neue", Arial, sans-serif;
  font-size: 24px;
}

#failure p {
  max-width: 640px;
  margin: 0 0 1.25rem;
  font-size: 14px;
  line-height: 1.5;
  opacity: 0.7;
}

#failure button {
  width: auto;
  min-height: 44px;
  padding: 0 1rem;
  border-radius: 999px;
}

@media (max-width: 760px) {
  #close-case { width: 40px; height: 40px; font-size: 28px; }
  #case-ui { max-width: 172px; transform: translate(-15%, -20%); }
  #case-title { margin-bottom: 7px; font-size: 9px; }
  #case-description { margin-bottom: 10px; font-size: 9px; }
  #case-ui nav { gap: 10px; font-size: 9px; }
  #case-ui button { width: 32px; height: 32px; font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  #loading i { animation: none; }
}
