/* catch.css - Catch the Pixel Game Styles */

* {
  box-sizing: border-box;
  touch-action: manipulation;
}

html, body {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

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

.catch-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 */
.catch-container {
  max-width: 1680px;
  width: 100%;
  margin: 0 auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Header */
.catch-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;
  gap: 10px;
}

.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;
  white-space: nowrap;
}

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

.header-spacer {
  width: 96px;
}

.catch-header h1 {
  font-size: 26px;
  color: #00FF66;
  text-shadow: 0 0 10px #00FF66;
  margin: 0;
  letter-spacing: 2px;
  text-align: center;
}

.hidden {
  display: none !important;
}

/* Main Game Area */
.game-area {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr) 290px;
  gap: 20px;
  flex: 1;
  margin-bottom: 20px;
}

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

/* 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;
  padding: 15px;
}

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

.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: 4px;
}

.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;
  min-width: 0;
}

.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: 12px;
  gap: 8px;
}

.player-status {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #666;
  display: inline-block;
  flex-shrink: 0;
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

.status-dot.not-ready {
  background: #FF3366;
  box-shadow: 0 0 8px #FF3366;
}

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

.player-name {
  font-size: 10px;
  color: #00FF66;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-color-display {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  border: 2px solid #fff;
  flex-shrink: 0;
}

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

.player-stats.single-stat {
  grid-template-columns: 1fr;
}

.stat {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 5px;
  padding: 8px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

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

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

.stat-sub {
  font-size: 7px;
  color: #9affc0;
  margin-top: 5px;
}

.stat-sub span {
  color: #FFD700;
}

/* Vertical Duel Bars */
.time-duel-bars {
  display: none;
}

.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:not(:disabled) {
  background: rgba(0, 255, 102, 0.3);
  transform: translateY(-2px);
}

.ready-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

.waiting-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  font-size: 9px;
  line-height: 1.4;
  color: #aaa;
  padding: 10px 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 5px;
}

.retro-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(0, 255, 102, 0.25);
  border-top-color: #00FF66;
  border-right-color: #00FF66;
  border-radius: 50%;
  flex-shrink: 0;
  animation: spinLoader 0.85s linear infinite;
}

@keyframes spinLoader {
  to { transform: rotate(360deg); }
}

.animated-dots::after {
  content: '';
  display: inline-block;
  width: 3ch;
  text-align: left;
  animation: dotCycle 1.5s steps(4, end) infinite;
}

@keyframes dotCycle {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}

/* 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;
}

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

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

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

.game-grid-container {
  position: relative;
  background: rgba(20, 20, 30, 0.8);
  border-radius: 10px;
  padding: 20px;
  border: 3px solid #444;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.mobile-round-strip {
  display: none;
}

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

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

.grid-stats {
  font-size: 11px;
  color: #FFD700;
}

.grid-wrapper {
  position: relative;
  width: min(620px, 100%);
  margin: 0 auto;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
  gap: 3px;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 3px solid #333;
  border-radius: 6px;
  background: #111122;
  padding: 4px;
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.grid-cell {
  background-color: #1c1c2e;
  cursor: default;
  border-radius: 3px;
  border: none;
  padding: 0;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.grid-cell.target-you {
  background-color: #00FF66;
  cursor: pointer;
  box-shadow: 0 0 14px #00FF66, inset 0 0 0 2px #ffffff;
  animation: targetPop 0.16s ease-out;
}

.grid-cell.target-you:hover {
  transform: scale(1.1);
}

.grid-cell.target-opponent {
  background-color: #FF3366;
  box-shadow: 0 0 12px rgba(255, 51, 102, 0.8);
  animation: targetPop 0.16s ease-out;
}

@keyframes targetPop {
  0% { transform: scale(0.4); }
  100% { transform: scale(1); }
}

/* Spawn Waiting Banner */
.spawn-banner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  background: rgba(10, 12, 22, 0.45);
  pointer-events: none;
  border-radius: 6px;
}

.spawn-banner-round {
  font-size: 16px;
  color: #FFD700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
}

.spawn-banner-text {
  font-size: 11px;
  color: #9affc0;
}

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

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

/* Countdown Overlay Over Board (3-2-1) */
.countdown-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 18, 0.68);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  z-index: 25;
  pointer-events: none;
  animation: fadeInOverlay 0.2s ease-out;
}

.countdown-card {
  background: rgba(18, 22, 34, 0.92);
  border: 3px solid #00FF66;
  border-radius: 12px;
  padding: 26px 34px;
  text-align: center;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.75), 0 0 25px rgba(0, 255, 102, 0.25);
  animation: pulseBorder 1s infinite;
}

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

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

/* Translucent Game Over Popup Over Board */
.game-over-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 18, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  z-index: 30;
  animation: fadeInOverlay 0.25s ease-out;
}

@keyframes fadeInOverlay {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.game-over-card {
  background: rgba(18, 22, 34, 0.92);
  border: 3px solid #00FF66;
  border-radius: 12px;
  padding: 24px 18px;
  max-width: 420px;
  width: 96%;
  text-align: center;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.75), 0 0 25px rgba(0, 255, 102, 0.25);
  animation: pulseBorder 2s infinite;
}

.game-over-card h2 {
  font-size: 20px;
  color: #FFD700;
  margin: 0 0 12px 0;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
  line-height: 1.3;
}

.game-over-card p {
  font-size: 10px;
  color: #d0d8e8;
  margin: 0 0 16px 0;
  line-height: 1.6;
}

.result-stats {
  background: rgba(0, 0, 0, 0.45);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 14px 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.result-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

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

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

.result-btn {
  width: 100%;
  padding: 14px;
  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: 10px;
  transition: all 0.2s;
}

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

/* Right Panel - Minimalist Reaction Stats */
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-width: 0;
}

.stats-container {
  background: rgba(20, 20, 30, 0.8);
  border-radius: 10px;
  padding: 20px;
  border: 3px solid #444;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.round-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid #333;
  border-radius: 6px;
  padding: 12px;
  text-align: center;
}

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

.round-value {
  font-size: 18px;
  color: #FFD700;
}

.player-time-box {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 6px;
  padding: 12px;
  border-left: 3px solid #555;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-time-box.you-box {
  border-left-color: #00FF66;
}

.player-time-box.opponent-box {
  border-left-color: #FF3366;
}

.time-box-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: #fff;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dot-green,
.dot-red {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
}

.dot-green {
  background: #00FF66;
}

.dot-red {
  background: #FF3366;
}

.time-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  color: #aaa;
}

.time-row strong {
  font-size: 11px;
  color: #fff;
}

.time-row.total strong {
  color: #00FF66;
  font-size: 12px;
}

.opponent-box .time-row.total strong {
  color: #FF3366;
}

.status-mini-box {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 6px;
  padding: 10px;
  text-align: center;
}

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

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

.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;
}

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

  .grid-wrapper {
    width: min(92vw, 560px);
  }

  .catch-header h1 {
    font-size: 18px;
  }

  .header-spacer {
    display: none;
  }
}

/* Mobile Phone Optimization */
@media (max-width: 768px) {
  .catch-container {
    padding: 8px;
  }

  .catch-header {
    padding: 10px 12px;
    margin-bottom: 10px;
  }

  .back-btn {
    padding: 8px 10px;
    font-size: 9px;
  }

  .catch-header h1 {
    font-size: 13px;
    letter-spacing: 1px;
    flex: 1;
  }

  .game-area {
    gap: 10px;
    margin-bottom: 10px;
  }

  .left-panel {
    gap: 8px;
  }

  .player-cards {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    align-items: stretch;
  }

  .player-cards.both-ready {
    grid-template-columns: minmax(0, 1fr) 26px minmax(0, 1fr);
    gap: 6px;
  }

  .time-duel-bars {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 4px;
    background: rgba(15, 15, 25, 0.9);
    border: 1px solid #333;
    border-radius: 6px;
    padding: 5px 4px;
  }

  .duel-bar-track {
    width: 6px;
    height: 100%;
    min-height: 52px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
  }

  .duel-bar-fill {
    width: 100%;
    border-radius: 3px;
    transition: height 0.3s ease;
  }

  .duel-bar-fill.you-fill {
    background: #00FF66;
    box-shadow: 0 0 6px rgba(0, 255, 102, 0.7);
  }

  .duel-bar-fill.opponent-fill {
    background: #FF3366;
    box-shadow: 0 0 6px rgba(255, 51, 102, 0.7);
  }

  .player-card {
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .player-header {
    margin-bottom: 8px;
  }

  .player-name {
    font-size: 8px;
  }

  .player-color-display {
    width: 18px;
    height: 18px;
  }

  .player-stats {
    gap: 5px;
    margin-bottom: 8px;
  }

  .player-cards.both-ready .player-stats {
    margin-bottom: 0;
  }

  .stat {
    padding: 6px 2px;
  }

  .stat-label {
    font-size: 7px;
  }

  .stat-value {
    font-size: 10px;
  }

  .stat-sub {
    font-size: 6.5px;
    margin-top: 4px;
  }

  .ready-btn {
    padding: 8px 4px;
    font-size: 8px;
  }

  .waiting-msg {
    font-size: 7px;
    padding: 7px 4px;
  }

  .retro-spinner {
    width: 10px;
    height: 10px;
  }

  .game-controls {
    padding: 8px 10px;
  }

  .room-label {
    display: none;
  }

  .room-status {
    font-size: 9px;
  }

  .game-grid-container {
    padding: 10px;
  }

  .mobile-round-strip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #00FF66;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 8px;
  }

  .mobile-round-label {
    font-size: 10px;
    color: #9affc0;
  }

  .mobile-round-value {
    font-size: 13px;
    color: #FFD700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
  }

  .grid-header {
    display: none;
  }

  .grid-wrapper {
    width: 100%;
    max-width: 440px;
  }

  .game-grid {
    gap: 2px;
    padding: 3px;
  }

  .grid-controls {
    margin-top: 8px;
  }

  .control-info {
    font-size: 8px;
    padding: 8px 6px;
  }

  .countdown-card {
    padding: 20px 26px;
  }

  .countdown-number {
    font-size: 40px;
  }

  .countdown-text {
    font-size: 11px;
  }

  .right-panel {
    display: none;
  }
}
