@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --water-color: #00d2ff;
  --water-glow: rgba(0, 210, 255, 0.65);
  --gold-coin: #f5a623;
}

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

body {
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #0d0f12;
  color: #ffffff;
  overflow-x: hidden;
  touch-action: manipulation;
}

/* Tenant Demo Switcher Top Bar */
.demo-top-nav {
  background: rgba(18, 22, 29, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  gap: 15px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo-text {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.1rem;
  background: linear-gradient(135deg, #ffc700 0%, #ff5e36 50%, #d400ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.tenant-selector-group {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-full);
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.tenant-tab-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.tenant-tab-btn.active {
  background: var(--theme-primary, #e53935);
  color: #ffffff;
  box-shadow: 0 4px 12px var(--theme-glow, rgba(229, 57, 53, 0.4));
}

.level-quick-select {
  display: flex;
  align-items: center;
  gap: 8px;
}

.level-quick-select label {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 500;
}

.level-dropdown {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-family: var(--font-heading);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
}

.level-dropdown option {
  background: #1a202c;
  color: #ffffff;
}

/* Container Principal do Jogo */
.game-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.game-main-layout {
  width: 100%;
  max-width: 1240px;
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  gap: 20px;
  align-items: stretch;
}

/* Painel Esquerdo: Pedido e Mascote */
.order-side-card {
  background: var(--card-bg, #1e1310);
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}

.tenant-logo-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
  max-width: 100%;
}

.tenant-logo-custom-img {
  max-height: 48px;
  max-width: 180px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
  border-radius: var(--radius-sm);
}

.tenant-logo-icon {
  font-size: 1.5rem;
}

.tenant-logo-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--theme-accent, #ffd700);
}

.order-number-box {
  margin-bottom: 16px;
}

.order-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #94a3b8;
  font-weight: 600;
}

.order-value {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 900;
  color: #ffffff;
}

.order-status-pill {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--status-border, rgba(255, 100, 100, 0.3));
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 20px;
  text-align: left;
}

.status-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: #ffffff;
  margin-bottom: 4px;
}

.status-subtitle {
  font-size: 0.75rem;
  color: #cbd5e1;
  margin-bottom: 8px;
}

.status-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.status-progress-bar {
  width: 70%;
  height: 100%;
  background: var(--progress-gradient, linear-gradient(90deg, #ff5e36, #ff9f43));
  border-radius: var(--radius-full);
  animation: pulseProgress 2s infinite ease-in-out;
}

@keyframes pulseProgress {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; filter: brightness(1.2); }
}

.mascot-area {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.mascot-avatar {
  width: 110px;
  height: 110px;
  border-radius: var(--radius-full);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, rgba(0, 0, 0, 0.4) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.8rem;
  border: 2px solid var(--mascot-border, rgba(255, 255, 255, 0.15));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.mascot-speech {
  font-size: 0.82rem;
  line-height: 1.35;
  color: #e2e8f0;
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(255, 255, 255, 0.1);
}

/* Painel Central: Tabuleiro do Jogo */
.game-center-board {
  background: var(--board-outer-bg, #1a1410);
  border: 2px solid var(--board-outer-border, #3a2a22);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  position: relative;
  overflow: hidden;
}

.board-header {
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.level-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
}

.nav-back-btn {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: transform var(--transition-fast);
}

.nav-back-btn:hover {
  transform: translateX(-3px);
}

.board-stats {
  display: flex;
  align-items: center;
  gap: 20px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
}

.stat-item.timer {
  color: #38bdf8;
}

.stat-item.score {
  color: var(--gold-coin);
}

.sound-toggle-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.sound-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

/* Área do Grid com Válvula de Entrada e Destino */
.board-gameplay-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  background: var(--grid-bg-texture, radial-gradient(circle at center, #261c16 0%, #150f0c 100%));
}

.board-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0px;
  position: relative;
}

/* Válvula de Entrada */
.source-valve-fixture {
  width: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 10;
  margin-right: -4px;
}

.valve-pump-housing {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #3a4b5d 0%, #1e2733 100%);
  border: 3px solid #6b8299;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.3), 0 8px 16px rgba(0, 0, 0, 0.6);
  position: relative;
}

.valve-glow-reservoir {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle, #00ffff 0%, #0077aa 100%);
  box-shadow: 0 0 16px #00d2ff, inset 0 0 8px #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  animation: pumpPulse 2s infinite ease-in-out;
}

@keyframes pumpPulse {
  0%, 100% { transform: scale(0.95); filter: brightness(1); }
  50% { transform: scale(1.05); filter: brightness(1.3); }
}

.valve-nozzle-right {
  position: absolute;
  right: -10px;
  width: 12px;
  height: 24px;
  background: linear-gradient(180deg, #94a3b8 0%, #475569 100%);
  border-radius: 0 4px 4px 0;
  border: 2px solid #334155;
}

/* Destino Final */
.target-destination-fixture {
  width: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 10;
  margin-left: -4px;
}

.dest-housing {
  width: 100%;
  height: 100%;
  background: var(--dest-housing-bg, linear-gradient(135deg, #573322 0%, #2e1a10 100%));
  border: 3px solid var(--dest-border, #a86c43);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.3), 0 8px 16px rgba(0, 0, 0, 0.6);
  position: relative;
  transition: var(--transition-bounce);
}

.dest-housing.active-success {
  border-color: #00ffff;
  box-shadow: 0 0 24px #00d2ff;
  transform: scale(1.1);
}

/* Painel Direito / Modal de Vitória */
.victory-side-card {
  background: var(--card-bg, #1e1310);
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
  transition: var(--transition-normal);
}

.victory-banner {
  background: var(--victory-banner-bg, linear-gradient(135deg, #c02424 0%, #851212 100%));
  color: #ffffff;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.2rem;
  letter-spacing: 1px;
  padding: 8px 24px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.victory-mascot-img {
  font-size: 4rem;
  margin: 10px 0;
  animation: floatMascot 3s ease-in-out infinite;
}

@keyframes floatMascot {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.victory-title {
  font-size: 0.95rem;
  color: #cbd5e1;
  margin-bottom: 8px;
}

.victory-score-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.9rem;
  color: var(--gold-coin);
  margin-bottom: 12px;
}

.victory-order-note {
  font-size: 0.82rem;
  color: #94a3b8;
  margin-bottom: 16px;
}

.food-icons-row {
  display: flex;
  gap: 8px;
  font-size: 1.8rem;
  margin-bottom: 20px;
}

.victory-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.btn-primary-next {
  width: 100%;
  background: var(--btn-next-bg, #ffffff);
  color: var(--btn-next-text, #000000);
  border: none;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1rem;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  transition: var(--transition-bounce);
}

.btn-primary-next:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn-primary-next:active {
  transform: scale(0.98);
}

.btn-secondary-exit {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 8px;
  transition: color var(--transition-fast);
}

.btn-secondary-exit:hover {
  color: #ffffff;
}

/* Barra Inferior de Regras e Informações */
.rules-bottom-bar {
  width: 100%;
  max-width: 1240px;
  background: rgba(18, 22, 29, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  margin-top: 20px;
  padding: 14px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.rule-col {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.rule-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.rule-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  color: #ffffff;
  margin-bottom: 2px;
}

.rule-desc {
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.3;
}

/* Responsividade Mobile e Telas Pequenas */
@media (max-width: 1024px) {
  .game-main-layout {
    grid-template-columns: 1fr;
  }
  .order-side-card {
    display: none; /* Em telas menores, o status fica resumido no topo */
  }
  .rules-bottom-bar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .game-viewport {
    padding: 8px;
  }
  .demo-top-nav {
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    gap: 10px;
  }
  .tenant-selector-group {
    justify-content: center;
  }
  .board-gameplay-area {
    padding: 10px 4px;
  }
  .rules-bottom-bar {
    grid-template-columns: 1fr;
    font-size: 0.8rem;
  }
}
