/* NEW: Styles for the Main Page Title Container */
html {
    overflow-y: scroll;
}
#page-title-container {
    background-color: #1a1a1a; /* Static dark background */
    color: #F0F0F0; /* Static light text color */
    border: 2px solid var(--card-border-color, #e2e8f0); /* Dynamic border matching card border */
    border-radius: 1.5rem; /* Matches card border radius */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.1); /* Adds depth */
    padding: 1rem 2rem; /* Generous padding */
    margin: 2rem auto 2rem; /* Auto margins for horizontal centering, 2rem vertical spacing */
    max-width: 40rem; /* Same as .max-w-4xl for central content block */
    text-align: center; /* Ensures content is centered if it doesn't span full width */
    
    display: flex; /* Use flexbox for vertical centering of text */
    align-items: center; /* Center vertically */
    justify-content: center; /* Center horizontally if text width is less than container */
    min-height: 6rem; /* A minimum height to ensure vertical centering has space */
}

/* Styling for the main title: "Legender Echoes" */
/* This now targets the H1 directly inside #page-title-container, and also covers the .main-title-text class */
/* We'll use the h1 selector for the main font/size/spacing, and also ensure the gradient works. */
#page-title-container h1 {
    font-family: 'Cinzel Decorative', serif; /* Keep your awesome fantasy font! */
    font-weight: 700;
    font-size: 3.5em;
    line-height: 1.1;
    margin-bottom: 0.1em;
    color: transparent;
    background: linear-gradient(to right, #ff0000, #ffa500);
    -webkit-background-clip: text;
    background-clip: text;
}

/* You no longer need this separate rule for .main-title-text for sizing and spacing
   because the #page-title-container h1 rule above is more specific and covers it.
   You can remove this block if the class on the h1 is only for Tailwind utility classes. */
/* If #page-title-container .main-title-text had *other* unique styles not covered above, keep them. */
/* Otherwise, delete this block: */
/*
#page-title-container .main-title-text {
    font-size: 1.5em; // This will be overridden by the h1 rule
    display: block; // h1 is already block
    line-height: 1.2; // This will be overridden by the h1 rule
    margin-bottom: 0 !important; // This will be overridden by the h1 rule's 0.1em
}
*/
ul.list-disc li::marker,
ul.list-circle li::marker,
ul.list-square li::marker {
    color: var(--text-color) !important; /* Force marker color to match theme text */
}
/* Styling for the sub-title: "Character Sheet" */
/* This now targets the H2 with the class .sub-title-text */
#page-title-container .sub-title-text {
    font-family: 'Cinzel Decorative', serif; /* This should already be here */
    font-weight: 700;
    font-size: 1.7em;
    line-height: 1.1;
    margin-top: 0;
    color: transparent;
    background: linear-gradient(to right, red, orange);
    -webkit-background-clip: text;
    background-clip: text;
}

body {
    font-family: 'Inter', sans-serif; /* MODIFIED: Inter as base, !important removed */
    background-color: var(--bg-color, #f0f4f8);
    color: var(--text-color, #2d3748);
    transition: background-color 0.5s ease-in-out, color 0.5s ease-in-out;
    background-attachment: fixed;
    min-height: 100vh;
}
.card {
    background-color: var(--card-bg-color, #ffffff); /* Corrected variable name */
    border-radius: 1.5rem; /* More rounded corners */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    padding: 1.5rem; /* Increased padding */
    margin-bottom: 1.5rem;
    border: 1px solid var(--card-border-color, #e2e8f0); /* Corrected variable name */
    transition: background-color 0.5s ease-in-out, border-color 0.5s ease-in-out;
}
.input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center; /* NEW: Center the content */
}
input[type="text"],
textarea,
select,
input[type="number"] { /* MODIFIED: Consolidated all input types here */
    font-family: 'Inter', sans-serif; /* MODIFIED: Explicitly set Inter, no !important */
    color: #000000 !important; /* Keep black text color forced for inputs */
    background-color: #ffffff;
    border: 1px solid #cbd5e0;
    border-radius: 0.75rem;
    padding: 0.5rem;
    font-size: 0.875rem;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

/* Labels should inherit dynamic text color */
label {
    font-family: 'Inter', sans-serif; /* MODIFIED: Explicitly set Inter, no !important */
    color: var(--text-color);
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    transition: color 0.5s ease-in-out;
}
.topic-header {
  color: var(--topic-text-color);
}
/* Standardize the Confirm Reset modal text color */
#customConfirmModal h3,
#customConfirmModal p {
    color: #000000; /* Force black text */
}
.tribe-source {
  color: var(--tribe-name-text-color);
}

.item-source {
  color: var(--item-name-text-color);
}
/* NEW: Style for stat labels */
.stat-label {
    width: 100%; /* full card width */
    font-weight: 700; /* bold */
    color: var(--text-color) !important; /* Ensure it uses the theme text color */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem; /* Adds space between the name and the bonus pill */
    flex-wrap: nowrap; 
    padding-bottom: 4px;    /* space between text and line */
    border-bottom: 2px solid var(--card-border-color); /* match card border color */
}
.stat-label .stat-name-wrapper {
  font-size: 1.4rem;      /* adjust to taste */
  line-height: 1.1;
  display: flex;
  flex-direction: column;  /* Keeps glow & gradient stacked */
  align-items: center;     /* Centers horizontally */
  justify-content: center; /* Centers vertically if needed */
  text-align: center;      /* Ensures text stays centered */
}

/* if needed, scale the icon to match */
.stat-label .stat-icon {
  width: 34px;
  height: 34px;
}
.stat-label span {
    text-decoration: none; /* Removed underline */
}

html {
    overflow-y: scroll;
}

/* This is the MASTER RULE. It targets BOTH box types and forces them
   to share the exact same sizing and internal layout properties.
   This is the key to perfect alignment. */
.stat-border-box,
.conduit-box {
    padding: 0.75rem 0.5rem;
    border-radius: 0.5rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;       /* create stacking context */
    overflow: hidden;         /* hide watermark edges */
    border: 2px solid var(--card-border-color);
    background-color: var(--conduit-bg-color);
}
.conduit-die-track {
    display: flex;
    justify-content: center; /* Centers horizontally */
    gap: 8px; /* Even spacing between dice */
    margin: 0 auto;
}
.conduit-box #conduitDie-track,
.conduit-box .die-track-container {
  display: flex;
  flex-direction: row;     /* force horizontal */
  justify-content: center; /* center the row */
  align-items: center;
  gap: 0.5rem;
  border-left: none;       /* in case the vertical style added one */
  padding-left: 0;
}

.conduit-box .element-icon-watermark {
  position: absolute;
  right: -15px;
  bottom: -15px;
  width: 250px;
  height: 250px;
  opacity: 0.15;
  z-index: -1;               /* always at the back */
  pointer-events: none;     /* never block clicks */
}
.conduit-die > *:not(.element-icon-watermark) {
  position: relative;
  z-index: 1;
}
/* This rule vertically justifies the content inside the Conduit box */
.conduit-box .channel-main-box {
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Pushes the text to the bottom */
}

/* Style for the new bonus pill */
.stat-bonus-display {
    flex: 0 0 auto;
    white-space: nowrap;
    overflow: visible;
    font-weight: 900;
    color: #1d4ed8; /* Blue, like other advantage text */
    background-color: #fff;
    border: 1px solid #000; /* restore black border */
    border-radius: 0.3rem;
    padding: 0.1rem 0.4rem;
    font-size: 1rem;
    line-height: 1.2;
}
.stat-bonus-display:empty::before {
    content: "--";
    color: #000000; /* optional style */
}
/* 1. The Wrapper: Sets the font and size for both layers. */
.conduit-label-wrapper {
  position: relative; /* Allows absolute positioning for the children */
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.25rem;
  font-weight: 700;
}

/* 2. The Glow Layer (Bottom): Creates the glow effect. */
.conduit-label-glow {
  color: var(--stat-name-glow-color);
  text-shadow: 0 0 8px var(--stat-name-glow-color);
}

/* 3. The Gradient Layer (Top): Sits perfectly on top of the glow. */
.conduit-label-gradient {
  position: absolute;
  top: 0;
  left: 0;
  
  /* The gradient effect 
  color: transparent;
  background: linear-gradient(45deg, 
      var(--tribe-header-bg-start, var(--text-color)), 
      var(--tribe-header-bg-end, var(--text-color))
  );
  -webkit-background-clip: text;
  background-clip: text;*/
    color: var(--highlight-color);
}

/* 4. The Emoji: Ensures it also gets a glow. */
.conduit-emoji {
  font-size: 1rem; /* Adjust size if needed */
  margin-left: 0.25rem;
  text-shadow: 0 0 8px var(--stat-name-glow-color);
}
/* Specific style for the "Max Channels" label */
/* Adjust selector if 'Max Channels' label gets its own class in HTML (e.g., .max-channels-label) */
.conduit-box .input-group + p + label, /* Targets label after input-group sibling, assuming p is 'Max Channels typically...' */
.conduit-box > div > label:not(.stat-label) { /* More general target for labels inside conduit-box that aren't stat-label */
    color: var(--conduit-die-h-text-color); /* Apply dynamic color */
}
/* Use a more specific selector to win the priority battle */
.conduit-info-text {
    background-color: rgba(255, 255, 255, 0.25); /* subtle light overlay */
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.4;
    margin-top: 25px;
    display: inline-block;
}
.conduit-box .conduit-info-text {
  background: #fff;
  color: var(--modal-info-text-color, #0a1324);
  border: 1px solid var(--card-border-color);
  border-radius: 0.5rem;
  padding: 0.6rem 0.75rem;
  max-width: 240px;
  margin: 0.5rem auto 0;   /* center the box */
  font-size: 0.9rem;
  line-height: 1.2;
}
.conduit-stat-display {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.5rem; /* Roughly 20px - you can adjust this value */
  text-shadow: 0 0 8px var(--stat-name-glow-color);
}
/* 1. The Wrapper: This holds the two layers together. */
.stat-name-wrapper {
  position: relative; /* Allows absolute positioning for the children */
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.25rem;
  font-weight: 700;
}

/* 2. The Glow Layer (Bottom): White text with a white glow. */
.stat-name-glow {
  color: var(--stat-name-glow-color);
  text-shadow: 0 0 8px var(--stat-name-glow-color);
}

/* 3. The Gradient Layer (Top): Sits perfectly on top of the glow. */
.stat-name-gradient {
  /* This uses absolute positioning to stack it on top of the glow layer */
  position: absolute;
  top: 0;
  left: 0;
  
  /* The gradient effect 
  color: transparent;
  background: linear-gradient(45deg, 
      var(--tribe-header-bg-start, var(--text-color)), 
      var(--tribe-header-bg-end, var(--text-color))
  );
  -webkit-background-clip: text;
  background-clip: text;*/
  /* Use the new variable to set a solid color */
  color: var(--highlight-color);
}
.stat-emoji {
    /* Reset gradient properties */
    font-size: 1.25rem;
    color: inherit; /* Inherit color from parent, or set a specific one */
    background: none;
    -webkit-background-clip: initial;
    background-clip: initial;

    /* Re-apply the glow effect directly to the emoji */
    text-shadow: 0 0 5px var(--stat-name-glow-color);

    /* Minor positioning adjustment if needed */
    margin-left: 0.25rem;
}
/* This creates the responsive grid container for the tracker */
#abilities-tracker-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  column-gap: 0.5rem; /* Sets the space between columns */
  row-gap: 0.5rem;    /* Sets the space between rows */
  margin-top: 0.5rem;
}

/* This styles each individual item in the grid */
.tracker-item {
  display: flex;
  align-items: center;
  gap: 0.5rem; 
  background-color: #f1f1f1;
  padding: 0.75rem;
  border-radius: 0.5rem;
  color: #14776a; /* Sets a static dark text color for readability */
}
#rest-ability-list, #session-ability-tracker {
  display: contents;
}
.input-group input[type="number"] {
    -moz-appearance: textfield; /* Firefox */
    appearance: textfield; /* Standard */
}
.input-group input::-webkit-outer-spin-button,
.input-group input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.btn {
    background-color: var(--btn-bg-color, #4c51bf);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    font-weight: 600;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    /* --- ADD THESE LINES TO PREVENT TEXT HIGHLIGHTING --- */
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none;     /* IE 10+ and Edge */
    user-select: none;         /* Standard syntax */
}
.btn:hover {
    background-color: var(--btn-hover-color, #5a61bb); /* Corrected variable name */
}
.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}
#reselect-adaptive-stat-btn {
    /* Remove any conflicting Tailwind classes from the HTML like bg-gray-400, hover:bg-gray-550 */
    background-color: var(--reselect-adaptive-stat-btn-bg-color); /* Corrected variable name */
    color: var(--reselect-adaptive-stat-btn-text-color); /* Corrected variable name */
    border: 1px solid var(--reselect-adaptive-stat-btn-border-color); /* Corrected variable name */
    
    /* Keep existing styling from .btn and .btn-sm if they are still on the button */
    padding: 0.25rem 0.75rem; /* For btn-sm */
    font-size: 0.75rem; /* For text-xs */
    width: fit-content;
    border-radius: 0.75rem;
    font-weight: 600;
    transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out, color 0.2s ease-in-out;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Keep a subtle shadow */
}

#reselect-adaptive-stat-btn:hover {
    background-color: var(--reselect-adaptive-stat-btn-hover-bg-color); /* Corrected variable name */
    color: var(--reselect-adaptive-stat-btn-hover-text-color); /* Corrected variable name */
    border-color: var(--reselect-adaptive-stat-btn-hover-border-color); /* Corrected variable name */
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.75rem;
    transition: background-color 0.2s ease-in-out;
}
.radio-label:hover {
    background-color: #edf2f7; /* Light gray on hover */
    /* If you want this dynamic, you'd add a --radio-label-hover-bg-color variable in elements.js and applyTheme */
}
.radio-label input[type="radio"]:checked + span {
    font-weight: 700;
    color: var(--btn-bg-color, #4c51bf); /* Corrected variable name */
}
/* Specific styles for Conduit Type dropdown options */
#elementalAffinity option {
    color: black; /* Ensure text is readable on colored backgrounds */
    font-weight: 500;
}
#elementalAffinity option[value="Light"] { background-color: #fffdfa; }
#elementalAffinity option[value="Dark"] { background-color: #e0e0e0; color: black; }
#elementalAffinity option[value="Wind"] { background-color: #a7f3d0; }
#elementalAffinity option[value="Water"] { background-color: #bfdbfe; color: black; }
#elementalAffinity option[value="Fire"] { background-color: #fecaca; }
#elementalAffinity option[value="Earth"] { background-color: #fef3c7; }
#elementalAffinity option[value="Ice"] { background-color: #dbeafe; }
#elementalAffinity option[value="Lightning"] { background-color: #e6e0ff; color: black; }

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    body {
        background-color: #ffffff !important; /* White background for printing */
        color: #000000 !important; /* Black text for printing */
    }
    .card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
    input, textarea, select {
        border: none !important; /* Remove borders from inputs for cleaner print */
        background-color: transparent !important; /* Transparent background for inputs */
    }
    .input-group button {
        display: none !important; /* Hide +/- buttons */
    }
    .radio-label input[type="radio"] {
        -webkit-print-color-adjust: exact; /* Ensure radio buttons print correctly */
        color-adjust: exact;
    }
}
/* Style for details/summary (collapsible sections) - DEFINITIVE FIX */
details {
    border: 1px solid var(--card-border-color, #e2e8f0); /* Corrected variable name */
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    /* This background applies to the whole details box, so the content area (details-content)
       will inherit this and match the main card background. */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    overflow: hidden; /* Ensures rounded corners are respected for inner summary/content */
}

/* The clickable summary/header itself - this is what gets the darkened background */
summary {
    padding: 1rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    color: var(--text-color, #2d3748);
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    
    /* Correctly uses the --collapsible-header-bg variable set by the JS */
    background-color: var(--collapsible-header-bg, #e2e8f0); 
    
    border-top-left-radius: 0.75rem;
    border-top-right-radius: 0.75rem;
    border-bottom-left-radius: 0.75rem; 
    border-bottom-right-radius: 0.75rem; 

    margin: 0;
    transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out;
}

/* When the details is open, adjust the summary's bottom border and radius */
details[open] > summary {
    border-bottom: 1px solid var(--card-border-color, #e2e8f0);
    border-bottom-left-radius: 0; /* Square off bottom corners when open */
    border-bottom-right-radius: 0;
}

summary::-webkit-details-marker {
    display: none; /* Hide default marker for Webkit browsers */
}

summary::after {
    content: '+'; /* Custom indicator for closed state */
    font-size: 1.5rem;
    color: var(--btn-bg-color, #4c51bf); /* Corrected variable name */
    transition: transform 0.2s ease-in-out;
}
details[open] summary::after {
    content: '-'; /* Custom indicator for open state */
    transform: rotate(0deg); /* No rotation needed for '-' */
}

/* Content area for expanded details - this should inherit the details background */
.details-content {
    padding: 1rem 1.5rem 1.5rem;
    color: var(--expanded-area-text-color, var(--text-color)); 
    background-color: var(--expanded-area-bg-color) !important; /* Use an unmissable color with !important */
    /* NO background-color here - it inherits from the 'details' parent, which is var(--card-bg-color) */
}
/* Ability names - now solid black */
/* Ability names - now inherit or use a dynamic highlight color */
.card .ability-name,
.details-content .ability-name,
#enhancements-display .ability-name {
    font-weight: 700;
    /* Change to use the main text color or a highlight color, depending on desired effect */
    color: var(--ability-highlight-color);
    /* color: var(--ability-highlight-color); /* Option 2: Use the highlight color for ability names */
}


/* Specific style for the top-left menu */
.top-left-menu {
    position: fixed;
    top: 1rem;
    left: 1rem;
    width: auto; /* Adjust width based on content */
    max-width: 200px; /* Limit max width */
    z-index: 99; /* Changed to a higher value */
    background-color: var(--card-bg-color, #ffffff);
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border: 1px solid var(--card-border-color, #e2e8f0);
}
.top-left-menu summary {
    /* Style it as a circular button */
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--card-bg-color, #ffffff); /* Corrected variable name */
    border: 1px solid var(--card-border-color, #e2e8f0); /* Corrected variable name */
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    
    /* Center the '+' icon */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s ease-in-out;
}
.top-left-menu summary:hover {
    border-color: var(--btn-bg-color); /* Corrected variable name */
    transform: scale(1.1);
}

/* Create the '+' icon */
.top-left-menu summary::after {
    content: '+';
    color: var(--text-color); /* Corrected variable name */
    font-size: 2rem;
    font-weight: 300;
    line-height: 1;
    transition: transform 0.3s ease-in-out;
}

/* When the menu is open, rotate the '+' to form an 'x' */
.top-left-menu[open] summary::after {
    transform: rotate(45deg);
}

.top-left-menu .details-content {
    margin-top: 0.5rem;
    background-color: var(--card-bg-color, #ffffff); /* Corrected variable name */
    border: 1px solid var(--card-border-color, #e2e8f0); /* Corrected variable name */
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.top-left-menu .details-content {
    padding: 0.5rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.top-left-menu .btn {
    width: 100%;
    text-align: left;
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    background-color: var(--btn-bg-color, #4c51bf); /* Corrected variable name */
    color: white;
    border-radius: 0.5rem;
    box-shadow: none;
}
.top-left-menu .btn:hover {
    background-color: var(--btn-hover-color, #5a61bb); /* Corrected variable name */
}
/* Style for menu links */
.top-left-menu .menu-link {
    display: block;
    width: 100%;
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    color: var(--text-color); /* Corrected variable name */
    text-align: left;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease-in-out;
}
.top-left-menu .menu-link:hover {
    background-color: var(--bg-color, #f0f4f8); /* Corrected variable name */
}

/* Popup styles for racial info and stat actions */
.info-popup {
    position: absolute;
    background-color: var(--card-bg-color, #ffffff); /* Corrected variable name */
    border: 1px solid var(--card-border-color, #e2e8f0); /* Corrected variable name */
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    z-index: 20;
    max-width: 300px;
    min-width: 200px;
    transition: opacity 0.2s ease-in-out;
    opacity: 0;
    visibility: hidden;
    top: 100%; /* Position below the trigger */
    left: 0;
    transform: translateY(0.5rem); /* Small offset */
}
.info-popup.show {
    opacity: 1;
    visibility: visible;
}
.info-popup ul {
    list-style: disc;
    padding-left: 1.25rem;
    margin-top: 0.5rem;
}
.info-popup ul li {
    margin-bottom: 0.25rem;
    line-height: 1.3;
}
.info-popup h4 {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color); /* Corrected variable name */
}

/* Container for the actions list */
.stat-actions-list {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    text-align: left;
    list-style: none;
    padding-left: 0;
    column-count: 1;
    margin-bottom: 0;
    min-width: 0; /* Prevents overflow from dictating minimum width */
    overflow: visible; /* Hide overflow if text truncates */
    align-items: flex-start; /* for flex layouts */
    justify-content: flex-start; /* for flex layouts */
    position: relative; /* Add this */
    z-index: 1;         /* And this to lift it above the watermark */
}
.stat-actions-list,
.stat-actions-list li { text-align: left; }

/* Style each LI directly */
.stat-actions-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* This creates the space between the pill and the text */
    border-bottom: 1px solid rgba(71, 71, 0.5);
    margin-bottom: 0.25rem;
    padding-bottom: 0.25rem;
    padding-left: 0; /* Ensures no indentation */
}
.stat-actions-list li > div > .bonus-pills-container {
    padding-left: 0 !important;
    margin-left: 0 !important;
}

.stat-actions-list li > div > span:first-child {
    padding-left: 0 !important;
    text-indent: 0 !important;
}

/* ADD THIS NEW BLOCK */
.stat-actions-list li > div {
    padding-left: 0;
}

.stat-actions-list li:last-child {
  border-bottom: none;
}

/* This is for the bonus pills container */
.bonus-pills-container {
    position: relative; /* Needed for z-index */
    z-index: 1;         /* Sits on top of the line */
    background: var(--stat-box-bg);
    display: inline-flex;
    padding-left: -20px;
    gap: 0.25rem;
}
.bonus-pills-container .bonus-pill {
  background-color: var(--btn-bg-color, #ccc);
  color: var(--text-on-btn, #000);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 0.4rem;
  white-space: nowrap;
}

/* Bonus pill styles (Consolidated and Renamed) */
.bonus-pill-adv,
.bonus-pill-dis {
    /* Text and Font Styling */
    font-weight: 900;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
    font-size: 0.9em;
    white-space: nowrap;

    /* Box Styling */
    background-color: #fff !important;
    border: 1px solid #000;
    border-radius: 0.3rem;
    padding: 0 0.35rem;

    /* Layout */
    position: relative;
    z-index: 2;
    flex-shrink: 0; /* Prevents shrinking in a flex container */
}

/* Specific Colors */
.bonus-pill-adv { color: #1d4ed8; } /* Blue */
.bonus-pill-dis { color: #b91c1c; } /* Red */

/* Horizontal rule styling */
hr {
    border-color: #000;
    margin: 1.5rem 0;
    opacity: 0.7;
}

/* --- FINAL: Gear Slot Styling --- */
.gear-slot {
    background: linear-gradient(145deg, rgba(255,255,255,0.05), rgba(0,0,0,0.05));
    border: 2px dashed var(--card-border-color, #e2e8f0); /* Corrected variable name */
    border-radius: 1rem;
    padding: 0.75rem;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    color: var(--text-color); /* Corrected variable name */
    text-align: center;
    position: relative;
}

.gear-slot::after {
    content: '';
    background-image: url('assets/ui/retrocursorsmall.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    position: absolute;
    width: 64px;
    height: 64px;
    right: 0; /* Anchor the cursor to the right edge */
    top: 50%;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    /* Mirror the icon and shift it right by 50% of its own width */
    transform: translate(50%, -50%) scaleX(-1); 
}

.gear-slot:hover {
    border-color: var(--btn-bg-color, #4c51bf); /* Corrected variable name */
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.gear-slot:hover::before {
    opacity: 1;
    width: 32px;
    margin-right: 0.5rem;
}

/* Show the icon on hover by changing opacity */
.gear-slot:hover::after {
    opacity: 1;
}

/* Standardized style for a filled slot */
.gear-slot.filled {
    border-style: solid;
    border-color: #b0c4de; 
    background: #081048; 
    box-shadow: 0 0 10px rgba(176, 196, 222, 0.3);
}

/* Position the main gear icon in the top-left corner */
.gear-slot-icon {
    position: absolute;
    top: 0;
    left: 0;
    font-size: 1.8rem;
    line-height: 1;
    opacity: 0.2;
    transition: all 0.2s ease-in-out;
    transform: translate(-35%, -40%); /* CHANGED - Nudged further up and left */
}

/* When an item is selected/filled */
.gear-slot.filled .gear-slot-icon {
    opacity: 1; 
    /* This combines the positioning and the scaling */
    transform: translate(-35%, -40%) scale(1.1); 
}

.gear-slot-text {
    font-weight: 600;
    font-size: 1rem;
    transition: color 0.2s ease-in-out;
}

.gear-slot.filled .gear-slot-text {
    font-weight: 700;
    color: #f0f8ff; 
}

/* Wound Track Styling */
.wound-track-container {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* Align items to the top for text below */
    padding-top: 0.5rem; /* Space for the line */
    padding-bottom: 0.5rem; /* Space for the text */
}
.wound-track-line {
    position: absolute;
    top: calc(1rem + 4px); /* Half height of bubble + border */
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--card-border-color, #e2e8f0); /* Corrected variable name */
    z-index: 0;
}
.wound-bubble-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative; /* For z-index to be above the line */
    z-index: 1;
    flex: 1; /* Distribute space evenly */
}
.wound-bubble-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    text-align: center;
    padding: 0.25rem; /* Small padding for clickable area */
}
.wound-bubble {
    width: 2.5rem; /* 40px */
    height: 2.5rem; /* 40px */
    border-radius: 9999px; /* Full rounded */
    background-color: #e2e8f0; /* Default light gray */
    border: 2px solid #cbd5e0; /* Default border */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem; /* text-sm */
    font-weight: 600; /* font-semibold */
    transition: all 0.2s ease-in-out;
    color: var(--text-color); /* Corrected variable name */
}
.wound-bubble-label input[type="radio"]:checked + .wound-bubble {
    background-color: var(--btn-bg-color, #4c51bf); /* Corrected variable name */
    border-color: var(--btn-bg-color, #4c51bf); /* Corrected variable name */
    color: white;
    transform: scale(1.1);
    box-shadow: 0 0 10px 3px var(--selected-radio-glow-color); /* Corrected variable name */
    transition: box-shadow 0.2s ease-in-out; /* Optional: smooth the shadow appearance */
}
.wound-bubble-label input[type="radio"]:disabled + .die-bubble {
    background-color: #f7fafc;
    border-color: #e2e8f0;
    color: #a0aec0;
    cursor: not-allowed;
}

/* NEW: Dice Track Styling */
.die-track-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 0.25rem; /* Smaller gap for dice */
    margin-top: 0.5rem;
    margin-left: 0.5rem;
}
/* ... other die-bubble styles ... */
.die-bubble-label input[type="radio"]:disabled + .die-bubble {
    background-color: var(--die-bubble-disabled-bg-color, #f7fafc); /* Corrected variable name */
    border-color: var(--die-bubble-disabled-border-color, #e2e8f0); /* Corrected variable name */
    color: var(--die-bubble-disabled-text-color, #a0aec0); /* Corrected variable name */
    cursor: not-allowed;
}
.die-bubble-label {
    cursor: pointer;
}
.die-bubble {
    width: 2rem; /* 32px */
    height: 2rem; /* 32px */
    border-radius: 9999px; /* Full rounded */
    background-color: var(--die-bubble-default-bg-color, #e2e8f0); /* Corrected variable name */
    border: 2px solid var(--die-bubble-default-border-color, #cbd5e0); /* Corrected variable name */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem; /* text-xs */
    font-weight: 600; /* font-semibold */
    transition: all 0.2s ease-in-out;
    color: var(--die-bubble-default-text-color, #000000); /* Corrected variable name */
}
.noticelabel {
    color: var(--highlight-color); /* Use the dynamic theme highlight color */
    font-weight: 600; /* This is the same as font-semibold */
    margin-top: 1rem; /* This is the same as mt-4 */
}
.die-bubble-label input[type="radio"]:checked + .die-bubble {
    background-color: var(--btn-bg-color, #4c51bf); /* Corrected variable name */
    border-color: var(--btn-bg-color, #4c51bf); /* Corrected variable name */
    color: white;
    transform: scale(1.1);
    box-shadow: 0 0 10px 3px var(--selected-radio-glow-color); /* Corrected variable name */
    transition: box-shadow 0.2s ease-in-out; /* Optional: smooth the shadow appearance */
}
/* MODIFIED: Explicitly use variables for disabled state, ensuring proper override */
.die-bubble-label input[type="radio"]:disabled + .die-bubble {
    background-color: var(--die-bubble-disabled-bg-color, #f7fafc); /* Corrected variable name */
    border-color: var(--die-bubble-disabled-border-color, #e2e8f0); /* Corrected variable name */
    color: var(--die-bubble-disabled-text-color, #a0aec0); /* Corrected variable name */
    cursor: not-allowed;
    /* Optional: If it *still* doesn't work, add !important here, but try without it first. */
    /* color: var(--die-bubble-disabled-text-color, #a0aec0) !important; */
}

/* Gear Selection Modal Styles */
.gear-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out;
}
.gear-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}
.gear-modal-content {
    background: linear-gradient(160deg, #182888, #081048);
    border: 3px solid #b0c4de;
    border-radius: 8px;
    width: 90%;
    max-width: 550px;
    box-shadow: 0 0 20px rgba(176, 196, 222, 0.5), inset 0 0 15px rgba(0,0,0,0.5);
    color: #f0f8ff;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.3s ease-in-out;
}
.gear-modal-overlay.show .gear-modal-content {
    transform: scale(1);
}
.gear-modal-header {
    padding: 1rem 1.5rem;
    font-family: 'Cinzel Decorative', serif; /* Verify Cinzel Decorative is here */
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    border-bottom: 2px solid #b0c4de;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}
.gear-modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #b0c4de;
    transition: color 0.2s ease;
}
.gear-modal-close:hover {
    color: #ffffff;
}
.gear-modal-body {
    padding: 1rem;
    max-height: 60vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Custom Scrollbar for the modal body */
.gear-modal-body::-webkit-scrollbar {
    width: 8px;
}
.gear-modal-body::-webkit-scrollbar-track {
    background: #081048;
}
.gear-modal-body::-webkit-scrollbar-thumb {
    background-color: #b0c4de;
    border-radius: 4px;
    border: 2px solid #081048;
}
.gear-modal-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    position: relative; /* This is crucial for positioning */
}
.gear-modal-item::before {
    content: '';
    background-image: url('assets/ui/retrocursorsmall.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    position: absolute;
    width: 64px;
    height: 64px;
    right: 25px; /* Anchor the cursor to the left edge */
    top: 50%;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    /* Mirror the icon and shift it right by 50% of its own width to overlap the border */
    transform: translate(50%, -50%) scaleX(-1); 
}

.gear-modal-item:hover::before {
    opacity: 1; /* Show the cursor on hover */
}
.gear-modal-item:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: #ffffff;
}
/* NEW: Show the cursor on hover */
.gear-modal-item:hover::after {
    opacity: 1;
}
.gear-item-icon {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
    margin-right: 1rem;
}
.gear-item-details {
    flex-grow: 1;
}
.gear-modal-item-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: #ffffff;
}
.gear-modal-item-description,
.gear-modal-item-stats,
.gear-modal-item-ability {
    font-size: 0.85rem;
    color: #b0c4de;
    opacity: 0.9;
}
.gear-modal-footer {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-top: 2px solid #b0c4de;
    background-color: rgba(0,0,0,0.2);
}
.gear-modal-footer .btn {
    flex-grow: 1;
    background-color: #2a0a4a;
    color: #f0f8ff;
    border: 2px solid #b0c4de;
    font-weight: 600;
    transition: all 0.2s ease;
}
.gear-modal-footer .btn:hover {
    background-color: #b0c4de;
    color: #081048;
}

/* Modal Styles (reused for gear and tribe info) */
.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: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out;
}
.modal-overlay.show {
    opacity: 1; /* Duplicated property, remove one if this exists */
    visibility: visible;
}
.modal-content {
    background-color: var(--card-bg-color, #ffffff); /* Corrected variable name */
    border-radius: 1.5rem;
    padding: 2rem;
    width: 90%;
    max-width: 800px; /* Increased max-width here if you want it wider like in HTML */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(-20px);
    transition: transform 0.3s ease-in-out;
    position: relative;
    color: var(--modal-preview-text-color, var(--text-color)); /* Corrected variable name */
}
.modal-overlay.show .modal-content {
    transform: translateY(0); /* Ensure this rule exists */
}
.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color); /* Corrected variable name */
}
#adaptiveStatModal .modal-content,
#tribe-details-modal .modal-content {
  -webkit-user-select: none; /* Safari */
  -ms-user-select: none;     /* IE 10+ and Edge */
  user-select: none;         /* Standard syntax */
}
/* 1. Set a smaller, more appropriate width for this specific modal */
.adaptive-stat-modal-content {
    max-width: 480px;
}

/* 2. Create a responsive grid that fits as many columns as possible */
#adaptiveStatModalItemList {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

/* 3. Style the individual stat buttons for a cleaner look */
.adaptive-stat-modal-item {
    padding: 1rem 0.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
}

/* 4. Center the confirm button instead of making it full-width */
#adaptiveStatConfirmBtn {
    width: auto;
    margin-left: auto;
    margin-right: auto;
    display: block;
    padding-left: 2rem;
    padding-right: 2rem;
}
.adaptive-stat-modal-item:hover {
    background-color: #e2e8f0;
    border-color: #4c51bf;
}
.adaptive-stat-modal-item.selected {
 /* background-color: var(--btn-bg-color, #4c51bf);*/
 /* color: white; NO LONGER USERS */
    /* Keep or adjust the border and shadow for visual selection feedback: */
    border: 2px solid var(--modal-preview-highlight-color, #888888); /* Corrected variable name */
    box-shadow: 0 0 10px 2px rgba(0, 0, 0, 0.2);
    transform: scale(1.02); /* Slight scale to indicate selection */
    /* You might want to add a subtle transition for these properties if they don't have one already */
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out, transform 0.2s ease-in-out;
}
.adaptive-stat-modal-item.disabled {
    background-color: #505050;
    color: #7c7c7c;
    cursor: not-allowed;
    border-color: #e7e7e7;
}
.adaptive-stat-display {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.25rem;
    text-shadow: 
    0 0 8px var(--adaptive-glow-color),
    0 0 12px var(--adaptive-glow-color);
}
.freeform-override-color {
    color: #000000 !important;
}
/* Add these new rules to the end of your style.css file! */

/* A general style for our new bordered resource boxes */
.resource-box {
    border: 1px solid var(--card-border-color, #e2e8f0);
    border-radius: 0.75rem;
    padding: 0.75rem;
    /* REMOVED height: 100%; to allow content to size the boxes naturally */
    display: flex;
    flex-direction: column;
    text-align: center;
}

/* A consistent label style for all our resource boxes */
.resource-label {
    font-weight: 600; /* semibold */
    color: var(--text-color); /* Corrected variable name */
    border-bottom: 2px solid var(--card-border-color, #e2e8f0); /* Corrected variable name */
    padding-bottom: 0.25rem;
    margin-bottom: 0.25rem;
}

/* Match the Channels box background behavior */
.temp-grit-bg {
    background-color: color-mix(in srgb, var(--btn-bg-color) 20%, transparent); /* Corrected variable name */
    border-radius: 0.5rem;
    padding: 0.5rem;
    margin-top: auto;
}

/* Adjust for dark mode */
@media (prefers-color-scheme: dark) {
    .temp-grit-bg {
        background-color: color-mix(in srgb, var(--btn-bg-color) 10%, transparent); /* Corrected variable name */
    }
}

/* Special background for the Channels box */
.channel-box-bg {
    background-color: color-mix(in srgb, var(--btn-bg-color) 20%, transparent); /* Corrected variable name */
}

/* The "high value" background for Momentum Tokens */
.momentum-box-bg {
    background: linear-gradient(
      135deg,
      rgba(252, 122, 0, 0.2), /* A transparent gold */
      rgba(255, 153, 0, 0)   /* Fading to nothing */
    );
}
/* NEW: Style for bonus pill container */
.bonus-pills-container {
    display: inline-flex;
    gap: 0.25rem; /* Adds a small space between pills */
    flex-shrink: 0; /* Prevents the container from shrinking */
    position: relative; /* ADD THIS LINE */
    z-index: 1;         /* AND ADD THIS LINE */
}

/* --- Styles for the new Race Selection Modal --- */
#race-list-container .race-btn,
#tribe-buttons-container .tribe-btn {
    width: 100%;
    padding: 0.5rem 1rem;
    margin-bottom: 0.25rem;
    text-align: left;
    background-color: var(--modal-tribe-btn-bg-color, #e5e7eb); /* Corrected variable name */
    color: var(--modal-tribe-btn-text-color, #1f2937); /* Corrected variable name */
    border: 1px solid var(--modal-tribe-btn-border-color, #d1d5db); /* Corrected variable name */
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

#race-list-container .race-btn:hover,
#tribe-buttons-container .tribe-btn:hover {
    background-color: var(--modal-tribe-btn-border-color, #d1d5db); /* Corrected variable name */
    border-color: var(--modal-preview-highlight-color, var(--btn-bg-color, #9ca3af)); /* Corrected variable name */
    transform: scale(1.02);
}

#race-list-container .race-btn.selected,
#tribe-buttons-container .tribe-btn.selected {
    background-color: var(--modal-tribe-btn-selected-bg-color, var(--btn-bg-color, #4c51bf)); /* Corrected variable name */
    color: var(--modal-tribe-btn-selected-text-color, white); /* Corrected variable name */
    border-color: var(--modal-tribe-btn-selected-bg-color, var(--btn-bg-color, #4c51bf)); /* Corrected variable name */
    font-weight: 600;
    transform: scale(1.03);
}

#race-modal-confirm-btn:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}


#race-selection-modal {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    /* NEW: Radial Gradient Background */
    background: radial-gradient(circle, rgba(255,255,255,0.7) 0%, rgba(0,0,0,0.5) 100%);
}
#race-selection-modal.show {
    opacity: 1;
    visibility: visible;
}
/* Styling for elements INSIDE the tribe preview container */
#tribe-preview-container {
    padding: 1rem; /* This gives it that breathing room! */
}
/* Headers inside modal previews (Action Bonuses, Other Bonuses, etc. - excluding main tribe name) */
/* Headers inside modal previews (Action Bonuses, Other Bonuses, etc. - excluding main tribe name) */
#tribe-preview-container h4,
#tribe-details-content h4 {
    color: var(--modal-preview-highlight-color, var(--modal-preview-text-color, #1f2937)); /* Corrected variable name */
    font-weight: 800;
    font-family: 'Cinzel Decorative', serif; /* REMOVE THIS LINE if it's present */
}

/* Strong/bold text inside BOTH modal previews */
#tribe-preview-container strong,
#tribe-details-content strong {
    color: var(--modal-preview-highlight-color, var(--modal-preview-text-color, #000000)); /* Corrected variable name */
}
/* NEW: Specific styles for the main tribe name in the preview modal */
#tribe-preview-container .tribe-header-display {
    color: var(--modal-preview-header-text-color); /* Corrected variable name */
    font-family: 'Cinzel Decorative', serif !important; /* Forces Cinzel Decorative for this specific header */
    font-weight: 900;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
/* Ability names inside BOTH modal previews */
#tribe-preview-container .ability-name,
#tribe-details-content .ability-name {
    color: var(--modal-preview-highlight-color, var(--modal-preview-text-color, #000000)); /* Corrected variable name */
    font-weight: 700;
}

/* List item markers inside BOTH modal previews */
#tribe-preview-container ul li::marker,
#tribe-details-content ul li::marker {
    color: var(--modal-preview-highlight-color, var(--modal-preview-text-color, #000000)); /* Corrected variable name */
}

/* Styles for the highlighted Tribal Weakness in the preview modal */
.tribal-weakness-preview {
    background-color: #0f0303;
    color: #c93f3f;
    border: 2px solid #b91c1c;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    text-align: center;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.tribal-weakness-preview h4 {
    color: #e60000 !important;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.tribal-weakness-preview strong {
    background: linear-gradient(90deg, #b91c1c 0%, #ffffff 100%);
    /* Include the standard property first, then the vendor prefix */
    background-clip: text; /* Add this line (standard property) */
    -webkit-background-clip: text; 

    -webkit-text-fill-color: transparent; 
    /* color: #ffffff; /* This line is often redundant, you can remove it */

    /* If you want a *visible* underline, you might need to use border-bottom */
    /* text-decoration: underline; /* This line will create a transparent underline if text-fill-color is transparent */
    
    font-weight: bold;

    /* Example if you want a solid underline: */
    /* border-bottom: 1px solid #ffffff; */
    /* padding-bottom: 2px; */
}
.tribal-weakness-preview p {
    color: #c93f3f;
    font-size: 0.875rem;
    line-height: 1.4;
}

/* NEW: Styling for general H2 titles within .card elements */
.card h2 {
    font-family: 'Cinzel Decorative', serif;
    font-size: 2em;
    font-weight: 700;
    margin-bottom: 1.5rem;
    
    /* NEW: Add glow effect */
    text-shadow: 0 0 10px var(--header-glow-color, transparent); /* Corrected variable name */
    
    /* NEW: Add tribe-themed text gradient */
    color: transparent;
    background: linear-gradient(45deg, 
        var(--tribe-header-bg-start, var(--text-color)), 
        var(--tribe-header-bg-end, var(--text-color))
    );
    -webkit-background-clip: text;
    background-clip: text;
}
#lineage-container {
    background-color: var(--card-bg-color); /* Corrected variable name */
    border: 1px solid var(--card-border-color); /* Corrected variable name */
    border-radius: 1.5rem;
    padding: 1rem;
    transition: all 0.3s ease-in-out;
}

.lineage-initial-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

.lineage-selected-state {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.lineage-display-header {
    font-family: 'Cinzel Decorative', serif;
    font-weight: 700;
    font-size: 1.6rem;
    text-align: center;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--card-border-color); /* Corrected variable name */
    text-shadow: 0 0 15px var(--stat-name-glow-color);
    /* NEW: Apply the gradient text effect */
    color: transparent;
    background: linear-gradient(45deg, 
        var(--tribe-header-bg-start, var(--text-color)), 
        var(--tribe-header-bg-end, var(--text-color))
    );
    -webkit-background-clip: text;
    background-clip: text;
}

.lineage-weakness-section {
    background-color: #0f0303;
    color: #c93f3f;
    border: 2px solid #b91c1c;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    width: 100%;
    height: auto; /* This makes it fit the text! */
}

.lineage-weakness-section h4 {
    font-weight: 700;
    color: #ffffff;
    padding-bottom: 0.25rem;
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.lineage-weakness-section p {
    font-size: 0.875rem;
    line-height: 1.4;
}

.lineage-actions-container {
    display: flex;
    justify-content: flex-end; /* Puts buttons on the right */
    gap: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--card-border-color); /* Corrected variable name */
}
/* --- Tablet & Mobile Responsiveness --- */
@media (max-width: 1024px) {
    /* Reduce padding on cards for smaller screens */
    .card {
        padding: 1rem;
    }

    /* Reduce horizontal margin of the main container */
    .max-w-4xl {
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
        margin-left: 1rem;
        margin-right: 1rem;
    }

    .stats-tray { left: 1rem; right: 1rem; 
    }

    .stats-tray::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
    }

    .stats-tray-content { max-width: 100%; margin: 0; box-sizing: border-box; 
    }

    /* Make the page title smaller on tablets */
    #page-title-container h1 {
        font-size: 2.5em;
    }
    #page-title-container .sub-title-text {
        font-size: 1.25em;
    }
}
/* NEW: Styles for Conduit Type Notice */
.conduit-notice-emphasis {
    color: #b91c1c; /* A deep red, similar to red-700 */
    font-weight: 900; /* Extra bold */
}

.conduit-notice-underline {
    text-decoration: underline;
}
.grit-display-line {
    display: flex;
    align-items: center;
    justify-content: center; /* Center the whole grit current/max line */
    /* REMOVED: gap from here, as grit-max-and-bonuses-container is no longer a part of this flex row */
    margin-top: 0.5rem;
    margin-bottom: 0.5rem; /* Add some space below this line */
}

/* MODIFIED: Container to stack Max value and Bonus indicators vertically */
.grit-max-and-bonuses-container {
    display: flex;
    flex-direction: column; /* Stack Max value and Bonus indicators */
    align-items: center; /* ALIGN WHOLE BLOCK TO CENTER HORIZONTALLY */
    /* REMOVED: gap: 0.1rem; as spacing will be managed by bonus-indicators internal gap */
    /* REMOVED: margin-left: 0.1rem; as it's no longer next to the slash */
    width: 100%; /* Ensure it takes full width of parent to center content */
}

.grit-current-section,
.grit-max-section { /* Removed old flex display from here */
    display: flex; /* Apply flex directly to these sections now */
    align-items: center;
    gap: 0.25rem;
}

.grit-current-section label { /* Specific sizing for 'Current' label */
    font-size: 0.75rem;
}

.grit-current-section input,
.grit-max-section #grit-max {
    width: 3.5rem; /* Smaller width for input and max display */
    font-size: 1.125rem; /* Smaller font size for numbers */
    padding: 0.25rem; /* Reduced padding */
    height: 2rem; /* Adjusted height */
    text-align: center;
}

.grit-max-section #grit-max {
    font-weight: bold; /* Ensure the number is bold */
}

/* NEW: Style for the "Max" label next to the number */
.grit-max-label {
    font-size: 0.75rem; /* Smaller size for "Max" */
    margin-left: 0.1rem; /* Small space from the number */
}

.grit-slash {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0.1rem;
}

/* MODIFIED: .grit-bonus-indicators to be horizontal */
.grit-bonus-indicators {
    display: flex;
    flex-direction: column; /* CHANGED: Stack children vertically */
    align-items: flex-start; /* Align text to the left */
    gap: 0; /* Remove gap between stacked lines, line-height will control spacing */
    margin-left: 0.5rem; /* Space from the "Max" label/number */
    line-height: 1;
    flex-shrink: 0;
}

/* MODIFIED: bonus-label to use 'block' for new line */
.grit-bonus-indicators .bonus-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-color); /* Corrected variable name */
    margin-bottom: 0.1rem; /* Small margin below the label */
}

.grit-bonus-indicators .bonus-value {
    font-size: 0.65rem;
    white-space: nowrap;
    /* color: var(--btn-bg-color); If you want them to be a highlight color */
}

.grit-bonus-indicators .bonus-indicator {
    font-size: 0.65rem; /* Even smaller font for the bonus details */
    white-space: nowrap; /* Prevent wrapping */
}
/* NEW: Class to control the width of the Quick Actions box */
.quick-actions-fixed-width {
    width: 150px; /* Set a fixed width for the box, adjust as needed */
    min-width: 150px; /* Ensure it doesn't shrink smaller than this */
    max-width: 150px; /* Ensure it doesn't grow larger than this */
}

/* Ensure buttons inside this fixed-width container fill it */
.quick-actions-fixed-width .btn {
    width: 100%; /* Buttons will now fill the 150px width */
}
/* NEW: Styles for each bonus value line */
.bonus-value-line {
    font-size: 0.65rem; /* Smaller font for bonus details */
    white-space: nowrap; /* Prevent wrapping */
    line-height: 1.1; /* Control vertical spacing */
    color: var(--text-color); /* Corrected variable name */
    display: block; /* Ensure each span takes its own line */
}
/* NEW: For compact +/- buttons next to inputs */
.input-group-compact {
    display: flex;
    align-items: center;
    gap: 0.1rem; /* Very small gap */
}

/* NEW: Styles for smaller channel control buttons (reused from Grit Pool) */
.btn-channel-control-plus,
.btn-channel-control-minus {
    background-color: var(--btn-bg-color, #4c51bf); /* Corrected variable name */
    color: white;
    padding: 0 0.4rem; /* Reduced padding */
    height: 1.2rem; /* Fixed height for small button */
    border-radius: 0.5rem; /* Slightly less rounded for compact feel */
    font-weight: 600;
    font-size: 0.7rem; /* Smaller font size */
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); /* Subtle shadow */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem; /* Fixed width */
}

.btn-channel-control-plus:hover,
.btn-channel-control-minus:hover {
    background-color: var(--btn-hover-color, #5a61bb); /* Corrected variable name */
}

/* Ensure number input inside compact group fits */
.input-group-compact input[type="number"] {
    height: 2.5rem; /* Match typical input height */
}

/* NEW: Container for the Max Channels value and its bonuses */
#channel-max-value-container {
    display: flex;
    flex-direction: column; /* Stack the value and bonuses vertically */
    align-items: center; /* Center them horizontally */
}
/* NEW: Overall container for Channels section */
.channel-main-box {
    display: flex;
    flex-direction: column;
    align-items: center; /* Center everything inside */
    width: 100%; /* Take full width of parent conduit-box */
    padding-top: 0.5rem; /* Space below Conduit Die */
}

/* NEW: Title style for "Channels" box */
.channel-main-box .channel-box-title {
    font-size: 1rem; /* Adjust size if needed */
    margin-bottom: 0.5rem; /* Space below title */
    text-align: center;
    width: 100%; /* Ensure border-bottom spans full width */
    border-bottom: 2px solid var(--card-border-color, #e2e8f0); /* Corrected variable name */
    padding-bottom: 0.25rem;
}

/* NEW: Horizontal row for Earned and Max sections */
.channel-content-row {
    display: flex;
    align-items: flex-start; /* Align contents to top */
    justify-content: center; /* Center the two main blocks */
    gap: 1.5rem; /* Increased gap to prevent overlap */
    width: 100%; /* Ensure it uses full width for centering */
}

/* NEW: Styles for Earned Channels section */
.channel-earned-section {
    display: flex;
    flex-direction: column;
    align-items: center; /* Center label and input */
    flex-shrink: 0; /* Prevent from shrinking too much */
}

/* NEW: Styles for Max Channels display section */
.channel-max-section-display {
    display: flex;
    flex-direction: column;
    align-items: center; /* Center label, value, and bonuses */
    flex-shrink: 0; /* Prevent from shrinking too much */
}
/* NEW: Styles for locked/unavailable abilities */
.locked-ability-text {
    color: var(--text-color); /* Corrected variable name */
    opacity: 0.5; /* Dim the text */
    filter: blur(5px); /* Slightly blur the text for visual effect */
    transition: opacity 0.3s ease, filter 0.3s ease; /* Smooth transition */
}

/* Optional: Slight hover effect for locked text if desired, to indicate it's interactable/part of the sheet */
.locked-ability-text:hover {
    opacity: 0.7;
    filter: blur(5px);
}

/* Style for the unlock emoji/number */
.unlock-indicator {
    font-size: 0.8em; /* Slightly smaller than ability name */
    margin-left: 0.3em;
    cursor: help; /* Indicate it's hoverable for tooltip */
    white-space: nowrap; /* Keep emoji and number on one line */
}
/* --- NEW: Tab Navigation System --- */
#tab-nav {
    gap: 0.5rem;
}
.tab-btn {
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    background-color: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    opacity: 0.6;
}
.tab-btn:hover {
    background-color: color-mix(in srgb, var(--card-bg-color) 80%, black);
    opacity: 1;
}
.tab-btn.active {
    color: var(--highlight-color);
    border-bottom-color: var(--highlight-color);
    opacity: 1;
}

/* --- NEW: Tab Content Panes --- */
.tab-pane {
    display: none; /* Hide all tabs by default */
}
.tab-pane.active {
    display: block; /* Show only the active tab */
}

:root { --container-max: 57rem; }

.stats-tray{
  position: fixed;
  bottom: 0;
  z-index: 90;
  left: calc((100vw - var(--container-max)) / 2);
  right: calc((100vw - var(--container-max)) / 2);
  transform: translateY(100%);
  transition: transform 0.4s ease-in-out, backdrop-filter 0.4s ease-in-out;
  
   /* --- ADD THESE LINES BACK IN --- */
  background-color: transparent;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px); /* For Safari compatibility */
  border-top: none;
  box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.2);
  
  max-height: 90vh;
  overflow-y: auto;
  
  /* --- ADD THESE TWO LINES --- */
  scrollbar-width: none;  /* For Firefox */
  -ms-overflow-style: none;  /* For Internet Explorer and Edge */
}
.stats-tray::-webkit-scrollbar {
    display: none;
}
.stats-tray.is-open{ transform: translateY(0); 
}
.stats-tray-content{
  max-height: none;
  overflow: visible;
  box-sizing: border-box;   /* keep this */
}
/* Ensure cards inside the tray don't have bottom margin */
.stats-tray-content .card {
    margin-bottom: 0;
}
.stats-tray-content #stats-card-content {
    margin-bottom: 1rem; /* Add space between stats and utilities */
}

/* --- NEW: d20 Toggle Button (Using Your Image) --- */
#stats-tray-toggle {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 95; /* Above the tray itself */
    
    /* Sizing */
    width: 60px;
    height: 60px;

    /* Image Styling */
    background-image: url('assets/icons/common/d20blank.png');
    background-color: transparent;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;

    /* Button Reset */
    border: none;
    cursor: pointer;

    /* Effects */
    transition: transform 0.2s ease-in-out, filter 0.2s ease-in-out;
}
#stats-tray-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    filter: drop-shadow(0 0 8px var(--highlight-color));
}
/* was: repeat(3, 1fr) */
.die-track-container {
  min-width: 0;
  flex-wrap: wrap;
}
/* --- NEW: Full-screen overlay for when stats tray is open --- */

body::before {
    content: '';
    position: fixed;
    inset: 0; /* This is a shorthand for top: 0; right: 0; bottom: 0; left: 0; */
    z-index: 89; /* Just below the tray's z-index of 90 */
    
    /* The visual effect */
    background-color: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px); /* For Safari */

    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out;
}
.stat-content-row {
  display: flex;
  gap: 0.75rem;
}
/* This rule makes the overlay visible when the body has our new class */
body.tray-is-active::before {
    opacity: 1;
    visibility: visible;
}
/* Split stat cards: left-align actions, push dice to the right */
#stats-grid-container .stat-border-box.stat-split .stat-content-row{
  display: flex;
  align-items: center;
  justify-content: space-between; /* spread to edges */
  width: 100%;
  gap: 0.75rem;
}

/* Actions column — let it grow and keep text left */
#stats-grid-container .stat-border-box.stat-split .stat-actions-list{
  flex: 1 1 auto;          /* take remaining space */
  text-align: left;        /* hard-left the text */
  align-items: flex-start; /* if it ever becomes flex */
  justify-content: flex-start;
  margin: 0;               /* no extra centering margins */
}

/* Dice column — fixed width and hard-right */
#stats-grid-container .stat-border-box.stat-split .die-track-container{
  flex: 0 0 56px;          /* skinny, fixed column for dice */
  margin-left: auto;       /* push it to the right edge */
  align-items: center;     /* keep dice centered within the column */
  border-left: 1px solid var(--card-border-color);
  padding-left: 0.75rem;
  z-index: 1;
}
/* --- New Icon Styling --- */
.stat-icon {
    position: static;              /* just in case */
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    margin-right: 0.25rem;
}

.element-icon-watermark {
    position: absolute;
    right: -15px;
    bottom: -15px;
    width: 250px;
    height: 250px;
    opacity: 0.30;
    z-index: 0;
    pointer-events: none;
}
.stat-border-box {
    --stat-box-bg: color-mix(in srgb, var(--card-bg-color) 80%, black);
    background-color: var(--stat-box-bg);
    position: relative; overflow: hidden;
    display: flex;
    flex-direction: column;
}
.stat-box-main-content, .die-track-container { 
    position: relative; z-index: 1; 
}
.stat-border-box.stat-split {
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
/* Header spans full width */
.stat-border-box.stat-split .stat-label {
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 0.5rem;       /* space before the list+dice row */
}

.stat-border-box.stat-split .stat-content-row .die-track-container {
  border-left: 1px solid var(--card-border-color);
  padding-left: 0.75rem;
  z-index: 1; /* stays above the row connector lines */
}

#conduitDie-track {
  display: flex !important;
  flex-direction: row !important;
  justify-content: center !important;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  margin: 0 auto;
  margin-top: 0.5rem; /* <-- Add this line */
}

/* Remove the left rule/padding that stat boxes use for vertical dice columns */
.conduit-die .die-track-container {
  padding-left: 0;
  border-left: none;
}


#stats-grid-container .stat-border-box.stat-split .stat-content-row{
  flex: 1;                    /* take the remaining height in the card */
  display: flex;
  align-items: center;        /* vertical centering */
  justify-content: center;    /* horizontal centering of the pair */
  gap: .75rem;
  min-height: 200px;          /* adjust to taste; gives centering room */
}
/* --- NEW: Shop Modal Item List Styles --- */
#shop-modal-item-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem; /* Space between items */
}

.shop-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-weight: 700;
}

/* --- Inventory V2 Styles (Corrected) --- */
.inventory-category-header {
    font-size: 1.25rem;
    font-weight: 600;
    color: #ddd0b2;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid #A18F63; /* Updated to match new theme */
}

.inventory-item {
    background-image: 
        /* The opacity values have been lowered to let the texture show through */
        linear-gradient(rgba(187, 163, 110, 0.4), rgba(109, 84, 51, 0.5)), 
        url('assets/parchment.jpg');

    /* The rest of the styles remain the same */
    border: 1px solid #E5E7EB;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    background-repeat: repeat;
    transition: box-shadow 0.2s ease-in-out;
    padding: 0.75rem 1rem;
}

.inventory-item:hover {
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.inventory-item.is-equipped {
    opacity: 0.7;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5); /* A better effect for textured backgrounds */
}

/* --- INVENTORY ITEM SUMMARY FIX --- */

/* 1. The main summary bar is now the unselectable, clickable entity */
.item-summary {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* ADDED: These lines prevent the text from being highlighted */
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none;     /* IE 10+ and Edge */
    user-select: none;         /* Standard */
}

/* 2. These are your existing, correct rules for the children */
.item-name {
    font-weight: 600;
    color: #11182C;
}
.item-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* 3. NEW RULE: This makes the direct children of the summary "invisible" to clicks */
.item-summary > * {
    pointer-events: none;
}

/* 4. NEW RULE: This OVERRIDES the rule above to re-enable clicks ONLY on the buttons */
.item-summary .btn,
.item-summary .quantity-btn {
    pointer-events: auto;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 100px;
    justify-content: center;
}

.quantity-text {
    font-weight: bold;
}

.item-stat-badge {
    display: flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    background-color: #E5E7EB; /* Default background */
    color: #374151; /* Default dark text */
}

.item-stat-badge[data-element="Light"]     { background-color: #FDF6E3; color: #9C8348; }
.item-stat-badge[data-element="Dark"]      { background-color: #000000; color: #F3F4F6; }
.item-stat-badge[data-element="Fire"]      { background-color: #991B1B; color: #FECACA; }
.item-stat-badge[data-element="Ice"]       { background-color: #1E40AF; color: #DBEAFE; }
.item-stat-badge[data-element="Earth"]     { background-color: #78350F; color: #FEF3C7; }
.item-stat-badge[data-element="Wind"]      { background-color: #065F46; color: #A7F3D0; }
.item-stat-badge[data-element="Water"]     { background-color: #1D4ED8; color: #BFDBFE; }
.item-stat-badge[data-element="Lightning"] { background-color: #4C1D95; color: #E9D5FF; }


.stat-badge-label {
    margin-right: 0.25rem;
    opacity: 0.8; /* Makes the label slightly less prominent */
}

.stat-badge-value {
    font-weight: 700; /* BOLD */
    text-shadow: 1px 1px 1px #000; /* The sweet ass black shadow */
}

/* --- Non-Expandable Item Style --- */
.inventory-item.not-expandable {
    cursor: default;
}

/* --- Expanded Item Detail Theming (High Specificity) --- */
#inventory-items-container .item-details {
    display: none;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    border-top: 1px solid #E5E7EB;
    background-color: rgba(253, 246, 227, 0.548);
    border: 2px solid #fff3ad;
    color: #000000;
    border-radius: 0.5rem; /* Applied to the whole details box */
    padding: 1rem;
}

#inventory-items-container .inventory-item.is-expanded .item-details {
    display: block;
}

#inventory-items-container .inventory-item .item-details p {
    color: #030303;
    font-style: italic;
    margin-bottom: 1rem;
}

#inventory-items-container .inventory-item .item-details h6 {
    color: #000000;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

#inventory-items-container .inventory-item .item-details ul {
    color: #000000;
    list-style-type: disc;
    padding-left: 1.5rem;
}

/* --- Inventory Quantity Text Fix --- */
.quantity-controls .quantity-text {
    color: #1F2937;
    font-weight: 600;
}

/* --- Gold Stepper Input Styles --- */
.stepper-input {
    position: relative;
    display: inline-flex;
}

.stepper-input input[type=number]::-webkit-inner-spin-button, 
.stepper-input input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
.stepper-input input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
  padding-right: 1.75rem;
}

.stepper-buttons {
    position: absolute;
    right: 1px;
    top: 1px;
    bottom: 1px;
    display: flex;
    flex-direction: column;
    width: 1.5rem;
}

.stepper-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    background-color: #E5E7EB;
    color: #4B5563;
    font-weight: bold;
    cursor: pointer;
    border: none;
    padding: 0;
    line-height: 1;
}

.stepper-btn:hover {
    background-color: #D1D5DB;
}

.stepper-btn:first-child {
    border-bottom: 1px solid #9CA3AF;
    border-top-right-radius: 0.375rem;
}

.stepper-btn:last-child {
    border-bottom-right-radius: 0.375rem;
}

/* --- Inventory Card Theming --- */
.inventory-card {
    background-image: url('assets/leather-texture.jpg');
    background-repeat: repeat;
    border: 2px solid #3b2b15;
    position: relative;
    padding: 0;
}

.inventory-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background-color: rgba(121, 94, 71, 0.75);
    border-radius: 0.75rem;
    z-index: 0;
}

#player-inventory-list {
    position: relative;
    z-index: 1;
}
.shop-item {
    /* These styles are copied from your .inventory-item rule */
    background-image: 
        linear-gradient(rgba(109, 84, 51, 0.884), rgba(187, 163, 110, 0.801)), 
        url('assets/parchment.jpg');
    background-repeat: repeat;
    border: 1px solid #E5E7EB;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;

    /* This adds the small space you wanted between each item */
    margin-bottom: 0.75rem; 
}

.shop-item-cost {
    font-family: 'Cinzel', serif;
    color: #B87333; /* A coppery-bronze color */
    font-weight: 700;
    font-size: 1.5rem;
    /* A subtle, sharp black shadow to make it feel stamped */
    text-shadow: 1px 1px 1px #000;
}

/* For the short description, e.g., "A Tier 5 knuckles." */
.shop-item-description {
    color: #000000;
    font-style: italic;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

/* --- Shop Modal Filter Tabs --- */
.shop-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.shop-filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: 9999px;
    background-color: #f3f4f6;
    color: #4b5563;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.shop-filter-btn:hover {
    background-color: #e5e7eb;
}

.shop-filter-btn.active {
    background-color: #4f46e5; /* Indigo */
    color: white;
}
/* --- Shop Modal Item Theming (Complete & Corrected) --- */

/* This styles the main container for each item in the shop */
.shop-item {
    background-image: 
        linear-gradient(rgba(187, 163, 110, 0.801), rgba(109, 84, 51, 0.884)), 
        url('assets/parchment.jpg');
    background-repeat: repeat;
    border: 1px solid #E5E7EB;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem; 
}

/* This new block uses the #shop-modal ID to ensure these text styles always win. */

#shop-modal .shop-item-name {
    color: #000000; /* Always black as requested */
    font-weight: 600;
    font-size: 1.1rem;
}

#shop-modal .shop-item-cost {
    font-family: 'Cinzel', serif;
    color: #c09b20; /* Your custom coppery-bronze color */
    font-weight: 700;
    font-size: 1.5rem;
    text-shadow: 1px 1px 1px #000; /* Your custom shadow */
}

#shop-modal .shop-item-description {
    color: #000000; /* Your custom color */
    font-style: italic;
    font-size: 0.85rem;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

#shop-modal .shop-item-detail {
    color: #2d3035; /* Your custom color */
    font-weight: 500;
}

#shop-modal .shop-item-detail strong {
    color: #030303; /* Your custom color */
    font-weight: 700;
}
/* --- Visual Item Slot Styles --- */
.shop-item-slots-container {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem; /* Space between different slot type lines */
}
/* --- Reusable Visual Item Slot Styles --- */
.slots-container {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem; /* Space between different slot type lines */
}

.slot-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.slot-label {
    font-weight: 700;
    color: #11182C;
    flex-shrink: 0; 
}

.slot-icons {
    display: flex;
    gap: 0.25rem; 
}

.slot-icon {
    width: 24px;
    height: 24px;
}
/* --- Initiative & Speed Tracker Styles --- */
.initiative-speed-display {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 100%;
    gap: 1rem;
    padding: 0.5rem 0;
}

.stat-display-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 2.25rem; /* Larger font for the number */
    line-height: 1.1;
    color: var(--highlight-color);
}

.stat-label-small {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-color);
    opacity: 0.9;
}
.gear-modal-item.selected {
    background-color: rgba(255, 255, 255, 0.25);
    border-color: #4f46e5; /* Indigo */
    box-shadow: inset 0 0 5px rgba(255, 255, 255, 0.5);
}
.w-px {
    width: 1px;
}
.h-16 {
    height: 4rem; /* 64px */
}
.bg-gray-400 {
    background-color: #9CA3AF;
}
/* ADD THIS TO THE END OF YOUR STYLESHEET */

/* And REPLACE it with this: */
.resource-icon-watermark {
    position: absolute;
    right: 5px;
    bottom: -100px;
    width: 250px;
    height: 250px;
    opacity: 0.30;
    z-index: 0; /* <-- This brings it above the background but below the content */
    pointer-events: none;
}

.resource-box {
    border: 1px solid var(--card-border-color, #e2e8f0);
    border-radius: 0.75rem;
    padding: 0.75rem;
    /* REMOVED: display: flex; and flex-direction: column; */
    text-align: center;
    position: relative; /* Ensure it's a positioning context for the watermark */
}
.resource-box-content {
    position: relative;
    z-index: 1; /* Lifts this content above the z-index: 0 watermark */
    
    /* This creates the semi-transparent background from your mockup */
    background-color: rgba(0, 0, 0, 0.45);
    
    /* Padding and rounding to look nice */
    padding: 0.5rem;
    border-radius: 0.5rem;
    
    /* Flex properties to ensure it fills the parent box */
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.attunable-slot {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.attunable-slot:hover {
    transform: scale(1.15);
}
/* Force user-select off for all interactive elements in the top-left menu */
.top-left-menu .btn,
.top-left-menu a,
.top-left-menu h4 {
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none;     /* IE 10+ and Edge */
    user-select: none;         /* Standard */
}