/* Roomwalk viewer - plain CSS, no framework, no build step. */

:root {
  --ink: #f2f3f5;
  --panel: rgba(16, 17, 20, 0.72);
  --accent: #3ea6ff;
  --radius: 10px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

/* The hidden attribute must always win, even over display:flex below. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #101114;
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: none;
}

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

/* ---------- Loading screen ---------- */

#loader {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: opacity .45s ease;
}

#loader.gone { opacity: 0; pointer-events: none; }

#poster {
  position: absolute;
  inset: 0;
  background-color: #15171c;
  background-image: linear-gradient(145deg, #1b1e25 0%, #101114 55%, #0b0c0e 100%);
  background-size: cover;
  background-position: center;
  filter: saturate(0.9);
}

#poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 20%, rgba(62,166,255,.10), transparent 60%),
              linear-gradient(to top, rgba(0,0,0,.72), rgba(0,0,0,.15) 60%);
}

#loader-panel {
  position: relative;
  width: min(560px, calc(100% - 32px));
  margin: 0 16px calc(12vh + var(--safe-b));
  padding: 18px 20px 20px;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-align: center;
}

#loader-title { font-size: 17px; font-weight: 600; letter-spacing: .2px; }

#bar-track {
  margin: 14px 0 10px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  overflow: hidden;
}

#bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .18s linear;
}

#bar-track.unknown #bar-fill {
  width: 35%;
  animation: slide 1.3s ease-in-out infinite;
}

@keyframes slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}

#loader-sub { font-size: 13px; opacity: .72; min-height: 1.4em; }
#loader.error #bar-fill { background: #ff6b6b; }
#loader.error #loader-sub { opacity: 1; color: #ffb3b3; word-break: break-word; }

#loader-retry {
  margin-top: 12px;
  padding: 8px 16px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--radius);
  cursor: pointer;
}

/* ---------- Buttons ---------- */

#ui {
  position: fixed;
  z-index: 20;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  display: flex;
  gap: 8px;
}

#ui button {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  padding: 9px 14px;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#ui button:hover { background: rgba(36,38,44,.85); }
#ui button:active { transform: translateY(1px); }

/* ---------- Hint ---------- */

#hint {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: calc(28px + var(--safe-b));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  padding: 12px 18px;
  max-width: calc(100% - 32px);
  text-align: center;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity .3s ease;
  pointer-events: none;
}

#hint strong { font-size: 14px; font-weight: 600; }
#hint span { font-size: 12px; opacity: .7; }
#hint.fade { opacity: 0; }

/* ---------- Credit line ---------- */

#credit {
  position: fixed;
  z-index: 20;
  left: calc(12px + env(safe-area-inset-left, 0px));
  bottom: calc(10px + var(--safe-b));
  font-size: 11px;
  opacity: .5;
  pointer-events: none;
  max-width: 60%;
}

/* ---------- Twin sticks (mobile) ---------- */

#sticks {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
}

.stick {
  position: absolute;
  bottom: calc(28px + var(--safe-b));
  width: 116px;
  height: 116px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.06);
  opacity: .45;
  transition: opacity .18s ease;
}

.stick.active { opacity: .9; }

#stick-left  { left:  calc(24px + env(safe-area-inset-left, 0px)); }
#stick-right { right: calc(24px + env(safe-area-inset-right, 0px)); }

.knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 50px;
  height: 50px;
  margin: -25px 0 0 -25px;
  border-radius: 50%;
  background: rgba(255,255,255,.60);
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
}

@media (max-height: 420px) {
  .stick { width: 92px; height: 92px; bottom: calc(14px + var(--safe-b)); }
  .knob { width: 40px; height: 40px; margin: -20px 0 0 -20px; }
}
