body {
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: #2a3b3f;
  background-image: linear-gradient(
    45deg,
    rgba(0, 0, 0, 0.1) 25%,
    transparent 25%,
    transparent 50%,
    rgba(0, 0, 0, 0.1) 50%,
    rgba(0, 0, 0, 0.1) 75%,
    transparent 75%,
    transparent
  );
  background-size: 30px 30px;
  font-family: sans-serif;
  color: #eee;
}

#game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 90%;
  max-width: 900px;
  padding: 15px;
  box-sizing: border-box;
  height: 95vh;
  justify-content: space-between;
}

#game-area {
      position: relative;
}

#room-title-card {
    position: absolute; /* Position it over the image */
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20%; /* Cover bottom 20% */
    background-color: rgba(0, 0, 0, 0.75); /* Semi-transparent black */
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out, visibility 0s linear 0.5s; /* Fade out, then hide */
    z-index: 10; /* Ensure it's above the image but below modals if any */
    box-sizing: border-box;
    padding: 10px;
}

#room-title-card.visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease-in-out, visibility 0s linear 0s; /* Fade in, then show */
}

#room-title-text {
    margin: 0;
    font-size: 2em; /* Adjust as needed */
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    color: white;
}

#scene-image-container {
  width: 100%;
  /* REMOVED box-shadow */
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

#scene-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 75vh;
  object-fit: contain;
}

#content-below-image {
  width: 100%;
  min-height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 15px 0;
  box-sizing: border-box;
  /* Add perspective for subtle 3D effect if desired, optional */
  /* perspective: 1000px; */
}

/* Base styles for animating elements */
.dialogue-text,
#button-container {
  opacity: 0; /* Start invisible */
  transform: translateY(30px); /* Start slightly lower */
  transition: opacity 0.4s ease-out, transform 0.4s ease-out; /* Define transition */
}

/* Styles when visible */
.dialogue-text.visible,
#button-container.visible {
  opacity: 1; /* Fade in */
  transform: translateY(0); /* Move up to final position */
}



.dialogue-text {
  /* display: none; /* Controlled by JS adding/removing .visible */
  width: auto;
  max-width: 95%;
  text-align: center;
  font-size: 0.95em;
  color: #f0f0f0; /* Slightly brighter text */
  /* UPDATED: Darker background */
  background-color: rgba(15, 20, 22, 0.92); /* Darker, more opaque */
  padding: 12px 20px;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  user-select: none;
  /* Transition defined above */
}
.dialogue-text:hover {
  /* Keep hover subtle */
  background-color: rgba(25, 30, 32, 0.95);
}

#button-container {
  /* display: none; /* Controlled by JS adding/removing .visible */
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
  width: 100%;
  /* Transition defined above */
}

/* Button styles remain the same */
button {
  padding: 8px 20px;
  border: none;
  border-radius: 5px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  min-width: 80px;
  transition: background-color 0.2s ease, transform 0.1s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

button:active {
  transform: translateY(1px);
}

.btn-active {
  background-color: #40e0d0;
  color: #1a2528;
}
.btn-active:hover {
  background-color: #38c7b7;
}

.btn-inactive {
  background-color: #ff69b4;
  color: white;
}
.btn-inactive:hover {
  background-color: #f05aa0;
}

.btn-visited {
  background-color: #708090; /* Slate Gray */
  color: #cccccc;
  border: 1px solid #5a6874;
  filter: grayscale(50%); /* Optional: make it look more faded */
}
.btn-visited:hover {
  background-color: #8492a0; /* Slightly lighter gray on hover */
  color: #dddddd;
  filter: grayscale(40%);
}

/* Ensure visited style overrides active/inactive background/color */
.btn-visited.btn-active,
.btn-visited.btn-inactive {
  background-color: #708090;
  color: #cccccc;
  border: 1px solid #5a6874;
}
.btn-visited.btn-active:hover,
.btn-visited.btn-inactive:hover {
  background-color: #8492a0;
  color: #dddddd;
}

/* ... (body, game-container, image styles same) ... */

#content-below-image {
  width: 100%;
  min-height: 70px; /* Increased min-height slightly */
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 15px 0;
  box-sizing: border-box;
}

/* Base styles for animating elements */
.dialogue-text,
#button-container {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.dialogue-text.visible,
#button-container.visible {
  opacity: 1;
  transform: translateY(0);
}

.dialogue-text {
  width: auto;
  max-width: 95%;
  text-align: center;
  font-size: 1.1em; /* Increased font size */
  color: #f0f0f0;
  background-color: rgba(15, 20, 22, 0.92);
  padding: 14px 22px; /* Increased padding */
  border-radius: 6px; /* Slightly larger radius */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease, color 0.2s ease; /* Added color transition */
}
.dialogue-text:hover {
  background-color: rgba(25, 30, 32, 0.95);
}

/* NEW: Pink text color class */
.dialogue-text.text-pink {
  color: #ff89c4; /* Brighter pink */
}
.dialogue-text.text-pink:hover {
  color: #ffaadd; /* Even brighter on hover */
}
.dialogue-text.text-green {
  color: green; /* Brighter green */
}
.dialogue-text.text-green:hover {
  color: rgb(0,140,0); /* Even brighter on hover */
}
.dialogue-text.text-blue {
  color: rgb(0, 220, 220); /* Cyan */
}
.dialogue-text.text-blue:hover {
  color: rgb(0, 255, 255); /* Brighter cyan */
}

#button-container {
  justify-content: center;
  gap: 18px; /* Increased gap */
  flex-wrap: wrap;
  width: 100%;
}

button {
  padding: 10px 24px; /* Increased padding */
  border: none;
  border-radius: 5px;
  font-size: 1.05em; /* Increased font size */
  font-weight: bold;
  cursor: pointer;
  min-width: 90px; /* Increased min width */
  transition: background-color 0.2s ease, transform 0.1s ease, filter 0.2s ease; /* Added filter transition */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ... (active, inactive, visited styles - keep visited override) ... */
.btn-active {
  /* ... */
}
.btn-active:hover {
  /* ... */
}
.btn-inactive {
  /* ... */
}
.btn-inactive:hover {
  /* ... */
}

.btn-visited {
  background-color: #708090;
  color: #cccccc;
  border: 1px solid #5a6874;
  filter: grayscale(50%);
}
.btn-visited:hover {
  background-color: #8492a0;
  color: #dddddd;
  filter: grayscale(40%);
}
.btn-visited.btn-active,
.btn-visited.btn-inactive {
  background-color: #708090;
  color: #cccccc;
  border: 1px solid #5a6874;
}
.btn-visited.btn-active:hover,
.btn-visited.btn-inactive:hover {
  background-color: #8492a0;
  color: #dddddd;
}

.dialogue-text {
  width: auto;
  max-width: 95%;
  text-align: center;
  /* UPDATED font-size */
  font-size: 1.25em; /* e.g., Increased from 1.1em */
  line-height: 1.5; /* Add line-height for better readability with larger text */
  color: #f0f0f0;
  background-color: rgba(15, 20, 22, 0.92);
  /* UPDATED padding */
  padding: 18px 25px; /* e.g., Increased from 14px 22px */
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* style.css */

/* ... (body, game-container, image styles same) ... */

#content-below-image {
  width: 100%;
  min-height: 80px; /* Increased min-height further */
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 0; /* Increased padding */
  box-sizing: border-box;
}

/* Base styles for animating elements */
.dialogue-text,
#button-container {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.dialogue-text.visible,
#button-container.visible {
  opacity: 1;
  transform: translateY(0);
}

.dialogue-text {
  width: auto;
  max-width: 95%;
  text-align: center;
  /* UPDATED font-size */
  font-size: 1.4em; /* Increased from 1.25em */
  line-height: 1.6; /* Adjusted line-height */
  color: #f0f0f0;
  background-color: rgba(15, 20, 22, 0.92);
  /* UPDATED padding */
  padding: 20px 30px; /* Increased from 18px 25px */
  border-radius: 7px; /* Slightly larger radius */
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4); /* Slightly larger shadow */
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.dialogue-text:hover {
  background-color: rgba(25, 30, 32, 0.95);
}

/* Pink text color class */
.dialogue-text.text-pink {
  color: #ff89c4;
}
.dialogue-text.text-pink:hover {
  color: #ffaadd;
}

#button-container {
  justify-content: center;
  gap: 20px; /* Increased gap */
  flex-wrap: wrap;
  width: 100%;
}

button {
  /* UPDATED padding */
  padding: 12px 28px; /* Increased from 10px 24px */
  border: none;
  border-radius: 6px; /* Slightly larger radius */
  /* UPDATED font-size */
  font-size: 1.15em; /* Increased from 1.05em */
  font-weight: bold;
  cursor: pointer;
  /* UPDATED min-width */
  min-width: 100px; /* Increased from 90px */
  transition: background-color 0.2s ease, transform 0.1s ease, filter 0.2s ease;
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.25); /* Slightly larger shadow */
}
button:active {
  transform: translateY(1px);
}

/* ... (active, inactive, visited styles remain the same, but will inherit new base button size/padding) ... */
.btn-active {
  background-color: #40e0d0;
  color: #1a2528;
}
.btn-active:hover {
  background-color: #38c7b7;
}
.btn-inactive {
  background-color: #ff69b4;
  color: white;
}
.btn-inactive:hover {
  background-color: #f05aa0;
}
.btn-visited {
  background-color: #708090;
  color: #cccccc;
  border: 1px solid #5a6874;
  filter: grayscale(50%);
}
.btn-visited:hover {
  background-color: #8492a0;
  color: #dddddd;
  filter: grayscale(40%);
}
.btn-visited.btn-active,
.btn-visited.btn-inactive {
  background-color: #708090;
  color: #cccccc;
  border: 1px solid #5a6874;
}
.btn-visited.btn-active:hover,
.btn-visited.btn-inactive:hover {
  background-color: #8492a0;
  color: #dddddd;
}

body {
  margin: 0;
  /* Keep existing body styles */
  position: relative; /* Needed if start screen uses absolute positioning */
  min-height: 100vh; /* Ensure body takes full height */
}

/* Start Screen Styles */
#start-screen {
  position: fixed; /* Or absolute if body is relative */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8); /* Dark semi-transparent background */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000; /* Ensure it's on top */
  color: white;
  text-align: center;
  font-family: sans-serif;
  opacity: 1;
  transition: opacity 0.5s ease-out; /* Fade out effect */
}

#start-screen.hidden {
  opacity: 0;
  pointer-events: none; /* Prevent interaction when hidden */
}

.start-screen-content {
  background-color: #2a2a2a; /* Darker box */
  padding: 40px 60px;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.start-screen-content h1 {
  margin-top: 0;
  color: #eee;
}

.start-screen-content p {
  color: #ccc;
  margin-bottom: 30px;
}

.start-screen-content button {
  display: inline-block; /* Or block with margin auto for centered stacking */
  padding: 12px 25px;
  font-size: 1.1em;
  margin: 10px;
  cursor: pointer;
  border: none;
  border-radius: 5px;
  background-color: #4caf50; /* Greenish */
  color: white;
  transition: background-color 0.2s ease;
}

.start-screen-content button:hover {
  background-color: #45a049;
}

.start-screen-content #load-game-btn {
  background-color: #007bff; /* Blue */
}
.start-screen-content #load-game-btn:hover {
  background-color: #0056b3;
}

.error-message {
  color: #ff4d4d; /* Red */
  margin-top: 15px;
  font-weight: bold;
}

/* Utility class to hide elements */
.hidden {
  display: none !important; /* Use important if needed to override other styles */
}

#text-container {
  background-color: rgba(0, 0, 0, 0.7); /* Semi-transparent black background */
  color: #ffffff; /* White text color for contrast */
  padding: 15px 20px; /*Add padding around the text */
  margin: 10px 5%; /* Add some margin top/bottom and center horizontally */
  border-radius: 8px; /* Optional: Add rounded corners */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4); /* Optional: Add a subtle shadow */

  /* Ensure text within the container is handled well */
  display: block; /* Make sure it behaves like a block */
}

#scene-text {
  font-size: 1.2em; /* Increase font size (adjust value as needed, e.g., 18px, 1.1em) */
  line-height: 1.5; /* Improve readability with slightly more line spacing */
  margin: 0; /* Remove default paragraph margins if needed */
  /* The color is inherited from #text-container */
}

/* Specific style for highlighted text (if you use text-pink class) */
#scene-text.text-pink {
  color: #ffc0cb; /* Ensure pink text is still visible on the dark background */
  font-weight: bold; /* Make it stand out more */
}



#gallery-screen {
    display: flex; /* Use flexbox for layout */
    flex-direction: column; /* Stack controls, viewer, and list vertically */
    width: 100%;
    max-width: 900px; /* Or your game's max width */
    margin: 20px auto;
    padding: 15px;
    box-sizing: border-box;
    background-color: #222; /* Darker background for gallery */
    color: #eee;
    border-radius: 8px;
}

#gallery-screen.hidden {
    display: none;
}

#gallery-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #444;
}

#gallery-controls h2 {
    margin: 0;
    font-size: 1.5em;
}

#gallery-scene-viewer {
    /* Mimic game-container structure if needed, or simplify */
    /* For now, let's assume it contains gallery-game-area and gallery-button-container */
    margin-bottom: 20px;
    border: 1px solid #555;
    padding: 10px;
    background-color: #333;
    min-height: 300px; /* Example height */
}

#gallery-game-area {
    position: relative; /* For title card positioning */
    text-align: center; /* Center image if smaller than container */
}

#gallery-scene-image {
    max-width: 100%;
    max-height: 400px; /* Adjust as needed */
    display: block;
    margin: 0 auto 10px auto;
    border: 1px solid #444;
}
/* Gallery Title Card - similar to game one but uses gallery IDs */
#gallery-room-title-card {
    position: absolute;
    bottom: 10px; /* Adjust if image has margin-bottom */
    left: 0;
    width: 100%;
    height: 20%;
    background-color: rgba(0, 0, 0, 0.75);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out;
    z-index: 10;
    box-sizing: border-box;
    padding: 10px;
}

#gallery-room-title-card.visible {
    opacity: 1;
    visibility: visible;
}

#gallery-room-title-text {
    margin: 0;
    font-size: 1.8em;
    color: white;
}


#gallery-text-container {
    background-color: rgba(0, 0, 0, 0.6);
    padding: 15px;
    margin-top: 10px;
    border-radius: 5px;
    min-height: 50px;
    text-align: left;
    cursor: pointer; /* For advancing dialogue */
}
#gallery-text-container.hidden {
    display: none;
}


#gallery-scene-text {
    margin: 0;
    line-height: 1.6;
    color: #fff; /* Default text color */
}
#gallery-scene-text.text-pink { /* For pink text in gallery */
    color: hotpink;
}


#gallery-button-container {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

#gallery-button-container button {
    /* Style gallery buttons similar to game buttons but maybe distinct */
    padding: 8px 15px;
    border: 1px solid #666;
    background-color: #4CAF50; /* Greenish for gallery actions */
    color: white;
    cursor: pointer;
    border-radius: 4px;
}
#gallery-button-container button.btn-inactive {
    background-color: #777;
}


#gallery-scene-list-container {
    max-height: 300px; /* Make scene list scrollable */
    border: 1px solid #555;
    padding: 10px;
    background-color: #2a2a2a;
}

#gallery-scene-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

#gallery-scene-list li {
    padding: 8px;
    cursor: pointer;
    border-bottom: 1px solid #444;
    transition: background-color 0.2s ease;
}

#gallery-scene-list li:last-child {
    border-bottom: none;
}

#gallery-scene-list li:hover {
    background-color: #555;
}

#gallery-scene-list li.active-gallery-item {
    background-color: #007bff; /* Highlight active scene */
    color: white;
}

/* Adjustments for text visibility inside gallery text container */
#gallery-text-container p {
    transition: opacity 0.3s ease-out;
    opacity: 0;
}

#gallery-text-container p.visible {
    opacity: 1;
}

#gallery-edit-scene-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

#gallery-content-area {
    /* This will hold either preview or editor */
}

#gallery-editor-area {
    padding: 15px;
    border: 1px dashed #888;
    margin-top: 10px;
    background-color: #3a3a3a;
    text-align: left;
}

#gallery-editor-area.hidden {
    display: none;
}

#gallery-editor-area h3, #gallery-editor-area h4 {
    margin-top: 0;
    color: #eee;
}

.gallery-input-field {
    width: 90%;
    padding: 8px;
    margin-bottom: 10px;
    background-color: #555;
    color: #fff;
    border: 1px solid #777;
    border-radius: 4px;
}
#gallery-scene-properties-editor {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #555;
}
#gallery-scene-properties-editor label {
    display: block;
    margin-bottom: 5px;
    color: #ccc;
}


.dialogue-line-editor {
    border: 1px solid #505050;
    padding: 10px;
    margin-bottom: 10px;
    background-color: #404040;
    border-radius: 4px;
}

.dialogue-line-editor label {
    display: block;
    margin-bottom: 3px;
    color: #ccc;
    font-size: 0.9em;
}

.dialogue-line-editor textarea {
    width: 100%;
    min-height: 60px;
    box-sizing: border-box;
}

.dialogue-line-editor input[type="text"],
.dialogue-line-editor input[type="number"] {
    width: 100%; /* Full width for easier editing */
    box-sizing: border-box;
}

/* Simple controls for reordering - more complex later if needed */
.dialogue-line-controls button {
    margin-right: 5px;
    font-size: 0.8em;
    padding: 3px 6px;
}

body {
  font-family: sans-serif;
  margin: 0;
  padding: 20px;
  background-color: #f4f4f4;
}
h1,
h2,
h3,
h4 {
  color: #333;
}
#editor-container {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
#sidebar {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid #ccc;
  padding-right: 20px;
}
#main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 10px; /* Reduced gap */
}
.sidebar-section {
  margin-bottom: 15px;
}
ul {
  list-style: none;
  padding: 0;
  margin: 0;
} /* Reset margin for ul */
#floor-list li,
#room-list li {
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  word-break: break-all;
  background-color: #fff;
}
#floor-list li:last-child,
#room-list li:last-child {
  border-bottom: none;
}
#floor-list li:hover,
#room-list li:hover {
  background-color: #e9e9e9;
}
#floor-list li.selected,
#room-list li.selected {
  background-color: #d0e0f0;
  font-weight: bold;
}
button {
  padding: 8px 15px;
  margin-top: 5px;
  margin-right: 5px;
  cursor: pointer;
  border: 1px solid #ccc;
  background-color: #e7e7e7;
  border-radius: 4px;
}
button:hover {
  background-color: #dcdcdc;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}
.danger-btn {
  background-color: #f44336;
  color: white;
  border: none;
}
.danger-btn:hover {
  background-color: #da190b;
}
hr {
  margin: 15px 0;
  border: 0;
  border-top: 1px solid #eee;
}
.hidden {
  display: none !important;
}
.editor-panel {
  border: 1px solid #ccc;
  padding: 15px;
  background-color: #fff;
  border-radius: 5px;
  margin-top: 0; /* Remove top margin if tabs handle spacing */
}
.form-group {
  margin-bottom: 12px;
}
.form-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: bold;
  font-size: 0.9em;
}
.form-group input[type="text"],
.form-group select,
.form-group input[type="number"] {
  width: 95%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}
.form-group input[readonly] {
  background-color: #eee;
}
.form-group small,
.small-info {
  font-size: 0.8em;
  color: #666;
  display: block;
  margin-top: 3px;
}
.flags-group label {
  display: inline-block;
  margin-right: 15px;
  font-weight: normal;
}
.flags-group input[type="checkbox"] {
  margin-right: 5px;
  vertical-align: middle;
}
.dialogue-item,
.button-item {
  border: 1px dashed #ddd;
  padding: 10px;
  margin-bottom: 10px;
  background-color: #fafafa;
}
.dialogue-item-image-section,
.button-item span {
  margin-left: 10px;
}
.remove-btn {
  background-color: #f44336;
  color: white;
  border: none;
  padding: 3px 8px;
  font-size: 0.8em;
  float: right;
}
#export-controls {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #ccc;
}
#loaded-folder-info {
  font-size: 0.9em;
  color: #555;
  margin-top: 5px;
}

/* Room Image Preview & Dropzone */
.room-image-group .image-preview-dropzone {
  margin-top: 5px;
  padding: 10px;
  border: 2px dashed #ccc;
  border-radius: 4px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.room-image-group .image-preview-dropzone.drag-over {
  background-color: #e8f0fe;
  border-color: #90caf9;
}
.room-image-group .preview-box {
  border: 1px solid #ddd;
  background-color: #f8f8f8;
  min-height: 100px;
  max-height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
}
#room-image-preview {
  max-width: 100%;
  max-height: 190px;
  display: block;
  object-fit: contain;
  opacity: 1;
  transition: opacity 0.3s ease;
}
#room-image-preview.hidden {
  opacity: 0;
}
#no-room-preview-text {
  position: absolute;
  color: #888;
  font-style: italic;
  padding: 10px;
  text-align: center;
}
#no-room-preview-text.hidden {
  display: none;
}

/* Dialogue Item Image Preview */
.dialogue-item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
}
.dialogue-item > label {
  width: auto;
}
.dialogue-item > input,
.dialogue-item > select {
  margin-right: 10px;
  flex-grow: 1;
  min-width: 80px;
}
.dialogue-item-image-section {
  width: 80px;
  text-align: center;
  margin-left: auto;
  flex-shrink: 0;
}
.dialogue-item-image-section label {
  font-size: 0.8em;
  display: block;
  margin-bottom: 3px;
  color: #555;
}
.dialogue-image-dropzone {
  border: 1px dashed #ccc;
  min-height: 40px;
  max-height: 60px;
  background-color: #f0f0f0;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.dialogue-image-dropzone.drag-over {
  background-color: #e8f0fe;
  border-color: #90caf9;
}
.dialogue-image-preview {
  max-width: 100%;
  max-height: 58px;
  object-fit: contain;
  display: block;
}
.dialogue-no-preview-text {
  position: absolute;
  font-size: 0.7em;
  color: #888;
  padding: 5px;
}

/* Connections Display */
.connections-display {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  background-color: #f9f9f9;
  padding: 10px;
  border: 1px solid #eee;
  border-radius: 4px;
  font-size: 0.85em;
  margin-bottom: 15px;
}
.connections-display div {
  flex: 1;
}
.connections-display h4 {
  margin-top: 0;
  margin-bottom: 5px;
  color: #444;
  border-bottom: 1px solid #eee;
  padding-bottom: 3px;
  font-size: 0.95em;
}
.connections-display ul {
  max-height: 70px;
  overflow-y: auto;
}
.connections-display li {
  padding: 2px 0;
  color: #666;
  word-break: break-all;
  border: none;
  cursor: default;
}
.connections-display li:hover {
  background-color: transparent;
}

#image-container {
  position: relative;
  display: inline-block; /* or block, depending on your layout */
}

/* --- NEW/MODIFIED Styles --- */

/* Tab Controls */
.tab-controls {
  margin-bottom: 10px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 5px;
}
.tab-btn {
  padding: 8px 15px;
  border: 1px solid #ccc;
  border-bottom: none;
  background-color: #f1f1f1;
  cursor: pointer;
  margin-right: 3px;
  border-radius: 4px 4px 0 0;
  position: relative;
  bottom: -1px; /* Overlap border slightly */
}
.tab-btn.active-tab {
  background-color: #fff;
  border-color: #ccc;
  border-bottom: 1px solid #fff; /* Hide bottom border */
  font-weight: bold;
}
.tab-btn:hover:not(.active-tab) {
  background-color: #e9e9e9;
}

/* Tab Panels */
.tab-panel {
  display: none; /* Hide panels by default */
}
.tab-panel.active-panel {
  display: block; /* Show active panel */
}

/* Floorplan Specific Styles */
#floorplan-controls {
  padding: 10px;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  margin-bottom: 10px;
  border-radius: 4px;
}
#floorplan-controls p {
  margin: 0 0 5px 0;
  font-size: 0.9em;
}
.adj-btn {
  padding: 5px 10px;
  font-size: 0.85em;
  margin-right: 8px;
  background-color: #6c757d;
  color: white;
  border: none;
}
.adj-btn:hover:not(:disabled) {
  background-color: #5a6268;
}
#adj-message {
  color: #007bff;
  font-weight: bold;
} /* Info message style */

#floorplan-grid-container {
  position: relative; /* Crucial for SVG overlay */
  min-height: 300px;
  background-color: #e9ecef; /* Slightly darker grid background */
  border: 1px solid #ccc;
  padding: 10px;
  overflow: auto;
  max-height: 60vh; /* Limit height relative to viewport */
}

#floorplan-grid {
  position: relative; /* Container for absolute cells */
  width: 100%;
  height: 100%;
}

.floorplan-cell {
  position: absolute;
  width: 90px; /* Cell dimensions */
  height: 65px;
  border: 1px solid #aaa;
  background-color: #fff;
  font-size: 0.75em;
  padding: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease,
    box-shadow 0.2s ease;
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  box-sizing: border-box;
  border-radius: 3px;
}
.floorplan-cell:hover {
  background-color: #e0f0ff;
  transform: translateY(-2px);
  box-shadow: 2px 4px 6px rgba(0, 0, 0, 0.15);
  z-index: 10;
}
.floorplan-cell.selected {
  background-color: #a0c4e8;
  border: 2px solid #336699;
  font-weight: bold;
  box-shadow: 2px 4px 6px rgba(0, 0, 0, 0.2);
  z-index: 5;
}
.floorplan-cell.type-entrance {
  background-color: #d1e7dd;
  border-color: #a3cfbb;
} /* Greenish */
.floorplan-cell.type-key {
  background-color: #fff3cd;
  border-color: #ffe69c;
} /* Yellowish */
.floorplan-cell.type-door {
  background-color: #e2e3e5;
  border-color: #d3d6d8;
} /* Greyish */
.floorplan-cell.type-maze {
  background-color: #f8f9fa;
  border-color: #dee2e6;
} /* Light grey */

#floorplan-prompt {
  text-align: center;
  color: #666;
  padding: 20px;
  font-style: italic;
}

/* SVG Connection Lines */
#floorplan-connections-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%; /* Should match grid container size ideally */
  height: 100%;
  pointer-events: none; /* Allow clicks to pass through to cells */
  z-index: 1; /* Behind cells but above background */
  overflow: visible; /* Ensure lines aren't clipped */
}
#floorplan-connections-svg line {
  stroke: #5a6268;
  stroke-width: 2;
  opacity: 0.6;
}

/* Key Room Dialogue Generator Section */
.key-room-section {
  background-color: #fff3cd; /* Light yellow background */
  border: 1px solid #ffe69c;
  padding: 10px;
  margin-bottom: 15px;
  border-radius: 4px;
}
.key-room-section h4 {
  color: #856404;
  margin-top: 0;
}
#key-sequence-image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding: 5px;
  border: 1px solid #eee;
  min-height: 50px; /* Ensure area is visible */
  background-color: #fff;
}
.key-sequence-thumbnail {
  width: 60px;
  height: 60px;
  object-fit: contain; /* Scale image within bounds */
  border: 1px solid #ccc;
  background-color: #f8f8f8;
  padding: 2px;
}
#generate-key-dialogue-btn {
  background-color: #ffc107; /* Amber */
  border-color: #ffc107;
  color: #343a40;
}
#generate-key-dialogue-btn:hover:not(:disabled) {
  background-color: #e0a800;
}
#clear-key-sequence-btn {
  background-color: #dc3545; /* Red */
  color: white;
  border: none;
  margin-left: 10px;
}

/* Ensure buttons within items don't prevent dragover */
.dialogue-item .remove-btn {
  pointer-events: auto;
} /* Allow clicks on remove button */
