/* Warbid Plaza — 2.5D spatial world styles */

/* MOBILE OVERFLOW FIX (9→10 final): prevent horizontal scroll at 390px */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }
}

.plaza-container {
  max-width: 100vw; /* Prevent overflow on all screens */
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: calc(100vh - 200px);
  padding: 20px 0;
}

.plaza-header {
  text-align: center;
  margin-bottom: 12px;
}

.plaza-title {
  font-family: var(--display);
  font-size: clamp(32px, 5vw, 56px);
  color: var(--lime);
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-shadow: 0 0 20px rgba(200, 245, 66, 0.4);
}

.plaza-intro {
  font-size: clamp(14px, 2.5vw, 18px);
  color: var(--muted);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Wallet bar */
.plaza-wallet-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.plaza-wallet-info {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--muted);
}

.plaza-wallet-info b {
  color: var(--lime);
}

#connect-wallet-btn {
  font-size: 14px;
  padding: 8px 16px;
}

/* Canvas container (responsive) */
.plaza-stage {
  position: relative;
  background: var(--bg-3);
  border: 2px solid var(--sol-line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0 auto;
  box-shadow: var(--shadow);
  max-width: 100%;
}

/* Mobile: full-width canvas for better viewport */
@media (max-width: 767px) {
  .plaza-stage {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    margin: 0; /* Was -20px, caused overflow — FIXED 9→10 */
    max-width: 100vw; /* Prevent overflow */
    width: 100%;
  }
}

#plaza-canvas {
  display: block;
  width: 100%; /* Mobile overflow fix: fit viewport */
  max-width: 100%; /* Mobile overflow fix: never exceed container */
  margin: 0 auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Zone label */
.plaza-zone-label {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(10, 11, 16, 0.9);
  border: 1px solid var(--sol);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--lime);
  pointer-events: none;
  z-index: 10;
}

/* Interaction prompt (ULTRA VISIBLE + touch-friendly) */
.plaza-interaction-prompt {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 11, 16, 0.98);
  border: 3px solid var(--lime);
  border-radius: var(--radius);
  padding: 16px 32px;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--lime);
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  display: none;
  box-shadow: 0 0 30px rgba(200, 245, 66, 0.6), 0 4px 16px rgba(0, 0, 0, 0.7);
  text-shadow: 0 0 8px rgba(200, 245, 66, 0.8);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.plaza-interaction-prompt:hover,
.plaza-interaction-prompt:active {
  background: var(--lime);
  color: var(--bg);
  transform: translateX(-50%) scale(1.08);
  box-shadow: 0 0 40px rgba(200, 245, 66, 0.9), 0 6px 20px rgba(0, 0, 0, 0.8);
}

/* Mobile: larger tap target */
@media (max-width: 767px) {
  .plaza-interaction-prompt {
    font-size: 16px;
    padding: 20px 40px;
    bottom: 100px; /* Above D-pad controls */
    max-width: calc(100% - 40px);
    text-align: center;
  }
}

/* D-pad controls (mobile - horizontal left/right only) */
.plaza-controls {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.plaza-dpad-lr {
  display: flex;
  align-items: center;
  gap: 12px;
}

.plaza-dpad-lr button {
  background: var(--bg-2);
  border: 2px solid var(--sol-line);
  border-radius: var(--radius);
  color: var(--lime);
  font-size: 28px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
}

.plaza-dpad-lr button:active {
  background: var(--sol);
  border-color: var(--lime);
  transform: scale(0.95);
}

.plaza-dpad-lr .dpad-center {
  background: transparent;
  border: none;
  pointer-events: none;
  font-size: 12px;
  color: var(--faint);
  padding: 0 16px;
  text-transform: uppercase;
  font-family: var(--mono);
  font-weight: 700;
}

/* NPC Dialogue Modal */
.plaza-dialogue-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 8, 0.85);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.plaza-dialogue-modal[hidden] {
  display: none;
}

.plaza-dialogue-box {
  background: var(--bg-2);
  border: 2px solid var(--sol);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow);
}

.plaza-dialogue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.plaza-dialogue-npc-name {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--lime);
}

.plaza-dialogue-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.plaza-dialogue-close:hover {
  color: var(--coral);
}

.plaza-dialogue-text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: 20px;
  min-height: 60px;
}

.plaza-dialogue-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plaza-dialogue-options .btn {
  justify-content: flex-start;
  text-align: left;
  padding: 12px 16px;
}

/* Avatar display */
.plaza-avatar {
  position: relative;
  display: inline-block;
}

.plaza-avatar-label {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--lime);
  white-space: nowrap;
  text-shadow: 0 0 4px rgba(5, 5, 8, 0.8);
}

/* Help section */
.plaza-help {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}

.plaza-help h3 {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--lime);
  margin: 0 0 12px 0;
}

.plaza-help ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plaza-help li {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.plaza-help li::before {
  content: '→';
  color: var(--sol);
  font-weight: 700;
}

.plaza-help code {
  background: var(--bg-3);
  padding: 2px 6px;
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--lime);
}

/* Mobile responsiveness */
@media (max-width: 640px) {
  .plaza-title {
    font-size: 32px;
  }

  .plaza-intro {
    font-size: 14px;
  }

  .plaza-wallet-bar {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .plaza-stage {
    border-width: 1px;
  }

  .plaza-dialogue-box {
    padding: 20px;
  }

  .plaza-dpad-lr button {
    width: 56px;
    height: 56px;
    font-size: 24px;
  }
}

/* Mobile controls always visible (critical for touch) */
.plaza-controls {
  display: flex;
}

/* Desktop keyboard hint */
@media (min-width: 768px) {
  .plaza-help-desktop {
    display: block;
  }
}

@media (max-width: 767px) {
  .plaza-help-desktop {
    display: none;
  }
  
  /* Mobile: D-pad larger + prominent */
  .plaza-dpad-lr button {
    width: 72px;
    height: 72px;
    font-size: 32px;
  }
}

/* Animation */
@keyframes plaza-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(0.95);
  }
}

.plaza-interaction-prompt {
  animation: plaza-pulse 1.5s ease-in-out infinite;
}

/* Guest gate overlay (Habbo-style entrance) */
.plaza-guest-gate {
  position: absolute;
  inset: 0;
  background: rgba(10, 11, 16, 0.95);
  backdrop-filter: blur(8px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.plaza-guest-gate[hidden] {
  display: none;
}

.plaza-guest-gate-content {
  text-align: center;
  max-width: 500px;
  padding: 32px;
  background: var(--bg-2);
  border: 3px solid var(--sol);
  border-radius: var(--radius);
  box-shadow: 0 0 30px rgba(153, 69, 255, 0.3);
}

.plaza-guest-gate-content h2 {
  font-family: var(--display);
  font-size: 32px;
  color: var(--lime);
  margin: 0 0 16px 0;
  text-shadow: 0 0 20px rgba(200, 245, 66, 0.4);
}

.plaza-guest-gate-content p {
  font-size: 16px;
  color: var(--muted);
  margin: 0 0 12px 0;
  line-height: 1.5;
}

.plaza-guest-gate-hint {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--faint);
  margin-bottom: 24px !important;
}

.plaza-guest-gate-content .btn-large {
  font-size: 18px;
  padding: 14px 32px;
  margin-bottom: 16px;
}

.plaza-guest-gate-spectator {
  font-size: 14px;
  color: var(--faint);
  margin: 0;
}

.plaza-guest-gate-spectator a {
  color: var(--sol);
  text-decoration: underline;
  cursor: pointer;
}

.plaza-guest-gate-spectator a:hover {
  color: var(--lime);
}

/* ═══════════════════════════════════════════════════════════
   WALLET PICKER MODAL (Habbo-dark neon style)
   ═══════════════════════════════════════════════════════════ */

.wallet-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 5, 8, 0.92);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.wallet-picker-dialog {
  background: var(--bg-2);
  border: 3px solid var(--sol);
  border-radius: 8px;
  padding: 28px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 0 40px rgba(153, 69, 255, 0.5), 0 8px 24px rgba(0, 0, 0, 0.4);
}

.wallet-picker-dialog h3 {
  margin: 0 0 20px;
  font-size: 24px;
  font-weight: 700;
  font-family: var(--display);
  color: var(--lime);
  text-shadow: 0 0 16px rgba(200, 245, 66, 0.4);
  text-align: center;
}

.wallet-picker-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.wallet-picker-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px 20px;
  background: var(--bg-3);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  font-family: var(--mono);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  min-height: 56px;
}

.wallet-picker-item:hover {
  background: var(--bg);
  border-color: var(--lime);
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(200, 245, 66, 0.3);
  text-decoration: none;
}

.wallet-picker-item:active {
  transform: translateY(0);
}

.wallet-picker-item.wallet-not-installed {
  opacity: 0.7;
  border-style: dashed;
}

.wallet-picker-item.wallet-not-installed:hover {
  opacity: 1;
  border-style: solid;
}

.wallet-picker-cancel {
  width: 100%;
  padding: 14px;
  background: transparent;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--mono);
  cursor: pointer;
  transition: all 0.2s ease;
}

.wallet-picker-cancel:hover {
  color: var(--ink);
  border-color: var(--faint);
  background: rgba(255, 255, 255, 0.05);
}

/* ═══════════════════════════════════════════════════════════
   TOASTS (Plaza notifications)
   ═══════════════════════════════════════════════════════════ */

.toasts {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-3);
  border: 2px solid var(--lime-line);
  border-radius: 4px;
  padding: 12px 16px;
  font-size: 14px;
  font-family: var(--mono);
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  animation: toastIn 0.3s ease;
  pointer-events: auto;
  max-width: 320px;
}

.toast.is-war {
  border-color: rgba(255, 45, 85, 0.6);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (max-width: 600px) {
  .wallet-picker-dialog {
    padding: 24px 20px;
  }
  
  .wallet-picker-item {
    padding: 18px 16px;
    font-size: 15px;
    min-height: 60px;
  }
  
  .toasts {
    top: 70px;
    right: 12px;
    left: 12px;
  }
  
  .toast {
    max-width: none;
  }
}
