* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Nunito', sans-serif;
  background: #0d0d0d;
  color: #fff;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* ========== PAINEL DE CONFIG ========== */
.panel {
  max-width: 720px;
  margin: 40px auto;
  background: linear-gradient(145deg, #1a1a2e, #16213e);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  border: 2px solid #0f3460;
}

.panel h1 {
  font-family: 'Press Start 2P', cursive;
  font-size: 22px;
  text-align: center;
  color: #e94560;
  margin-bottom: 8px;
  text-shadow: 0 0 20px rgba(233,69,96,0.5);
}

.subtitle {
  text-align: center;
  color: #a0a0b0;
  margin-bottom: 28px;
  font-size: 14px;
}

.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}

.config-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.config-group.full {
  grid-column: 1 / -1;
}

.config-group label {
  font-size: 13px;
  font-weight: 700;
  color: #c0c0d0;
}

.config-group input[type="text"],
.config-group input[type="number"] {
  background: #0f0f1a;
  border: 2px solid #2a2a4a;
  border-radius: 10px;
  padding: 10px 14px;
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.config-group input:focus {
  border-color: #e94560;
}

.config-group input[type="color"] {
  width: 100%;
  height: 42px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: transparent;
}

.btn-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.btn {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn.primary {
  background: linear-gradient(135deg, #e94560, #c73e54);
  color: #fff;
  box-shadow: 0 6px 20px rgba(233,69,96,0.4);
}

.btn.secondary {
  background: #2a2a4a;
  color: #ccc;
}

.tip {
  background: rgba(233,69,96,0.1);
  border-left: 4px solid #e94560;
  padding: 12px 16px;
  border-radius: 0 10px 10px 0;
  font-size: 13px;
  color: #d0d0e0;
  line-height: 1.5;
}

.tip kbd {
  background: #2a2a4a;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
}

/* ========== JOGO ========== */
#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#game-container.hidden,
#victory-screen.hidden,
#config-panel.hidden {
  display: none;
}

#background {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #1a0a2e 0%, #2d1b4e 40%, #4a1942 70%, #8b0000 100%);
  background-size: cover;
  background-position: center;
  z-index: 0;
}

#background::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 28%;
  background: linear-gradient(transparent, rgba(255,80,0,0.35));
  pointer-events: none;
}

/* HUD */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 24px;
  background: linear-gradient(180deg, rgba(0,0,0,0.7), transparent);
  pointer-events: none;
}

.team-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
}

.team-info.left {
  align-items: flex-start;
}

.team-info.right {
  align-items: flex-end;
  text-align: right;
}

.team-name {
  font-family: 'Press Start 2P', cursive;
  font-size: 14px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  letter-spacing: 1px;
}

.xp-bar-container {
  width: 200px;
  height: 18px;
  background: rgba(0,0,0,0.5);
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.2);
  position: relative;
  overflow: hidden;
}

.xp-bar {
  height: 100%;
  width: 100%;
  border-radius: 8px;
  transition: width 0.4s ease, background 0.3s;
}

.xp-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  text-shadow: 0 1px 3px #000;
}

.player-count {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  font-weight: 600;
}

.vs {
  font-family: 'Press Start 2P', cursive;
  font-size: 28px;
  color: #ffd700;
  text-shadow: 0 0 20px rgba(255,215,0,0.6);
  margin-top: 8px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* Canvas */
#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
}

/* Controles de interação */
#interaction-controls {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 30px;
  z-index: 30;
}

.interact-btn {
  padding: 14px 28px;
  border: none;
  border-radius: 16px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  color: #fff;
  transition: transform 0.12s, box-shadow 0.12s;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  line-height: 1.3;
}

.interact-btn:hover {
  transform: scale(1.05);
}

.interact-btn:active {
  transform: scale(0.97);
}

.left-btn {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.right-btn {
  background: linear-gradient(135deg, #3498db, #2980b9);
}

.interact-btn small {
  font-weight: 600;
  opacity: 0.85;
  font-size: 11px;
}

/* Recent interactions */
#recent-interactions {
  position: absolute;
  top: 110px;
  right: 16px;
  width: 200px;
  background: rgba(0,0,0,0.55);
  border-radius: 12px;
  padding: 10px;
  z-index: 25;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.1);
  max-height: 220px;
  overflow: hidden;
}

.recent-title {
  font-size: 11px;
  font-weight: 800;
  color: #ffd700;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#recent-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recent-item {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  animation: slideIn 0.3s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-item.left {
  border-left: 3px solid #e74c3c;
}

.recent-item.right {
  border-left: 3px solid #3498db;
}

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

/* Botão config */
.btn-config {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.btn-config:hover {
  opacity: 1;
}

/* Tela de vitória */
#victory-screen {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.victory-content {
  text-align: center;
  animation: victoryPop 0.5s ease;
}

@keyframes victoryPop {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.victory-content h2 {
  font-family: 'Press Start 2P', cursive;
  font-size: 28px;
  color: #ffd700;
  margin-bottom: 16px;
  text-shadow: 0 0 30px rgba(255,215,0,0.5);
}

.victory-content p {
  font-size: 18px;
  margin-bottom: 28px;
  color: #ccc;
}

/* Responsivo */
@media (max-width: 700px) {
  .panel {
    margin: 16px;
    padding: 20px;
  }
  .config-grid {
    grid-template-columns: 1fr;
  }
  .team-name {
    font-size: 11px;
  }
  .xp-bar-container {
    width: 140px;
  }
  .interact-btn {
    padding: 10px 16px;
    font-size: 12px;
  }
  #recent-interactions {
    display: none;
  }
}

/* ========== PRESENTES E CONTROLES LATERAIS ========== */
#interaction-controls {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 30;
  pointer-events: none;
}

.side-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}

.right-side {
  align-items: flex-end;
}

.gift-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  max-width: 280px;
}

.right-side .gift-row {
  justify-content: flex-end;
}

.gift-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
  background: rgba(0,0,0,0.55);
  border: 2px solid rgba(255,255,255,0.15);
  transition: transform 0.12s, background 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.gift-btn:hover {
  transform: scale(1.15);
  background: rgba(0,0,0,0.75);
  box-shadow: 0 0 12px rgba(255,215,0,0.4);
}

.gift-btn:active {
  transform: scale(0.95);
}

.gift-btn.big {
  width: 42px;
  height: 42px;
  font-size: 20px;
  border-color: rgba(255, 165, 0, 0.5);
}

.gift-btn.mega {
  width: 46px;
  height: 46px;
  font-size: 22px;
  border-color: rgba(0, 206, 201, 0.6);
  box-shadow: 0 0 10px rgba(0, 206, 201, 0.3);
}

.interact-btn {
  padding: 12px 22px;
  border: none;
  border-radius: 14px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  color: #fff;
  transition: transform 0.12s, box-shadow 0.12s;
  box-shadow: 0 5px 18px rgba(0,0,0,0.4);
  line-height: 1.3;
}

.interact-btn:hover {
  transform: scale(1.05);
}

.interact-btn:active {
  transform: scale(0.97);
}

.left-btn {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.right-btn {
  background: linear-gradient(135deg, #3498db, #2980b9);
}

.interact-btn small {
  font-weight: 600;
  opacity: 0.85;
  font-size: 10px;
}

/* Botão de som */
.btn-sound {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 40;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.btn-sound:hover {
  opacity: 1;
}

.btn-sound.muted {
  opacity: 0.4;
  text-decoration: line-through;
}

/* Ajuste do botão config */
.btn-config {
  left: 16px;
  transform: none;
}

@media (max-width: 700px) {
  .gift-row {
    max-width: 160px;
  }
  .gift-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  .gift-btn.big, .gift-btn.mega {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
}
