/* Hex Grid - Professional Honeycomb Layout */
.hex-grid {
  display: grid;
  width: auto;
  justify-content: center;
  grid-auto-flow: dense;
  --hex-size: 70px;
  --hex-height: calc(var(--hex-size) * 1.1547); /* 2/√3 for regular hexagon */
  grid-template-columns: repeat(10, var(--hex-size));
  grid-auto-rows: var(--hex-height);
  gap: 2px 4px;
  padding: 40px 20px;
  margin: 0 auto;
  max-width: 1000px;
}

.hex-row {
  display: contents;
}

/* Even rows - shift hexes by half width */
.hex-row:nth-child(even) .hex {
  transform: translateX(calc(var(--hex-size) * -0.5));
}

.hex {
  width: var(--hex-size);
  height: var(--hex-height);
  position: relative;
  cursor: pointer;
  transition: transform 0.2s, filter 0.2s;
  justify-self: center;
  align-self: center;
}

.hex-inner {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
}

.hex:hover .hex-inner {
  transform: scale(1.08);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.15));
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.3), inset 0 0 20px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

.hex.owned-p1 .hex-inner {
  background: linear-gradient(135deg, #00d4ff, #0099cc);
  border-color: #00d4ff;
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.5), inset 0 0 10px rgba(255, 255, 255, 0.3);
}

.hex.owned-p2 .hex-inner {
  background: linear-gradient(135deg, #ff006e, #cc0058);
  border-color: #ff006e;
  box-shadow: 0 0 20px rgba(255, 0, 110, 0.5), inset 0 0 10px rgba(255, 255, 255, 0.3);
}

.hex.answered .hex-inner {
  cursor: default;
}

.hex.selected .hex-inner {
  box-shadow: 0 0 30px #ffd700, inset 0 0 20px rgba(0, 0, 0, 0.3);
  border-color: #ffd700;
  animation: pulse-selected 1.5s infinite;
}

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

.hex-letter {
  font-size: 1.8rem;
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Mini board for players */
.mini-board {
  display: grid;
  width: auto;
  justify-content: center;
  grid-auto-flow: dense;
  --mini-hex-size: 28px;
  --mini-hex-height: calc(var(--mini-hex-size) * 1.1547);
  grid-template-columns: repeat(10, var(--mini-hex-size));
  grid-auto-rows: var(--mini-hex-height);
  gap: 1px 2px;
  padding: 10px;
  margin: 20px auto;
  max-width: 100%;
}

.mini-row {
  display: contents;
}

/* Even rows - shift hexes by half width */
.mini-row:nth-child(even) .mini-hex {
  transform: translateX(calc(var(--mini-hex-size) * -0.5));
}

.mini-hex {
  width: var(--mini-hex-size);
  height: var(--mini-hex-height);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: bold;
  background: rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: all 0.2s;
  justify-self: center;
  align-self: center;
}

.mini-hex.owned-p1 {
  background: linear-gradient(135deg, #00d4ff, #0099cc);
  color: #000;
}

.mini-hex.owned-p2 {
  background: linear-gradient(135deg, #ff006e, #cc0058);
  color: #fff;
}

.mini-hex.answered {
  opacity: 0.6;
}

.mini-hex.selected {
  box-shadow: 0 0 10px #ffd700;
  transform: scale(1.15);
  z-index: 10;
}

.mini-hex.selectable {
  cursor: pointer;
  border: 2px solid #ffd700;
  animation: pulse-selectable 1.5s infinite;
}

@keyframes pulse-selectable {
  0%, 100% { box-shadow: 0 0 5px #ffd700; }
  50% { box-shadow: 0 0 15px #ffd700; }
}

/* Responsive */
@media (max-width: 900px) {
  .hex-grid {
    --hex-size: 60px;
    padding: 30px 10px;
  }

  .hex-letter {
    font-size: 1.5rem;
  }
}

@media (max-width: 768px) {
  .hex-grid {
    --hex-size: 48px;
    gap: 1px 2px;
  }

  .hex-letter {
    font-size: 1.2rem;
  }

  .mini-board {
    --mini-hex-size: 24px;
  }
}

@media (max-width: 480px) {
  .hex-grid {
    --hex-size: 38px;
    padding: 20px 5px;
  }

  .hex-letter {
    font-size: 0.9rem;
  }

  .mini-board {
    --mini-hex-size: 20px;
  }
}
