/* Board & Tile Styles */
.board-world {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: 0 0;
  transition: transform 0.08s ease-out;
  will-change: transform;
}

.mansion-grid {
  position: relative;
  width: 0;
  height: 0;
}

/* Individual Room Tile */
.room-tile {
  position: absolute;
  width: 140px;
  height: 140px;
  background: #141721;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(30, 36, 50, 0.8), rgba(12, 15, 22, 0.95)),
    linear-gradient(45deg, rgba(212, 175, 55, 0.03) 25%, transparent 25%, transparent 75%, rgba(212, 175, 55, 0.03) 75%);
  background-size: 100% 100%, 20px 20px;
  border: 2px solid rgba(212, 175, 55, 0.3);
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px;
  box-sizing: border-box;
  user-select: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  animation: tileSpawn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.room-tile:hover {
  border-color: var(--gold-primary);
  box-shadow: 0 10px 25px rgba(223, 177, 91, 0.2);
}

.room-tile.current-tile {
  border-color: var(--gold-light);
  box-shadow: 0 0 20px rgba(223, 177, 91, 0.4);
}

.room-tile.valid-move-target {
  cursor: pointer;
  border-color: #38bdf8;
  animation: targetPulse 1.5s infinite;
}

/* Room Header & Name */
.tile-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 2;
  background: rgba(8, 10, 16, 0.72);
  border-radius: 4px;
  padding: 3px 5px;
  backdrop-filter: blur(3px);
  border: 1px solid rgba(212, 175, 55, 0.2);
}

.tile-name {
  font-family: var(--font-heading);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--gold-light);
  line-height: 1.15;
  text-shadow: 0 2px 4px rgba(0,0,0,0.95);
  max-width: 95px;
}

.tile-icon-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: bold;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.tile-icon-badge.omen {
  background: var(--curse-purple);
  color: #fff;
  box-shadow: 0 0 8px rgba(147, 51, 234, 0.6);
}

.tile-icon-badge.item {
  background: var(--ghost-green);
  color: #fff;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.tile-icon-badge.event {
  background: var(--crimson-red);
  color: #fff;
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.6);
}

.tile-icon-badge.stairs {
  background: var(--gold-dark);
  color: #fff;
  box-shadow: 0 0 8px rgba(223, 177, 91, 0.6);
}

/* Tile Center / Token Area */
.tile-token-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  z-index: 2;
  position: relative;
}

/* Player Mini Token */
.player-token {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.player-token:hover {
  transform: scale(1.25);
  z-index: 10;
  box-shadow: 0 0 12px currentColor;
}

.player-token.is-turn {
  animation: turnTokenPulse 1.2s infinite;
}

.player-token.is-traitor {
  border-color: var(--crimson-red);
  box-shadow: 0 0 10px var(--crimson-red);
}

/* Monster Token */
.monster-token {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  background: var(--crimson-dark);
  border: 2px solid var(--crimson-red);
  color: #fee2e2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.7);
}

/* Doors (N, S, E, W) */
.door-marker {
  position: absolute;
  background: #3f2a15;
  border: 1px solid var(--gold-primary);
  z-index: 3;
}

.door-marker.door-N {
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 6px;
  border-radius: 2px 2px 0 0;
}

.door-marker.door-S {
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 6px;
  border-radius: 0 0 2px 2px;
}

.door-marker.door-W {
  left: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 28px;
  border-radius: 2px 0 0 2px;
}

.door-marker.door-E {
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 28px;
  border-radius: 0 2px 2px 0;
}

/* Unrevealed Door Exploration Button */
.explore-door-btn {
  position: absolute;
  width: 26px;
  height: 26px;
  background: rgba(13, 148, 136, 0.85);
  border: 1.5px solid #2dd4bf;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  box-shadow: 0 0 10px rgba(45, 212, 191, 0.6);
  animation: explorePulse 1.8s infinite;
}

.explore-door-btn:hover {
  background: #14b8a6;
  transform: scale(1.25);
  box-shadow: 0 0 18px rgba(45, 212, 191, 0.9);
}

.explore-door-btn.explore-N {
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
}

.explore-door-btn.explore-S {
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
}

.explore-door-btn.explore-W {
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
}

.explore-door-btn.explore-E {
  right: -14px;
  top: 50%;
  transform: translateY(-50%);
}

/* Legacy Stickers on Tiles */
.tile-stickers {
  position: absolute;
  bottom: 4px;
  right: 4px;
  display: flex;
  gap: 3px;
  z-index: 2;
}

.legacy-seal {
  font-size: 0.6rem;
  padding: 2px 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border-gold);
  color: var(--gold-light);
  font-family: var(--font-heading);
}

/* Stairs Action Button */
.stairs-btn {
  margin-top: 2px;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: linear-gradient(135deg, #b45309, #78350f);
  border: 1px solid var(--gold-light);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: transform 0.15s;
}

.stairs-btn:hover {
  transform: scale(1.05);
  background: #d97706;
}

/* Keyframes */
@keyframes tileSpawn {
  0% { transform: scale(0.6) rotate(-3deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes targetPulse {
  0% { box-shadow: 0 0 5px rgba(56, 189, 248, 0.3); }
  50% { box-shadow: 0 0 16px rgba(56, 189, 248, 0.8); }
  100% { box-shadow: 0 0 5px rgba(56, 189, 248, 0.3); }
}

@keyframes turnTokenPulse {
  0% { box-shadow: 0 0 4px #fff, 0 0 10px var(--gold-primary); }
  50% { box-shadow: 0 0 10px #fff, 0 0 22px var(--gold-light); }
  100% { box-shadow: 0 0 4px #fff, 0 0 10px var(--gold-primary); }
}

@keyframes explorePulse {
  0% { transform: scale(1); box-shadow: 0 0 8px rgba(45, 212, 191, 0.5); }
  50% { transform: scale(1.12); box-shadow: 0 0 18px rgba(45, 212, 191, 0.9); }
  100% { transform: scale(1); box-shadow: 0 0 8px rgba(45, 212, 191, 0.5); }
}
