:root {
  --ink: #f5f5f5;
  --bg: #000;
  --accent: #ff2d55;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; }
body { font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif; }

#stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #000;
}

.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#intro, #zoom {
  object-fit: cover;
  background: #000;
  transition: opacity 600ms ease, filter 600ms ease;
}
#zoom { opacity: 0; pointer-events: none; }
#zoom.visible { opacity: 1; }

/* Longer, eased fade specifically for the zoom → 3D handoff */
#zoom.handoff-out  { transition: opacity 1500ms cubic-bezier(.4,.0,.2,1); opacity: 0; }
#intro.handoff-out { transition: opacity 1500ms cubic-bezier(.4,.0,.2,1); opacity: 0; }
#three.handoff-in  { transition: opacity 1500ms cubic-bezier(.4,.0,.2,1); }

#three {
  display: block;
  opacity: 0;
  transition: opacity 800ms ease;
}

.hidden { opacity: 0; pointer-events: none; }
.visible { opacity: 1; pointer-events: auto; }

#three.visible { opacity: 1; }
#intro.fade-out { opacity: 0; }

#hud {
  position: absolute;
  inset: auto 0 7vh 0;
  display: flex;
  justify-content: center;
  z-index: 10;
  transition: opacity 500ms ease, transform 500ms ease;
  transform: translateY(8px);
}
#hud.visible { transform: translateY(0); }

#enter {
  position: relative;
  appearance: none;
  border: 0;
  background: rgba(15, 15, 15, 0.55);
  color: var(--ink);
  font: 600 14px/1 ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  padding: 18px 28px 18px 32px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.08) inset,
    0 0 30px rgba(255, 45, 85, 0.0),
    0 12px 40px rgba(0,0,0,0.6);
  transition: transform 200ms ease, box-shadow 400ms ease, background 200ms ease;
}
#enter:hover {
  transform: translateY(-1px);
  background: rgba(25, 25, 25, 0.7);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.18) inset,
    0 0 50px rgba(255, 45, 85, 0.45),
    0 14px 40px rgba(0,0,0,0.7);
}
#enter:active { transform: translateY(0); }
#enter .arrow { display: inline-block; transition: transform 200ms ease; }
#enter:hover .arrow { transform: translateX(4px); }

/* subtle pulse on the button when it first appears */
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(255,45,85,0.55), 0 0 0 1px rgba(255,255,255,0.08) inset, 0 12px 40px rgba(0,0,0,0.6); }
  70%  { box-shadow: 0 0 0 18px rgba(255,45,85,0), 0 0 0 1px rgba(255,255,255,0.08) inset, 0 12px 40px rgba(0,0,0,0.6); }
  100% { box-shadow: 0 0 0 0 rgba(255,45,85,0), 0 0 0 1px rgba(255,255,255,0.08) inset, 0 12px 40px rgba(0,0,0,0.6); }
}
#hud.visible #enter { animation: pulse-ring 2.2s ease-out 0.2s 2; }

#loader {
  display: grid;
  place-items: center;
  background: #000;
  z-index: 100;
  transition: opacity 400ms ease;
}
#loader.gone { opacity: 0; pointer-events: none; }

#loader .bar {
  width: min(280px, 56vw);
  height: 2px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 16px;
}
#loader .fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #fff, #ff2d55);
  transition: width 200ms ease;
}
#loader .lbl {
  font-size: 11px;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  opacity: 0.55;
}

#ca-banner {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  font: 600 11px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  background: rgba(15,15,15,0.55);
  padding: 12px 22px;
  border-radius: 999px;
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08) inset, 0 6px 24px rgba(0,0,0,0.45);
  user-select: all;            /* easy to copy when address is real */
  pointer-events: auto;
  white-space: nowrap;
}
#ca-banner .value {
  color: var(--accent);
  margin-left: 6px;
}

#about-btn {
  position: absolute;
  top: 18px;
  left: 18px;
  background: rgba(15,15,15,0.55);
  color: var(--ink);
  border: 0;
  font: 500 11px/1 ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  padding: 12px 18px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08) inset, 0 8px 28px rgba(0,0,0,0.5);
  z-index: 11;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 500ms ease, transform 500ms ease, background 200ms ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
#about-btn.visible { opacity: 0.9; transform: translateY(0); }
#about-btn:hover { opacity: 1; background: rgba(28,28,28,0.7); }
#about-btn .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  display: inline-block;
}

#about-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 42vw);
  background: linear-gradient(
    180deg,
    rgba(8,8,10,0.78) 0%,
    rgba(0,0,0,0.92) 100%
  );
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border-left: 1px solid rgba(255,255,255,0.06);
  color: var(--ink);
  padding: 88px 56px 56px;
  z-index: 12;
  transform: translateX(100%);
  opacity: 0;
  transition:
    transform 900ms cubic-bezier(.4,0,.2,1),
    opacity 700ms ease;
  overflow-y: auto;
}
#about-panel.open {
  transform: translateX(0);
  opacity: 1;
}

#about-panel .close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(255,255,255,0.04);
  border: 0;
  color: var(--ink);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background 200ms ease, transform 200ms ease;
}
#about-panel .close:hover { background: rgba(255,255,255,0.12); transform: rotate(90deg); }

#about-panel .eyebrow {
  font-size: 10px;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  opacity: 0.5;
  margin-bottom: 22px;
}
#about-panel h1 {
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
}
#about-panel .rule {
  width: 36px;
  height: 2px;
  background: var(--accent);
  margin-bottom: 28px;
}
#about-panel p {
  font-size: 14px;
  line-height: 1.7;
  opacity: 0.78;
  margin: 0 0 18px;
}
#about-panel ul.links {
  list-style: none;
  padding: 0;
  margin: 32px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#about-panel ul.links a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: padding 200ms ease, color 200ms ease;
}
#about-panel ul.links a .lbl {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}
#about-panel ul.links a .icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  opacity: 0.85;
  transition: opacity 200ms ease, transform 200ms ease;
}
#about-panel ul.links a::after {
  content: '↗';
  opacity: 0.4;
  transition: transform 200ms ease, opacity 200ms ease;
}
#about-panel ul.links a:hover {
  padding-left: 6px;
  color: var(--accent);
}
#about-panel ul.links a:hover .icon { opacity: 1; transform: translateY(-1px); }
#about-panel ul.links a:hover::after {
  transform: translate(2px, -2px);
  opacity: 1;
}

/* ----- Live chat --------------------------------------------------- */

#chat-panel {
  position: absolute;
  top: 88px;
  right: 20px;
  bottom: 24px;
  width: min(320px, 90vw);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(8,8,10,0.7) 0%, rgba(0,0,0,0.82) 100%);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  z-index: 11;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 500ms ease, transform 500ms ease;
  overflow: hidden;
}
#chat-panel.visible { opacity: 1; transform: translateY(0); }
#chat-panel.away { opacity: 0; pointer-events: none; }

.chat-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  font: 600 11px/1 ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.85;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.chat-head .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 13px;
  line-height: 1.45;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 6px; }

.chat-msg { word-break: break-word; opacity: 0; animation: chat-in 300ms ease forwards; }
@keyframes chat-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.chat-msg .nick { font-weight: 700; margin-right: 6px; }
.chat-msg .text { color: rgba(255,255,255,0.88); }

.chat-empty, .chat-status {
  font-size: 12px;
  opacity: 0.45;
  letter-spacing: 0.04em;
  padding: 6px 2px;
}

.chat-nick-gate {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.chat-nick-gate.hidden { display: none; }

.chat-form {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.chat-form.hidden { display: none; }

#chat-nick-input, #chat-input {
  flex: 1 1 auto;
  min-width: 0;
  appearance: none;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: var(--ink);
  font: 400 13px/1 ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: 10px 12px;
  border-radius: 10px;
  outline: none;
  transition: border-color 200ms ease, background 200ms ease;
}
#chat-nick-input:focus, #chat-input:focus {
  border-color: rgba(255, 45, 85, 0.5);
  background: rgba(255,255,255,0.08);
}

#chat-nick-submit, .chat-form button {
  flex: 0 0 auto;
  appearance: none;
  border: 0;
  background: var(--accent);
  color: #fff;
  font: 600 12px/1 ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.04em;
  padding: 0 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 150ms ease, transform 150ms ease;
}
#chat-nick-submit:hover, .chat-form button:hover { opacity: 0.85; }
#chat-nick-submit:active, .chat-form button:active { transform: scale(0.96); }

@media (max-width: 760px) {
  #chat-panel {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: 12px;
    height: 34vh;
    width: auto;
  }
}
