/* ==========================================================================
   TURISTA MUNDIAL - ESTILOS EXCLUSIVOS & AISLADOS
   Refaccionaria Guerrero - Design System Corporate Glassmorphism Premium
   ========================================================================== */

:root {
  --primary: #00599a;
  --primary-dark: #003d6b;
  --accent: #da1a32;
  --gold: #f5a623;
  --yellow-glow: #ffe600;
  --green-success: #10b981;
  --bg-dark: #0f172a;
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.3);
  --shadow-premium: 0 12px 32px rgba(0, 89, 154, 0.25);
  --font-main: 'Barlow', 'Inter', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-main);
  background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
  color: #fff;
}

/* --- LOBBY & REGISTRO DE JUGADOR --- */
#turista-lobby-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lobby-card {
  width: 100%;
  max-width: 440px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(241, 245, 249, 0.9));
  border-radius: 28px;
  padding: 30px 24px;
  color: #1e293b;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.5);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.lobby-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  margin: -30px -24px 25px -24px;
  padding: 25px 20px;
  color: white;
}

.lobby-header h1 {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.lobby-header p {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-top: 4px;
}

.avatar-selector {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 15px 0 20px 0;
}

.avatar-option {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #f1f5f9;
  border: 3px solid transparent;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.avatar-option.selected {
  border-color: var(--primary);
  background: #e0f2fe;
  transform: scale(1.15);
  box-shadow: 0 0 15px rgba(0, 89, 154, 0.4);
}

.input-field {
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  border: 2px solid #cbd5e1;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  outline: none;
  margin-bottom: 15px;
  transition: border-color 0.2s;
  background: #fff;
}

.input-field:focus {
  border-color: var(--primary);
}

.btn-lobby-action {
  width: 100%;
  padding: 15px;
  border-radius: 16px;
  border: none;
  font-size: 1.05rem;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

.btn-primary-game {
  background: linear-gradient(135deg, var(--gold) 0%, #ff8c00 100%);
  color: #0f172a;
}

.btn-secondary-game {
  background: #f1f5f9;
  color: var(--primary);
  border: 2px solid #cbd5e1;
}

.btn-lobby-action:active {
  transform: scale(0.98);
}

/* --- GAME MAIN LAYOUT --- */
#turista-app-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

/* Header superior del juego */
.game-top-bar {
  height: 64px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
}

.current-turn-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 89, 154, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(0, 89, 154, 0.5);
}

.current-turn-badge .avatar-mini {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.current-turn-badge .turn-info {
  font-size: 0.8rem;
  font-weight: 800;
}

.game-actions-mini {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
}

.icon-btn:active {
  background: rgba(255, 255, 255, 0.25);
}

/* --- TABLERO CONTENEDOR & CANVAS CON PERSPECTIVA 3D --- */
.board-viewport {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  touch-action: none;
  min-height: 300px;
  perspective: 1100px;
  perspective-origin: 50% 55%;
}

#board-canvas-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: center center;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  transform-style: preserve-3d;
}

#board-canvas-container.board-3d-tilted {
  transform: rotateX(46deg) rotateZ(0deg) scale(0.92);
  box-shadow: 0 45px 90px rgba(0, 0, 0, 0.85), 0 10px 30px rgba(0, 89, 154, 0.35);
  border-radius: 20px;
}

#board-canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
}


/* --- CONTROLES FLOTANTES DE ZOOM --- */
.zoom-controls {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.zoom-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.zoom-btn:active {
  transform: scale(0.92);
  background: var(--primary);
}

/* --- PANEL DE JUGADORES (ARRIBA DEBAJO DEL HEADER) --- */
.players-ribbon {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding: 8px 14px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  z-index: 100;
}

.player-card-strip {
  min-width: 110px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s;
}

.player-card-strip.active-player {
  background: linear-gradient(135deg, rgba(0, 89, 154, 0.4), rgba(218, 26, 50, 0.3));
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(245, 166, 35, 0.4);
}

.player-card-strip .p-avatar {
  font-size: 1.3rem;
}

.player-card-strip .p-details {
  display: flex;
  flex-direction: column;
}

.player-card-strip .p-name {
  font-size: 0.75rem;
  font-weight: 800;
  color: #e2e8f0;
  white-space: nowrap;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-card-strip .p-money {
  font-size: 0.85rem;
  font-weight: 900;
  color: var(--green-success);
}

/* --- BARRA DE BOTONES (JUSTO ABAJO DE LOS NOMBRES) --- */
.bottom-controls-bar {
  position: relative;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  z-index: 100;
}

.btn-roll-dice {
  width: 100%;
  max-width: 280px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffe600 0%, #f5a623 50%, #ff6b00 100%);
  border: 2px solid rgba(255, 255, 255, 0.4);
  color: #0f172a;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(245, 166, 35, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.15s;
}


.btn-roll-dice:disabled {
  background: #475569;
  color: #94a3b8;
  box-shadow: none;
  cursor: not-allowed;
}

.btn-roll-dice:not(:disabled):active {
  transform: scale(0.96);
}

/* --- MODALES DE ACCIÓN (COMPRA, SORPRESA, ALERTA) --- */
.game-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.game-modal-card {
  width: 100%;
  max-width: 380px;
  background: #ffffff;
  border-radius: 24px;
  padding: 24px;
  color: #0f172a;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  position: relative;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.game-modal-card .property-header-tag {
  padding: 10px;
  border-radius: 12px;
  color: white;
  font-size: 1.2rem;
  font-weight: 900;
  margin-bottom: 15px;
}

.game-modal-card .property-price {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--accent);
  margin: 10px 0;
}

.modal-actions-row {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions-row button {
  flex: 1;
  padding: 12px;
  border-radius: 14px;
  border: none;
  font-weight: 900;
  font-size: 0.95rem;
  cursor: pointer;
}

/* --- ANIMACIÓN 3D DE DADOS & BANNER DE PUNTOS --- */
/* --- ANIMACIÓN 3D DE DADOS EN ESQUINA INFERIOR --- */
.dice-overlay-container {
  position: fixed;
  inset: auto auto 75px 20px;
  z-index: 1500;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  border: 2px solid var(--gold);
  border-radius: 20px;
  padding: 14px 18px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 15px rgba(245, 166, 35, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dice-box-3d {
  display: flex;
  gap: 24px;
  margin-bottom: 10px;
  perspective: 600px;
}

.dice-scene {
  width: 48px;
  height: 48px;
  perspective: 400px;
}

.dice-cube-3d {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1.15);
}

.dice-cube-3d.rolling {
  animation: diceRoll3DTumbling 0.25s infinite linear;
}

@keyframes diceRoll3DTumbling {
  0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(0.95); }
  25% { transform: rotateX(90deg) rotateY(180deg) rotateZ(45deg) scale(1.05); }
  50% { transform: rotateX(180deg) rotateY(270deg) rotateZ(90deg) scale(1.1); }
  75% { transform: rotateX(270deg) rotateY(360deg) rotateZ(135deg) scale(1.05); }
  100% { transform: rotateX(360deg) rotateY(540deg) rotateZ(180deg) scale(0.95); }
}

/* CARAS DEL DADO 3D (48px) */
.dice-face {
  position: absolute;
  width: 48px;
  height: 48px;
  background: linear-gradient(145deg, #ffffff 0%, #f1f5f9 60%, #cbd5e1 100%);
  border: 2px solid #94a3b8;
  border-radius: 12px;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.15), 0 0 3px rgba(255,255,255,0.8);
  display: grid;
  padding: 6px;
  box-sizing: border-box;
  backface-visibility: hidden;
}

/* PUNTOS (PIPS) EN LAS CARAS */
.pip {
  display: block;
  width: 9px;
  height: 9px;
  background: #1e293b;
  border-radius: 50%;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.6);
  align-self: center;
  justify-self: center;
}

.pip.red {
  background: #da1a32;
  box-shadow: inset 0 1px 2px rgba(100,0,0,0.6);
}

/* POSICIONAMIENTO TRIDIMENSIONAL DE CARAS (48px / 2 = 24px) */
.face-1 { transform: rotateY(0deg) translateZ(24px); display: flex; align-items: center; justify-content: center; }
.face-1 .pip { width: 12px; height: 12px; }

.face-2 { transform: rotateX(-90deg) translateZ(24px); display: flex; justify-content: space-between; flex-direction: column; padding: 7px; }
.face-2 .pip:nth-child(2) { align-self: flex-end; }

.face-3 { transform: rotateY(90deg) translateZ(24px); display: flex; justify-content: space-between; padding: 6px; }
.face-3 .pip:nth-child(2) { align-self: center; }
.face-3 .pip:nth-child(3) { align-self: flex-end; }

.face-4 { transform: rotateY(-90deg) translateZ(24px); display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 6px; padding: 6px; }

.face-5 { transform: rotateX(90deg) translateZ(24px); display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; padding: 4px; }
.face-5 .pip:nth-child(1) { grid-area: 1 / 1; }
.face-5 .pip:nth-child(2) { grid-area: 1 / 3; }
.face-5 .pip:nth-child(3) { grid-area: 2 / 2; width: 10px; height: 10px; }
.face-5 .pip:nth-child(4) { grid-area: 3 / 1; }
.face-5 .pip:nth-child(5) { grid-area: 3 / 3; }

.face-6 { transform: rotateY(180deg) translateZ(24px); display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; gap: 2px; padding: 6px 8px; }

.dice-result-banner {
  background: linear-gradient(135deg, #ffe600 0%, #f5a623 100%);
  color: #0f172a;
  padding: 6px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 12px rgba(245, 166, 35, 0.4);
  white-space: nowrap;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}


/* --- OPTIMIZACIÓN RESPONSIVA MÓVIL Y TRANSICIÓN HORIZONTAL (LANDSCAPE) --- */
.mobile-controls-wrapper {
  display: flex;
  flex-direction: column;
  transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 100;
}

@media (orientation: landscape) and (max-height: 600px) {
  #turista-app-container {
    display: grid;
    grid-template-columns: 240px 1fr;
    grid-template-rows: 54px 1fr;
    grid-template-areas:
      "header header"
      "controls board";
    height: 100dvh;
  }

  .game-top-bar {
    grid-area: header;
    height: 54px;
  }

  .mobile-controls-wrapper {
    grid-area: controls;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    padding: 10px;
    gap: 12px;
    overflow-y: auto;
  }

  .players-ribbon {
    flex-direction: column;
    background: transparent;
    border-bottom: none;
    padding: 0;
    overflow-y: visible;
  }

  .player-card-strip {
    min-width: 100%;
    width: 100%;
  }

  .bottom-controls-bar {
    flex-direction: column;
    background: transparent;
    border-bottom: none;
    padding: 0;
    width: 100%;
    gap: 8px;
  }

  .btn-roll-dice {
    max-width: 100% !important;
    height: 38px;
    font-size: 0.88rem;
  }

  .board-viewport {
    grid-area: board;
    height: 100%;
  }

  .dice-overlay-container {
    bottom: 12px;
    left: 12px;
    padding: 8px 12px;
  }
}

@keyframes floatUpEmoji {
  0% { transform: translateY(0) scale(0.6); opacity: 1; }
  50% { transform: translateY(-100px) scale(1.3); opacity: 0.9; }
  100% { transform: translateY(-220px) scale(1.6); opacity: 0; }
}

/* --- ESTILOS RESPONSIVOS PARA MI CARTERA DE PROPIEDADES --- */
@media (max-width: 640px) {
  .my-properties-modal-card {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 28px 28px 0 0 !important;
    max-height: 85vh;
    animation: slideUpBottom 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
}

@keyframes slideUpBottom {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

