* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #1a1a1a;
  color: #ffffff;
  font-family: 'Fira Code', 'JetBrains Mono', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.4;
  overflow: hidden;
}

/* HP critical blinking animation */
@keyframes hp-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.3; }
}

.hp-critical-blink {
  animation: hp-blink 1s infinite;
}

#app {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Make game container fill the screen */
.game-container {
  display: grid;
  grid-template-columns: 1fr 320px;
  grid-template-rows: auto 1fr auto;
  gap: 15px;
  padding: 20px;
  width: 100%;
  height: 100%;
  max-width: 1800px;
  margin: 0 auto;
}

/* Stats panel in right sidebar */
.stats-view {
  grid-column: 2;
  grid-row: 2;
  background: #2a2a2a;
  border: 1px solid #444;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Dungeon takes main area on left */
.dungeon-view {
  grid-column: 1;
  grid-row: 2;
  background: #000000;
  border: 1px solid #444;
  padding: 15px;
  overflow: hidden; /* Changed from auto to hidden - no scrollbars */
  display: flex;
  align-items: center; /* Center canvas vertically */
  justify-content: center; /* Center canvas horizontally */
}

#dungeon-canvas {
  display: block;
  image-rendering: pixelated; /* Crisp pixel art */
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

/* Make dungeon grid scale better */
.dungeon-grid {
  margin: 0;
  line-height: 1.2;
  letter-spacing: 0.1em;
  font-size: 16px;
  white-space: pre;
}

/* Messages banner at top */
.messages-view {
  grid-column: 1 / -1;
  grid-row: 1;
  background: #2a2a2a;
  border: 1px solid #444;
  padding: 8px 12px;
  max-height: 80px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.messages div {
  margin: 2px 0;
  font-size: 0.9em;
}

.msg-info { color: #ffffff; }
.msg-combat { color: #ff8800; }
.msg-warning { color: #ffdd00; }
.msg-critical { color: #ff0000; }
.msg-success { color: #00ff00; }

/* Contextual command bar spans full width at bottom */
.contextual-command-bar {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Visibility state classes */
.tile-visible { opacity: 1.0; }
.tile-explored { opacity: 0.5; }
.tile-unexplored { opacity: 0; }

/* Stats Panel Components */
.stats-row {
  display: flex;
  gap: 12px;
  font-size: 0.9em;
}

/* Stats panel styling */
.stats-panel {
  flex: 1;
  padding: 6px 8px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0; /* Allow flex shrink */
}

.stats-panel-header {
  color: #888;
  font-size: 0.75em;
  margin-bottom: 2px;
  border-bottom: 1px solid #333;
  padding-bottom: 2px;
  font-weight: bold;
}

.stats-panel-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 6px; /* row-gap column-gap */
  font-size: 0.8em;
}

.stats-panel-content > div {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.equipment-section {
  /* Inherits 2-column grid from .stats-panel-content */
}

.equipment-header {
  /* Inherits from .stats-panel-header */
}

.equipment-slot {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.equipment-slot.empty {
  color: #666;
  font-style: italic;
}

.equipment-slot.cursed {
  color: #ff4444;
}

.status-section {
  /* Inherits 2-column grid from .stats-panel-content */
}

.status-header {
  /* Inherits from .stats-panel-header */
}

.status-effect-item {
  margin: 0;
}

.status-empty {
  color: #666;
  font-style: italic;
}

.resource-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bar-visual {
  display: inline-block;
  width: 100px;
  height: 12px;
  background: #333;
  border: 1px solid #555;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .game-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
  }

  .messages-view {
    grid-column: 1;
    grid-row: 1;
    max-height: 60px;
  }

  .stats-view {
    grid-column: 1;
    grid-row: 2;
    max-height: 250px;
  }

  .dungeon-view {
    grid-column: 1;
    grid-row: 3;
  }

  .contextual-command-bar {
    grid-column: 1;
    grid-row: 4;
  }
}

/* Modal overlay and content */
.modal-overlay {
  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;
}

.modal-content {
  background: #1a1a1a;
  border: 2px solid #8B7355;
  padding: 20px;
  min-width: 400px;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  color: #FFFFFF;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.modal-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #8B7355;
  color: #D4AF37;
}

.modal-subtitle {
  font-weight: bold;
  margin-top: 15px;
  margin-bottom: 5px;
  color: #D4AF37;
}

.modal-items {
  margin: 10px 0;
}

.modal-item {
  padding: 3px 0;
  color: #FFFFFF;
  cursor: pointer;
}

.modal-item:hover {
  background: #333;
}

.modal-empty {
  padding: 3px 0;
  color: #888888;
  font-style: italic;
}

.modal-equipment div {
  padding: 2px 0;
  color: #CCCCCC;
}

.modal-footer {
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px solid #8B7355;
  text-align: center;
  color: #888888;
  font-size: 14px;
}

.modal-section {
  margin: 10px 0;
}

.modal-inventory {
  min-width: 500px;
}
/* ============================================================================
   TARGETING MODAL STYLES
   ============================================================================ */

.targeting-modal {
  z-index: 1001; /* Above other modals */
}

.targeting-modal .modal-content {
  min-width: 400px;
  padding: 20px;
}

/* ============================================================================
   TARGET INFO DISPLAY
   ============================================================================ */

.targeting-info {
  padding: 15px;
  margin: 15px 0;
  border-radius: 4px;
  border: 2px solid #666;
  background: #222;
}

.targeting-info.valid {
  border-color: #4CAF50;
  background: #1a2e1a;
}

.targeting-info.invalid {
  border-color: #f44336;
  background: #2e1a1a;
}

.target-name {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 8px;
  color: #fff;
}

.targeting-info.valid .target-name {
  color: #4CAF50;
}

.targeting-info.invalid .target-name {
  color: #f44336;
}

.target-stats {
  font-size: 14px;
  color: #ccc;
  margin-bottom: 5px;
}

.target-error {
  font-size: 14px;
  color: #f44336;
  margin-top: 8px;
  font-style: italic;
}

.target-count {
  font-size: 12px;
  color: #999;
  margin-top: 8px;
  font-style: italic;
}

/* ============================================================================
   INSTRUCTIONS
   ============================================================================ */

.targeting-instructions {
  font-size: 13px;
  line-height: 1.6;
  color: #aaa;
  text-align: center;
}

.targeting-instructions div {
  margin: 4px 0;
}

/* ============================================================================
   KEYBOARD HINTS
   ============================================================================ */

.targeting-instructions [Tab],
.targeting-instructions [Shift+Tab],
.targeting-instructions [*],
.targeting-instructions [Enter],
.targeting-instructions [ESC] {
  display: inline-block;
  padding: 2px 6px;
  margin: 0 2px;
  background: #444;
  border-radius: 3px;
  font-family: monospace;
  font-weight: bold;
  color: #fff;
}

/* ============================================================================
   MODE CHANGE NOTIFICATION
   ============================================================================ */

.mode-change-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  padding: 1rem 2rem;
  border: 2px solid #44ff44;
  border-radius: 4px;
  font-size: 1.2rem;
  font-weight: bold;
  font-family: monospace;
  z-index: 9999;
  transition: opacity 0.3s;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* ============================================================================
   SEGMENTED PROGRESS BARS
   ============================================================================ */

.segmented-bar {
  width: 100%;
  height: 18px;
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  transition: width 0.3s ease;

  /* Segmented pattern: 14px bar + 2px gap */
  background-image: repeating-linear-gradient(
    90deg,
    currentColor 0px,
    currentColor 14px,
    #00000080 14px,
    #00000080 16px
  );
}

/* HP color states */
.bar-fill.hp { color: #00ff00; }
.bar-fill.hp.wounded { color: #ffdd00; }
.bar-fill.hp.critical { color: #ff8800; }
.bar-fill.hp.danger { color: #ff0000; }

/* XP bar */
.bar-fill.xp { color: #ffd700; }

/* Hunger states */
.bar-fill.hunger { color: #00ff00; }
.bar-fill.hunger.warning { color: #ff8800; }
.bar-fill.hunger.critical { color: #ff0000; }

/* Light states */
.bar-fill.light { color: #ffdd00; }
.bar-fill.light.warning { color: #ff8800; }
.bar-fill.light.critical { color: #ff0000; }

/* ============================================================================
   TWO-COLUMN STATS LAYOUT
   ============================================================================ */

/* New two-column grid layout */
.stats-row-new {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  font-size: 1.1em; /* Increased from 0.9em for readability */
}

.stats-panel-wide {
  flex: 1;
  padding: 12px 15px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
}

.stats-panel-content-vertical {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 1em; /* Increased from 0.8em */
}

/* Stat line with progress bar: label (80px) + value (100px) + bar (flex) */
.stat-line {
  display: grid;
  grid-template-columns: 80px 100px 1fr;
  gap: 10px;
  align-items: center;
}

.stat-label {
  font-weight: bold;
  color: #888;
}

.stat-value {
  color: #fff;
  font-family: monospace;
  text-align: right;
}

/* Compact stat row for secondary stats (Gold, Depth, Turn) */
.stat-compact {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  font-size: 0.9em;
  color: #aaa;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #333;
}

.stat-compact span {
  white-space: nowrap;
}

/* ============================================================================
   EQUIPMENT & STATUS STYLING
   ============================================================================ */

.equipment-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.equipment-item {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 10px;
  align-items: center;
}

.equip-label {
  font-weight: bold;
  color: #888;
}

.equip-value {
  color: #fff;
}

.equip-cursed {
  color: #ff4444;
}

.status-effects {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #333;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-badge {
  font-size: 0.95em;
}
