/* ─── World (Vegas casino floor) ──────────────────────────────────────── */
.world-body {
  margin: 0;
  /* Deep mahogany-and-burgundy room ambience — replaces the flat purple
     wash so the canvas reads as a real casino room. */
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, #2a1208 0%, #150804 70%, #08030a 100%);
  color: #f5e6c8;
  /* overflow-x:hidden + width:100% (instead of 100vw on children) prevents
     the horizontal scrollbar on phones — 100vw includes the scrollbar gutter
     and pushes content past the viewport edge. */
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  height: 100vh;
  /* iOS Safari: 100vh includes the URL bar; svh/dvh fix the cut-off footer. */
  height: 100dvh;
}
html { overflow-x: hidden; max-width: 100%; }

/* Cinematic vignette over the canvas — non-interactive, sits above the
   floor render but below all HUD/overlays. Soft warm fall-off in the
   corners makes the floor feel like a lit room. */
.world-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background:
    radial-gradient(ellipse 70% 60% at 50% 55%,
      rgba(0,0,0,0) 0%,
      rgba(0,0,0,0) 55%,
      rgba(10,4,2,0.55) 90%,
      rgba(5,2,1,0.85) 100%);
}

.world-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: linear-gradient(180deg, rgba(20,5,40,0.95), rgba(20,5,40,0.6));
  backdrop-filter: blur(8px);
  z-index: 10;
  border-bottom: 1px solid rgba(255, 215, 100, 0.2);
}
.world-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #ffd76a;
  font-weight: 700;
  font-size: 18px;
}
.world-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.world-pill {
  background: rgba(255, 215, 100, 0.1);
  border: 1px solid rgba(255, 215, 100, 0.3);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: #ffd76a;
}
.world-pill-bal strong { color: #ffeb99; }

.world-main {
  position: relative;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

#world-canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100vh;
  height: 100dvh;
  cursor: crosshair;
  outline: none;
}

.world-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 5, 40, 0.95);
  color: #ffeb99;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 215, 100, 0.4);
  font-size: 14px;
  z-index: 20;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.world-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  backdrop-filter: blur(4px);
}
.world-modal[hidden] { display: none; }
.world-modal-card {
  background: linear-gradient(180deg, #2a0d4a, #150627);
  border: 1px solid rgba(255, 215, 100, 0.4);
  border-radius: 16px;
  padding: 28px 32px;
  max-width: 480px;
  width: 92%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.world-modal-card h2 { margin-top: 0; color: #ffd76a; }
.world-modal-card p { color: #d8c5a0; margin-bottom: 20px; }
.world-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 16px;
  flex-wrap: wrap;
}

.closet-card { max-width: 560px; }
.closet-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.closet-swatch {
  aspect-ratio: 1;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.1);
  cursor: pointer;
  position: relative;
  background: #1a0d29;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, border-color 0.15s;
}
.closet-swatch:hover { transform: scale(1.05); border-color: rgba(255,215,100,0.5); }
.closet-swatch.is-selected {
  border-color: #ffd76a;
  box-shadow: 0 0 20px rgba(255, 215, 100, 0.5);
}
.closet-swatch canvas { width: 80%; height: 80%; }

/* Table scene overlay — embeds the game UI inside the world page so the
   player stays in a single SPA-like flow instead of navigating away. */
.world-table-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 100;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}
.world-table-overlay[hidden] { display: none; }
.world-table-overlay iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #150627;
}

/* ── Emote menu (radial popup at click position) ───────────────────────── */
.emote-menu {
  position: fixed;
  display: flex;
  gap: 6px;
  background: rgba(20, 5, 40, 0.96);
  border: 1px solid rgba(255, 215, 100, 0.5);
  border-radius: 999px;
  padding: 6px 10px;
  z-index: 200;
  box-shadow: 0 6px 22px rgba(0,0,0,0.55);
  transform: translate(-50%, -110%);
  animation: emoteMenuIn 0.15s ease-out;
}
.emote-menu[hidden] { display: none; }
.emote-menu .emote-target {
  font-size: 11px;
  color: #ffd76a;
  align-self: center;
  padding-right: 4px;
  border-right: 1px solid rgba(255,215,100,0.25);
  margin-right: 2px;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.emote-menu .emote-btn {
  background: rgba(255,215,100,0.08);
  border: 1px solid rgba(255,215,100,0.35);
  color: #ffeb99;
  font-size: 18px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, background 0.1s;
}
.emote-menu .emote-btn:hover { background: rgba(255,215,100,0.22); transform: scale(1.08); }
.emote-menu .emote-btn[data-emote="slap"] { border-color: #ff7a7a; color: #ffb0b0; }
.emote-menu .emote-btn[data-emote="slap"]:hover { background: rgba(255,80,80,0.3); }
@keyframes emoteMenuIn {
  from { opacity: 0; transform: translate(-50%, -90%) scale(0.92); }
  to   { opacity: 1; transform: translate(-50%, -110%) scale(1); }
}

/* Floating emote label (rises and fades over the target penguin). */
.emote-float-label {
  position: fixed;
  z-index: 199;
  pointer-events: none;
  font-weight: 800;
  font-size: 18px;
  color: #ffeb99;
  text-shadow: 0 2px 6px rgba(0,0,0,0.7);
  transform: translate(-50%, -100%);
  animation: emoteFloatRise 1.4s ease-out forwards;
}
.emote-float-label.is-slap {
  color: #ff5a5a;
  font-size: 22px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.85);
}
@keyframes emoteFloatRise {
  0%   { opacity: 0; transform: translate(-50%, -60%) scale(0.6); }
  20%  { opacity: 1; transform: translate(-50%, -110%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -200%) scale(1); }
}

/* In-game emote bar (used inside the table iframe). */
.emote-bar {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  background: rgba(20, 5, 40, 0.92);
  border: 1px solid rgba(255, 215, 100, 0.45);
  border-radius: 999px;
  padding: 6px 12px;
  z-index: 9997;
  box-shadow: 0 6px 22px rgba(0,0,0,0.55);
  align-items: center;
}
.emote-bar select {
  background: rgba(255,215,100,0.08);
  color: #ffeb99;
  border: 1px solid rgba(255,215,100,0.35);
  border-radius: 8px;
  padding: 4px 6px;
  font-size: 12px;
  max-width: 160px;
}
.emote-bar .emote-btn {
  background: rgba(255,215,100,0.08);
  border: 1px solid rgba(255,215,100,0.35);
  color: #ffeb99;
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.emote-bar .emote-btn:hover { background: rgba(255,215,100,0.22); }
.emote-bar .emote-btn[data-emote="slap"] { border-color: #ff7a7a; color: #ffb0b0; }
.emote-bar .emote-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Floor HUD: quick-chat button + emote-wheel button ──────────────────── */
.floor-hud {
  position: fixed;
  left: 14px;
  bottom: 14px;
  display: flex;
  gap: 8px;
  z-index: 40;
}
.floor-hud-btn {
  background: rgba(20, 5, 40, 0.92);
  border: 1px solid rgba(255, 215, 100, 0.45);
  color: #ffeb99;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45);
  transition: transform 0.1s, background 0.1s;
}
.floor-hud-btn:hover { background: rgba(255,215,100,0.18); transform: translateY(-1px); }
.floor-hud-btn-primary {
  background: linear-gradient(180deg, rgba(255,215,100,0.32), rgba(200,150,40,0.22));
  border-color: rgba(255,215,100,0.7);
  color: #fff5d0;
  font-weight: 800;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.18);
}
.floor-hud-btn-primary:hover { background: linear-gradient(180deg, rgba(255,225,130,0.45), rgba(220,170,60,0.30)); }
.floor-hud-btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* Persistent waiting-for-opponent banner. */
.seated-banner {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  min-width: 320px;
  max-width: 92vw;
  background: linear-gradient(180deg, rgba(35,18,8,0.96), rgba(20,8,4,0.96));
  border: 1px solid rgba(255,215,100,0.55);
  border-radius: 14px;
  color: #ffeb99;
  z-index: 22;
  box-shadow: 0 10px 32px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,235,170,0.12);
  animation: seated-pulse 2.4s ease-in-out infinite;
}
.seated-banner[hidden] { display: none; }
.seated-banner-icon { font-size: 26px; line-height: 1; }
.seated-banner-text { flex: 1; min-width: 0; }
.seated-banner-title {
  font-weight: 800;
  font-size: 14px;
  color: #fff5d0;
  letter-spacing: 0.3px;
}
.seated-banner-sub {
  font-size: 12px;
  color: #f0d68a;
  margin-top: 2px;
}
.seated-banner-cancel {
  background: rgba(120,30,30,0.85);
  color: #fff;
  border: 1px solid rgba(255,120,120,0.55);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.seated-banner-cancel:hover { background: rgba(160,40,40,0.95); }
@keyframes seated-pulse {
  0%, 100% { box-shadow: 0 10px 32px rgba(0,0,0,0.6), 0 0 0 0 rgba(255,215,100,0.0), inset 0 1px 0 rgba(255,235,170,0.12); }
  50%      { box-shadow: 0 10px 32px rgba(0,0,0,0.6), 0 0 0 6px rgba(255,215,100,0.10), inset 0 1px 0 rgba(255,235,170,0.18); }
}
.floor-hud-btn .floor-hud-key {
  font-size: 11px;
  border: 1px solid rgba(255,215,100,0.45);
  border-radius: 6px;
  padding: 1px 5px;
  background: rgba(0,0,0,0.25);
  margin-left: 4px;
}

/* Quick-chat input bar — appears centered above the HUD when active. */
.floor-chat-bar {
  position: fixed;
  left: 50%;
  bottom: 70px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  background: rgba(20, 5, 40, 0.96);
  border: 1px solid rgba(255, 215, 100, 0.5);
  border-radius: 999px;
  padding: 6px 10px;
  z-index: 60;
  box-shadow: 0 6px 22px rgba(0,0,0,0.55);
  align-items: center;
  width: min(560px, calc(100vw - 40px));
}
.floor-chat-bar[hidden] { display: none; }
.floor-chat-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: #ffeb99;
  font-size: 14px;
  padding: 6px 8px;
}
.floor-chat-input::placeholder { color: rgba(255,235,153,0.5); }
.floor-chat-send {
  background: rgba(255,215,100,0.18);
  border: 1px solid rgba(255,215,100,0.5);
  color: #ffeb99;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}
.floor-chat-send:hover { background: rgba(255,215,100,0.32); }

/* Emote wheel — anchored above the HUD emote button. */
.floor-emote-wheel {
  position: fixed;
  left: 14px;
  bottom: 70px;
  display: flex;
  gap: 6px;
  background: rgba(20, 5, 40, 0.96);
  border: 1px solid rgba(255, 215, 100, 0.5);
  border-radius: 999px;
  padding: 6px 10px;
  z-index: 60;
  box-shadow: 0 6px 22px rgba(0,0,0,0.55);
  animation: emoteMenuIn 0.15s ease-out;
}
.floor-emote-wheel[hidden] { display: none; }
.floor-emote-wheel .emote-btn {
  background: rgba(255,215,100,0.08);
  border: 1px solid rgba(255,215,100,0.35);
  color: #ffeb99;
  font-size: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, background 0.1s;
}
.floor-emote-wheel .emote-btn:hover { background: rgba(255,215,100,0.22); transform: scale(1.08); }
.floor-emote-wheel .emote-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Floating chat bubble above a penguin. Re-positioned every frame by
   world.js so it follows the player as they walk. */
.floor-chat-bubble {
  position: fixed;
  z-index: 198;
  pointer-events: none;
  background: rgba(255, 248, 220, 0.96);
  color: #2a0d4a;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid rgba(20, 5, 40, 0.5);
  box-shadow: 0 4px 12px rgba(0,0,0,0.45);
  max-width: 220px;
  word-wrap: break-word;
  white-space: pre-wrap;
  transform: translate(-50%, -100%);
  animation: chatBubbleIn 0.2s ease-out;
}
.floor-chat-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 0; height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid rgba(255, 248, 220, 0.96);
  transform: translateX(-50%);
}
.floor-chat-bubble.is-fading { opacity: 0; transition: opacity 0.4s ease-out; }
@keyframes chatBubbleIn {
  from { opacity: 0; transform: translate(-50%, -80%) scale(0.9); }
  to   { opacity: 1; transform: translate(-50%, -100%) scale(1); }
}

/* Hide/restyle the existing voice-chat module HUD slightly so it sits in
   the corner instead of dead-center on top of the canvas. */
#voice-chat-hud, .voice-chat-hud {
  bottom: 12px !important;
  right: 12px !important;
  left: auto !important;
  top: auto !important;
}

/* ── Responsive: tablet and small desktop (< 1024px) ─────────────────────
   Compact the header so its 6 elements (brand + name pill + balance pill +
   Get BC + Closet + Classic + Account) don't wrap onto three lines and eat
   the top of the canvas. */
@media (max-width: 1024px) {
  .world-header { padding: 8px 12px; gap: 8px; }
  .world-header .brand { font-size: 16px; }
  .world-header-info { gap: 8px; }
  .world-pill { font-size: 12px; padding: 4px 10px; }
  .bc-cta, .world-header-info .button { font-size: 12px; padding: 6px 10px; }
}

/* ── Responsive: phones (≤ 720px) ─────────────────────────────────────────
   Header was wrapping onto 3 lines (~150px tall) and overlapping the floor.
   The bottom HUD + seated banner + voice HUD + chat bar all stacked at the
   same Y range and overlapped each other. This block:
     • Collapses the header to a single scrollable row.
     • Hides the brand text (icon stays) and the wallet pill label "BC".
     • Shrinks the floor-HUD buttons to icon-only.
     • Lifts the seated banner above the HUD and shrinks it.
     • Repositions the voice HUD so it doesn't sit on top of the wheel. */
@media (max-width: 720px) {
  .world-header {
    padding: 6px 10px;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .world-header::-webkit-scrollbar { display: none; }
  .world-header .brand { font-size: 0; gap: 0; }
  .world-header .brand img { width: 28px; height: 28px; }
  .world-header-info {
    gap: 6px;
    flex-wrap: nowrap;
    flex-shrink: 0;
  }
  .world-pill { font-size: 11px; padding: 4px 8px; white-space: nowrap; }
  .bc-cta, .world-header-info .button {
    font-size: 11px;
    padding: 5px 9px;
    white-space: nowrap;
  }

  /* Floor HUD: icon-only on phones to save room. */
  .floor-hud { left: 8px; bottom: 8px; gap: 6px; }
  .floor-hud-btn {
    font-size: 0;        /* hide the trailing label text */
    padding: 8px 10px;
    line-height: 1;
  }
  .floor-hud-btn::first-letter { font-size: 18px; } /* keep the emoji big */
  .floor-hud-btn .floor-hud-key { display: none; }
  /* Re-show full labels for the primary Quick Match button so it stays
     obvious — it's the most important action on the floor. */
  .floor-hud-btn-primary { font-size: 12px; padding: 8px 12px; }

  /* Seated banner: smaller, lifted above the HUD row so they don't kiss. */
  .seated-banner {
    bottom: 64px;
    min-width: 0;
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    padding: 8px 12px;
    gap: 10px;
  }
  .seated-banner-icon { font-size: 20px; }
  .seated-banner-title { font-size: 13px; }
  .seated-banner-sub { font-size: 11px; }
  .seated-banner-cancel { padding: 6px 10px; font-size: 11px; }

  /* Chat bar: full width minus margins, raised above the HUD. */
  .floor-chat-bar { bottom: 56px; width: calc(100vw - 16px); }

  /* Emote wheel: keep above the HUD button it anchors to. */
  .floor-emote-wheel { left: 8px; bottom: 56px; }

  /* Voice HUD: nudge up so it doesn't overlap the corner of the floor HUD
     when both are visible. */
  #voice-chat-hud, .voice-chat-hud {
    bottom: 56px !important;
    right: 8px !important;
    transform: scale(0.85);
    transform-origin: bottom right;
  }

  /* World toast: above the chat bar, never under it. */
  .world-toast { bottom: 110px; font-size: 13px; padding: 10px 16px; }
}
