@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap');
body { margin: 0; font-family: 'Inter', sans-serif; display: flex; height: 100vh; background-color: #15191e; color: #e0e0e0; padding-bottom: 60px; /* Added to prevent footer overlap */ }
#sidebar { width: 250px; background-color: #20262d; padding: 15px; border-right: 1px solid #3f4c5a; display: flex; flex-direction: column; gap: 10px; }
.sidebar-section { margin-bottom: 20px; border-top: 1px solid #3f4c5a; padding-top: 10px; }
.sidebar-section h3, .sidebar-section h4 { margin-top: 0; border-bottom: 1px solid #3f4c5a; padding-bottom: 5px;}
.tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid #3f4c5a; margin-bottom: 10px;}
.tab-button { background: none; border: none; padding: 10px 15px; cursor: pointer; color: #e0e0e0; font-size: 14px; border-bottom: 2px solid transparent; }
#tab-story-beats .sidebar-section button {
    display: block;
    width: 100%;
    margin-bottom: 10px;
}
.tab-button.active { border-bottom-color: #b6cae1; color: #b6cae1; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Main content area containers: #map-container and #note-editor-container */
#map-container {
    position: relative; /* This is key for stacking canvases and containing overlays */
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 10px;
}

.canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
    cursor: grab;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    touch-action: none; /* Prevent browser touch gestures */
}

#quest-canvas { /* Using ID for specificity */
    display: block;
    width: 100%;
    height: 100%;
    background-color: #2a3138; /* Dark background */
}

.card-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allow events to pass through to the canvas */
}

.card {
    background-color: #3a4f6a; /* Dark card background */
    border: 2px solid #5f6a7a; /* Border color */
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    position: absolute;
    width: 300px; /* New width */
    height: 300px; /* New height */
    pointer-events: auto; /* Re-enable pointer events for the cards */
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    transform-origin: center center;
    color: #e0e0e0; /* Light text */
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: 1;
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(80, 80, 80, 0.5); /* 50% grey transparent */
    z-index: 2;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    box-sizing: border-box;
    text-align: center;
}

/* Status-based Glows */
.card.status-unavailable {
    box-shadow: 0 0 15px 5px rgba(128, 128, 128, 0.7); /* Grey glow */
}
.card.status-available {
    box-shadow: 0 0 15px 5px rgba(0, 0, 255, 0.7); /* Blue glow */
}
.card.status-active {
    box-shadow: 0 0 15px 5px #FFD700; /* Gold glow */
}
.card.status-completed {
    box-shadow: 0 0 15px 5px #008000; /* Green glow */
}
.card.status-failed {
    box-shadow: 0 0 15px 5px #8B0000; /* Blood red glow */
}
.card.status-abandoned {
    box-shadow: 0 0 15px 5px #483D8B; /* Dark Royal Purple glow */
}

.card:hover {
    transform: scale(1.05);
    border-color: #b6cae1; /* Highlight border on hover */
}

.card.selected {
    border-color: #8ab4f8; /* A brighter selection color */
    transform: scale(1.08);
    box-shadow: 0 8px 20px rgba(138, 180, 248, 0.2);
    z-index: 10;
}

.card h3 {
    margin: 0;
    font-size: 1.5rem; /* Existing font size */
    font-weight: 600;
    color: #e0e0e0;
    text-align: center;
    width: 100%;
}

.card-subtitle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 0.5rem;
}

.card-rating {
    font-size: 1.2rem;
    color: #f5b32d;
}

.card-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    width: 100%;
    overflow: hidden;
}

.card-characters {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 0.5rem;
}

.card-character-profile {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 2px solid white;
    background-color: #5f6a7a;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
}

.card-description {
    font-size: 0.9rem;
    margin: 0;
    width: 100%;
    /* The font size will be adjusted by JS if needed */
}

.card-rewards {
    font-size: 0.8rem;
    font-style: italic;
    margin-top: auto; /* Pushes it to the bottom */
    width: 100%;
}

.context-menu {
    position: absolute;
    background-color: #20262d; /* Dark context menu */
    border: 1px solid #3f4c5a;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    list-style: none;
    padding: 8px 0;
    margin: 0;
    z-index: 200;
    min-width: 150px;
    cursor: pointer;
}

.context-menu li {
    padding: 10px 15px;
    font-size: 0.9rem;
    color: #e0e0e0; /* Light text */
    transition: background-color 0.1s ease;
}

.context-menu li:hover {
    background-color: #3f4c5a; /* Hover color */
}

/* Mode-specific cursors */
body.linking-mode {
    cursor: crosshair;
}

body.moving-mode {
    cursor: grabbing;
}

/* #note-editor-container has initial inline styles: display: none; flex-grow: 1; padding: 10px; */
/* JS will toggle this class to show it and ensure flex properties */
#note-editor-container.active {
    display: flex !important; /* Override inline display: none */
    flex-direction: column; /* To make #note-editor-area inside it grow */
}

#dm-canvas, #drawing-canvas, #shadow-canvas {
    position: absolute;
    max-width: 100%;
    max-height: 100%;
    border: 1px solid #3f4c5a;
}

#dm-canvas {
    background-color: #2a3138;
    z-index: 1; /* Base canvas */
}

#shadow-canvas {
    background-color: transparent;
    z-index: 2; /* Shadow canvas on top of map */
    pointer-events: none; /* Clicks pass through unless a shadow tool is active */
}

#drawing-canvas {
    background-color: transparent;
    z-index: 3; /* UI/drawing canvas on top of shadows */
    pointer-events: none; /* Allows clicks to pass through to the dm-canvas */
}
button, input[type="file"] {
    padding: 8px 12px;
    background-color: #b6cae1;
    max-width: 100%;
    box-sizing: border-box;
    color: #15191e;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}
button:hover, input[type="file"]:hover {
    background-color: #a0b4c9;
}

#map-tools-section {
    display: none;
}

/* Styling for buttons in the map tools section */
#map-tools-section .map-tools-buttons button {
    display: block; /* Stack buttons vertically */
    width: 100%; /* Make buttons take full width of their container */
    margin-bottom: 5px; /* Space between buttons */
    box-sizing: border-box; /* Ensure padding and border don't expand width */
}

#map-tools-section .map-tools-buttons button:last-child {
    margin-bottom: 0; /* No margin for the last button */
}

/* Styling for disabled map tool buttons */
#map-tools-section .map-tools-buttons button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #5f6a7a; /* Darker, less prominent background */
    color: #a0a0a0; /* Greyed out text */
}

/* Ensure non-disabled buttons in map tools still use default button styles if overridden by [disabled] */
#map-tools-section .map-tools-buttons button:not([disabled]):hover {
    background-color: #a0b4c9; /* Standard hover from general button styles */
}


label { display: block; margin-bottom: 5px; }
h3 { margin-top: 0; border-bottom: 1px solid #3f4c5a; padding-bottom: 5px;}
.button-like-label {
    padding: 8px 12px;
    background-color: #b6cae1;
    color: #15191e;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: inline-block; /* To behave like a button */
}
.button-like-label:hover {
    background-color: #a0b4c9;
}
.visibility-icon {
    margin-right: 8px;
    cursor: pointer;
    display: inline-block; /* Ensures it takes space */
    width: 20px; /* Give it a fixed width for alignment */
    text-align: center;
}
#active-maps-list, #active-maps-list ul {
    list-style-type: none;
    padding-left: 0; /* Reset default browser padding for ULs */
    margin-top: 0; /* Optional: Reset default margins */
    margin-bottom: 0; /* Optional: Reset default margins */
}
/* Individual list items will still have padding-left set by JS for hierarchy */
.edit-icon {
    cursor: pointer;
    margin-left: 8px;
    font-size: 0.9em; /* Slightly smaller than h3 */
    display: inline-block; /* Allows margin and proper positioning */
}

/* Styling for map list items */
.map-list-item {
    padding: 5px 2px; /* Add some padding for easier clicking */
    border-radius: 3px;
    margin-bottom: 2px; /* Slight spacing between items */
}

.map-list-item.clickable-map:hover {
    background-color: #2a3138; /* Hover effect when clickable */
    cursor: pointer;
}

/* When in edit mode, the hover effect is different (or can be non-existent if preferred) */
.uploaded-maps-list.edit-mode-active .map-list-item:hover {
     background-color: #313842; /* Different hover for edit mode, or remove if not desired */
}

.file-actions {
    margin-left: 10px; /* Spacing between filename and action icons */
}
.file-action-icon {
    cursor: pointer;
    margin-left: 5px; /* Spacing between icons */
    display: none; /* Hidden by default, shown when .file-actions is displayed */
    padding: 2px; /* Make click target slightly larger */
    border-radius: 3px; /* Slightly rounded corners for icons if they had a background */
}
.file-action-icon:hover {
    /* background-color: #3f4c5a; */ /* Optional: Subtle hover for icons */
    color: #b6cae1; /* Highlight icon color on hover */
}
/* Ensure icons within an active .file-actions span are visible */
.edit-mode-active .file-actions .file-action-icon {
    display: inline-block;
}
/* Specific styling for move icons if needed, e.g., to prevent them from looking too large */
.move-map-up, .move-map-down {
    font-weight: bold;
}

#active-maps-list.edit-mode-active .map-name-span:hover {
    /* Optional: Style for map names when in edit mode, e.g., different background */
    /* background-color: #3a4148; */ /* Example */
}

/* Styling for selected map items in either list */
.selected-map-item {
    background-color: #3a4f6a !important; /* A distinct background color for selection */
    /* border-left: 3px solid #b6cae1; */ /* Example: a border indicator */
    font-weight: bold; /* Make text bold */
    color: #ffffff !important; /* Ensure text is readable */
}
/* Ensure hover on a selected item doesn't obscure selection, or is complementary */
.selected-map-item:hover {
    background-color: #4a5f7a !important; /* Slightly different hover for selected item */
}

.rename-input-active {
    /* Basic styling for the rename input field */
    padding: 2px 4px;
    border: 1px solid #b6cae1;
    background-color: #15191e;
    color: #e0e0e0;
    border-radius: 3px;
}

.hover-label {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none; /* Allows mouse events to pass through to the canvas */
    z-index: 1000; /* Ensure it's on top */
    /* display: none; is handled by inline style initially and JS */
}

/* Context Menu Styling */
.context-menu {
    background-color: #2a3138; /* Dark background, similar to canvas */
    border: 1px solid #3f4c5a; /* Border similar to other elements */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2); /* Subtle shadow for depth */
    z-index: 1001; /* Ensure it's above the hover-label and canvas elements */
    color: #e0e0e0; /* Light text color */
    border-radius: 4px; /* Rounded corners */
}

.context-menu ul {
    list-style: none;
    padding: 5px 0;
    margin: 0;
}

.context-menu ul li {
    padding: 8px 15px;
    cursor: pointer;
    font-size: 14px;
}

.context-menu ul li:hover {
    background-color: #3f4c5a; /* Hover effect for menu items */
    color: #b6cae1; /* Highlight text on hover */
}

/* Notes Tab Styles */
/* #tab-notes no longer needs to be a flex column for the editor,
   but keeping it block or flex for its children (controls, list) is fine.
   Height 100% might also not be necessary if it's just for the list area,
   which will have its own scroll. */
#tab-notes {
    /* display: flex; */ /* Not strictly necessary anymore for editor */
    /* flex-direction: column; */
    /* height: 100%; */ /* Let content define its height within sidebar constraints */
}

.notes-controls {
    padding-bottom: 10px; /* Add some space below the controls */
}

#create-new-note-button {
    width: 100%;
    margin-top: 5px;
}

#notes-sidebar {
    /* border-top: 1px solid #3f4c5a; Already part of .sidebar-section */
    /* padding-top: 10px; Already part of .sidebar-section */
    /* max-height is set inline in HTML, can be moved here if preferred */
    overflow-y: auto;
}

#notes-list li {
    padding: 8px 10px;
    border-radius: 3px;
    margin-bottom: 3px;
    cursor: pointer;
    border: 1px solid transparent; /* For consistent sizing with selected */
    display: flex; /* To align text and icons */
    justify-content: space-between; /* Pushes icons to the right */
    align-items: center; /* Vertically aligns text and icons */
}

#notes-list li:hover {
    background-color: #2a3138;
}

#notes-list li.selected-note-item {
    background-color: #3a4f6a !important;
    border-left: 3px solid #b6cae1;
    font-weight: bold;
    color: #ffffff !important;
}

/* Settings Overlay */
#settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1005; /* High z-index to be on top */
}

#settings-window {
    width: 80%;
    max-width: 900px;
    height: 80%;
    max-height: 600px;
    background-color: #20262d;
    border: 1px solid #3f4c5a;
    border-radius: 8px;
    display: flex;
    overflow: hidden;
}

#settings-sidebar {
    width: 200px;
    background-color: #15191e;
    padding: 15px;
    border-right: 1px solid #3f4c5a;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-category-button {
    background: none;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    color: #e0e0e0;
    font-size: 14px;
    text-align: left;
    border-radius: 4px;
}

.settings-category-button.active {
    background-color: #3a4f6a;
    font-weight: bold;
}

.settings-category-button:hover:not(.active) {
    background-color: #2a3138;
}

#settings-content {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
}

.settings-category-content {
    display: none;
}

.settings-category-content.active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#import-export-content h2 {
    margin-top: 0;
    flex-shrink: 0;
}

.import-export-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.import-export-controls button {
    background-color: #3a4f6a;
}

.import-export-main {
    display: flex;
    flex-grow: 1;
    gap: 15px;
    min-height: 0; /* Important for flex children with overflow */
}

.import-export-list {
    width: 30%;
    border: 1px solid #3f4c5a;
    border-radius: 4px;
    overflow-y: auto;
    background-color: #15191e;
    padding: 5px;
}

.import-export-preview {
    width: 70%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.import-export-preview textarea {
    flex-grow: 1;
    width: 100%;
    resize: none;
    background-color: #15191e;
    border: 1px solid #3f4c5a;
    color: #e0e0e0;
    border-radius: 4px;
    padding: 10px;
    font-family: monospace;
}

.import-export-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

#automation-controls {
    text-align: center;
}

#automation-active-controls {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

/* Sizing for smaller toggle switch */
.switch.is-small {
  width: 40px;
  height: 22px;
}

.switch.is-small .slider:before {
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
}

.switch.is-small input:checked + .slider:before {
  transform: translateX(18px);
}

/* Styling for the labels next to the toggle */
.toggle-label {
    font-size: 12px;
    color: #a0b4c9; /* Muted color for non-active */
    transition: color 0.3s ease;
}

.toggle-label.active {
    color: #e0e0e0; /* Brighter color for active */
    font-weight: bold;
}

/* Asset Preview Pane */
#asset-preview-container {
    padding: 10px;
    background-color: rgba(21, 25, 30, 0.85);
    border-radius: 5px;
    border: 1px solid #3f4c5a;
    color: #e0e0e0;
}

#asset-preview-box {
    position: relative; /* Needed for positioning the chain points */
    width: 150px;
    height: 150px;
    background-color: #15191e;
    border: 1px solid #5f6a7a;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto; /* Center the box within its container */
}

.chain-point {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid white;
    transform: translate(-50%, -50%); /* Center the dot on its coordinates */
    z-index: 10;
}

#asset-chain-start-point {
    background-color: #4caf50; /* Green */
}

#asset-chain-end-point {
    background-color: #f44336; /* Red */
}

#asset-preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* Scales the image down to fit, maintaining aspect ratio */
    /* The transform (scale, rotate) will be applied via inline styles from JS */
}

#asset-preview-title {
    margin: 8px 0 0 0;
    font-size: 12px;
    color: #a0b4c9;
    text-align: center;
    word-break: break-all;
}

/* Assets Footer Tab Content */
#footer-assets {
    display: flex;
    flex-direction: column;
    width: 100%;
    /* padding: 10px; Let the explorer handle its own padding */
    gap: 10px;
    height: 100%; /* Make this fill the footer content area */
    box-sizing: border-box;
}

#assets-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#asset-explorer {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    background-color: #15191e; /* Darker background for the explorer area */
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #3f4c5a;
    min-height: 0; /* Important for flex children to allow scrolling */
}

#asset-path-display {
    color: #a0b4c9;
    font-style: italic;
    padding-bottom: 5px;
    border-bottom: 1px solid #3f4c5a;
}

#asset-file-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    flex-grow: 1;
}

.asset-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
    background-color: #2a3138;
    border: 2px solid transparent;
}

.asset-item:hover {
    background-color: #3f4c5a;
}

.asset-item.selected {
    border-color: #8ab4f8;
    box-shadow: 0 0 12px 4px rgba(138, 180, 248, 0.7);
}

.asset-item img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid #3f4c5a;
}

.asset-item svg {
    width: 80px;
    height: 80px;
    color: #b6cae1;
}

.asset-item .asset-name {
    font-size: 12px;
    text-align: center;
    word-break: break-all; /* To prevent long names from overflowing */
    line-height: 1.2;
}

.asset-favorite-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    cursor: pointer;
    color: #a0b4c9; /* Muted color for non-favorite */
    padding: 0;
    font-size: 20px; /* Make the star bigger */
    line-height: 1;
}

.asset-favorite-btn:hover {
    color: #ffd700; /* Gold color on hover */
}

.asset-favorite-btn.is-favorite {
    color: #ffd700; /* Gold for favorite */
}

.asset-favorite-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    cursor: pointer;
    color: #a0b4c9; /* Muted color for non-favorite */
    padding: 0;
}

.asset-favorite-btn:hover {
    color: #ffd700;
}

.asset-favorite-btn.is-favorite {
    color: #ffd700; /* Gold for favorite */
}

.asset-favorite-btn svg {
    width: 20px;
    height: 20px;
}

.story-step-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 5px;
}

.story-step-title {
    font-weight: bold;
}

.story-step-title:hover {
    background-color: #f0f0f0;
    cursor: text;
}

.story-step-text {
    font-size: 0.9em;
    color: #a0b4c9;
}

/* Styles for Automation Note Linking in Details Sidebar */
.available-notes-container {
    background-color: #15191e;
    border: 1px solid #3f4c5a;
    border-radius: 4px;
    padding: 5px;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 10px;
}

.available-note-item {
    padding: 8px;
    margin: 2px 0;
    background-color: #2a3138;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.available-note-item:hover {
    background-color: #3f4c5a;
    color: #b6cae1;
}

.automation-linked-notes-list {
    list-style-type: decimal; /* Use numbers for the ordered list */
    padding-left: 20px; /* Standard padding for ordered lists */
    margin-top: 5px;
}

.linked-note-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    margin-bottom: 2px;
}

.linked-note-item a {
    color: #8ab4f8;
    text-decoration: none;
    flex-grow: 1;
}

.linked-note-item a:hover {
    text-decoration: underline;
}

.remove-note-link-btn {
    background: none;
    border: none;
    color: #ff4d4d;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.remove-note-link-btn:hover {
    color: #ff8a8a;
}

.encounter-participant-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 8px;
    margin-bottom: 3px;
    background-color: #2a3138;
    border-radius: 3px;
    border: 1px solid #3f4c5a;
}

.remove-participant-btn {
    background: none;
    border: none;
    color: #ff4d4d;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.remove-participant-btn:hover {
    color: #ff8a8a;
}

.sidebar-placeholder {
    color: #8c96a2;
    font-style: italic;
    font-size: 0.9em;
    padding: 10px;
    text-align: center;
}

.module-card.automation-card-selected {
    box-shadow: 0 0 0 3px #4A90E2, 0 5px 15px rgba(0,0,0,0.3);
    transform: scale(1.05);
}

#automation-canvas .module-card.dragging {
    opacity: 0.5;
}

#shadow-tools-container, #assets-tools-container {
    display: flex;
    gap: 10px;
    padding: 10px;
    background-color: rgba(42, 49, 56, 0.8);
    border-radius: 5px;
}

#shadow-tools-container button.active,
#assets-tools-container button.active {
    background-color: #a0b4c9;
    box-shadow: 0 0 8px rgba(182, 202, 225, 0.7);
}

/* Opacity slider styles */
.asset-preview-slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.asset-preview-slider-container label {
    font-size: 12px;
    margin-bottom: 0; /* Override default label margin */
}

.asset-preview-slider-container input[type="range"] {
    flex-grow: 1;
    margin: 0; /* Override default input margin */
    padding: 0; /* Override default input padding */
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: #5f6a7a;
    outline: none;
    opacity: 0.7;
    transition: opacity .2s;
    border-radius: 4px;
}

.asset-preview-slider-container input[type="range"]:hover {
    opacity: 1;
}

.asset-preview-slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #b6cae1;
    cursor: pointer;
    border-radius: 50%;
}

.asset-preview-slider-container input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #b6cae1;
    cursor: pointer;
    border-radius: 50%;
}

#asset-preview-opacity-value {
    font-size: 12px;
    font-family: 'Courier New', Courier, monospace;
    min-width: 25px; /* Ensure space for "1.0" */
    text-align: right;
}

/* Automation View Styles */
#automation-container {
    display: flex;
    flex-grow: 1;
    height: 100%;
}

#modules-sidebar, #details-sidebar {
    width: 33.33%;
    background-color: #20262d;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#modules-sidebar {
    border-right: 1px solid #3f4c5a;
}

#details-sidebar {
    border-left: 1px solid #3f4c5a;
}

#automation-canvas-container {
    width: 33.33%;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align to top */
    overflow-y: auto; /* Allow scrolling */
    padding: 10px;
    background-color: #2a3138;
    border-left: 1px solid #3f4c5a;
    border-right: 1px solid #3f4c5a;
}

#automation-canvas {
    width: 100%;
    height: auto; /* Let content define height */
    background-color: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.module-card {
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #3f4c5a;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.2s, border-color 0.2s;
}

.module-card:hover {
    border-color: #b6cae1;
}

.module-card-dm {
    background-color: #4a5f7a; /* A blue-ish grey for DM only */
    color: #e0e0e0;
}

.module-card-both {
    background-color: #3a6a4f; /* A green-ish color for Both */
    color: #e0e0e0;
}

#automation-canvas .module-card {
    position: relative; /* Needed for absolute positioning of the label */
    cursor: default;
}

.automation-card-label {
    position: absolute;
    bottom: 5px;
    right: 8px;
    font-size: 11px;
    font-weight: normal;
    color: #a0b4c9;
    font-style: italic;
}

.quest-footer-card {
    padding: 8px 12px;
    background-color: #3a4f6a;
    color: #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 5px;
    border: 1px solid #5f6a7a;
}

.quest-footer-card:hover {
    background-color: #4a5f7a;
}

.quest-footer-card.selected {
    border-color: #b6cae1;
    box-shadow: 0 0 5px rgba(182, 202, 225, 0.5);
}

.quest-footer-card h4 {
    margin: 0 0 5px 0;
    font-size: 1.1em;
}

.quest-footer-card p {
    margin: 0;
    font-size: 0.9em;
    color: #a0b4c9;
}

.footer-placeholder {
    color: #a0b4c9;
    font-style: italic;
    padding: 10px;
    text-align: center;
}

#footer-active-quest-details h4 {
    margin-top: 15px;
    border-bottom: 1px solid #3f4c5a;
    padding-bottom: 5px;
}

#footer-active-quest-details h4:first-child {
    margin-top: 0;
}

.quest-steps-list {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.quest-steps-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    font-size: 0.95em;
}

.quest-steps-list input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.quest-steps-list label.completed {
    text-decoration: line-through;
    color: #8c96a2;
}

.quest-triggers-list {
    list-style: disc;
    padding-left: 20px;
    margin: 0 0 10px 0;
    font-size: 0.9em;
    color: #a0b4c9;
}

.successor-quests-container {
    margin-top: 15px;
    border-top: 1px solid #3f4c5a;
    padding-top: 10px;
}

/* Footer Tabs */
.footer-tabs {
    display: flex;
    background-color: #20262d;
    border-bottom: 1px solid #3f4c5a;
}

.footer-tab-button {
    background: none;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    color: #e0e0e0;
    font-size: 14px;
    border-bottom: 2px solid transparent;
}

.footer-tab-button.active {
    border-bottom-color: #b6cae1;
    color: #b6cae1;
}

.footer-content-container {
    display: grid;
    flex-grow: 1;
    min-height: 0;
    padding: 10px;
}

.footer-tab-content {
    grid-area: 1 / 1;
    width: 100%;
    visibility: hidden;
    display: flex; /* Keep flex for internal layout */
    min-height: 0;
}

.footer-tab-content.active {
    visibility: visible;
}

#footer-quests,
#footer-automation {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
}

#footer-quests-left,
#footer-quests-right,
#footer-quests-center,
#footer-automation-left,
#footer-automation-main {
    overflow-y: auto;
    padding: 10px;
    background-color: #15191e;
    border-radius: 4px;
}

/* JSON Export Modal Styles */
#json-export-overlay {
    /* This will use the .modal class, but we can override if needed */
    /* For now, we assume .modal provides the basic overlay */
}

#json-export-content-container {
    background-color: #2a3138;
    padding: 20px;
    border: 1px solid #3f4c5a;
    border-radius: 8px;
    width: 80%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

#json-export-close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #e0e0e0;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

#json-export-close-button:hover {
    color: #b6cae1;
}

#json-export-content-container h3 {
    margin-top: 0;
    border-bottom: 1px solid #3f4c5a;
    padding-bottom: 10px;
}

#json-export-content {
    background-color: #15191e; /* Darker background for the code */
    color: #d4d4d4;
    padding: 15px;
    border: 1px solid #3f4c5a;
    border-radius: 4px;
    white-space: pre-wrap;
    word-wrap: break-word;
    flex-grow: 1; /* Allow the pre tag to fill available space */
    overflow-y: auto; /* Add scrollbar if content overflows */
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

#copy-json-button {
    margin-top: 15px;
    padding: 10px;
    align-self: center; /* Center the button */
    width: 50%;
}

.trigger-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.trigger-text {
    flex-grow: 1;
}

.remove-trigger-btn {
    padding: 5px 10px;
}

/* New Story Beat Card Overlay Styles */
#story-beat-card-body h3 {
    border-bottom: 1px solid #ccc;
    padding-bottom: 5px;
    margin-top: 15px;
}

.editable-div, .editable-textarea {
    border: 1px solid #ccc;
    padding: 5px;
    min-height: 50px;
    border-radius: 4px;
    background-color: #fff;
}

.editable-textarea {
    width: 95%;
}

#quest-status, #quest-type, #quest-associated-maps {
    width: 100%;
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

#quest-associated-maps {
    height: 100px;
}

.npc-row {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
    align-items: center;
}

.npc-select, .npc-role {
    flex-grow: 1;
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.remove-npc-btn, #add-npc-btn {
    padding: 5px 10px;
}

.rewards-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: center;
}

#save-quest-details-btn {
    width: 100%;
    margin-top: 20px;
    padding: 10px;
    font-size: 16px;
}

/* New Story Steps & Difficulty Styles */
.difficulty-rating {
    cursor: pointer;
}

.star {
    font-size: 24px;
    color: #f5b32d;
}

.story-step-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.story-step-checkbox {
    width: 20px;
    height: 20px;
}

.story-step-text {
    flex-grow: 1;
}

.remove-step-btn {
    padding: 5px 10px;
}


.story-beat-card-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1002;
}

.story-beat-card-content {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 500px;
    max-height: calc(100% - 20px);
    background-color: #fcfcf8;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.story-beat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid #e9e8ce;
}

.story-beat-card-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: bold;
    color: #1c1c0d;
}

.story-beat-card-back-button,
.story-beat-card-close-button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #1c1c0d;
    padding: 0 5px;
}

#story-beat-card-body {
    padding: 20px;
    font-family: "Spline Sans", "Noto Sans", sans-serif;
    color: #1c1c0d;
}

#story-beat-card-body h1 {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 1rem;
}

#story-beat-card-body h3 {
    font-size: 18px;
    font-weight: bold;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

#story-beat-card-body p {
    font-size: 16px;
    line-height: 1.5;
}

#story-beat-card-body .status-tabs {
    display: flex;
    background-color: #f4f4e6;
    border-radius: 8px;
    padding: 5px;
    margin-bottom: 1rem;
}

#story-beat-card-body .status-tab {
    flex-grow: 1;
    text-align: center;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    color: #9e9d47;
    font-weight: 500;
}

#story-beat-card-body .status-tab.active {
    background-color: #fcfcf8;
    box-shadow: 0 0 4px rgba(0,0,0,0.1);
    color: #1c1c0d;
}

#story-beat-card-body .prerequisite,
#story-beat-card-body .reward-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

@media (max-width: 600px) {
    .story-beat-card-content {
        width: calc(100% - 20px);
        max-width: 350px;
    }
}

/* New Floating Footer Styles */
#dm-floating-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #20262d;
    border-top: 1px solid #3f4c5a;
    box-sizing: border-box;
    z-index: 1002;
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    max-height: 45vh;
    transform: translateY(100%);
    overflow-y: auto;
}

#dm-floating-footer.visible {
    transform: translateY(0);
}

#footer-content-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px;
    padding-right: 100px; /* Space for the floating d20 icon */
    box-sizing: border-box;
    flex-grow: 1;
    min-height: 0;
}

#footer-left {
    flex-basis: 30%;
    overflow-y: auto;
}

#footer-center {
    flex-basis: 60%;
    overflow-y: auto;
}

#dm-tools-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
    display: flex;
    gap: 10px;
}

#dm-tools-list li {
    padding: 8px 12px;
    background-color: #3a4f6a;
    color: #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    flex-grow: 1;
}

#dm-tools-list li:hover {
    background-color: #4a5f7a;
}

#footer-notes-area {
    width: 100%;
}

#dm-notes-input {
    width: 100%;
    padding: 8px;
    background-color: #15191e;
    border: 1px solid #3f4c5a;
    color: #e0e0e0;
    border-radius: 4px;
    box-sizing: border-box;
}

#footer-timer-audio-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#footer-timer-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

#campaign-timer-display {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.2em;
    color: #b6cae1;
    background-color: #15191e;
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #3f4c5a;
}

body.targeting {
    cursor: crosshair;
}

#token-stat-block-set-targets.active {
    background-color: #ff4d4d;
    color: white;
}

.dice-button-compact {
    padding: 5px;
    font-size: 12px;
    background-color: #3a4f6a;
    color: #e0e0e0;
    border: 1px solid #5f6a7a;
}

.dice-button-compact .dice-count {
    font-weight: bold;
    margin-left: 4px;
    color: #b6cae1;
}

.token-stat-block {
    background-color: #2a3138;
    border: 1px solid #3f4c5a;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    z-index: 1002;
    color: #e0e0e0;
    padding: 10px;
    width: 250px;
    max-height: 400px;
    overflow-y: auto;
}

.token-stat-block-content h4, .token-stat-block-content p {
    margin: 0 0 5px 0;
    text-align: center;
}

.token-stat-block-content .stat-block-health {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.token-stat-block-content .token-stat-block-hp-input {
    width: 50px;
    margin: 0 5px;
    background-color: #15191e;
    color: #e0e0e0;
    border: 1px solid #3f4c5a;
}

.token-stat-block-content .stat-block-rolls {
    border-top: 1px solid #3f4c5a;
    margin-top: 10px;
    padding-top: 10px;
}

.token-stat-block-content .stat-block-rolls h5 {
    margin: 0 0 5px 0;
}

.token-stat-block-content #token-stat-block-rolls-list {
    list-style: none;
    padding: 0;
    margin: 0 0 10px 0;
}

.token-stat-block-content #token-stat-block-rolls-list li {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
}

.token-stat-block-content .add-roll-form {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#token-stat-block-add-roll-name, #token-stat-block-add-roll-tags, #token-stat-block-save-roll-btn {
    width: 100%;
    box-sizing: border-box;
}

#token-stat-block-add-roll-tags {
    margin-bottom: 5px;
    background-color: #15191e;
    border: 1px solid #3f4c5a;
    color: #e0e0e0;
    padding: 5px;
}

#token-stat-block-dice-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 3px;
}

.dice-button-compact {
    padding: 3px;
    font-size: 11px;
}

.modifier-form {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modifier-form input {
    width: 50px;
}

.token-stat-block-content #token-stat-block-rolls-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
    margin-bottom: 2px;
}

.token-stat-block-content #token-stat-block-rolls-list .roll-name {
    flex-grow: 1;
    margin-right: 5px;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.token-stat-block-content #token-stat-block-rolls-list .roll-actions button {
    padding: 2px 5px;
    font-size: 11px;
}

/* Toast Notification Styles */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050; /* High z-index to be on top of most elements */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    pointer-events: none; /* Allow clicks to pass through the container */
}

.toast-message {
    pointer-events: auto; /* Re-enable pointer events for the toast itself */
    width: 350px;
    /* Re-uses styles from .dice-dialogue-message for consistency */
    animation: toast-fade-in 0.5s ease-out;
}

@keyframes toast-fade-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-fade-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.initiative-character-hp, .initiative-character-damage {
    margin-left: 10px;
    font-size: 0.9em;
}

.initiative-character-hp input, .initiative-character-damage input {
    background-color: #15191e;
    color: #e0e0e0;
    border: 1px solid #3f4c5a;
    border-radius: 3px;
    text-align: center;
}

#initiative-timers {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.1em;
    color: #b6cae1;
}

.initiative-character-initials {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #4a5f7a;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: #e0e0e0;
    flex-shrink: 0;
    margin-right: 15px;
    font-size: 1.2em;
}

#notes-list li.selected-note-item:hover {
    background-color: #4a5f7a !important;
}

/* Styles for note actions (rename, move, delete) - similar to map actions */
.note-actions {
    margin-left: 10px;
}

.note-action-icon {
    cursor: pointer;
    margin-left: 8px;
    display: none; /* Hidden by default */
}
.note-action-icon:hover {
    color: #b6cae1;
}

#notes-list.edit-mode-active .note-action-icon {
    display: inline-block; /* Show icons in edit mode */
}
#notes-list.edit-mode-active .note-list-item-name:hover {
    /* Optional: style for note names when in edit mode and hovering name part */
    /* background-color: #313842; */
}


#note-editor-area {
    flex-grow: 1; /* Takes remaining space in its container (#note-editor-container) */
    display: flex;
    flex-direction: column;
    /* padding-top: 15px; /* Padding is now on #note-editor-container */
    overflow-y: hidden; /* EasyMDE handles its own scrolling */
}

#note-title-input {
    padding: 8px;
    margin-bottom: 10px;
    background-color: #2a3138;
    color: #e0e0e0;
    border: 1px solid #3f4c5a;
    border-radius: 4px;
    font-size: 16px;
}

#save-note-button {
    margin-bottom: 10px;
    align-self: flex-start; /* Or 'flex-end' or 'center' as preferred */
}

/* EasyMDE Specific Styles - adjust if necessary */
#note-editor-area .EasyMDEContainer {
    flex-grow: 1; /* Allows the editor to fill available vertical space */
    display: flex; /* Helps manage internal layout of EasyMDE if it needs to fill space */
    flex-direction: column;
    min-height: 200px; /* Ensure it has a minimum height */
}

#note-editor-area .EasyMDEContainer .CodeMirror {
    flex-grow: 1; /* Make CodeMirror instance fill the EasyMDEContainer */
    height: auto; /* Override fixed height if any, to allow flex growth */
    border: 1px solid #3f4c5a;
    background-color: #2a3138;
    color: #e0e0e0;
}
#note-editor-area .EasyMDEContainer .CodeMirror-focused {
    border-color: #b6cae1;
}
#note-editor-area .editor-toolbar {
    border-top: 1px solid #3f4c5a;
    border-left: 1px solid #3f4c5a;
    border-right: 1px solid #3f4c5a;
    background-color: #20262d; /* Match sidebar for toolbar */
}
#note-editor-area .editor-toolbar button,
#note-editor-area .editor-toolbar button.active {
    color: #e0e0e0; /* Light icon color */
    border-color: #3f4c5a;
}
#note-editor-area .editor-toolbar button:hover {
    background-color: #3f4c5a;
    border-color: #5f6a7a;
}

#note-editor-area .editor-preview,
#note-editor-area .editor-preview-side {
    background-color: #2a3138; /* Match editor background */
    border: 1px solid #3f4c5a;
    color: #e0e0e0;
}
/* Ensure links in preview are visible */
#note-editor-area .editor-preview a,
#note-editor-area .editor-preview-side a {
    color: #8ab4f8; /* A common link color, adjust as needed */
}
#note-editor-area .editor-preview img,
#note-editor-area .editor-preview-side img {
    max-width: 100%; /* Ensure images are responsive within the preview */
    height: auto;
}

.note-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1002;
}

.note-preview-content {
    background-color: #2a3138;
    padding: 20px;
    border-radius: 5px;
    max-width: 80%;
    max-height: 80%;
    overflow-y: auto;
    position: relative;
}

.note-preview-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    color: #e0e0e0;
    cursor: pointer;
}

/* Character Tab Styles */
#character-sheet-container.active {
    display: flex !important;
    flex-direction: column;
}

#character-sheet-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

#character-name-input {
    padding: 8px;
    margin-bottom: 10px;
    background-color: #2a3138;
    color: #e0e0e0;
    border: 1px solid #3f4c5a;
    border-radius: 4px;
    font-size: 16px;
}

#characters-list li {
    padding: 8px 10px;
    border-radius: 3px;
    margin-bottom: 3px;
    cursor: pointer;
    border: 1px solid transparent; /* For consistent sizing with selected */
    display: flex; /* To align text and icons */
    justify-content: space-between; /* Pushes icons to the right */
    align-items: center; /* Vertically aligns text and icons */
}

#characters-list li:hover {
    background-color: #2a3138;
}

#characters-list li.selected-character-item {
    background-color: #3a4f6a !important;
    border-left: 3px solid #b6cae1;
    font-weight: bold;
    color: #ffffff !important;
}

.quest-footer-card {
    padding: 8px 12px;
    background-color: #3a4f6a;
    color: #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 5px;
    text-align: center;
}

.quest-footer-card:hover {
    background-color: #4a5f7a;
}

.quest-footer-card.selected {
    border: 1px solid #b6cae1;
    box-shadow: 0 0 5px #b6cae1;
}

.footer-placeholder {
    color: #a0b4c9;
    font-style: italic;
    padding: 10px;
    text-align: center;
}

.quest-steps-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.quest-steps-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
}

.quest-triggers-list {
    list-style: disc;
    padding-left: 20px;
    margin: 0 0 10px 0;
}

.parent-quest-button {
    width: 100%;
    margin-bottom: 5px;
}

#characters-list li.selected-character-item:hover {
    background-color: #4a5f7a !important;
}

.character-actions {
    margin-left: 10px;
}

.character-action-icon {
    cursor: pointer;
    margin-left: 8px;
    display: none; /* Hidden by default */
}
.character-action-icon:hover {
    color: #b6cae1;
}

#characters-list.edit-mode-active .character-action-icon {
    display: inline-block; /* Show icons in edit mode */
}

/* Dropdown styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    background-color: #f1f1f1;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
}

.dropdown-menu a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
}

.dropdown-menu a:hover {
    background-color: #ddd;
}

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

.modal-content {
    background-color: #2a3138;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 700px;
    border-radius: 5px;
}

.overlay-minimize-button {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #e0e0e0;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.overlay-minimize-button:hover {
    color: #b6cae1;
}

/* Mode Toggle Switch */
.mode-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #5f6a7a; /* Darker grey for off state */
  -webkit-transition: .4s;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}

input:checked + .slider {
  background-color: #3a4f6a; /* Use the selected item color */
}

input:focus + .slider {
  box-shadow: 0 0 1px #3a4f6a;
}

input:checked + .slider:before {
  -webkit-transform: translateX(26px);
  -ms-transform: translateX(26px);
  transform: translateX(26px);
}

/* Rounded sliders */
.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

.button-like-a {
    display: inline-block;
    padding: 8px 12px;
    background-color: #b6cae1;
    color: #15191e;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    text-align: center;
    vertical-align: middle;
}

.button-like-a:hover {
    background-color: #a0b4c9;
}

#character-preview-body img {
    max-width: 150px;
    max-height: 150px;
    object-fit: cover;
    border-radius: 5px;
    float: left;
    margin-right: 15px;
    margin-bottom: 10px;
}

/* For the floating d20 icon */
.floating-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 1003; /* Higher than the footer */
    transition: transform 0.3s ease-in-out;
}

/* .floating-icon:hover {
    background-color: #555;
} */

/* For the overlay */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001; /* Ensure it's above the icon */
}

.overlay-content {
    background-color: rgba(42, 49, 56, 0.85); /* Semi-transparent background */
    padding: 20px;
    border: 1px solid #3f4c5a;
    width: 80%;
    max-width: 600px;
    border-radius: 5px;
    position: relative;
    color: #e0e0e0;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7); /* Shadow for all text */
    display: flex;
    flex-direction: column;
}

#dice-roller-overlay {
    z-index: 1003;
}

#dice-roller-overlay .overlay-content,
#initiative-tracker-overlay .overlay-content {
    width: 800px;
    max-width: 90vw;
    height: 600px;
    max-height: 80vh;
}

#saved-rolls-list-container,
#initiative-master-character-list-container .list-container,
#initiative-active-list-container .list-container,
#initiative-saved-list-container .list-container {
    overflow-y: auto;
}

#saved-rolls-container,
#initiative-master-character-list-container,
#initiative-active-list-container,
#initiative-saved-list-container {
    min-height: 0;
}

#dice-roller-overlay .dice-roller-content,
#initiative-tracker-content {
    min-height: 0;
}

.overlay-content h2 {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); /* More pronounced shadow for the title */
}

.dice-roller-content {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

#dice-roller-placeholder {
    width: 48%;
    border: 1px solid #3f4c5a;
    padding: 10px;
    border-radius: 4px;
}

.dice-dialogue {
    position: absolute;
    bottom: 80px; /* Position above the d20 icon */
    right: 20px;
    width: 300px;
    max-height: 200px;
    background-color: rgba(40, 50, 60, 0.9);
    border-radius: 10px;
    padding: 10px;
    display: none; /* Initially hidden */
    flex-direction: column-reverse;
    overflow: hidden;
    border: 1px solid #4a5f7a;
    z-index: 3;
}

.dice-dialogue-message {
    background-color: rgba(21, 25, 30, 0.8);
    color: #e0e0e0;
    padding: 0;
    margin-bottom: 5px;
    border-radius: 5px;
    font-size: 0.9em;
    border-left: 3px solid #76a9d7;
}


/* Persistent Action Log */
.dice-dialogue.persistent-log {
    position: fixed;
    bottom: 20px;
    right: 80px;
    width: 350px;
    height: 400px;
    max-height: 80vh;
    flex-direction: column;
    overflow-y: hidden; /* Main container does not scroll */
    border-radius: 10px; /* Re-apply border-radius from .dice-dialogue */
    border: 1px solid #4a5f7a; /* Re-apply border */
    background-color: rgba(40, 50, 60, 0.9); /* Re-apply bg */
}

#action-log-header {
    padding: 5px;
    display: flex;
    gap: 5px;
    background-color: #20262d;
    border-bottom: 1px solid #3f4c5a;
    flex-shrink: 0; /* Prevent header from shrinking */
}

#action-log-note-input {
    flex-grow: 1;
    background-color: #15191e;
    border: 1px solid #3f4c5a;
    color: #e0e0e0;
    padding: 5px;
    border-radius: 3px;
}

#action-log-add-note-btn {
    padding: 5px 10px;
    flex-shrink: 0;
}

#action-log-content {
    flex-grow: 1; /* Allows content to fill space */
    overflow-y: auto; /* Content area is scrollable */
    padding: 5px;
}

#action-log-minimize-button {
    background: none;
    border: none;
    color: #e0e0e0;
    font-size: 20px;
    cursor: pointer;
    padding: 0 5px;
    margin-left: auto; /* Push to the right */
}

/* Dice Roll Card */
.dice-roll-card-content {
    display: flex;
    gap: 12px;
    padding: 16px;
}

.dice-roll-profile-pic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #4a5f7a;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: #e0e0e0;
    flex-shrink: 0;
}

.dice-roll-text-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dice-roll-name {
    font-size: 16px;
    line-height: 1.25;
    margin: 0;
}

.dice-roll-name strong {
    font-weight: bold;
}

.dice-roll-details {
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
    color: #a0b4c9;
}

.dice-roll-sum-text {
    font-size: 1.2em;
    font-weight: bold;
    color: #e0e0e0; /* Make it stand out more than the rest of the details */
}

/* Initiative Tracker Styles */
#initiative-tracker-overlay .list-container {
    flex-grow: 1;
    overflow-y: auto;
    background-color: #15191e;
    border: 1px solid #3f4c5a;
    padding: 10px;
    min-height: 300px; /* Ensure lists have a minimum height */
}

.initiative-character-card {
    display: flex;
    align-items: center;
    background-color: #2a3138;
    padding: 5px;
    border-radius: 5px;
    margin-bottom: 5px;
    border-left: 3px solid #4a5f7a; /* Default border color */
    cursor: grab;
}

.initiative-character-card.dragging {
    opacity: 0.5;
    background: #5f6a7a;
}

.initiative-character-card.active-turn {
    border-left-color: #b6cae1;
    box-shadow: 0 0 8px #b6cae1;
}

#initiative-settings-container .setting-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

#initiative-settings-container label {
    margin-bottom: 5px;
    font-weight: bold;
    color: #a0b4c9;
}

#initiative-settings-container input[type="range"] {
    width: 100%;
}

#initiative-settings-container span {
    text-align: center;
    margin-top: 5px;
    color: #e0e0e0;
}

.initiative-character-card img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

.initiative-character-info {
    flex-grow: 1;
}

.initiative-character-info h4 {
    margin: 0 0 2px 0;
    color: #e0e0e0;
    font-size: 0.9em;
}

.initiative-character-info p {
    margin: 0;
    font-size: 0.8em;
    color: #a0b4c9;
}

.initiative-value {
    font-size: 1.2em;
    font-weight: bold;
    margin-left: 10px;
    min-width: 30px;
    text-align: center;
}

#saved-initiatives-list li {
    padding: 8px 10px;
    border-radius: 3px;
    margin-bottom: 3px;
    cursor: pointer;
    border: 1px solid transparent;
}

#saved-initiatives-list li:hover {
    background-color: #2a3138;
}

#saved-initiatives-list li.selected {
    background-color: #3a4f6a !important;
    border-left: 3px solid #b6cae1;
    font-weight: bold;
    color: #ffffff !important;
}
