:root {
  --bg-deep: #071915;
  --bg-mid: #0e2e26;
  --panel-bg: rgba(11, 34, 29, 0.78);
  --panel-border: rgba(167, 243, 208, 0.22);
  --gold: #f4bd52;
  --gold-bright: #ffe49c;
  --mint: #6ee7b7;
  --ink: #f4fbf7;
  --muted: #b5d5c8;
  --danger: #fca5a5;
  --font-main: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-main);
  color: var(--ink);
  background: radial-gradient(circle at 20% 10%, #144338 0%, #09201a 52%, #04100d 100%);
  overflow-x: hidden;
}

.start-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
}

.orb-1 {
  width: 480px;
  height: 480px;
  top: -140px;
  left: -100px;
  background: #2dd4bf;
}

.orb-2 {
  width: 520px;
  height: 520px;
  top: 120px;
  right: -120px;
  background: #f59e0b;
  opacity: 0.22;
}

.orb-3 {
  width: 420px;
  height: 420px;
  bottom: -140px;
  left: 35%;
  background: #3b82f6;
  opacity: 0.2;
}

.top-bar {
  position: relative;
  z-index: 5;
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 28px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-text strong {
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  color: var(--gold-bright);
}

.brand-text span {
  font-size: 0.88rem;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-pill,
.lang-select {
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(9, 28, 24, 0.72);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.nav-pill:hover,
.lang-select:hover {
  border-color: var(--mint);
}

.page-main {
  position: relative;
  z-index: 5;
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 28px 56px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.42);
}

.hero-stage-shell {
  position: relative;
  width: 100%;
  min-height: clamp(560px, 76vh, 740px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px 24px 22px;
}

.hero-canvas-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
}

.hero-fallback-scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(circle at 50% 25%, #1d6450 0%, #0d3227 52%, #061813 100%);
  transition: background 0.45s ease;
}

.hero-poster-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.92;
  transition: opacity 0.45s ease;
}

.hero-stage-shell.has-webgl .hero-poster-img {
  opacity: 0;
}

.hero-stage-shell[data-world="ocean"] .hero-fallback-scene {
  background: radial-gradient(circle at 50% 20%, #106082 0%, #083550 56%, #041d2e 100%);
}

.hero-stage-shell[data-world="space"] .hero-fallback-scene {
  background: radial-gradient(circle at 50% 20%, #2b2266 0%, #131133 58%, #070815 100%);
}

.hero-demo-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
}

.hero-demo-canvas.is-live {
  opacity: 1;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(
    ellipse 46% 52% at 16% 88%,
    rgba(4, 15, 13, 0.46) 0%,
    rgba(4, 15, 13, 0.0) 72%
  );
}

.hero-stage-top {
  position: relative;
  z-index: 4;
  padding: 18px 24px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-demo-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-width: 100%;
}

.demo-tabs {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 5px;
  border-radius: 999px;
  background: rgba(6, 20, 17, 0.72);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(12px);
}

.hero-like-demo-btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(154, 240, 214, 0.35);
  background: rgba(6, 20, 17, 0.72);
  color: var(--mint);
  font-family: var(--font-main);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.hero-like-demo-btn:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: rgba(6, 20, 17, 0.88);
}

.hero-like-demo-btn:disabled {
  opacity: 0.65;
  cursor: progress;
}

.demo-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 15px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.demo-tab.active {
  background: rgba(244, 189, 82, 0.24);
  border-color: var(--gold);
  color: var(--gold-bright);
}

.hero-pause-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(6, 20, 17, 0.72);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.hero-pause-btn[aria-pressed="true"] {
  border-color: var(--gold);
  color: var(--gold-bright);
}

.hero-overlay-card {
  position: relative;
  z-index: 4;
  align-self: flex-start;
  max-width: 356px;
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(6, 22, 19, 0.74);
  border: 1px solid rgba(167, 243, 208, 0.26);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.44);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hero-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(110, 231, 183, 0.14);
  border: 1px solid rgba(110, 231, 183, 0.3);
  color: #cffae6;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.3;
}

.hero-heading {
  margin: 0;
  font-size: clamp(1.25rem, 1.8vw, 1.58rem);
  line-height: 1.15;
  color: var(--gold-bright);
}

.hero-world-desc {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.32;
  color: var(--muted);
}

.create-controls {
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cta-primary {
  width: 100%;
  min-height: 50px;
  padding: 11px 16px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffe291 0%, #f4b740 100%);
  color: #1c1506;
  font-family: var(--font-main);
  font-size: 1.04rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 10px 26px rgba(244, 183, 64, 0.38);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.cta-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.04);
}

.cta-primary:disabled {
  opacity: 0.65;
  cursor: progress;
}

.role-switch-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px 10px;
}

.snapshot-progress-banner {
  margin: 0;
  padding: 7px 12px;
  border-radius: 10px;
  background: rgba(110, 231, 183, 0.14);
  border: 1px solid rgba(110, 231, 183, 0.34);
  color: #cffae6;
  font-size: 0.84rem;
  font-weight: 600;
  text-align: center;
}

.role-link-btn {
  background: transparent;
  border: 0;
  padding: 4px 10px;
  color: var(--mint);
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.role-link-btn:hover {
  color: var(--gold-bright);
}

.step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.step-illus {
  width: 26px;
  height: 26px;
  color: var(--mint);
  opacity: 0.88;
}

.trust-footer {
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.trust-footer strong {
  color: var(--gold-bright);
  font-size: 0.96rem;
}

.trust-footer p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.48;
  color: var(--muted);
}

.error-banner {
  margin: 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(127, 29, 29, 0.65);
  border: 1px solid rgba(252, 165, 165, 0.5);
  color: #fee2e2;
  font-size: 0.9rem;
}

.error-banner a,
.snapshot-partial-link {
  color: #fef08a;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bottom-restore-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 2px 0 8px;
}

.bottom-restore-wrap[hidden],
.snapshots-section[hidden] {
  display: none !important;
}

.bottom-restore-link {
  background: transparent;
  border: 0;
  padding: 6px 12px;
  color: var(--muted);
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  opacity: 0.88;
}

.bottom-restore-link:hover {
  color: var(--mint);
  opacity: 1;
}

.hidden {
  display: none !important;
}

.recent-section {
  padding: 22px 26px;
}

.section-head h2 {
  margin: 0 0 14px;
  font-size: 1.2rem;
  color: var(--gold-bright);
}

.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: 12px;
}

.recent-card {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recent-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.recent-room-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  color: var(--mint);
}

.recent-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.recent-btn {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(110, 231, 183, 0.14);
  border: 1px solid rgba(110, 231, 183, 0.3);
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 700;
}

.recent-btn.primary {
  background: rgba(244, 189, 82, 0.22);
  border-color: var(--gold);
  color: var(--gold-bright);
}

.recent-remove {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
}

.snapshots-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.snapshots-head h2 {
  margin-bottom: 4px;
}

.snapshots-local-note {
  margin: 0;
  max-width: 660px;
  font-size: 0.85rem;
  line-height: 1.42;
  color: var(--muted);
}

.snapshots-empty-hint {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.snapshot-card-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.32);
}

.snapshot-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.snapshot-action-btn {
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid rgba(154, 240, 214, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-family: var(--font-main);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.snapshot-action-btn.primary {
  background: rgba(244, 189, 82, 0.24);
  border-color: var(--gold);
  color: var(--gold-bright);
}

.snapshot-action-btn.danger {
  border-color: rgba(252, 165, 165, 0.42);
  color: #fecaca;
}

.steps-heading {
  margin: 0 0 14px;
  font-size: 1.25rem;
  color: var(--gold-bright);
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.step-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.step-num {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(244, 189, 82, 0.22);
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-card h3 {
  margin: 4px 0 0;
  font-size: 1.05rem;
}

.step-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.4;
}

.step-link {
  margin-top: auto;
  padding-top: 6px;
  color: var(--mint);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

/* Room gone page */
.gone-main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 5;
}

.gone-card {
  max-width: 520px;
  width: 100%;
  padding: 36px 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.gone-emoji {
  font-size: 3.4rem;
}

.gone-card h1 {
  margin: 0;
  font-size: 1.7rem;
  color: var(--gold-bright);
}

.gone-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.gone-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 12px 24px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffe291 0%, #f4b740 100%);
  color: #1c1506;
  font-weight: 800;
  text-decoration: none;
  margin-top: 8px;
}

@media (max-width: 900px) {
  .top-bar {
    padding: 8px 12px 4px;
    gap: 8px;
  }

  .brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .brand-text strong {
    font-size: 1.05rem;
  }

  .brand-text span {
    display: none;
  }

  .nav-pill,
  .lang-select {
    height: 32px;
    padding: 0 10px;
    font-size: 0.78rem;
  }

  .page-main {
    padding: 4px 12px 28px;
    gap: 16px;
  }

  .hero-stage-shell {
    min-height: 0;
    padding: 0;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow: hidden;
  }

  .hero-canvas-stage {
    position: relative;
    width: 100%;
    height: clamp(356px, 44vh, 420px);
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: 0;
  }

  .hero-stage-top {
    padding: 10px 10px 0;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 6px;
  }

  .hero-demo-left {
    align-items: center;
    gap: 6px;
  }

  .hero-like-demo-btn {
    padding: 5px 12px;
    font-size: 0.78rem;
  }

  .demo-tabs {
    padding: 3px;
    gap: 4px;
  }

  .demo-tab {
    padding: 5px 11px;
    font-size: 0.82rem;
  }

  .hero-scrim,
  .hero-badge,
  #demo-pause-btn,
  .hero-pause-btn {
    display: none !important;
  }

  .hero-overlay-card {
    position: relative;
    max-width: 100%;
    width: 100%;
    border-radius: 0 0 20px 20px;
    border: 0;
    border-top: 1px solid rgba(167, 243, 208, 0.2);
    padding: 12px 16px 14px;
    gap: 7px;
    background: rgba(6, 22, 19, 0.92);
    box-shadow: none;
  }

  .hero-overlay-card h1,
  .hero-heading {
    font-size: 1.24rem;
    line-height: 1.16;
  }

  .hero-world-desc {
    font-size: 0.83rem;
    line-height: 1.3;
  }

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

@media (max-width: 380px) {
  .top-bar {
    padding: 8px 10px 4px;
    gap: 6px;
  }

  .top-actions {
    gap: 6px;
    flex-wrap: wrap;
    max-width: 100%;
  }

  .nav-pill,
  .lang-select {
    height: 30px;
    padding: 0 8px;
    font-size: 0.74rem;
    max-width: 100%;
  }

  .page-main {
    padding: 4px 8px 24px;
    gap: 12px;
  }

  .hero-stage-top {
    padding: 8px 6px 0;
  }

  .demo-tabs {
    justify-content: center;
    max-width: 100%;
  }

  .demo-tab {
    padding: 4px 8px;
    font-size: 0.74rem;
    gap: 4px;
  }

  .hero-overlay-card {
    padding: 10px 12px 12px;
  }

  .cta-primary {
    font-size: 0.96rem;
    min-height: 46px;
    padding: 10px 12px;
  }

  .recent-section,
  .step-card,
  .trust-footer {
    padding: 14px 12px;
  }
}

/* Smart TV / keyboard arrow navigation focus ring */
:focus-visible,
body.tv-nav-active :focus {
  outline: 3px solid #facc15 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.42), 0 0 18px rgba(250, 204, 21, 0.45) !important;
}
