/* forge-aesthetics.css - The Z-Axis of Space */

/* === GOLDEN BELL TOWER STRUCTURE WITH MATRIX AESTHETIC === */
/* <CSS> */
/* Preserve all existing Matrix styling */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --dark-bg: #1a1a2e;
  --darker-bg: #0f0f1a;
  --panel-bg: #2c3e50;
  --accent: #f39c12;
  --accent-dark: #d35400;
  --danger: #e74c3c;
  --success: #27ae60;
  --primary: #3498db;

  /* Golden Bell Tower Enhancement Colors */
  --tower-gold: #ffd700;
  --tower-glow: rgba(255, 215, 0, 0.3);
  --ancient-stone: #2a2520;
  --weathered-bronze: #8b7355;
  --ember-hearth: #c45c2a;
  --deep-shadow: #1a1510;
  --mystic-silver: #e8e0d8;
  --portal-teal: #38ffb3;
  --bell-brass: #b8945a;
  --cathedral-purple: #4a2c6d;
}

body {
  background: linear-gradient(180deg, #010101 0%, #031a0f 100%) !important;
  color: #b8ffcc;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.3px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* === ENHANCED HEADER WITH IMP PORTAL TOGGLE === */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* Change 1: Match the parent container (which is stretched), not the viewport */
  width: 100% !important;
  height: 70px;
  /* Change 2: Remove the rigid math. Let the Flexbox and Zoom handle the size. */
  min-width: 0 !important;
  padding: 5px 20px;
  box-sizing: border-box;
  position: relative;
  background: linear-gradient(90deg, rgba(0, 20, 10, 0.9) 0%, rgba(0, 30, 15, 0.8) 50%, rgba(0, 20, 10, 0.9) 100%);
  border-bottom: 2px solid rgba(56, 255, 107, 0.3);
  box-shadow: 0 0 30px rgba(56, 255, 107, 0.1);
}

.title-block {
  flex: 1;
  text-align: center;
  position: relative;
}

.app-title {
  font-size: 0.7em;
  font-weight: bold;
  color: var(--tower-gold);
  /* Golden accent */
  text-shadow:
    2px 2px 4px rgba(0, 0, 0, 0.8),
    0 0 10px rgba(255, 215, 0, 0.3);
  letter-spacing: 1px;
}

.app-subtitle {
  font-size: 1em;
  color: #38ff6b;
  text-shadow: 0 0 8px rgba(56, 255, 107, 0.5);
}

/* === IMP PORTAL MODE TOGGLE === */
.portal-toggle {
  display: flex;
  gap: 10px;
  background: rgba(0, 30, 15, 0.7);
  padding: 8px;
  border-radius: 10px;
  border: 1px solid rgba(56, 255, 107, 0.3);
  box-shadow: 0 0 15px rgba(56, 255, 107, 0.2);
}

.portal-btn {
  padding: 10px 20px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--portal-teal);
  color: var(--portal-teal);
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.9em;
}

.portal-btn.active {
  background: linear-gradient(145deg, rgba(56, 255, 179, 0.3), rgba(30, 200, 140, 0.4));
  color: #fff;
  border-color: var(--portal-teal);
  box-shadow: 0 0 20px rgba(56, 255, 179, 0.5);
  text-shadow: 0 0 8px rgba(56, 255, 179, 0.8);
}

.portal-btn:hover:not(.active) {
  background: rgba(56, 255, 179, 0.1);
  transform: translateY(-2px);
}

/* === IMP PORTAL PANEL (Right Panel Replacement) === */
.imp-portal {
  display: none;
  flex-direction: column;
  gap: 15px;
  height: 100%;
}

.imp-portal.active {
  display: flex;
}

.imp-section {
  background: linear-gradient(145deg, rgba(0, 25, 15, 0.9), rgba(0, 15, 10, 0.95));
  border: 1px solid rgba(56, 255, 179, 0.3);
  border-radius: 8px;
  padding: 15px;
  box-shadow:
    0 0 20px rgba(56, 255, 179, 0.1),
    inset 0 0 15px rgba(0, 255, 100, 0.05);
}

.imp-section-header {
  color: var(--portal-teal);
  font-size: 1.1em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(56, 255, 179, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.imp-node-list {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.imp-node {
  background: rgba(0, 40, 20, 0.6);
  padding: 10px;
  border-radius: 5px;
  border: 1px solid rgba(56, 255, 179, 0.2);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.imp-node:hover {
  background: rgba(56, 255, 179, 0.1);
  border-color: rgba(56, 255, 179, 0.5);
  transform: translateX(5px);
}

.imp-node-icon {
  width: 20px;
  height: 20px;
  background: var(--portal-teal);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8em;
  color: #000;
}

.imp-node-dialogue .imp-node-icon {
  background: #3498db;
}

.imp-node-roll .imp-node-icon {
  background: #e74c3c;
}

.imp-node-media .imp-node-icon {
  background: #9b59b6;
}

.imp-node-interaction .imp-node-icon {
  background: #f39c12;
}

/* === IMP MEDIA CARDS === */
.imp-media-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
  padding: 5px;
}

.media-card {
  background: rgba(0, 30, 15, 0.8);
  border: 1px solid rgba(56, 255, 179, 0.2);
  border-radius: 6px;
  padding: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.media-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(56, 255, 179, 0.3);
  border-color: var(--portal-teal);
}

.media-card img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 5px;
  background: rgba(0, 0, 0, 0.3);
}

.media-card-title {
  font-size: 0.8em;
  color: var(--portal-teal);
  margin-top: 5px;
}

/* === IMP DELTA COMPOSER === */
.delta-composer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.delta-input {
  background: rgba(0, 20, 10, 0.8);
  border: 1px solid rgba(56, 255, 179, 0.3);
  border-radius: 5px;
  padding: 10px;
  color: #8fffba;
  font-family: 'Courier New', monospace;
  resize: vertical;
  min-height: 80px;
}

.delta-input:focus {
  outline: none;
  border-color: var(--portal-teal);
  box-shadow: 0 0 10px rgba(56, 255, 179, 0.3);
}

.delta-actions {
  display: flex;
  gap: 8px;
}

.delta-btn {
  flex: 1;
  padding: 8px;
  background: rgba(0, 40, 20, 0.7);
  border: 1px solid rgba(56, 255, 179, 0.3);
  color: var(--portal-teal);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.delta-btn:hover {
  background: rgba(56, 255, 179, 0.2);
  transform: translateY(-2px);
}

/* === IMP PLAYTEST VIEWPORT === */
.playtest-viewport {
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(56, 255, 179, 0.3);
  border-radius: 8px;
  padding: 15px;
  min-height: 200px;
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.playtest-message {
  padding: 10px;
  border-radius: 5px;
  border-left: 3px solid var(--portal-teal);
  background: rgba(0, 30, 15, 0.5);
}

.playtest-message.npc {
  border-left-color: #3498db;
}

.playtest-message.player {
  border-left-color: #2ecc71;
}

.playtest-message.system {
  border-left-color: #f39c12;
}

/* === IMP NODE EDITOR MODAL === */
#impNodeModal .modal-content {
  max-width: 700px;
  min-height: 600px;
}

.node-editor {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  height: 500px;
}

.node-palette {
  background: rgba(0, 20, 10, 0.8);
  border-radius: 5px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.node-type {
  padding: 10px;
  background: rgba(0, 40, 20, 0.6);
  border: 1px solid rgba(56, 255, 179, 0.2);
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.node-type:hover {
  background: rgba(56, 255, 179, 0.1);
  border-color: var(--portal-teal);
}

.node-properties {
  background: rgba(0, 20, 10, 0.8);
  border-radius: 5px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

/* === IMP COMMAND CONSOLE ENHANCEMENTS === */
.console-input-area {
  position: relative;
}

.command-suggestions {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: rgba(0, 30, 15, 0.95);
  border: 1px solid rgba(56, 255, 179, 0.3);
  border-radius: 5px 5px 0 0;
  max-height: 150px;
  overflow-y: auto;
  display: none;
  z-index: 100;
}

.command-suggestion {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(56, 255, 179, 0.1);
}

.command-suggestion:hover,
.command-suggestion.active {
  background: rgba(56, 255, 179, 0.2);
}

/* === RESPONSIVE DESIGN FOR IMP SYSTEM === */
@media (max-width: 1200px) {
  .imp-media-cards {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}

@media (max-width: 1024px) {
  .node-editor {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .node-palette {
    flex-direction: row;
    overflow-x: auto;
  }

  .node-type {
    min-width: 100px;
  }
}

@media (max-width: 768px) {
  .portal-toggle {
    flex-direction: column;
    gap: 5px;
  }

  .portal-btn {
    padding: 8px 12px;
    font-size: 0.8em;
  }
}

/* === BELL TOWER VERTICAL ACCENT (Visual Enhancement) === */
/* Fix the bell tower accent positioning - 15px from right edge */
.bell-tower-accent {
  position: fixed;
  top: 0;
  right: 15px;
  /* 15px from the right edge */
  width: 4px;
  height: 100vh;
  background: linear-gradient(to bottom,
      transparent 0%,
      var(--tower-gold) 10%,
      var(--tower-gold) 30%,
      rgba(255, 215, 0, 0.7) 50%,
      var(--tower-gold) 70%,
      transparent 100%);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
  z-index: 5;
  pointer-events: none;
}

.cathedral-light {
  position: fixed;
  top: 0;
  right: 13px;
  /* Slightly offset from the main line */
  width: 8px;
  height: 100vh;
  background: linear-gradient(to bottom,
      transparent 0%,
      rgba(56, 255, 179, 0.1) 20%,
      rgba(56, 255, 179, 0.3) 40%,
      rgba(56, 255, 179, 0.1) 60%,
      transparent 100%);
  filter: blur(2px);
  z-index: 4;
  pointer-events: none;
  animation: spirePulse 8s infinite alternate;
}

@keyframes spirePulse {
  0% {
    opacity: 0.3;
  }

  100% {
    opacity: 0.7;
  }
}

.node-type.active {
  background: rgba(56, 255, 179, 0.2);
  border-color: var(--portal-teal);
  box-shadow: 0 0 10px rgba(56, 255, 179, 0.3);
}

/* Preserve all existing Encounter Forge CSS below this point */
/* ... (All your existing CSS remains exactly the same) ... */
/* Your existing CSS remains the same!! */
/* * { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --dark-bg: #1a1a2e;
  --darker-bg: #0f0f1a;
  --panel-bg: #2c3e50;
  --accent: #f39c12;
  --accent-dark: #d35400;
  --danger: #e74c3c;
  --success: #27ae60;
  --primary: #3498db;
} */

body {
  background: linear-gradient(135deg, var(--dark-bg) 0%, var(--darker-bg) 100%);
  color: #ecf0f1;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  padding: 0;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100vw;
  /* Use viewport width instead of 100% */
  height: 60px;
  min-width: calc(34 * 30px + 320px + 320px + 30px);
  /* Grid + panels + gaps */
  padding: 5px 20px;
  box-sizing: border-box;
  position: relative;

}

.title-block {
  flex: 1;
  text-align: center;
}

.app-title {
  font-size: 2.2em;
  font-weight: bold;
  color: var(--accent);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.app-subtitle {
  font-size: 1em;
  color: #bdc3c7;
}

.mode-toggle {
  display: flex;
  gap: 10px;
}

.mode-btn {
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

.mode-btn.active {
  background: var(--accent);
  color: #000;
}

/* Ensure panels are completely separate */
.left-panel,
.right-panel {
  position: relative;
  z-index: 1;
}

.left-panel {
  grid-column: 1;
}

.right-panel {
  grid-column: 3;
}

/* Fix container grid */
.container {
  display: grid;
  grid-template-columns: 320px 1fr 320px;
  gap: 15px;
  padding: 15px;
  height: calc(100vh - 80px);
  min-width: 1690px;
  width: 100%;
}

/* Reset and fix panel styling */
.panel {
  background: var(--panel-bg);
  border-radius: 10px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  height: 100%;
  overflow-y: auto;
  gap: 15px;
}

.panel-header {
  color: var(--accent);
  font-size: 1.2em;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.main-area {
  display: flex;
  flex-direction: column;
  gap: 0px;
  /* Remove gap, we'll use margins */
  height: 100%;
}

.grid-container {
  background: linear-gradient(145deg, rgba(0, 15, 10, 0.8) 0%, rgba(0, 5, 5, 0.9) 100%);
  box-shadow:
    inset 0 0 30px rgba(0, 0, 0, 0.9),
    0 0 20px rgba(56, 255, 107, 0.05);
  border: 1px solid rgba(56, 255, 107, 0.2);
  border-radius: 10px;
  padding: 15px;
  flex: 1;
  /* Take available space */
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: auto;
  margin-bottom: 10px;
  /* Space before status bar */
}

.grid-wrapper {
  position: relative;
  display: inline-block;
  background: #000;
  border: 3px solid var(--accent);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
  margin-top: 0;
  /* Ensure no top margin */
}

/* 🛡️ HERO LAYER UPDATES */
#heroLayer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  pointer-events: none;
}

.axes {
  position: absolute;
  font-size: 11px;
  font-family: monospace;
  color: var(--accent);
  pointer-events: none;
  font-weight: bold;
  z-index: 5;
}

.x-axis {
  top: -25px;
  left: 0;
  display: flex;
}

.y-axis {
  top: 0;
  left: -25px;
  display: flex;
  flex-direction: column;
}

.axis-label {
  width: 32px;
  height: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.grid {
  display: grid;
  grid-template-columns: repeat(34, 32px);
  gap: 0;
  position: relative;
  z-index: 1;
  /* Floor level */
}

.cell {
  width: 32px;
  height: 32px;
  background: #34495e;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: monospace;
  font-size: 14px;
  font-weight: bold;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

.cell:hover {
  outline: 2px solid var(--accent);
  z-index: 10;
  transform: scale(1.1);
}

.cell.has-note::after {
  content: '•';
  position: absolute;
  top: 2px;
  right: 3px;
  color: var(--accent);
  font-size: 12px;
  z-index: 5;
}

/* Token Styles */
.token {
  position: absolute;
  border-radius: 50%;
  border: 2px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  cursor: grab;
  pointer-events: auto;
  z-index: 20;
  width: 30px;
  height: 30px;
  font-size: 0.8em;
  transition: all 0.2s ease;
  user-select: none;
  /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.7); */
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);

  background-color: #e74c3c;
  color: white;
  font-weight: bold;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);

  transition: transform 0.1s ease;


}

.token:hover {
  /* transform: scale(1.15); */
  border-color: #f1c40f;
  cursor: pointer;
  z-index: 30;
}

.token.dragging {
  cursor: grabbing;
  z-index: 100;
  box-shadow: 0 0 20px gold;
}

.token-pc {
  /* background: #2980b9;
  border-color: #3498db; */
  background-color: #3498db;
}

.token-npc {
  /* background: #27ae60;
  border-color: #2ecc71; */
  background-color: #27ae60;
}

.token-enemy {
  background: #c0392b;
  border-color: #e74c3c;
}

#tokenLayer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  /* Higher than grid (usually 1) */
  pointer-events: none;
  /* Let clicks pass through to grid... */
}

/* Tool Styles */
.tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 15px;
}

.tab {
  flex: 1;
  padding: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: #ecf0f1;
  font-weight: bold;
  font-size: 12px;
}

.tab.active {
  background: var(--accent);
  color: #000;
}

/* Make sure tools are properly contained */
.tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-height: 250px;
  min-height: 220px;
  overflow-y: auto;
  padding-right: 5px;
  margin-bottom: 0;
}

/* Make tools more responsive for tablet landscape */
@media (max-width: 1024px) and (orientation: landscape) {
  .tools {
    max-height: 280px;
    /* Even taller in landscape */
    min-height: 250px;
    grid-template-columns: repeat(4, 1fr);
    /* More columns in landscape */
  }

  .tool {
    min-height: 55px;
    /* Larger touch targets */
  }

  .tool-char {
    font-size: 18px;
    /* Larger icons */
  }

  .tool-name {
    font-size: 9px;
    /* Slightly larger text */
  }
}

/* Ensure panels don't collapse on tablets */
@media (max-width: 1024px) {
  .container {
    grid-template-columns: 300px 1fr 300px;
    /* Slightly narrower panels */
    gap: 10px;
  }

  .panel {
    min-height: 500px;
    /* Prevent panels from getting too small */
  }
}

/* For very small screens in landscape */
@media (max-width: 768px) and (orientation: landscape) {
  .container {
    grid-template-columns: 280px 1fr 280px;
  }

  .tools {
    max-height: 200px;
    /* Adjust for very small height */
    grid-template-columns: repeat(5, 1fr);
    /* Even more columns */
  }
}

/* Make sure the left panel content is properly structured */
#leftPanel {
  display: flex;
  flex-direction: column;
}

.tabs {
  flex-shrink: 0;
  /* Don't let tabs shrink */
}

.tools {
  flex-shrink: 0;
  /* Don't let tools shrink */
}

.tool {
  background: rgba(0, 0, 0, 0.3);
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  min-height: 45px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.tool:hover {
  outline: 2px solid var(--accent);
}

.tool.active {
  outline: 3px solid var(--accent);
}

.tool-char {
  font-size: 16px;
  font-weight: bold;
  line-height: 1;
}

.tool-name {
  font-size: 8px;
  margin-top: 2px;
  line-height: 1.1;
}

.tool-edit {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 10px;
  opacity: 0.7;
  cursor: pointer;
}

.tool-edit:hover {
  opacity: 1;
  color: var(--accent);
}

/* Button Styles */
button {
  padding: 10px;
  margin: 5px 0;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

.btn-wide {
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-warning {
  background: var(--accent);
  color: #000;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Encounter Panel */
.initiative-list {
  flex: 1;
  overflow-y: auto;
  margin: 10px 0;
  max-height: 300px;
  min-height: 100px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.initiative-item {
  padding: 10px;
  margin: 8px 0;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.initiative-item:hover {
  background: rgba(0, 0, 0, 0.5);
}

.initiative-active {
  background: rgba(243, 156, 18, 0.3) !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 10px rgba(243, 156, 18, 0.5);
}

.token-details {
  font-size: 0.8em;
  opacity: 0.9;
  margin-top: 5px;
}

.hp-controls {
  display: flex;
  gap: 5px;
  margin-top: 8px;
}

.hp-btn {
  background: rgba(20, 20, 20, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ecf0f1;
  padding: 4px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.8em;
  flex: 1;
}

.hp-btn:hover {
  background: rgba(243, 156, 18, 0.3);
}

/* Form Styles */
.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 0.9em;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 8px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: #ecf0f1;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  overflow-y: auto;
}

.modal-content {
  background: var(--panel-bg);
  margin: 30px auto;
  padding: 20px;
  border-radius: 10px;
  max-width: 800px;
  /* INCREASED from 600px */
  min-height: 500px;
  /* ADD THIS */
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
  border: 2px solid var(--accent);
  position: relative;
  /* ADD THIS */
}

.modal-content h2 {
  color: var(--accent);
  margin-top: 0;
  margin-bottom: 20px;
}

/* FIX THE TEXTAREA IN MODALS */
#exportText,
#importText {
  width: 100%;
  min-height: 400px;
  /* INCREASED from 150px */
  max-height: 600px;
  /* ADD THIS */
  padding: 15px;
  /* INCREASED */
  margin: 8px 0;
  background: rgba(0, 0, 0, 0.7);
  /* DARKER */
  color: #8fffba;
  /* MATRIX GREEN */
  border: 1px solid rgba(56, 255, 107, 0.4);
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  /* INCREASED from default */
  line-height: 1.5;
  /* ADD THIS */
  resize: vertical;
  overflow-y: auto;
  /* ENSURE SCROLLING */
  box-sizing: border-box;
}

/* Prevent body scroll when modal is open */
body.modal-open {
  overflow: hidden;
}

input,
textarea,
select {
  width: 100%;
  padding: 10px;
  margin: 8px 0;
  background: rgba(0, 0, 0, 0.5);
  color: #ecf0f1;
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-family: inherit;
  box-sizing: border-box;
}

textarea {
  min-height: 150px;
  resize: vertical;
}

.modal-btns {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.modal-btns button {
  flex: 1;
  min-width: 100px;
}

.color-presets {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  margin: 10px 0;
}

.color-preset {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
}

.color-preset:hover {
  border-color: var(--accent);
}

.color-input-group {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
}

.color-preview {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: 1px solid var(--accent);
  flex-shrink: 0;
}

/* Status Bar */
.status-bar {
  background: rgba(0, 0, 0, 0.7);
  padding: 8px 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9em;
  color: #bdc3c7;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-dark);
}

/* === Matrix Dark Aesthetic Enhancement === */
body {
  background: linear-gradient(180deg, #010101 0%, #031a0f 100%) !important;
  color: #b8ffcc;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.3px;
}

#app,
.main,
.container {
  background: rgba(0, 20, 10, 0.3);
  box-shadow: 0 0 20px rgba(56, 255, 107, 0.05) inset;
  border: 1px solid rgba(56, 255, 107, 0.15);
}

button,
select,
input {
  background: rgba(5, 30, 15, 0.3);
  border: 1px solid rgba(56, 255, 107, 0.2);
  color: #8fffba;
}

button:hover {
  box-shadow: 0 0 8px rgba(56, 255, 107, 0.4);
  background: rgba(5, 40, 20, 0.6);
}

.scanlines::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(0, 0, 0, 0.08) 1px, transparent 1px);
  background-size: 100% 3px;
  opacity: 0.4;
}

.console {
  font-family: 'Courier New', monospace;
  background: rgba(0, 20, 10, 0.6);
  border: 1px solid rgba(56, 255, 107, 0.2);
  padding: 8px;
  border-radius: 8px;
  color: #9fefb5;
  overflow: auto;
  height: 160px;
}

.console-line.success {
  color: #38ff6b;
}

.console-line.error {
  color: #ff6060;
}

/* Enhanced Panel System */
.panel {
  background: linear-gradient(145deg, rgba(0, 25, 15, 0.85), rgba(0, 15, 10, 0.9));
  box-shadow:
    0 0 30px rgba(0, 255, 100, 0.1),
    inset 0 0 20px rgba(0, 255, 100, 0.03);
  border: 1px solid rgba(56, 255, 107, 0.25);
  position: relative;
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(56, 255, 107, 0.5), transparent);
}

.panel-header {
  color: #38ff6b;
  text-shadow: 0 0 10px rgba(56, 255, 107, 0.5);
  border-bottom: 2px solid rgba(56, 255, 107, 0.3);
  background: rgba(0, 50, 25, 0.3);
  padding: 10px;
  margin: -15px -15px 15px -15px;
}

/* Enhanced Tabs */
.tab {
  background: linear-gradient(145deg, rgba(0, 20, 10, 0.6), rgba(0, 10, 5, 0.8));
  border: 1px solid rgba(56, 255, 107, 0.2);
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 8px;
}

.tab:hover {
  background: linear-gradient(145deg, rgba(0, 40, 20, 0.7), rgba(0, 20, 10, 0.9));
  border-color: rgba(56, 255, 107, 0.4);
  box-shadow: 0 0 10px rgba(56, 255, 107, 0.3);
}

.tab.active {
  background: linear-gradient(145deg, rgba(56, 255, 107, 0.3), rgba(30, 180, 70, 0.4));
  color: #fff;
  border-color: rgba(56, 255, 107, 0.8);
  box-shadow: 0 0 15px rgba(56, 255, 107, 0.5);
  text-shadow: 0 0 8px rgba(56, 255, 107, 0.8);
}

/* ENHANCED LARGER CONSOLE - NO NESTED SCROLL */
.console {
  font-family: 'Courier New', monospace;
  background: linear-gradient(145deg, rgba(0, 20, 10, 0.95), rgba(0, 10, 5, 0.98));
  border: 2px solid rgba(56, 255, 107, 0.4);
  padding: 15px;
  padding-top: 35px;
  /* Space for header */
  border-radius: 8px;
  color: #9fefb5;
  overflow-y: auto;
  /* Only scroll on the main console */
  height: 280px;
  box-shadow:
    inset 0 0 30px rgba(0, 0, 0, 0.9),
    0 0 20px rgba(56, 255, 107, 0.15),
    0 4px 20px rgba(0, 0, 0, 0.8);
  position: relative;
  margin: 10px 0;
  display: flex;
  flex-direction: column;
}

.console::before {
  content: "⚔️ DM COMMAND CENTER v3.14";
  position: absolute;
  top: 5px;
  left: 10px;
  font-size: 11px;
  font-weight: bold;
  opacity: 0.6;
  color: #38ff6b;
  text-shadow: 0 0 8px rgba(56, 255, 107, 0.6);
  letter-spacing: 1px;
}

.console::after {
  content: "";
  position: absolute;
  top: 25px;
  left: 10px;
  right: 10px;
  height: 1px;
  background: linear-gradient(90deg,
      transparent,
      rgba(56, 255, 107, 0.3) 20%,
      rgba(56, 255, 107, 0.3) 80%,
      transparent);
}

/* THE CHRONICLE (Console Styling) - RESIZED */
#consoleLines {
  background-color: #0d0d0d;
  padding: 15px;
  /* More padding */
  /* Let's make sure it's tall enough to read a paragraph */
  min-height: 200px;
  max-height: 400px;
  /* Or whatever fits your layout */
  overflow-y: auto;
  font-size: 16px;
  /* Base size bump (was likely 12-14px) */
}

/* Regular System Logs */
.console-line {
  border-bottom: 1px solid #222;
  padding: 6px 0;
  /* More vertical space between logs */
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  /* ~14.4px */
  color: #aaa;
  /* Slightly brighter for readability */
  line-height: 1.4;
}

/* 🔮 THE ORACLE SPEAKS (AI Narrative) */
.console-line.ai-narrative {
  background-color: rgba(50, 20, 70, 0.4);
  border-left: 4px solid #bf94e4;
  padding: 15px;
  /* Big comfy padding */
  margin: 10px 0;
  /* Separate it from the noise */

  color: #e0d0ff;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-style: italic;

  /* THE BIG TEXT */
  font-size: 1.15em;
  /* ~18.4px - Much easier to read */
  line-height: 1.6;
  /* Cinematic spacing */

  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
  border-radius: 0 4px 4px 0;
}

/* 👁️ THE overlord SPEAKS */
.console-line.ai-overlord {
  background-color: rgba(20, 60, 70, 0.4);
  /* Cyan/Teal tint */
  border-left: 4px solid #00d2ff;
  /* Bright Cyan accent */
  padding: 15px;
  margin: 10px 0;
  color: #ccf6ff;
  /* Pale cyan text */
  font-family: 'Roboto', sans-serif;
  /* Clean, modern, "High Tech" font */
  font-size: 1.15em;
  line-height: 1.6;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
}

.console-line:hover {
  background: rgba(56, 255, 107, 0.05);
  border-left-color: rgba(56, 255, 107, 0.3);
}

.console-line.success {
  color: #38ff6b;
  text-shadow: 0 0 5px rgba(56, 255, 107, 0.4);
  font-weight: bold;
}

.console-line.error {
  color: #ff6060;
  text-shadow: 0 0 5px rgba(255, 96, 96, 0.4);
  font-weight: bold;
}

.console-line.info {
  color: #4db8ff;
}

.console-line.warning {
  color: #ffaa00;
  font-weight: bold;
}

/* Input area - stays at bottom, doesn't scroll */
.console-input-area {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  /* Don't shrink */
  position: sticky;
  bottom: 0;
  background: linear-gradient(145deg, rgba(0, 20, 10, 0.95), rgba(0, 10, 5, 0.98));
  padding-top: 8px;
}

#consoleInput {
  background: rgba(0, 30, 15, 0.8);
  border: 1px solid rgba(56, 255, 107, 0.4);
  color: #8fffba;
  padding: 10px 14px;
  font-size: 15px;
  font-family: 'Courier New', monospace;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
  flex: 1;
}

#consoleInput::placeholder {
  color: rgba(143, 255, 186, 0.5);
  font-style: italic;
}

#consoleInput:focus {
  outline: none;
  border-color: rgba(56, 255, 107, 0.8);
  box-shadow:
    inset 0 0 10px rgba(0, 0, 0, 0.5),
    0 0 10px rgba(56, 255, 107, 0.3);
}

#consoleSend {
  background: linear-gradient(145deg, rgba(56, 255, 107, 0.3), rgba(30, 180, 70, 0.4));
  border: 1px solid rgba(56, 255, 107, 0.6);
  color: #fff;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 2px 10px rgba(56, 255, 107, 0.2);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

#consoleSend:hover {
  background: linear-gradient(145deg, rgba(56, 255, 107, 0.5), rgba(30, 180, 70, 0.6));
  box-shadow: 0 0 20px rgba(56, 255, 107, 0.4);
  transform: translateY(-2px);
}

/* Scrollbar for console lines only */
#consoleLines::-webkit-scrollbar {
  width: 6px;
}

#consoleLines::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
}

#consoleLines::-webkit-scrollbar-thumb {
  background: rgba(56, 255, 107, 0.4);
  border-radius: 3px;
}

#consoleLines::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 255, 107, 0.6);
}

/* Status Bar Above Console */
.status-bar {
  background: linear-gradient(145deg, rgba(0, 20, 10, 0.9), rgba(0, 10, 5, 0.95));
  border: 1px solid rgba(56, 255, 107, 0.3);
  padding: 10px 15px;
  font-size: 14px;
  color: #9fefb5;
  border-radius: 5px;
  margin-bottom: 5px;
  /* Space before console */
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
  text-align: center;
  font-weight: bold;
}

/* Compact Buttons */
.btn-compact {
  padding: 6px 8px;
  font-size: 0.85em;
  margin: 2px 0;
}

.section-toggle {
  text-align: left;
  font-size: 0.9em;
  padding: 8px 10px;
}

.section-content {
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.collapsible-section {
  margin: 8px 0;
}

/* Undo/Redo Button Styles */
#undoBtn:disabled,
#redoBtn:disabled,
#quickSaveBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

#undoBtn:disabled:hover,
#redoBtn:disabled:hover,
#quickSaveBtn:disabled:hover {
  transform: none !important;
  box-shadow: none !important;
}

/* Compact button enhancements for tablet */
.btn-compact {
  padding: 8px 6px !important;
  font-size: 0.8em !important;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* Scene Selection Styles */
/* === IMP SCENE CONTROLS - MATCHING PORTAL STYLING === */
.imp-button-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Scene buttons that match your IMP portal style */
.imp-scene-btn {
  padding: 10px 16px;
  background: linear-gradient(145deg, rgba(0, 40, 20, 0.7), rgba(0, 20, 10, 0.9));
  border: 1px solid rgba(56, 255, 179, 0.3);
  color: var(--portal-teal);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-family: 'Courier New', monospace;
  font-weight: 600;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.imp-scene-btn:hover {
  background: linear-gradient(145deg, rgba(56, 255, 179, 0.2), rgba(30, 200, 140, 0.3));
  border-color: rgba(56, 255, 179, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(56, 255, 179, 0.2);
  text-shadow: 0 0 8px rgba(56, 255, 179, 0.5);
}

.imp-scene-btn.primary {
  background: linear-gradient(145deg, rgba(56, 255, 179, 0.3), rgba(30, 200, 140, 0.4));
  border-color: rgba(56, 255, 179, 0.6);
  color: #fff;
  box-shadow: 0 0 20px rgba(56, 255, 179, 0.3);
}

.imp-scene-btn.primary:hover {
  background: linear-gradient(145deg, rgba(56, 255, 179, 0.5), rgba(30, 200, 140, 0.6));
  box-shadow: 0 0 25px rgba(56, 255, 179, 0.5);
}

/* Scene Info Panel - Matching IMP Style */
.scene-info-panel {
  margin-top: 15px;
  padding: 15px;
  background: linear-gradient(145deg, rgba(0, 25, 15, 0.8), rgba(0, 15, 10, 0.9));
  border: 1px solid rgba(56, 255, 179, 0.3);
  border-radius: 8px;
  border-left: 4px solid var(--portal-teal);
  font-size: 13px;
  line-height: 1.5;
  box-shadow:
    inset 0 0 20px rgba(0, 0, 0, 0.4),
    0 0 15px rgba(56, 255, 179, 0.1);
}

.scene-info-panel p {
  margin: 8px 0;
  color: #8fffba;
}

.scene-info-panel strong {
  color: var(--portal-teal);
  text-shadow: 0 0 8px rgba(56, 255, 179, 0.3);
}

.scene-info-panel em {
  color: #aaa;
  font-style: italic;
  font-size: 12px;
}

.scene-info-panel small {
  color: #666;
  font-size: 11px;
}

/* Scene Stats */
.scene-stats {
  display: flex;
  gap: 15px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(56, 255, 179, 0.2);
  font-size: 12px;
}

.stat-item {
  color: #8fffba;
}

.stat-item strong {
  color: var(--portal-teal);
}

/* Scene Creation Modal Enhancements */
#impCreateSceneModal .modal-content {
  background: linear-gradient(145deg, rgba(0, 25, 15, 0.95), rgba(0, 15, 10, 0.98));
  border: 2px solid rgba(56, 255, 179, 0.4);
  box-shadow: 0 0 40px rgba(56, 255, 179, 0.2);
}

.scene-preview {
  background: rgba(0, 30, 15, 0.6);
  border: 1px solid rgba(56, 255, 179, 0.2);
  border-radius: 6px;
  padding: 15px;
  margin: 15px 0;
}

.scene-preview h4 {
  margin: 0 0 10px 0;
  color: var(--portal-teal);
  text-shadow: 0 0 8px rgba(56, 255, 179, 0.3);
}

.preview-stats {
  display: flex;
  gap: 20px;
  margin: 10px 0;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  font-size: 12px;
}

.preview-stats span {
  color: #8fffba;
}

.preview-stats strong {
  color: var(--portal-teal);
}

/* Form inputs matching IMP style */
#sceneNameInput,
#sceneDescInput,
#sceneTypeSelect {
  background: rgba(0, 20, 10, 0.8);
  border: 1px solid rgba(56, 255, 179, 0.3);
  color: #8fffba;
  border-radius: 4px;
  padding: 10px;
  font-family: 'Courier New', monospace;
  margin: 8px 0;
}

#sceneNameInput:focus,
#sceneDescInput:focus,
#sceneTypeSelect:focus {
  outline: none;
  border-color: rgba(56, 255, 179, 0.6);
  box-shadow: 0 0 10px rgba(56, 255, 179, 0.3);
}

/* Modal actions */
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

#time-banner {
  font-size: 1.4em;
  margin-left: 1em;
  font-weight: bold;
  color: #ff4444;
  /* bright, in-your-face red */
  background: #111;
  padding: 0.2em 0.6em;
  border-radius: 6px;
  font-family: monospace;
}

/* === MULTI-MODE PANEL SYSTEM === */
.panel-mode-selector {
  display: flex;
  gap: 5px;
  margin-bottom: 15px;
  border-bottom: 2px solid rgba(56, 255, 179, 0.3);
  padding-bottom: 5px;
}

.mode-tab {
  flex: 1;
  padding: 8px 12px;
  background: rgba(0, 20, 10, 0.6);
  border: 1px solid rgba(56, 255, 179, 0.2);
  color: var(--portal-teal);
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9em;
}

.mode-tab:hover {
  background: rgba(56, 255, 179, 0.1);
}

.mode-tab.active {
  background: rgba(56, 255, 179, 0.3);
  border-color: var(--portal-teal);
  color: #fff;
  box-shadow: 0 0 10px rgba(56, 255, 179, 0.3);
}

.panel-mode-content {
  display: none;
}

.panel-mode-content.active {
  display: flex;
  flex-direction: column;
}

/* === NPC DISPLAY STYLES === */
.npc-display {
  gap: 15px;
}

.npc-portrait-container {
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 15px 0;
}

.npc-portrait {
  max-width: 280px;
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 3px solid var(--portal-teal);
  box-shadow: 0 0 20px rgba(56, 255, 179, 0.3);
}

.npc-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.npc-section {
  background: rgba(0, 30, 15, 0.6);
  border: 1px solid rgba(56, 255, 179, 0.2);
  border-radius: 6px;
  padding: 12px;
}

.npc-section h3 {
  color: var(--portal-teal);
  font-size: 1em;
  margin: 0 0 8px 0;
  text-shadow: 0 0 8px rgba(56, 255, 179, 0.3);
}

.npc-section.collapsible h3 {
  cursor: pointer;
  user-select: none;
}

.npc-section.collapsible h3:hover {
  color: #fff;
}

.npc-section p {
  margin: 0;
  color: #8fffba;
  font-size: 0.9em;
  line-height: 1.5;
}

.npc-content {
  margin-top: 10px;
}

#npcHooks {
  list-style: none;
  padding: 0;
  margin: 0;
}

#npcHooks li {
  padding: 8px;
  margin: 6px 0;
  background: rgba(0, 0, 0, 0.3);
  border-left: 3px solid var(--portal-teal);
  border-radius: 4px;
}

#npcHooks li strong {
  color: var(--portal-teal);
  display: block;
  margin-bottom: 4px;
}

/* Center Panel Mode System */
.center-mode-selector {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem;
  background: #16213e;
  border-bottom: 2px solid #533483;
  flex-shrink: 0;
}

.center-mode-btn {
  padding: 0.5rem 1rem;
  background: #1a1a2e;
  color: #eee;
  border: 2px solid #533483;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  font-weight: 600;
}

.center-mode-btn:hover {
  background: #533483;
  transform: translateY(-2px);
}

.center-mode-btn.active {
  background: #533483;
  border-color: #e94560;
  box-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
}

/* Modular Container */
.modular-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* Center Views */
/* In forge-aesthetics.css or add to <style> tag */
.center-view {
  display: none;
  width: 100%;
  height: 100%;
}

.center-view.active {
  display: block;
}

/* Map view should take full space */
#mapView {
  padding: 0;
}

#mapView .grid-container {
  width: 100%;
  height: 100%;
}

/* Other views get padding */
.scene-builder-panel,
.story-panel,
.npc-panel {
  padding: 1rem;
  width: 100%;
  height: 100%;
  overflow-y: auto;
}

.scene-nodes-container,
.story-beats-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

/* Scene Node Card */
.scene-node-card {
  background: #16213e;
  padding: 1rem;
  border-radius: 8px;
  border: 2px solid #533483;
}

.scene-node-card h4 {
  margin: 0 0 0.5rem 0;
  color: #e94560;
}

.scene-node-card p {
  margin: 0;
  color: #ecf0f1;
}

/* Story Beat Card */
.beat-card {
  background: #16213e;
  padding: 1rem;
  border-left: 4px solid #e94560;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.beat-card:hover {
  transform: translateX(10px);
  border-left-width: 8px;
}

.beat-card.completed {
  opacity: 0.6;
  border-left-color: #27ae60;
}

/* CONTEXT MENU (The Action UI) */
#context-menu {
  position: absolute;
  z-index: 1000;
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 4px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  display: none;
  /* Hidden by default */
  min-width: 120px;
  overflow: hidden;
}

.ctx-item {
  padding: 8px 12px;
  color: #e0e0e0;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  border-bottom: 1px solid #333;
  transition: background 0.2s;
}

.ctx-item:last-child {
  border-bottom: none;
}

.ctx-item:hover {
  background: #333;
  color: #fff;
}

.ctx-item.danger {
  color: #ff6b6b;
}

.ctx-item.danger:hover {
  background: #501010;
}

/* ==========================================================================
   5D ARCHITECTURE: THE ZOOM LENS
   Instead of crushing the grid, we opti-scale the interface to fit.
   ========================================================================== */

@media (max-width: 1750px) {
  body {
    /* "zoom" is a special Chrome/Edge property that scales everything 
       down intelligently without breaking layout flow.
       0.8 = 80% size. 
    */
    zoom: 0.8;
  }
}

@media (max-width: 1400px) {
  body {
    /* If the screen is very small (like a 13" laptop), shrink a bit more */
    zoom: 0.75;
  }
}

/* ==========================================================================
   SCROLLBAR POLISH
   Removes double-scrollbars by forcing containers to be rigid.
   ========================================================================== */

/* 1. Fix Right Panel Double Scroll */
/* We hide the scrollbar on the main panel so only the Tools/Lists scroll */
#rightPanel {
  overflow-y: hidden !important;
  padding-right: 5px;
  /* Tiny buffer so text doesn't hit edge */
}

/* Ensure the inner scrollable areas are accessible */
.tools,
.initiative-list,
.imp-portal {
  overflow-y: auto !important;
  /* Custom scrollbar styling to make it subtle */
  scrollbar-width: thin;
  scrollbar-color: var(--accent) rgba(0, 0, 0, 0.3);
}

/* 2. Fix DM Console Double Scroll */
/* The console container shouldn't scroll, only the text lines inside should */
.console {
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column;
}

#consoleLines {
  overflow-y: auto !important;
  flex-grow: 1;
  /* Fills the available space */
  height: 100%;
}

/* ==========================================================================
   FINAL FIX: HORIZONTAL SCROLL KILLER
   Strictly forbids side-to-side scrolling in side panels.
   ========================================================================== */

#rightPanel,
#leftPanel {
  /* The nuclear option for horizontal scrolling */
  overflow-x: hidden !important;
}

/* Ensure inputs and buttons don't accidentally push the width out */
#rightPanel input,
#rightPanel button,
#rightPanel select,
#rightPanel .token-creator,
#rightPanel .dice-engine {
  max-width: 100% !important;
  /* Never be wider than the parent */
  box-sizing: border-box;
  /* Include padding in that 100% calc */
}

/* For long text lines in the initiative tracker or chat */
.initiative-item,
.console-line {
  white-space: normal;
  /* Wrap text */
  word-wrap: break-word;
  /* Break long words if necessary */
}