/* arena.css - Pixel Territory Game Styles */

/* Reset & Base */
.arena-page {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: #0a0a0a;
  color: #00FF66;
  font-family: 'Press Start 2P', monospace;
  overflow-x: hidden;
}

.arena-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(circle at 20% 30%, rgba(0, 255, 102, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(255, 51, 102, 0.05) 0%, transparent 40%);
  pointer-events: none;
  z-index: -1;
}

/* Container */
.arena-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.arena-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: rgba(20, 20, 30, 0.95);
  border-bottom: 3px solid #00FF66;
  margin-bottom: 20px;
  border-radius: 8px;
}

.back-btn {
  background: rgba(0, 255, 102, 0.2);
  border: 2px solid #00FF66;
  color: #00FF66;
  padding: 10px 20px;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.2s;
}

.back-btn:hover {
  background: rgba(0, 255, 102, 0.3);
  transform: translateY(-1px);
}

.arena-header h1 {
  font-size: 28px;
  color: #00FF66;
  text-shadow: 0 0 10px #00FF66;
  margin: 0;
  letter-spacing: 2px;
}

.rematch-btn {
  background: rgba(255, 51, 102, 0.2);
  border: 2px solid #FF3366;
  color: #FF3366;
  padding: 10px 20px;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.2s;
}

.rematch-btn:hover {
  background: rgba(255, 51, 102, 0.3);
  transform: translateY(-1px);
}

.hidden {
  display: none !important;
}

/* Main Game Area */
.game-area {
  display: grid;
  grid-template-columns: 300px 1fr 300px;
  gap: 20px;
  flex: 1;
  margin-bottom: 20px;
}

/* Left Panel */
.left-panel {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: rgba(20, 20, 40, 0.95);
  border: 3px solid #00FF66;
  border-radius: 10px;
  padding: 25px;
  max-width: 500px;
  width: 90%;
}

.modal-content h2 {
  color: #00FF66;
  text-align: center;
  margin-bottom: 20px;
  font-size: 18px;
}

.instructions {
  margin: 15px 0;
}

.instruction-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 12px;
  padding: 8px;
  background: rgba(0, 255, 102, 0.05);
  border-radius: 6px;
  border-left: 2px solid #00FF66;
}

.instruction-icon {
  font-size: 20px;
  margin-right: 12px;
  min-width: 25px;
}

.instruction-text {
  flex: 1;
  font-size: 10px;
  line-height: 1.5;
  color: #9affc0;
}

.instruction-text ul {
  margin: 5px 0;
  padding-left: 15px;
}

.instruction-text li {
  margin-bottom: 3px;
}

.modal-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #00FF66, #00CC55);
  border: 2px solid #000;
  color: black;
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  cursor: pointer;
  border-radius: 6px;
  margin-top: 15px;
  transition: all 0.2s;
}

.modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 255, 102, 0.3);
}

/* Player Cards */
.player-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.player-card {
  background: rgba(30, 30, 40, 0.8);
  border-radius: 8px;
  padding: 15px;
  border: 2px solid;
  transition: all 0.3s;
}

.player-card.you {
  border-color: #00FF66;
  box-shadow: 0 0 15px rgba(0, 255, 102, 0.2);
}

.player-card.opponent {
  border-color: #666;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.1);
}

.player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.player-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #666;
  display: inline-block;
}

.status-dot.active {
  background: #00FF66;
  box-shadow: 0 0 10px #00FF66;
  animation: pulse 1s infinite;
}

.player-name {
  font-size: 12px;
  color: #00FF66;
}

.player-color-display {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: 2px solid #fff;
}

.player-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 15px;
}

.stat {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 5px;
  padding: 8px;
  text-align: center;
}

.stat-label {
  font-size: 8px;
  color: #aaa;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 14px;
  color: #fff;
}

.ready-btn {
  width: 100%;
  padding: 10px;
  background: rgba(0, 255, 102, 0.2);
  border: 2px solid #00FF66;
  color: #00FF66;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.2s;
}

.ready-btn:hover {
  background: rgba(0, 255, 102, 0.3);
  transform: translateY(-2px);
}

.ready-btn.ready {
  background: rgba(255, 215, 0, 0.2);
  border-color: #FFD700;
  color: #FFD700;
}

.waiting-msg {
  text-align: center;
  font-size: 10px;
  color: #aaa;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 5px;
}

/* Game Controls */
.game-controls {
  background: rgba(20, 20, 30, 0.8);
  border-radius: 8px;
  padding: 15px;
  border: 2px solid #444;
}

.room-info {
  text-align: center;
}

.room-label {
  font-size: 9px;
  color: #aaa;
  margin-bottom: 5px;
}

.room-status {
  font-size: 11px;
  color: #00FF66;
}

/* Countdown Display */
.countdown-display {
  background: rgba(0, 0, 0, 0.8);
  border: 3px solid #00FF66;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  animation: pulseBorder 1s infinite;
}

@keyframes pulseBorder {
  0%, 100% { border-color: #00FF66; }
  50% { border-color: #FF3366; }
}

.countdown-number {
  font-size: 48px;
  color: #FF3366;
  margin-bottom: 10px;
  text-shadow: 0 0 20px #FF3366;
  animation: pulse 1s infinite;
}

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

.countdown-text {
  font-size: 14px;
  color: #00FF66;
}

/* Center Panel */
.center-panel {
  display: flex;
  flex-direction: column;
}

.game-grid-container {
  background: rgba(20, 20, 30, 0.8);
  border-radius: 10px;
  padding: 20px;
  border: 3px solid #444;
  flex: 1;
}

.grid-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #444;
}

.grid-title {
  font-size: 14px;
  color: #00FF66;
}

.grid-stats {
  font-size: 10px;
  color: #aaa;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  grid-template-rows: repeat(16, 1fr);
  gap: 2px;
  width: min(500px, calc(100vw - 720px));
  min-width: 300px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border: 3px solid #333;
  border-radius: 5px;
  background: #111122;
  overflow: hidden;
}

.grid-cell {
  cursor: not-allowed;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  border-radius: 2px;
  border: none;
  padding: 0;
}

.grid-cell.playable {
  cursor: pointer;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.45);
  animation: playablePulse 1.4s ease-in-out infinite;
}

.grid-cell.playable:hover {
  transform: scale(1.08);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.7), inset 0 0 0 2px rgba(255, 255, 255, 0.65);
}

.grid-cell.you,
.grid-cell.opponent {
  cursor: default;
}

@keyframes playablePulse {
  0%,
  100% { filter: brightness(1); }
  50% { filter: brightness(1.15); }
}

.grid-controls {
  margin-top: 15px;
  text-align: center;
}

.control-info {
  font-size: 10px;
  color: #aaa;
  padding: 10px;
  background: rgba(0, 255, 102, 0.1);
  border-radius: 5px;
}

/* Right Panel */
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.territory-container {
  background: rgba(20, 20, 30, 0.8);
  border-radius: 10px;
  padding: 20px;
  border: 3px solid #444;
}

.territory-container h3 {
  font-size: 12px;
  color: #00FF66;
  text-align: center;
  margin-bottom: 15px;
  border-bottom: 2px solid #444;
  padding-bottom: 8px;
}

.territory-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.territory-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bar-label {
  width: 80px;
  font-size: 9px;
  color: #aaa;
}

.bar-container {
  flex: 1;
  height: 20px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid #333;
}

.bar-fill {
  height: 100%;
  transition: width 0.5s ease;
}

.you-bar .bar-fill {
  background: linear-gradient(90deg, #00CC55, #00FF66);
}

.opponent-bar .bar-fill {
  background: linear-gradient(90deg, #CC2255, #FF3366);
}

.free-bar .bar-fill {
  background: linear-gradient(90deg, #3333AA, #4444CC);
}

.bar-value {
  width: 80px;
  font-size: 9px;
  color: #fff;
  text-align: right;
}

.territory-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 15px;
}

.territory-stat {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 5px;
  padding: 10px;
  text-align: center;
}

.stat-title {
  font-size: 8px;
  color: #aaa;
  margin-bottom: 5px;
}

.stat-value {
  font-size: 14px;
  color: #fff;
}

/* Game Over Display */
.game-over-display {
  background: rgba(20, 20, 30, 0.95);
  border: 3px solid #00FF66;
  border-radius: 10px;
  padding: 25px;
  text-align: center;
  animation: pulseBorder 2s infinite;
}

.game-over-display h2 {
  font-size: 24px;
  color: #FFD700;
  margin-bottom: 10px;
  text-shadow: 0 0 15px #FFD700;
}

.game-over-display p {
  font-size: 12px;
  color: #aaa;
  margin-bottom: 15px;
}

.result-stats {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 15px;
  margin: 15px 0;
}

.result-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #333;
}

.result-stat:last-child {
  border-bottom: none;
}

.result-stat span {
  font-size: 10px;
  color: #aaa;
}

.result-stat strong {
  font-size: 14px;
  color: #fff;
}

.result-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #00FF66, #00CC55);
  border: 2px solid #000;
  color: black;
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  cursor: pointer;
  border-radius: 6px;
  margin-top: 15px;
  transition: all 0.2s;
}

.result-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 255, 102, 0.3);
}

/* Footer */
.arena-footer {
  padding: 10px;
  text-align: center;
  background: rgba(20, 20, 30, 0.8);
  border-radius: 5px;
  border: 2px solid #444;
}

.connection-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #666;
}

.status-indicator.connected {
  background: #00FF66;
  box-shadow: 0 0 10px #00FF66;
  animation: pulse 2s infinite;
}

.status-indicator.connecting {
  background: #FFAA00;
  box-shadow: 0 0 10px #FFAA00;
  animation: pulse 1s infinite;
}

.status-indicator.disconnected {
  background: #FF3366;
  box-shadow: 0 0 10px #FF3366;
}


@media (max-width: 1200px) {
  .game-area {
    grid-template-columns: 1fr;
  }

  .game-grid {
    width: min(92vw, 540px);
    min-width: 0;
  }
}
