/* css/board.css - 100 Chambers Game Board & Avatar Token Styling */

/* Main Game Layout */
.game-container {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  max-width: 1400px;
  width: 98%;
  margin: 16px auto 260px;
  padding: 0 10px;
}

@media (max-width: 1024px) {
  .game-container {
    grid-template-columns: 1fr;
    margin-bottom: 280px;
  }
}

/* Board Wrapper */
.board-wrapper {
  background: var(--bg-panel);
  border: 2px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: visible;
}

.board-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(230, 184, 0, 0.2);
}

.board-title {
  font-size: 1.2rem;
  color: var(--gold-light);
}

/* 100 Chambers Grid (10x10) */
.chambers-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-gap: 6px;
  width: 100%;
  max-width: 850px;
  aspect-ratio: 1 / 1;
  background: #090a0f;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid #222938;
}

/* Individual Chamber Tile */
.chamber-tile {
  background: #151821;
  border: 1px solid #2d3345;
  border-radius: 4px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px;
  transition: all 0.2s ease;
  user-select: none;
}

.chamber-tile:hover {
  background: #1e2433;
  border-color: var(--gold-primary);
  z-index: 10;
}

.chamber-number {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Trap Chamber (Red Bordered) */
.chamber-tile.trap-chamber {
  border: 2px solid var(--crimson-trap);
  background: radial-gradient(circle at center, rgba(211, 47, 47, 0.25) 0%, #151821 80%);
  box-shadow: inset 0 0 8px var(--crimson-glow);
}

.chamber-tile.trap-chamber .chamber-number {
  color: #ff6b6b;
}

.trap-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 0.65rem;
  color: #ff4d4d;
}

/* Antechamber #1 */
.chamber-tile.chamber-1 {
  border: 2px solid #43a047;
  background: radial-gradient(circle at center, rgba(67, 160, 71, 0.25) 0%, #151821 80%);
}

/* Boss Chamber #100 */
.chamber-tile.chamber-100 {
  border: 2px solid var(--gold-light);
  background: radial-gradient(circle at center, rgba(255, 215, 0, 0.4) 0%, #201a05 90%);
  box-shadow: 0 0 16px var(--gold-glow);
  grid-column: span 1;
}

.chamber-tile.chamber-100 .chamber-number {
  color: var(--gold-light);
  font-size: 0.9rem;
}

.boss-icon {
  font-size: 1.2rem;
  color: var(--gold-light);
  text-align: center;
}

/* Avatar Tokens Container */
.tokens-container {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
  align-items: center;
  min-height: 20px;
}

.avatar-token {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.9);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.avatar-token:hover {
  transform: scale(1.6);
  z-index: 50;
}

.token-red { background: #e53935; }
.token-blue { background: #1e88e5; }
.token-green { background: #43a047; }
.token-yellow { background: #fdd835; }
.token-white { background: #ffffff; }
.token-black { background: #1a1a1a; border-color: #78909c; }

/* Control Panel (Sidebar) */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.turn-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-main);
}

.turn-banner-badge {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--sand-accent);
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.turn-player-name {
  font-size: 1.4rem;
  font-family: var(--font-heading);
  color: var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.turn-phase-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* 3D Dice Roller Box */
.dice-roller-box {
  background: #0d0f14;
  border: 1px solid #2d3345;
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.dice-display {
  width: 76px;
  height: 76px;
  background: linear-gradient(145deg, #2a2208, #151103);
  border: 2px solid var(--gold-primary);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--gold-light);
  box-shadow: 0 0 15px var(--gold-glow);
  transition: all 0.25s ease;
  user-select: none;
}

.dice-display:hover {
  transform: scale(1.08);
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.7);
  border-color: #fff;
}

.dice-display.rolling {
  animation: diceRollAnim 0.6s ease-in-out infinite;
}

@keyframes diceRollAnim {
  0% { transform: rotate(0deg) scale(0.9); }
  50% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(0.9); }
}

.action-buttons-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* Players Status List */
.players-status-card {
  background: var(--bg-card);
  border: 1px solid #2d3345;
  border-radius: var(--radius-md);
  padding: 16px;
}

.players-status-card h3 {
  font-size: 1rem;
  color: var(--gold-light);
  margin-bottom: 12px;
}

.player-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  margin-bottom: 6px;
  border: 1px solid transparent;
}

.player-status-row.active {
  border-color: var(--gold-primary);
  background: rgba(230, 184, 0, 0.08);
}

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

.player-status-pos {
  font-size: 0.85rem;
  color: var(--sand-accent);
}

/* Expedition Log */
.expedition-log-card {
  background: var(--bg-card);
  border: 1px solid #2d3345;
  border-radius: var(--radius-md);
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.expedition-log-card h3 {
  font-size: 1rem;
  color: var(--gold-light);
  margin-bottom: 10px;
}

.log-stream {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.log-entry {
  padding: 6px 8px;
  border-left: 3px solid #444;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 0 4px 4px 0;
  transition: all 0.3s ease;
}

.log-entry.newest-log {
  border-left-color: var(--gold-light);
  background: rgba(230, 184, 0, 0.1);
  color: #fff;
  font-weight: 500;
}

/* Mobile Phone Responsive Optimizations (< 600px) */
@media (max-width: 600px) {
  .board-wrapper {
    padding: 8px;
  }
  .chambers-grid {
    grid-gap: 2px;
    padding: 4px;
  }
  .chamber-tile {
    padding: 2px;
    border-radius: 2px;
  }
  .chamber-number {
    font-size: 0.55rem;
  }
  .trap-badge {
    font-size: 0.5rem;
    top: 1px;
    right: 1px;
  }
  .avatar-token {
    width: 9px;
    height: 9px;
    border-width: 1px;
  }
  .dice-display {
    width: 64px;
    height: 64px;
    font-size: 2.2rem;
  }
  .game-container {
    margin: 8px auto 230px;
    padding: 0 4px;
  }
}

/* Reaction Wheel Popover */
.dice-roller-box {
  position: relative;
}

.reaction-wheel-popover {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 150;
  background: rgba(18, 21, 30, 0.98);
  border: 1px solid var(--gold-primary);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 15px var(--gold-glow);
  margin-top: 8px;
  animation: popIn 0.2s ease-out;
}

@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.reaction-wheel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  color: var(--gold-light);
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(230, 184, 0, 0.2);
  padding-bottom: 6px;
}

.reaction-close {
  background: transparent;
  border: none;
  color: #aaa;
  font-size: 1.2rem;
  cursor: pointer;
}

.reaction-close:hover {
  color: #fff;
}

.reaction-wheel-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.btn-emote {
  background: #10131c;
  border: 1px solid #2d3345;
  border-radius: 8px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-emote:hover {
  background: #2b1f06;
  border-color: var(--gold-light);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 0 10px var(--gold-glow);
}

.emote-icon {
  font-size: 1.5rem;
}

.emote-name {
  font-size: 0.65rem;
  color: var(--sand-accent);
  font-weight: 600;
}

/* Floating Reaction Bubble above Chamber Tile on Board */
.reaction-floating-bubble {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: #171b26;
  border: 2px solid var(--gold-light);
  color: #fff;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 0 15px var(--gold-light), 0 6px 20px rgba(0, 0, 0, 0.9);
  z-index: 1000;
  pointer-events: none;
  animation: floatReaction 3s forwards;
  display: flex;
  align-items: center;
  gap: 5px;
}

@keyframes floatReaction {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.5); }
  15% { opacity: 1; transform: translate(-50%, -10px) scale(1.15); }
  25% { transform: translate(-50%, -8px) scale(1); }
  75% { opacity: 1; transform: translate(-50%, -12px); }
  100% { opacity: 0; transform: translate(-50%, -28px); }
}
