/* ====================
   BEDROOM NAVIGATION CSS
   Multi-view system with hotspots
   ==================== */

:root {
  --hotspot-glow: #33ff33;
  --hotspot-hover: rgba(51, 255, 51, 0.3);
  --hotspot-border: rgba(51, 255, 51, 0.5);
  --portal-glow: #00f3ff;
  --secret-glow: #bc13fe;
  --unlock-glow: #ffd700;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
}

/* ============================
   BASE LAYOUT
   ============================ */
/* Only apply to standalone bedroom page, not index.html */
.bedroom-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #000;
  overflow: hidden;
  font-family: 'Press Start 2P', 'Courier New', monospace;
}

/* Don't override game-container or room-container sizing - let style.css handle it */
/* Only add transition for view switching animation */
#bedroom-view {
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

/* ============================
   HOTSPOTS CONTAINER
   ============================ */
#hotspots-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ============================
   HOTSPOT BASE STYLES
   ============================ */
.hotspot {
  position: absolute;
  cursor: pointer;
  pointer-events: auto;
  border: 2px solid transparent;
  border-radius: 4px;
  transition: all 0.3s ease;
  background: transparent;
}

/* Debug mode - show all hotspots */
.bedroom-container.debug .hotspot {
  background: rgba(255, 0, 0, 0.2);
  border-color: rgba(255, 0, 0, 0.5);
}

/* Hover effect - green terminal glow */
.hotspot:hover {
  border-color: var(--hotspot-border);
  background: var(--hotspot-hover);
  box-shadow:
    0 0 10px var(--hotspot-glow),
    0 0 20px var(--hotspot-glow),
    inset 0 0 10px rgba(51, 255, 51, 0.1);
}

/* ============================
   HOTSPOT TYPES
   ============================ */
.hotspot-portal:hover {
  border-color: var(--portal-glow);
  box-shadow:
    0 0 15px var(--portal-glow),
    0 0 30px var(--portal-glow);
}

.hotspot-secret:hover {
  border-color: var(--secret-glow);
  box-shadow:
    0 0 15px var(--secret-glow),
    0 0 30px var(--secret-glow);
}

.hotspot-unlock:hover {
  border-color: var(--unlock-glow);
  box-shadow:
    0 0 15px var(--unlock-glow),
    0 0 30px var(--unlock-glow);
}

.hotspot-game:hover {
  border-color: #ff6b6b;
  box-shadow:
    0 0 10px #ff6b6b,
    0 0 20px #ff6b6b;
}

/* ============================
   HOTSPOT LABELS
   ============================ */
.hotspot-label {
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: var(--hotspot-glow);
  padding: 4px 8px;
  border-radius: 2px;
  font-size: 10px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease;
  border: 1px solid var(--hotspot-glow);
  text-transform: uppercase;
  letter-spacing: 1px;
  pointer-events: none;
}

.hotspot:hover .hotspot-label {
  opacity: 1;
}

/* ============================
   NAVIGATION ARROWS
   ============================ */
.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  z-index: 200;
  border: 1px solid rgba(51, 255, 51, 0.2);
  border-radius: 4px;
  opacity: 0.5;
}

.nav-arrow:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.7);
  border-color: var(--hotspot-glow);
  box-shadow: 0 0 15px rgba(51, 255, 51, 0.3);
}

.nav-arrow.left {
  left: 10px;
}

.nav-arrow.right {
  right: 10px;
}

.nav-arrow-icon {
  font-size: 24px;
  color: rgba(51, 255, 51, 0.7);
  transition: all 0.3s ease;
}

.nav-arrow:hover .nav-arrow-icon {
  color: var(--hotspot-glow);
  text-shadow: 0 0 10px var(--hotspot-glow);
}

/* ============================
   VIEW TRANSITIONS
   ============================ */
#bedroom-view.slide-left {
  animation: slideOutLeft 0.3s ease-out forwards;
}

#bedroom-view.slide-right {
  animation: slideOutRight 0.3s ease-out forwards;
}

#bedroom-view.slide-in-from-left {
  animation: slideInFromLeft 0.3s ease-out forwards;
}

#bedroom-view.slide-in-from-right {
  animation: slideInFromRight 0.3s ease-out forwards;
}

/* Exit animations - where the current view goes */
@keyframes slideOutLeft {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(-100px); opacity: 0; }
}

@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100px); opacity: 0; }
}

/* Enter animations - where the new view comes from */
@keyframes slideInFromRight {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInFromLeft {
  from { transform: translateX(-100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================
   VIEW LABEL
   ============================ */
#view-label {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: var(--hotspot-glow);
  padding: 8px 16px;
  border: 1px solid var(--hotspot-glow);
  border-radius: 2px;
  font-size: 12px;
  letter-spacing: 2px;
  z-index: 200; /* Above scanlines (z-index 15) */
  pointer-events: none; /* Don't block clicks */
}

/* ============================
   MODAL STYLES (enhancements for bedroom)
   Base modal styles are in style.css
   ============================ */
#bedroom-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#bedroom-modal.hidden {
  display: none;
}

/* Modal body text styling */
.modal-body {
  margin: 0 0 20px 0;
  line-height: 1.8;
  font-size: 11px;
  font-family: 'IBM Plex Mono', monospace;
}

.modal-body p {
  margin: 0 0 12px 0;
}

.modal-body em {
  color: #888;
  font-style: italic;
}

/* Modal choices container */
.modal-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

/* ============================
   TOAST NOTIFICATIONS
   ============================ */
.bedroom-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0, 0, 0, 0.9);
  color: var(--hotspot-glow);
  padding: 12px 24px;
  border: 1px solid var(--hotspot-glow);
  border-radius: 2px;
  font-size: 11px;
  font-family: 'Press Start 2P', monospace;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 2000;
}

.bedroom-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================
   COORDINATE HELPER STYLES
   ============================ */
.coord-helper-active .hotspot {
  pointer-events: none;
}

.coord-helper-active #bedroom-view {
  cursor: crosshair;
}

#coord-helper-ui {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
}

.coord-helper-panel {
  background: rgba(0, 0, 0, 0.95);
  border: 2px solid var(--hotspot-glow);
  padding: 16px;
  width: 350px;
  color: var(--hotspot-glow);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
}

.coord-helper-panel h3 {
  margin: 0 0 12px 0;
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  border-bottom: 1px solid var(--hotspot-glow);
  padding-bottom: 8px;
}

.coord-helper-panel p {
  margin: 0 0 12px 0;
  line-height: 1.5;
  color: #aaa;
}

.coord-display {
  background: #111;
  padding: 8px;
  margin-bottom: 12px;
  border: 1px solid #333;
}

.coord-display div {
  margin: 4px 0;
}

.coord-output {
  background: #0a0a0a;
  padding: 8px;
  margin-bottom: 12px;
  border: 1px solid #333;
  max-height: 200px;
  overflow-y: auto;
}

.coord-output pre {
  margin: 8px 0 0 0;
  white-space: pre-wrap;
  font-size: 10px;
  color: #33ff33;
}

.coord-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.coord-buttons button {
  background: transparent;
  border: 1px solid var(--hotspot-glow);
  color: var(--hotspot-glow);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 10px;
  font-family: 'IBM Plex Mono', monospace;
  transition: all 0.2s;
}

.coord-buttons button:hover {
  background: var(--hotspot-glow);
  color: #000;
}

.coord-instructions {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #333;
}

.coord-instructions p {
  margin: 4px 0;
  font-size: 10px;
}

.coord-point-marker {
  position: absolute;
  width: 20px;
  height: 20px;
  background: var(--hotspot-glow);
  color: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 0 10px var(--hotspot-glow);
}

.coord-preview-rect {
  position: absolute;
  border: 2px dashed var(--hotspot-glow);
  background: rgba(51, 255, 51, 0.1);
  pointer-events: none;
  z-index: 99;
}

/* ============================
   NIGHT MODE
   ============================ */
.night-mode #bedroom-view {
  filter: brightness(0.4) contrast(1.2);
}

.night-mode .hotspot:hover {
  box-shadow:
    0 0 15px var(--hotspot-glow),
    0 0 30px var(--hotspot-glow),
    0 0 45px var(--hotspot-glow);
}

/* Reveal hidden elements in night mode */
.night-mode .hotspot[data-id="tamagotchi"] {
  animation: glowPulse 2s infinite;
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 5px var(--secret-glow); }
  50% { box-shadow: 0 0 20px var(--secret-glow), 0 0 30px var(--secret-glow); }
}

/* ============================
   CRT EFFECTS (OVERLAY)
   ============================ */
.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.1) 0px,
    rgba(0, 0, 0, 0.1) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 500;
}

.vignette {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle at center,
    transparent 40%,
    rgba(0, 0, 0, 0.4) 100%
  );
  pointer-events: none;
  z-index: 499;
}

/* ============================
   HOUSE MAP MODAL
   ============================ */
.house-map {
  font-family: 'IBM Plex Mono', monospace;
}

.house-map p {
  padding: 8px;
  border: 1px solid #333;
  margin: 4px 0;
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 768px) {
  .nav-arrow {
    width: 30px;
    height: 80px;
  }

  .nav-arrow-icon {
    font-size: 18px;
  }

  #view-label {
    font-size: 10px;
    padding: 6px 12px;
  }

  .modal-content {
    padding: 16px;
    max-width: 95%;
  }

  .modal-title {
    font-size: 12px;
  }

  .modal-text {
    font-size: 10px;
  }

  .choice-btn, .retro-btn, .modal-choice-btn, .modal-close {
    padding: 8px 12px;
    font-size: 8px;
    min-width: auto;
    flex: 1 1 45%;
  }

  #coord-helper-ui {
    top: auto;
    bottom: 20px;
    right: 10px;
    left: 10px;
  }

  .coord-helper-panel {
    width: auto;
  }
}

/* ============================
   ANGLED HOTSPOTS
   For items displayed at an angle in the art
   ============================ */
.hotspot-angled {
  transform: rotate(45deg);
  transform-origin: center center;
}

.hotspot-angled:hover {
  transform: rotate(45deg) scale(1.05);
}

.hotspot-angled .hotspot-label {
  transform: translateX(-50%) rotate(-45deg);
}

/* ============================
   CONTAINER TYPE (Nightstand, drawers, etc.)
   ============================ */
.hotspot-container:hover {
  border-color: #ff9500;
  box-shadow:
    0 0 10px #ff9500,
    0 0 20px rgba(255, 149, 0, 0.5);
}

/* ============================
   LAVA LAMP AMBIENT EFFECT
   ============================ */
.lava-lamp-glow #bedroom-view::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    ellipse at 90% 50%,
    rgba(255, 100, 50, 0.12) 0%,
    rgba(255, 50, 100, 0.08) 25%,
    transparent 55%
  );
  pointer-events: none;
  animation: lavaGlow 4s ease-in-out infinite;
  z-index: 50;
}

@keyframes lavaGlow {
  0%, 100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 0.75;
    transform: scale(1.02);
  }
}

/* Lava lamp glow affects hotspot colors too */
.lava-lamp-glow .hotspot:hover {
  border-color: #ff6b9d;
  box-shadow:
    0 0 15px #ff6b9d,
    0 0 30px rgba(255, 107, 157, 0.5);
}

/* ============================
   FOG MAP STYLES
   ============================ */
.fog-map {
  background: #0a0a0a;
  padding: 16px;
  border: 1px solid #333;
  border-radius: 4px;
}

.fog-map pre {
  color: var(--hotspot-glow);
  margin: 0;
}

/* ============================
   GLOWING DOOR EFFECT
   ============================ */
.hotspot-glowing {
  animation: doorGlow 2s ease-in-out infinite;
}

.hotspot-glowing::before {
  content: '';
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  background: linear-gradient(
    45deg,
    rgba(255, 200, 100, 0.3),
    rgba(255, 255, 200, 0.5),
    rgba(255, 200, 100, 0.3)
  );
  border-radius: 4px;
  z-index: -1;
  filter: blur(10px);
  animation: doorGlow 2s ease-in-out infinite;
}

@keyframes doorGlow {
  0%, 100% {
    opacity: 0.5;
    filter: blur(8px);
  }
  50% {
    opacity: 0.8;
    filter: blur(12px);
  }
}

.hotspot-glowing:hover {
  border-color: #ffd700 !important;
  box-shadow:
    0 0 20px rgba(255, 215, 0, 0.5),
    0 0 40px rgba(255, 215, 0, 0.3),
    0 0 60px rgba(255, 215, 0, 0.2) !important;
}

/* ============================
   INVENTORY SYSTEM
   ============================ */
.inventory-container {
  background: #0a0a0a;
  border: 1px solid #333;
  padding: 12px;
  margin-top: 10px;
  border-radius: 4px;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.inventory-item {
  background: #1a1a1a;
  border: 1px solid #333;
  padding: 8px;
  text-align: center;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.inventory-item:hover {
  border-color: var(--hotspot-glow);
  background: #222;
  box-shadow: 0 0 10px rgba(51, 255, 51, 0.2);
}

.item-icon {
  display: block;
  font-size: 20px;
  margin-bottom: 4px;
}

.item-name {
  display: block;
  font-size: 8px;
  color: #aaa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Collection type hotspot */
.hotspot-collection:hover {
  border-color: #9b59b6;
  box-shadow:
    0 0 10px #9b59b6,
    0 0 20px rgba(155, 89, 182, 0.5);
}

/* Inventory type hotspot */
.hotspot-inventory:hover {
  border-color: #3498db;
  box-shadow:
    0 0 10px #3498db,
    0 0 20px rgba(52, 152, 219, 0.5);
}

/* ============================
   CLICKABLE INVENTORY ITEMS
   ============================ */
.inventory-item.clickable-item {
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  outline: none;
}

.inventory-item.clickable-item:hover,
.inventory-item.clickable-item:focus {
  border-color: var(--hotspot-glow);
  background: #222;
  box-shadow:
    0 0 10px rgba(51, 255, 51, 0.3),
    inset 0 0 5px rgba(51, 255, 51, 0.1);
  transform: translateY(-2px);
}

.inventory-item.clickable-item:active {
  transform: translateY(0);
  box-shadow: 0 0 5px rgba(51, 255, 51, 0.2);
}

/* Item icon pulse on hover */
.inventory-item.clickable-item:hover .item-icon {
  animation: itemPulse 0.5s ease;
}

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

/* ============================
   ITEM DETAILS VIEW
   ============================ */
.item-details {
  text-align: left;
}

.item-details .item-description {
  color: #ccc;
  line-height: 1.6;
  margin-bottom: 10px;
}

.item-details .item-meta {
  background: #0a0a0a;
  border-radius: 4px;
  padding: 10px;
}

/* ============================
   ARTIFACT EXAMINE VIEW
   ============================ */
.artifact-examine {
  text-align: left;
}

.artifact-examine p {
  line-height: 1.6;
}

/* Artifact properties box styling */
.artifact-examine div[style*="background: #1a1a1a"] {
  animation: artifactGlow 2s ease-in-out infinite;
}

@keyframes artifactGlow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(255, 0, 255, 0.2);
  }
  50% {
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.4), 0 0 25px rgba(255, 0, 255, 0.2);
  }
}

/* ============================
   ITEM TYPE COLORS
   ============================ */
/* Key items - gold */
.inventory-item[data-item-id*="key"]:hover,
.inventory-item[data-item-id*="keys"]:hover {
  border-color: #ffd700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

/* Artifact/Relic items - purple/mystical */
.inventory-item[data-item-type="artifact"]:hover,
.inventory-item[data-item-type="relic"]:hover {
  border-color: #ff00ff;
  box-shadow: 0 0 15px rgba(255, 0, 255, 0.5);
}

/* Toy items - fun cyan */
.inventory-item[data-item-id*="tamagotchi"]:hover {
  border-color: #00f3ff;
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.4);
}

/* Document items - paper white */
.inventory-item[data-item-id*="map"]:hover {
  border-color: #f0e68c;
  box-shadow: 0 0 10px rgba(240, 230, 140, 0.4);
}

/* ============================
   D&D TOME TRANSITION SYSTEM
   Epic transition when entering the D&D world
   ============================ */

/* Tome teaser styling in modal */
.dnd-tome-teaser {
  text-align: center;
  padding: 20px 10px;
}

.dnd-tome-teaser .tome-glow {
  color: #ffd700;
  font-size: 14px;
  text-shadow: 0 0 10px #ffd700, 0 0 20px #ffd700;
  animation: tomeGlow 2s ease-in-out infinite;
  margin-bottom: 15px;
}

.dnd-tome-teaser .tome-whisper {
  color: #9b59b6;
  font-style: italic;
  font-size: 16px;
  animation: whisperPulse 3s ease-in-out infinite;
  margin-top: 15px;
}

@keyframes tomeGlow {
  0%, 100% {
    text-shadow: 0 0 10px #ffd700, 0 0 20px #ffd700;
    opacity: 0.8;
  }
  50% {
    text-shadow: 0 0 20px #ffd700, 0 0 40px #ffd700, 0 0 60px #ffd700;
    opacity: 1;
  }
}

@keyframes whisperPulse {
  0%, 100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

/* Transition overlay */
.dnd-transition-overlay {
  position: fixed;
  inset: 0;
  background: #1a1510;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.5s ease-in;
  pointer-events: none;
}

.dnd-transition-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Flying pages effect */
.tome-pages-flying {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(255, 215, 0, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 60%, rgba(255, 215, 0, 0.1) 0%, transparent 50%);
  animation: pagesSwirl 2s ease-in-out;
}

.tome-pages-flying::before,
.tome-pages-flying::after {
  content: '';
  position: absolute;
  width: 60px;
  height: 80px;
  background: linear-gradient(135deg, #f5e6d3 0%, #c9b896 100%);
  border: 1px solid #8b7355;
  animation: pageFly 1.5s ease-out forwards;
  opacity: 0;
}

.tome-pages-flying::before {
  top: 50%;
  left: 50%;
  animation-delay: 0.2s;
}

.tome-pages-flying::after {
  top: 50%;
  left: 50%;
  animation-delay: 0.4s;
}

@keyframes pageFly {
  0% {
    transform: translate(-50%, -50%) rotate(0deg) scale(0.5);
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + 200px), calc(-50% - 300px)) rotate(45deg) scale(1.5);
    opacity: 0;
  }
}

@keyframes pagesSwirl {
  0% {
    transform: scale(0.5) rotate(0deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.2) rotate(180deg);
    opacity: 0.5;
  }
  100% {
    transform: scale(2) rotate(360deg);
    opacity: 0;
  }
}

/* Reality crack / golden light burst */
.reality-crack {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    45deg,
    transparent 40%,
    rgba(255, 215, 0, 0.3) 45%,
    rgba(255, 215, 0, 0.8) 50%,
    rgba(255, 215, 0, 0.3) 55%,
    transparent 60%
  );
  animation: crackSpread 1.5s ease-out forwards;
  opacity: 0;
}

@keyframes crackSpread {
  0% {
    clip-path: circle(0% at 50% 50%);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    clip-path: circle(150% at 50% 50%);
    opacity: 1;
  }
}

/* Screen shake when entering */
.entering-tome {
  animation: screenShake 0.5s ease-out;
}

@keyframes screenShake {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-5px) translateY(2px); }
  20% { transform: translateX(5px) translateY(-2px); }
  30% { transform: translateX(-4px) translateY(1px); }
  40% { transform: translateX(4px) translateY(-1px); }
  50% { transform: translateX(-3px); }
  60% { transform: translateX(3px); }
  70% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
  90% { transform: translateX(-1px); }
}

/* Transition text */
.transition-text {
  font-family: 'Press Start 2P', cursive;
  color: #ffd700;
  font-size: 16px;
  text-shadow:
    0 0 10px #ffd700,
    0 0 20px #ffd700,
    0 0 40px #ffd700;
  animation: textPulse 1s ease-in-out infinite, textFadeIn 0.5s ease-out forwards;
  z-index: 10;
  text-align: center;
  letter-spacing: 2px;
}

@keyframes textPulse {
  0%, 100% {
    text-shadow:
      0 0 10px #ffd700,
      0 0 20px #ffd700,
      0 0 40px #ffd700;
  }
  50% {
    text-shadow:
      0 0 20px #ffd700,
      0 0 40px #ffd700,
      0 0 60px #ffd700,
      0 0 80px #ffd700;
  }
}

@keyframes textFadeIn {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ============================
   REVERSE TRANSITION (Exit from D&D)
   ============================ */
.dnd-exit-overlay {
  position: fixed;
  inset: 0;
  background: #1a1510;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.5s ease-in;
  pointer-events: none;
}

.dnd-exit-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.dnd-exit-overlay .reality-heal {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at center,
    rgba(255, 215, 0, 0.8) 0%,
    rgba(255, 215, 0, 0.3) 30%,
    transparent 60%
  );
  animation: healReality 1.5s ease-in-out forwards;
}

@keyframes healReality {
  0% {
    transform: scale(2);
    opacity: 1;
  }
  100% {
    transform: scale(0);
    opacity: 0;
  }
}

.dnd-exit-overlay .exit-text {
  font-family: 'Press Start 2P', cursive;
  color: #ffd700;
  font-size: 14px;
  text-shadow: 0 0 10px #ffd700, 0 0 20px #ffd700;
  animation: textPulse 1s ease-in-out infinite;
  z-index: 10;
  text-align: center;
}

/* Character sheet preview styling */
.character-sheet-preview {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
}

/* ============================
   RARITY SYSTEM
   ============================ */

.inventory-item[data-item-rarity="common"]    { border-color: #444; }
.inventory-item[data-item-rarity="uncommon"]  { border-color: #1eff00; }
.inventory-item[data-item-rarity="rare"]      { border-color: #0070dd; }
.inventory-item[data-item-rarity="epic"]      { border-color: #a335ee; }
.inventory-item[data-item-rarity="legendary"] { border-color: #ff8000; }
.inventory-item[data-item-rarity="exotic"]    { border-color: #e6cc80; }

.inventory-item[data-item-rarity="uncommon"]:hover  { box-shadow: 0 0 10px rgba(30, 255, 0, 0.4); }
.inventory-item[data-item-rarity="rare"]:hover      { box-shadow: 0 0 10px rgba(0, 112, 221, 0.5); }
.inventory-item[data-item-rarity="epic"]:hover      { box-shadow: 0 0 14px rgba(163, 53, 238, 0.6); }
.inventory-item[data-item-rarity="legendary"]:hover {
  box-shadow: 0 0 18px rgba(255, 128, 0, 0.65);
  animation: legendaryPulse 1.5s ease-in-out infinite;
}
.inventory-item[data-item-rarity="exotic"]:hover {
  box-shadow: 0 0 20px rgba(230, 204, 128, 0.7);
  animation: exoticShimmer 2s ease infinite;
}

.item-name-rarity {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}
.item-name-rarity.rarity-common    { color: #aaa; }
.item-name-rarity.rarity-uncommon  { color: #1eff00; }
.item-name-rarity.rarity-rare      { color: #0070dd; }
.item-name-rarity.rarity-epic      { color: #a335ee; }
.item-name-rarity.rarity-legendary { color: #ff8000; }
.item-name-rarity.rarity-exotic    { color: #e6cc80; text-shadow: 0 0 6px rgba(230,204,128,0.6); }

.rarity-label { font-weight: bold; }
.rarity-label.rarity-common    { color: #aaa; }
.rarity-label.rarity-uncommon  { color: #1eff00; }
.rarity-label.rarity-rare      { color: #0070dd; }
.rarity-label.rarity-epic      { color: #a335ee; }
.rarity-label.rarity-legendary { color: #ff8000; }
.rarity-label.rarity-exotic    { color: #e6cc80; text-shadow: 0 0 6px rgba(230,204,128,0.6); }

@keyframes legendaryPulse {
  0%, 100% { box-shadow: 0 0 14px rgba(255, 128, 0, 0.5); }
  50%       { box-shadow: 0 0 26px rgba(255, 128, 0, 0.9); }
}
@keyframes exoticShimmer {
  0%, 100% { box-shadow: 0 0 16px rgba(230, 204, 128, 0.6); }
  50%       { box-shadow: 0 0 28px rgba(230, 204, 128, 1.0); filter: brightness(1.15); }
}

/* ============================
   REACTIVE ROOM STATE
   ============================ */
.room-state-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 120;
}

/* room-mutation elements removed — per-element overlays fought the artwork.
   Ambient gradients below handle progression state visually. */

#bedroom-view.room-ambient-main-stirred::before,
#bedroom-view.room-ambient-main-breached::before,
#bedroom-view.room-ambient-main-marked::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30;
}

#bedroom-view.room-ambient-main-stirred::before {
  background:
    radial-gradient(circle at 53% 72%, rgba(222, 197, 131, 0.12), transparent 18%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.02), rgba(14, 10, 5, 0.08));
}

#bedroom-view.room-ambient-main-breached::before {
  background:
    radial-gradient(circle at 49% 47%, rgba(0, 243, 255, 0.13), transparent 18%),
    radial-gradient(circle at 59% 19%, rgba(188, 19, 254, 0.08), transparent 12%),
    linear-gradient(to bottom, rgba(2, 8, 12, 0.03), rgba(5, 12, 18, 0.14));
}

#bedroom-view.room-ambient-main-marked::before {
  background:
    radial-gradient(circle at 49% 47%, rgba(0, 243, 255, 0.16), transparent 19%),
    radial-gradient(circle at 60% 71%, rgba(230, 204, 128, 0.10), transparent 14%),
    radial-gradient(circle at 59% 19%, rgba(188, 19, 254, 0.10), transparent 12%),
    linear-gradient(to bottom, rgba(5, 9, 13, 0.05), rgba(8, 10, 16, 0.16));
}

@keyframes roomPulseWarm {
  0%, 100% { box-shadow: 0 0 14px rgba(255, 211, 91, 0.18); }
  50% { box-shadow: 0 0 24px rgba(255, 211, 91, 0.38); }
}

@keyframes roomPulseCool {
  0%, 100% { opacity: 0.86; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-1px); }
}

@keyframes posterGlitch {
  0%, 100% { transform: translate(0, 0); opacity: 0.92; }
  20% { transform: translate(1px, -1px); opacity: 1; }
  40% { transform: translate(-1px, 1px); }
  60% { transform: translate(1px, 0); }
  80% { transform: translate(0, -1px); }
}

/* ============================
   BACKPACK NEW-ITEM BADGE
   ============================ */
.backpack-new-badge {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #a335ee;
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  padding: 5px 8px;
  border-radius: 3px;
  border: 1px solid #cc66ff;
  box-shadow: 0 0 12px rgba(163, 53, 238, 0.7), 0 0 24px rgba(163, 53, 238, 0.3);
  animation: badgePulse 1.2s ease-in-out infinite;
  z-index: 3000;
  cursor: pointer;
  letter-spacing: 1px;
  pointer-events: auto;
}
.backpack-new-badge:hover {
  background: #cc66ff;
  box-shadow: 0 0 20px rgba(163, 53, 238, 0.9);
}
@keyframes badgePulse {
  0%, 100% { transform: scale(1);     box-shadow: 0 0 12px rgba(163,53,238,0.7); }
  50%       { transform: scale(1.06); box-shadow: 0 0 22px rgba(163,53,238,1.0); }
}
