:root {
    --bg-color: #f4f1e9;
    --surface-color: #ffffff;
    --text-color: #3d3d3d;
    --border-color: #cccccc;
    --primary-color: #8a0303;
    --secondary-color: #5a5a5a;
    --discord-blurple: #5865F2;
    --error-color: #dc3545;
    --success-color: #28a745;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 1rem;
}

.main-container {
    max-width: 1400px;
    margin: auto;
}

@media (min-width: 1024px) {
    .app-layout {
        display: grid;
        /* UPDATED: Added a third column for the new right sidebar */
        grid-template-columns: 224px 1fr 224px;
        gap: 1.5rem;
        align-items: flex-start;
    }
    .sidebar {
        position: sticky;
        top: 1rem;
    }
    .content-area {
        min-width: 0;
    }
    /* ADDED: Make the new right sidebar sticky as well */
    .right-sidebar {
        position: sticky;
        top: 1rem;
    }
}

@media (max-width: 1023px) {
    .app-layout {
        display: flex;
        flex-direction: column;
    }
    .sidebar {
        box-sizing: border-box;
        margin-bottom: 1.5rem;
    }
    /* ADDED: Ensure the right sidebar appears after the main content on mobile */
    .right-sidebar {
        order: 3;
    }
}

.sidebar {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.sidebar-header {
    border-bottom: 2px solid #000;
    padding-bottom: 0.8rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.sidebar-header p {
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-section h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #555;
    margin: 0 0 0.25rem 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
    text-align: center;
}

.vitals-column-left .sidebar-section {
    gap: 0.5rem;
}

.sidebar-button,
.sidebar-select {
    width: 100%;
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
    background-color: #e9e5d8;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-color);
    cursor: pointer;
    text-align: center;
    box-sizing: border-box;
}

.sidebar-button-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
    gap: 0.5rem;
}

.sidebar-button-group .sidebar-button {
    flex: 1;
}

.sidebar-button.btn-discord {
    background-color: var(--discord-blurple);
    color: white;
    border-color: var(--discord-blurple);
}

.sidebar-button.btn-green {
    background-color: #4CAF50;
    color: white;
    border-color: #3e8e41;
}

.sidebar-button.btn-lock {
    background-color: #ffc107;
    color: black;
    border-color: #e0a800;
}

.sidebar-button.btn-unlock {
    background-color: #17a2b8;
    color: white;
    border-color: #138496;
	padding-left: 0.25rem; 
    padding-right: 0.25rem;
}

.sidebar-button.btn-logout {
    background-color: #b04040;
    color: white;
    border-color: #9d3a3a;
}

.discord-connected {
    color: var(--discord-blurple);
    font-weight: bold;
    font-size: 0.8rem;
    text-align: center;
}

.sidebar-input-group label {
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    color: #555;
    margin-bottom: 0.25rem;
    display: block;
}

.sidebar-input-group input {
    width: 100%;
    box-sizing: border-box;
    font-size: 0.8rem;
    padding: 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.sidebar-input-group input:disabled {
    background-color: #f0f0f0;
    cursor: not-allowed;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.sidebar-setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0rem;
}

/* Added to give the setting dropdowns a consistent fixed width */
.settings-group .sidebar-select {
    width: 60px; 
}

.sidebar-setting-row label {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--secondary-color);
    white-space: nowrap;
}

.sidebar-setting-row label.clickable {
    cursor: pointer;
    transition: color 0.2s;
}

.sidebar-setting-row label.clickable:hover {
    color: var(--primary-color);
}

.sidebar-setting-row.clickable {
    cursor: pointer;
}

.sidebar-setting-row.clickable label {
    pointer-events: none;
}

.sidebar-setting-row.clickable:hover label {
    color: var(--primary-color);
}

.last-roll-display {
    font-size: 0.8rem;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.roll-meta {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 0.5rem;
    align-items: center;
}

.meta-label {
    font-weight: 600;
    color: var(--secondary-color);
}

.meta-value {
    word-break: break-word;
}

.roll-results {
    border-top: 1px solid var(--border-color);
    padding-top: 0.6rem;
}

.results-dice {
    margin-left: 0.5rem;
    word-break: break-all;
}

.roll-outcome {
    font-weight: bold;
    font-size: 0.8rem;
    text-align: center;
    padding: 0.2rem;
    border-radius: 4px;
}

.roll-outcome.botch,
.roll-outcome.failure {
    background-color: #f8d7da;
    color: #721c24;
}

.roll-outcome.success {
    background-color: #d4edda;
    color: #155724;
}

.sheet-container {
    font-family: 'Amatic SC', cursive;
    width: 100%;
    box-sizing: border-box;
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
}

.sheet-header,
.stat-block {
    padding-bottom: 0.2rem;
    margin-bottom: 0.1rem;
}

.sheet-header,
.stat-block.attributes,
.stat-block.abilities {
    border-bottom: none;
}

.stat-block.vitals {
    margin-top: 0;
    border-bottom: none;
}

.header-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.25rem 1.5rem;
}

/* MODIFIED: Changed from auto-fit to a fixed 3-column layout */
.stat-columns {
    display: grid;
    /* grid-template-columns: 1fr 1fr 1fr; */
	grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
    gap: 0.25rem 1.5rem;
    align-items: start; /* Align items to the top of the columns */
}

.header-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem;
    align-items: center;
}

.header-item label {
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
    color: #555;
    white-space: normal;
}

.header-item input {
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 0.1rem 0;
    background: transparent;
    font-size: 1rem;
    font-family: 'Amatic SC', cursive;
    font-weight: bold;
    width: 100%;
}

.header-item input:disabled {
    background-color: #f0f0f0;
    cursor: not-allowed;
}

.sheet-main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.3rem;
}

.stat-block-header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.stat-block-header h3 {
    font-family: 'Amatic SC', cursive;
    text-align: center;
    margin-top: 0;
    margin-bottom: 0.1rem;
    letter-spacing: 1px;
    flex-grow: 1;
    font-size: 2.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.stat-block-header h3::before,
.stat-block-header h3::after {
    content: '';
    flex-grow: 1;
    height: 2px;
    background-color: #000;
    margin: 0 1em;
}

.stat-block h4 {
    margin-top: 0.2rem;
    margin-bottom: 0.2rem;
    font-size: 1.4rem;
    font-weight: bold;
}

.stat-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: center;
    margin-bottom: 0.1rem;
    gap: 0.5rem;
    /* font-size: 0.9rem; */ 
	font-size: 0.8rem;
    font-weight: normal;
    font-family: 'Inter', sans-serif;
}

.rating-container {
    display: flex;
    align-items: center;
    /* justify-content: flex-end; <-- removed becaus eoverflow issues */
    /* min-width: 140px; <-- THIS WAS REMOVED */
}

.bonus-indicator {
    font-size: 0.8rem;
    color: var(--secondary-color);
    font-weight: 600;
    width: 35px;
    text-align: left;
    padding-left: 5px;
}

.bonus-indicator.positive {
    color: var(--success-color);
}

.bonus-indicator.negative {
    color: var(--error-color);
}

.vitals-column-left {
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.vitals-grid {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 1.5rem;
}

.vitals-column h4 {
    text-align: center;
}

.vitals-column h4.ability-label {
    display: inline-block;
    width: 100%;
    text-align: center;
}

.health-track-vertical {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.health-level-row {
    display: grid;
    grid-template-columns: auto 1fr max-content;
    gap: 0.75rem;
    align-items: center;
    font-size: 0.85rem;
    font-weight: normal;
    font-family: 'Inter', sans-serif;
}

.health-boxes-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
}

.health-level-label {
    color: var(--secondary-color);
}

.health-level-penalty {
    font-weight: 600;
    color: #888;
}

.health-settings {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: normal;
}

.dot-rating {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    /* min-width: 125px;  */ 
    /* justify-content: flex-end;  ADDED THIS - - than removed because overlap */
}

.dot {
    height: 10px;
    width: 10px;
    background-color: var(--surface-color);
    border: 1px solid var(--text-color);
    border-radius: 50%;
    margin-right: 2px;
    cursor: pointer;
    flex-shrink: 0;
}

.dot.filled {
    background-color: var(--text-color);
}

/* ADDED: Style for the currently active/selected advantage level dot */
/* This now uses the theme's blue color for a much clearer indication. */
.dot.active {
    background-color: var(--discord-blurple);
    border-color: var(--discord-blurple);
    box-shadow: none; /* Removed the old red shadow */
}

.dot-rating.disabled .dot {
    cursor: not-allowed;
    background-color: #e0e0e0;
}

/* MODIFIED: Made this selector more specific to override the 'not-allowed' cursor above. */
/* This now correctly sets the pointer cursor on advantage dots in locked mode for level selection. */
.leveled-advantage-dots.dot-rating.disabled .dot {
    cursor: pointer;
}


/* This rule makes filled dots in any disabled rating appear grey. */
.dot-rating.disabled .dot.filled {
    background-color: #888;
}

/* This MORE SPECIFIC rule overrides the one above for the single ACTIVE advantage dot, making it blue. */
/* This fixes the bug where the active dot was grey instead of the correct blue color. */
.leveled-advantage-dots.dot-rating.disabled .dot.active {
    background-color: var(--discord-blurple);
    border-color: var(--discord-blurple);
}


.health-state-box {
    position: relative;
    width: 15px;
    height: 15px;
    border: 1px solid var(--text-color);
    border-radius: 2px;
    cursor: pointer;
    box-sizing: border-box;
    flex-shrink: 0;
}

.health-state-box::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-color);
    line-height: 1;
    font-weight: bold;
    font-family: 'Times New Roman', serif;
}

.health-state-box[data-state='1']::after {
    content: '/';
    font-size: 18px;
}

.health-state-box[data-state='2']::after {
    content: 'X';
    font-size: 13px;
}

.health-state-box[data-state='3']::after {
    content: '*';
    font-size: 20px;
    top: 48%;
}

.health-state-box.disabled {
    cursor: not-allowed;
    background-color: #e0e0e0;
}

.power-stats-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.25rem 1rem;
    align-items: start;
}

.power-stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: center;
    margin-bottom: 0.25rem;
}

.power-stat-row-locked {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 1.3rem;
    font-weight: bold;
    gap: 0.25rem;
    width: 100%;
}

.power-stat-row-locked .ability-label {
    display: flex;
    align-items: center;
    width: 100%;
    white-space: nowrap;
}

.power-stat-row-locked .ability-label::before,
.power-stat-row-locked .ability-label::after {
    content: '';
    flex-grow: 1;
    height: 1px;
    background-color: var(--border-color);
    margin: 0 0.5em;
}

.power-stat-row .stat-name-input {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: normal;
}

.power-stat-row .power-stat-control-group {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: normal;
}

.power-stat-row-locked.long-stat {
    grid-column: 1 / -1;
}

.ability-row-unlocked .stat-name-input {
    font-family: 'Inter', sans-serif;
	/* font-size: 0.9rem; */
    font-size: 0.8rem;
    font-weight: normal;
    letter-spacing: normal;
}

.stat-name-input {
    font-size: 1.2rem;
    font-family: 'Amatic SC', cursive;
    font-weight: bold;
    padding: 2px 4px;
    flex: 1;
    min-width: 80px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.power-stat-control-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.power-stat-temp-dots .dot.filled {
    background-color: #AAB7BF;
}

.stat-remove-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 1.2rem;
    /* padding: 0 0.5rem; */
	padding: 0;
    margin-left: auto;
}

.stat-remove-btn:hover {
    color: var(--error-color);
}

/* --- NEW STYLE for edit button --- */
.edit-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 1rem;
    /* padding: 0 0.2rem; */ 
	padding: 0;
    line-height: 1;
}

.edit-btn:hover {
    color: var(--primary-color);
}

.add-stat-btn {
    margin-top: 0.5rem;
}

.attribute-label,
.ability-label {
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background-color 0.2s, box-shadow 0.2s;
    user-select: none;
    word-break: break-word; /* ADD THIS LINE */
}

.attribute-label:hover,
.ability-label:hover {
    background-color: #f0f0f0;
}

.attribute-label.selected {
    background-color: var(--primary-color);
    color: white;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* --- MODIFIED STYLE for unlocked ability row --- */
/* Original removed 
.ability-row-unlocked {
    display: flex;
    align-items: center;
    gap: 0.5rem;
} */

.ability-row-unlocked {
    display: grid;
    /* This creates a flexible column for the name and auto-sized columns for the rest */
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    align-items: center;
    gap: 0.5rem;
}

.ability-row-unlocked .stat-name-input {
    flex: 1 1 auto;
}

.ability-row-unlocked .rating-container {
    flex-shrink: 0;
}

.ability-row-unlocked .edit-btn,
.ability-row-unlocked .stat-remove-btn {
    flex-shrink: 0;
    margin-left: 0;
}

/* --- ADVANTAGES & DRAG-AND-DROP --- */
.advantage-buttons {
    display: flex;
    align-items: center;
	gap: 0.5rem;
    /* margin-left: 8px;  <-- REMOVED this line */
}

/* ADDED THIS ENTIRE NEW RULE */
.stat-row.unlocked-advantage .rating-container {
    width: max-content;
}

.advantage-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.advantage-header-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.category-rename-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 0.2rem;
    font-size: 0.9rem;
    color: #999;
    line-height: 1;
}

.category-rename-btn:hover {
    color: var(--primary-color);
}

.add-to-category-btn {
    background: none;
    border: 1px solid transparent;
    color: #aaa;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    line-height: 1;
    padding: 0 0.4rem;
    border-radius: 50%;
}

.add-to-category-btn:hover {
    color: var(--primary-color);
    background-color: #f0f0f0;
}

/* ADDED: Styles for the Drag and Drop layout */
.advantage-dnd-container {
    display: grid;
    /* grid-template-columns: 1fr 1fr 1fr; */
	grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
    gap: 1.5rem;
    align-items: start;
}

.advantage-column {
    background-color: #f9f7f2;
    border-radius: 2px;
    padding: 0.1rem;
    min-height: 50px; /* Gives a visible drop target when empty */
    transition: background-color 0.2s ease;
}

.advantage-column.dragging-over {
    background-color: #e9e5d8;
}

.advantage-category-draggable {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s ease;
}

.advantage-category-draggable.dragging {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.advantage-item-draggable {
    background-color: #fdfdfd;
    border-radius: 4px;
    border: 1px solid transparent; /* Placeholder for dragging style */
}

.advantage-item-draggable.dragging {
    background-color: var(--surface-color);
    border-color: #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* END of Drag and Drop Styles */


.modal-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color);
}

.edit-advantage-modal-body .input-group {
    display: grid;
    grid-template-columns: 150px 1fr;
    align-items: center;
    gap: 1rem;
}

/* --- NEW: Leveled Advantage Modal Styles --- */
.edit-advantage-modal-body .input-group.checkbox-group {
    grid-template-columns: 1fr 1fr;
    padding-left: 160px; /* Aligns checkboxes with inputs */
}

.advantage-levels-editor {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.advantage-level-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 1rem;
    align-items: start;
}

.level-label {
    font-weight: bold;
    text-align: right;
    padding-top: 0.5rem;
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.level-inputs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.level-text-fields {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 0.5rem;
}

.level-selects {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}
/* --- END: Leveled Advantage Modal Styles --- */

.edit-advantage-modal-body .input-group label {
    font-weight: 600;
    text-align: right;
}

.edit-advantage-modal-body .input-group textarea {
    width: 100%;
    box-sizing: border-box;
    font-size: 0.9rem;
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
}

.toast-message {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    z-index: 1000;
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s, visibility 0.3s;
    opacity: 0;
    visibility: hidden;
}

.toast-message.show {
    opacity: 1;
    visibility: visible;
}

.toast-message.success-message {
    background-color: #d4edda;
    color: #155724;
}

.toast-message.error-message {
    background-color: #f8d7da;
    color: #721c24;
}

.auth-container {
    max-width: 400px;
    margin: auto;
}

.form-container {
    background-color: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.form-container button {
    width: 100%;
    padding: 0.8rem;
    border: none;
    border-radius: 4px;
    background-color: var(--primary-color);
    color: #fff;
    font-weight: bold;
    cursor: pointer;
}

.form-container input[type="text"],
.form-container input[type="email"],
.form-container input[type="password"] {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
}

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

.modal-content {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    text-align: center;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    min-width: 350px; /* Added minimum width for better layout */
}

.modal-content.description-modal {
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.description-text {
    white-space: pre-wrap;
    text-align: left;
    line-height: 1.6;
    font-size: 0.8rem;
    margin: 1rem 0;
    user-select: text;
    cursor: text;
}

.modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 1rem;
    margin: 0 -1rem;
    text-align: left;
    font-family: 'Inter', sans-serif;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.delete-button {
    background-color: #b04040;
    color: white;
    border: 1px solid #9d3a3a;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    width: 100%;
    box-sizing: border-box;
    border-radius: 4px;
    cursor: pointer;
}

.delete-area {
    text-align: right;
    margin-top: 1rem;
}

.delete-area button {
    background-color: #b04040;
    color: white;
    border: 1px solid #9d3a3a;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    width: auto;
}

.delete-area button:disabled {
    background-color: #aaa;
    cursor: not-allowed;
    border-color: #999;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    box-sizing: border-box;
    font-size: 0.9rem;
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* --- NEW STYLE for checkbox label in modal --- */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    white-space: nowrap; /* Prevents the text from wrapping */
    font-size: 0.9rem;
}

/* --- SPECIFIC STYLE for Discord modal checkbox --- */
.checkbox-inline {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    text-align: left !important;
    justify-content: flex-start !important;
    width: auto !important;
}

.input-group label[for="ability-attribute-select"] {
    display: block; /* This makes the label take up the full width */
    text-align: center;
}

.input-group input.error {
    border-color: var(--error-color);
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.error-message {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.password-requirements {
    margin-top: 0.5rem;
}

.password-requirements small {
    color: #666;
    font-size: 0.75rem;
    line-height: 1.3;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.special-form-unlocked {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-editor {
    border: 1px solid #e0e0e0;
    padding: 0.75rem;
    border-radius: 4px;
    background: #fcfcfc;
}

.form-editor-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.form-editor-header input {
    font-weight: bold;
    font-size: 1rem;
}

.form-category-select label {
    font-size: 0.8rem;
    margin-right: 0.5rem;
}

.form-editor-body h5 {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    color: #555;
    text-transform: uppercase;
}

.modifier-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 100px auto;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.modifier-row input,
.modifier-row select {
    width: 100%;
    box-sizing: border-box;
    font-size: 0.8rem;
    padding: 0.3rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.special-form-locked-view {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group-label {
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    color: var(--secondary-color);
}

.centered-stat-label {
    font-family: 'Amatic SC', cursive;
    text-align: center;
    margin-bottom: 0.25rem;
    letter-spacing: 1px;
    font-size: 1.3rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.centered-stat-label::before,
.centered-stat-label::after {
    content: '';
    flex-grow: 1;
    height: 1px;
    background-color: var(--border-color);
    margin: 0 0.5em;
}


.form-group-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
}

.form-pill {
    cursor: pointer;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 12px;
    background-color: #e9e5d8;
    border: 1px solid #ccc;
    user-select: none;
    transition: all 0.2s;
}

.form-pill:hover {
    border-color: #888;
}

.form-pill.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: bold;
}

/* --- START: ISOLATED ADVANTAGE STYLES --- */

/* This is the new, dedicated grid container for a single advantage row. */
.advantage-row {
    position: relative; /* ADDED: This is crucial for positioning the copy button inside */
    display: grid;
    grid-template-columns: 1fr auto; /* Label takes available space, controls shrink-to-fit. */
    align-items: center;
    margin-bottom: 0.1rem;
    gap: 0.5rem;
    /* font-size: 0.9rem; */
	font-size: 0.8rem;
    font-weight: normal;
    font-family: 'Inter', sans-serif;
}

/* A dedicated label style for advantages. */
.advantage-label {
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background-color 0.2s;
    user-select: none;
    word-break: break-word; /* Prevents long names from overflowing */
    min-width: 0; /* A key fix for allowing grid items with long text to shrink */
}

.advantage-label:hover {
    background-color: #f0f0f0;
}

/* The right-hand-side container for either dots or buttons. */
.advantage-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* --- ADDED: Styles for the new Copy to Clipboard button --- */
.view-description-btn {
    position: absolute;
    /* REMOVED: right: 140px; - This is now handled by inline styles */
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem; /* Made smaller */
    color: #b0b0b0;
    padding: 0; /* Removed padding for a "no box" look */
    margin: 0 5px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, color 0.2s;
    line-height: 1;
}

.advantage-row:hover .view-description-btn {
    opacity: 1;
    visibility: visible;
}

.view-description-btn:hover {
    color: var(--primary-color);
}
/* --- END: View Description button styles --- */


/* --- END: ISOLATED ADVANTAGE STYLES --- */

/* --- MERITS & FLAWS --- */

.merits-flaws-list {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
}

.merit-flaw-row {
    position: relative; /* ADD THIS LINE */
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0.5rem;
    padding: 2px 0;
}

.merit-flaw-name {
    word-break: break-word;
    min-width: 0;
}

.merit-flaw-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.merit-value {
    font-weight: bold;
    font-size: 0.75rem;
    min-width: 10px;
    text-align: right;
}

.merit-value.positive {
    color: var(--success-color);
}

.merit-value.negative {
    color: var(--error-color);
}

.view-description-btn.merit-view-btn {
    position: absolute; /* CHANGE from static */
    top: 50%; /* ADD THIS LINE */
    transform: translateY(-50%); /* CHANGE from none */
    right: 25px; /* ADD THIS LINE to position it before the buttons */
    opacity: 0;
    visibility: hidden;
    margin: 0;
    margin-left: 5px;
}

.merit-flaw-row:hover .view-description-btn.merit-view-btn {
    opacity: 1;
    visibility: visible;
}


/* --- Customization for Merits & Flaws Title Font --- */
.vitals-column-left .sidebar-section h3 {
    font-family: 'Amatic SC', cursive;
    font-size: 1.4rem;
    font-weight: bold;
    text-transform: none; /* Amatic SC font looks better in title case */
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

/* --- NOTES --- */
.notes-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
}

.note-row {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0.5rem;
    padding: 2px 0;
}

.note-name {
    word-break: break-word;
    min-width: 0;
}

.note-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.view-description-btn.note-view-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 25px;
    opacity: 0;
    visibility: hidden;
    margin: 0;
    margin-left: 5px;
}

.note-row:hover .view-description-btn.note-view-btn {
    opacity: 1;
    visibility: visible;
}


@media (max-width: 768px) {
    .vitals-grid {
        grid-template-columns: 1fr;
    }
    .modifier-row {
        grid-template-columns: 1fr 1fr;
    }
    .form-container input[type="text"],
    .form-container input[type="email"],
    .form-container input[type="password"] {
        padding: 0.8rem;
    }
}

/* --- ADDED FOR SHARE MODAL --- */
.share-modal-body {
    text-align: left;
    font-family: 'Inter', sans-serif;
}

.share-modal-body h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.share-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem;
}

.share-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

.share-list li:last-child {
    border-bottom: none;
}

.share-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.share-form input {
    flex-grow: 1;
}
