:root {
  --bg: #0d0c0b;
  --ink: #f2ede5;
  --muted: #a29a8f;
  --accent: #e3a35c;
  --line: rgba(255, 255, 255, 0.12);
  --panel: rgba(16, 15, 14, 0.88);
  --display: "Anton", Impact, "Arial Narrow", sans-serif;
  --sans: "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html { scrollbar-width: thin; scrollbar-color: #3a3632 transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; z-index: 0; }
#scroll-space { height: 850vh; }
#scrim {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, rgba(13,12,11,.88) 0%, rgba(13,12,11,.62) 24%, rgba(13,12,11,0) 42%);
}

/* ---------------------------------------------------------------- topo */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand {
  font-family: var(--display); font-size: 26px; letter-spacing: 0.06em;
  color: var(--ink); text-decoration: none; display: flex; align-items: baseline; gap: 6px;
}
.brand { align-items: center; gap: 10px; }
.brand img { display: block; width: 30px; height: 30px; }
.brand span { line-height: 1; }
.brand small { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; color: #b9b2a7; text-transform: uppercase; }
.made-by { display: flex; align-items: center; gap: 14px; margin-top: 26px; }
.made-by span { font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.made-by img { display: block; width: 230px; height: auto; }
#loader img { margin: 0 auto 6px; }
.topbar nav {
  display: flex; gap: 2px; padding: 4px;
  border: 1px solid var(--line); border-radius: 999px;
  background: rgba(14, 13, 12, 0.82);
}
.topbar nav a {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); text-decoration: none; padding: 8px 14px; border-radius: 999px;
  transition: color .3s, background .3s;
}
.topbar nav a:hover { color: var(--ink); }
.topbar nav a.on { color: #1a120a; background: var(--accent); }
.cta-top {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink); text-decoration: none; padding: 10px 16px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(14, 13, 12, 0.82);
}
.cta-top:hover { border-color: var(--accent); color: var(--accent); }

/* ---------------------------------------------------------------- botão explorar */
.top-actions { display: flex; gap: 8px; align-items: center; }
.explore-btn {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600;
  color: #1a120a; background: var(--accent); border: 1px solid var(--accent); border-radius: 999px;
  padding: 10px 16px; cursor: pointer;
}
.explore-btn span { font-size: 13px; margin-right: 2px; }
.explore-btn:hover { filter: brightness(1.08); }
button.btn { cursor: pointer; font: inherit; font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; }

/* ---------------------------------------------------------------- modo livre */
html.free-lock, html.free-lock body { overflow: hidden; }
#free-ui { display: none; }
body.free #free-ui { display: block; }
body.free .panel, body.free #room-tag, body.free .hint, body.free .progress, body.free #scrim,
body.free .topbar nav, body.free .top-actions { display: none; }
body.free #scene { cursor: grab; touch-action: none; }
body.free #scene:active { cursor: grabbing; }
.free-head {
  position: fixed; z-index: 6; top: 64px; left: 32px; right: 32px;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; pointer-events: none;
}
.free-head > * { pointer-events: auto; }
.free-title b { font-family: var(--display); font-weight: 400; font-size: 34px; text-transform: uppercase; letter-spacing: .02em; display: block; text-shadow: 0 2px 20px rgba(0,0,0,.6); }
.free-title p { margin: 6px 0 0; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: #cfc7bb; max-width: 52ch; line-height: 1.6; text-shadow: 0 1px 10px rgba(0,0,0,.8); }
.free-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink); background: rgba(14,13,12,.85); border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 16px; cursor: pointer;
}
.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill.solid { background: var(--ink); color: #1a120a; border-color: var(--ink); }
.pill.solid:hover { background: var(--accent); border-color: var(--accent); color: #1a120a; }
.free-rooms {
  position: fixed; z-index: 6; left: 50%; bottom: 26px; transform: translateX(-50%); width: max-content;
  display: flex; gap: 4px; padding: 5px; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 32px);
  background: rgba(14,13,12,.85); border: 1px solid var(--line); border-radius: 999px;
}
.free-rooms button {
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); background: none; border: 0; border-radius: 999px; padding: 9px 14px; cursor: pointer;
}
.free-rooms button:hover { color: var(--ink); }
.free-rooms button.on { background: var(--accent); color: #1a120a; }
#free-labels { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.spot-label {
  position: absolute; left: 0; top: 0; display: none; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap;
  color: var(--ink); background: rgba(14,13,12,.82); border: 1px solid rgba(227,163,92,.55); border-radius: 999px;
  padding: 7px 12px 7px 9px; cursor: pointer; pointer-events: auto; transition: background .2s, color .2s;
}
.spot-label.show { display: inline-flex; }
.spot-label i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(227,163,92,.25); }
.spot-label:hover { background: var(--accent); color: #1a120a; }
/* joystick analógico (modo livre): pequeno, translúcido, funciona com mouse e toque */
#joystick {
  position: fixed; z-index: 6; left: 28px; bottom: 28px; width: 112px; height: 112px; border-radius: 50%; display: none;
  background: radial-gradient(circle, rgba(255,255,255,.05) 0 38%, rgba(255,255,255,.11) 100%);
  border: 1.5px solid rgba(255,255,255,.26); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: .62; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; transition: opacity .2s;
}
body.free #joystick { display: block; }
#joystick.on { opacity: 1; cursor: grabbing; }
#joystick b { position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background:
    linear-gradient(rgba(255,255,255,.3), rgba(255,255,255,.3)) 50% 9px / 2px 9px no-repeat,
    linear-gradient(rgba(255,255,255,.3), rgba(255,255,255,.3)) 50% calc(100% - 9px) / 2px 9px no-repeat,
    linear-gradient(rgba(255,255,255,.3), rgba(255,255,255,.3)) 9px 50% / 9px 2px no-repeat,
    linear-gradient(rgba(255,255,255,.3), rgba(255,255,255,.3)) calc(100% - 9px) 50% / 9px 2px no-repeat; }
#joystick i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.7), rgba(255,255,255,.3)); border: 1.5px solid rgba(255,255,255,.7);
  box-shadow: 0 4px 14px rgba(0,0,0,.35); }

/* ---------------------------------------------------------------- painel de capítulos */
.panel {
  position: fixed; z-index: 4;
  left: 32px; top: 50%; transform: translateY(-46%);
  width: min(30vw, 440px);
  pointer-events: none;
  transition: opacity .6s, transform .6s;
}
.panel article {
  position: absolute; left: 0; top: 50%; width: 100%;
  transform: translateY(-46%) translateX(-16px);
  opacity: 0; visibility: hidden;
  transition: opacity .55s ease, transform .55s ease, visibility 0s .55s;
}
.panel article.active {
  opacity: 1; visibility: visible; transform: translateY(-50%);
  transition: opacity .7s ease .1s, transform .7s ease .1s, visibility 0s;
  pointer-events: auto;
}
.kicker {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 18px; display: flex; align-items: center; gap: 10px;
}
.kicker b { color: #1a120a; background: var(--accent); padding: 3px 7px; border-radius: 3px; font-weight: 600; }
.panel h1, .panel h2 {
  font-family: var(--display); font-weight: 400; text-transform: uppercase;
  line-height: 0.98; letter-spacing: 0.01em; margin: 0 0 20px;
  font-size: clamp(40px, 4.4vw, 68px);
  text-shadow: 0 2px 30px rgba(0, 0, 0, .5);
}
.panel h2 { font-size: clamp(36px, 3.7vw, 58px); }
.panel em { font-style: normal; color: var(--accent); }
.panel p { font-size: 15px; line-height: 1.6; color: #d6cfc5; margin: 0 0 22px; max-width: 40ch; text-shadow: 0 1px 12px rgba(0,0,0,.6); }
.panel dl {
  display: flex; flex-wrap: wrap; gap: 0; margin: 0;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: var(--panel);
}
.panel dl > div { flex: 1 1 0; min-width: 110px; padding: 12px 14px; border-right: 1px solid var(--line); }
.panel dl > div:last-child { border-right: 0; }
.panel dt { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.panel dd { margin: 0; font-family: var(--mono); font-size: 13px; color: var(--ink); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600;
  text-decoration: none; padding: 14px 20px; border-radius: 999px;
  background: var(--accent); color: #1a120a; border: 1px solid var(--accent);
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: rgba(14,13,12,.6); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }

/* modo tour: o painel some e o rótulo do ambiente aparece */
body.tour .panel article.tour-intro.active { opacity: 0; }
#room-tag {
  position: fixed; z-index: 4; left: 32px; bottom: 54px;
  display: grid; gap: 6px; max-width: 460px;
  opacity: 0; transform: translateY(12px); transition: opacity .6s, transform .6s;
  pointer-events: none;
}
#room-tag.show { opacity: 1; transform: none; }
#room-tag em { font-style: normal; font-family: var(--mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }
#room-tag strong { font-family: var(--display); font-weight: 400; font-size: clamp(38px, 4vw, 60px); text-transform: uppercase; line-height: 1; text-shadow: 0 2px 30px rgba(0,0,0,.7); }
#room-tag span { font-size: 15px; color: #d6cfc5; text-shadow: 0 1px 12px rgba(0,0,0,.8); }

/* ---------------------------------------------------------------- progresso, dica, transições */
.progress { position: fixed; z-index: 5; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.06); }
.progress i { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }
.hint {
  position: fixed; z-index: 4; left: 32px; bottom: 28px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 10px; transition: opacity .5s;
  padding: 10px 16px 8px; border-radius: 14px; background: rgba(14,13,12,.85);
}
.hint i { width: 1px; height: 34px; background: linear-gradient(var(--accent), transparent); animation: drip 1.8s ease-in-out infinite; }
.hint.gone { opacity: 0; }
@keyframes drip { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

#fade { position: fixed; inset: 0; z-index: 3; background: #050505; opacity: 0; pointer-events: none; }

#loader {
  position: fixed; inset: 0; z-index: 10; background: var(--bg);
  display: grid; place-content: center; text-align: center; gap: 10px; transition: opacity .8s, visibility 0s .8s;
}
#loader span { font-family: var(--display); font-size: 54px; letter-spacing: .08em; }
#loader small { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
body.ready #loader { opacity: 0; visibility: hidden; }

/* ---------------------------------------------------------------- telas médias */
@media (max-width: 1100px) {
  .panel { width: min(38vw, 420px); }
  .topbar nav a { padding: 8px 10px; }
}

/* ---------------------------------------------------------------- celular */
@media (max-width: 820px), (max-aspect-ratio: 9/10) {
  .topbar { padding: 14px 16px; }
  .topbar nav { display: none; }
  .brand { font-size: 22px; gap: 8px; }
  .brand img { width: 26px; height: 26px; }
  .brand small { display: none; }
  .made-by { margin-top: 16px; }
  .made-by img { width: 190px; }
  .cta-top { display: none; }
  .explore-btn { padding: 8px 12px; font-size: 10px; }
  .free-head { top: 56px; left: 16px; right: 16px; flex-direction: column; }
  .free-title b { font-size: 26px; }
  .free-title p { font-size: 10px; }
  .free-actions { justify-content: flex-start; }
  .pill { padding: 8px 12px; font-size: 10px; }
  .free-rooms { bottom: 16px; border-radius: 18px; }
  .free-rooms button { padding: 8px 10px; font-size: 10px; }
  #joystick { left: 18px; bottom: 74px; width: 100px; height: 100px; }
  #joystick i { width: 42px; height: 42px; margin: -21px 0 0 -21px; }
  .panel {
    left: 16px; right: 16px; width: auto; top: auto; bottom: 22px; transform: none;
    height: 44vh;
  }
  .panel article { top: auto; bottom: 0; transform: translateY(12px); }
  .panel article.active { transform: none; }
  .panel h1 { font-size: clamp(34px, 10vw, 46px); margin-bottom: 12px; }
  .panel h2 { font-size: clamp(30px, 9vw, 42px); margin-bottom: 12px; }
  .panel h1 br, .panel h2 br { display: none; }
  .panel p { font-size: 14px; line-height: 1.5; margin-bottom: 14px; }
  .kicker { margin-bottom: 10px; font-size: 10px; }
  .panel dl > div { min-width: 0; padding: 10px; }
  .panel dd { font-size: 12px; }
  .panel article::before {
    content: ""; position: absolute; inset: -60px -16px -22px; z-index: -1;
    background: linear-gradient(transparent, rgba(10,9,8,.82) 38%, rgba(10,9,8,.94));
  }
  #room-tag { left: 16px; right: 16px; bottom: 34px; }
  #scrim { background: linear-gradient(0deg, rgba(13,12,11,.9) 0%, rgba(13,12,11,.55) 34%, rgba(13,12,11,0) 52%); }
  #room-tag strong { font-size: 38px; }
  .hint { bottom: auto; top: 64px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 10px; }
  .btn { padding: 12px 16px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .panel article, .panel article.active, #room-tag { transition: opacity .2s; }
  .hint i { animation: none; }
}

/* ---------------------------------------------------------------- modo filme (gravação de vídeo) */
body.film *, body.film *::before { transition: none !important; animation: none !important; }
body.film #loader, body.film .hint { display: none !important; }
body.film-clean .topbar, body.film-clean .panel, body.film-clean #room-tag, body.film-clean .progress,
body.film-clean #scrim, body.film-clean #fade { display: none !important; }
