/* Display face for names and headings only (SIL OFL 1.1, see src/fonts/im-fell-english-sc/OFL.txt) */
@font-face {
    font-family: 'IM Fell English SC';
    src: url(/fonts/IMFellEnglishSC-Regular-latin.woff2) format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* GLOBAL VALUES — design tokens. Dark surfaces, one gold accent; change values here, not in rules. */
:root {
    /* Surfaces and text */
    --main-bg-color: #262626;
    --table-secondary-bg: #3F3F3F;
    --surface-hover: #454545;
    --surface-pressed: #595040;
    --ink: #191919;
    --text-color: #ffffff !important;
    --text-muted: #c5c5c5;

    /* Gold accent */
    --gold: #ffc107;
    --gold-light: #ffda6a;
    --gold-pale: #ffe08a;
    --gold-deep: #dda600;
    --gold-muted: #b88b18;

    /* Vitals */
    --health-bar-height: 40px;
    --health-bar-bg: green;
    --mind-bar-height: 30px;
    --mind-bar-bg: #0070c0;

    /* Shape and elevation */
    --border-radius: 10px;
    --text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
    --text-stroke: 1px black;
    --shadow-overlay: 0 6px 20px rgba(0, 0, 0, 0.6);

    /* Spacing (4px base) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 32px;
    --padding-standard: 20px;

    /* Motion (zeroed by the prefers-reduced-motion block at the end) */
    --transition-duration: 0.3s;
    --duration-medium: 0.4s;
    --duration-slow: 0.5s;

    /* Type */
    --font-family: Arial, sans-serif !important;
    --font-display: 'IM Fell English SC', Georgia, 'Times New Roman', serif;
    --font-size-large: 1.5em;

    --button-bg-color: var(--gold);

    /* override bootstrap colors */
    --bs-nav-pills-link-active-bg: var(--gold) !important;
}


* {
    touch-action: manipulation;
  }
  


/* Override Bootstrap button styles */
.btn {
    background-color: var(--main-bg-color);
    color: var(--text-color);
    border-radius: var(--border-radius);
    transition: background-color var(--transition-duration);
}

:is(button, .btn, .form-control, .form-select, .nav-link) {
    min-height: 44px;
    min-width: 44px;
}

:focus-visible {
    outline: 3px solid var(--gold-pale) !important;
    outline-offset: 3px;
    box-shadow: 0 0 0 5px #151515 !important;
}

.btn:hover:not(:disabled):not(.disabled) {
    background-color: var(--surface-hover);
    color: #fff;
}

.btn:active:not(:disabled):not(.disabled),
.btn[aria-pressed="true"] {
    background-color: var(--surface-pressed);
    border-color: var(--gold-pale);
    color: #fff;
}

.btn.btn-warning {
    background-color: var(--gold);
    border-color: var(--gold);
    color: var(--ink);
    font-weight: 700;
    text-shadow: none;
}

.btn.btn-warning:hover:not(:disabled):not(.disabled) {
    background-color: var(--gold-light);
    border-color: var(--gold-light);
    color: var(--ink);
}

.btn.btn-warning:active:not(:disabled):not(.disabled) {
    background-color: var(--gold-deep);
    border-color: var(--gold-deep);
    color: var(--ink);
}

.btn.btn-outline-warning {
    color: var(--gold-light);
    border-color: var(--gold-muted);
}

.btn.btn-outline-warning:hover:not(:disabled):not(.disabled),
.btn.btn-outline-warning[aria-pressed="true"] {
    background-color: var(--gold-light);
    color: var(--ink);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.nav-pills .nav-link.active {
    background-color: var(--button-bg-color) !important;
}

.nav-link.active {
    padding-bottom: 20px !important;
    padding-top: 20px !important;
}

#combat-tab, #inventory-tab, #abilities-tab, #notebook-tab {
    padding-bottom: 20px !important;
    padding-top: 20px !important;
}



/* Customize Bootstrap card component */
.card {
    background-color: var(--main-bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--text-shadow);
    color: var(--text-color);
    margin: 10px;
}



/* Hide scrollbar for Chrome, Safari and Opera */
body::-webkit-scrollbar {
    display: none !important;
}
body {
    background-color: var(--main-bg-color) !important;
    /* position: relative !important; */
    overflow-x: hidden !important;
    width: 100% !important;
    font: "Source Sans Pro", sans-serif !important;
    -ms-overflow-style: none !important;  /* IE and Edge */
    scrollbar-width: none !important;  /* Firefox */
    color: var(--text-color) !important;
}



/* MAIN LOGO */
#logo-image {
    max-width: 100%;
    height: auto;
    display: block;
  }


/* LOGO TEXT */
.logo-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 10px;
    overflow: visible;
    /* width: 100% !important; */
    /* height: auto !important; */
    font-size: 3.5em !important;
    font-weight: bold !important;
    text-shadow: var(--text-shadow);
    -webkit-text-stroke: var(--text-stroke);
    position: relative;
    box-sizing: border-box;
}



.navbar {
    background-color: var(--main-bg-color) !important;
    border-bottom: 0px !important;
    padding: 20px !important;
    border: 0px !important;
    border-color: var(--main-bg-color) !important;
}

#navbar-css {
    border: 0px !important; 
    top: 0;
    left: 0;
    width: 100%;
    background: transparent !important;
    z-index: 1000;
}

#offcanvasNavbar {
    background-color: var(--main-bg-color) !important;
    border: 0px !important;
    border-color: var(--main-bg-color) !important;
    height: 25vh !important;
}

#sidebar-body {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
}

#hamburger-icon {
    border: 0px !important;

}


#heroList {
    display: flex;
    flex-direction: column;
}



.player-button-container {
    display: flex;
    flex-direction: row; /* Change to row to align items side by side */
    box-sizing: border-box;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0px;
    margin-left: 10px;
    margin-right: 10px;
    margin-bottom: 10px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color var(--transition-duration);
    background-size: cover !important;
    overflow: hidden;
    position: relative;
    isolation: isolate;
}

/* Darkens the art behind the hero's name so it stays legible over busy portraits */
.player-button-container::after,
.hero-info::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.35) 45%, transparent 75%);
}

.player-button {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px;
    border-radius: var(--border-radius);
    width: 100%;
    font-family: var(--font-family);
    font-weight: bold;
    cursor: pointer;
    transition: background-color var(--transition-duration);
    color: var(--text-color);
    background: transparent;
    text-shadow: var(--text-shadow);
    -webkit-text-stroke: var(--text-stroke);
    position: relative; /* Ensure the parent container has a relative position */
    overflow: hidden;
}

/* Player Info style (name and character) */
.player-info {
    position: absolute; /* Change to absolute to align to the bottom left */
    bottom: 0;
    left: 0;
    padding: 10px; /* Adjust padding as needed */
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* Align children to the bottom */
    align-items: flex-start; /* Align children to the left */
}

.player-stats {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    width: 100%; /* Adjust width as needed */
}

.player-name {
    font-family: var(--font-display);
    font-size: 2.25em;
    font-weight: 400;
    line-height: 1.1;
    -webkit-text-stroke: 0;
}
.player-character {
    font-style: italic;
    font-weight: bold;
    font-size: 1.5em;
    -webkit-text-stroke: 0;
}
.attack-dice, .defend-dice, .gold-amount {
    font-size: 2.0em;
    filter: grayscale(100%);
    -webkit-text-stroke: 0px;
    text-shadow: 
        1px 1px 0 #000, 
        -1px -1px 0 #000, 
        -1px 1px 0 #000, 
        1px -1px 0 #000, 
        1px 0 0 #000, 
        -1px 0 0 #000, 
        0 1px 0 #000, 
        0 -1px 0 #000,
        2px 2px 4px rgba(0, 0, 0, 0.7);
}
.welcome-text {
    font-family: var(--font-display);
    font-size: 1.85em;
    font-weight: 400;
    margin: 10px;
    /* text-shadow: var(--text-shadow); */
    align-content: center; 
    text-align: center;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 400;
}



/* CHARACTER BUILDER */
.builder-options {
    margin: 10px;
}

.builder-instructions {
    font-size: 1.0em;
    /* text-shadow: var(--text-shadow); */
    margin: 10px;
    white-space: pre-wrap;
}
.character_builder {
    background-size: cover !important;
    height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}
.character_builder_description, table {
    font-size: var(--font-size-large);
    /* text-shadow: var(--text-shadow); */
}
.character_builder_description {
    background-color: rgba(128, 128, 128, 0.5);
    padding: 5px;
    margin: 0 auto 30px auto;
    white-space: pre-wrap;
    -webkit-text-stroke: var(--text-stroke);
}



/* ACTIVE HERO */
.hero-image-and-name-container {
    width: 100%;
    top: -40px;
    position: relative;
}

.hero-info-container {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    /* position: relative; */
    margin: 10px;
}
.hero-info {
    flex-direction: column !important;
    height: 30vh !important;
    font-size: 1.0em !important;
    text-shadow: var(--text-shadow) !important;
    position: relative !important;
    display: flex !important;
    align-items: flex-start !important;
    justify-content: flex-end !important;
    -webkit-text-stroke: var(--text-stroke) !important;
    overflow: hidden !important;
    background-size: cover;
    z-index: 0 !important; /* Ensure it stays below the navbar */
}

.hero-image-edit-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s;
    background: transparent;
}



.hero-info-player-name {
    font-family: var(--font-display);
    font-size: 2.25em;
    font-weight: 400;
    line-height: 1.1;
    text-shadow: var(--text-shadow);
    -webkit-text-stroke: 0;
    margin: 0 !important;
    margin-left: 10px !important;
    padding: 0 !important;
}
.hero-info-hero-type {
    font-style: italic;
    font-size: 1.25em;
    font-weight: bold;
    text-shadow: var(--text-shadow);
    -webkit-text-stroke: 0;
    margin: 0 !important;
    margin-left: 10px !important;
    padding: 0 !important;
    margin-bottom: 10px !important;
}


/* BODY POINTS BAR */
/* .health {
    width: 100% !important;
    justify-content: center !important;
} */
.body_points_text {
    font-size: .7em;
    /* text-shadow: var(--text-shadow); */
    display: flex;
    justify-content: center;
    align-self: flex-end;
    margin-top: 10px !important;
}

.healthBar-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    position: relative;
}

.healthBar {
    width: 100%;
    height: var(--health-bar-height);
    background-color: var(--table-secondary-bg); /* Empty bar color */
    position: relative;
}

.healthBar-fill {
    height: 100%;
    width: 100%;
    background-color: var(--health-bar-bg); /* Fill color */
    transition: width var(--duration-slow), background-color var(--duration-slow);
}

.healthBar-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25em;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--health-bar-height);
    pointer-events: none;
}


/* MIND POINTS BAR */
.mind_points_text {
    font-size: .7em;
    display: flex;
    justify-content: center;
    align-self: flex-end;
    margin-top: 10px !important;
}
.mindBar-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    position: relative;
}
.mindBar {
    height: var(--mind-bar-height);
    width: 100%;
    background-color: var(--table-secondary-bg); /* Empty bar color */
    position: relative;
}
.mindBar-fill {
    height: 100%;
    width: 100%;
    background-color: var(--mind-bar-bg); /* Fill color */
    transition: width var(--duration-slow), background-color var(--duration-slow);
}
.mindBar-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25em;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--mind-bar-height);
    pointer-events: none;
}



.attackBonusBar-container {
    width: 100%;
    display: flex;
    justify-content: center;
    /* margin-bottom: 10px; */
    position: relative;
}
.attackBonusBar {
    /* display: flex; */
    /* justify-content: center; */
    /* margin-bottom: 10px; */
    width: 100%;
    position: relative;
}
.attackBonusBar-id {
    display: flex;
    justify-content: center;
    /* margin-bottom: 10px; */
    position: relative;
    pointer-events: none; /* Allow clicks to pass through */
}

.attackBonusBar-label {
    font-size: 1.25em;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
}



@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
  }
  
  .shake {
    animation: shake 0.5s ease;
  }
  



.stats-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 10px;
    width: 50%; /* Adjust width as needed */
}

.stats-container-active-hero {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    column-gap: 10px;
    margin-top: 30px;
}

.stats-header {
    display: contents;
    justify-content: space-between;
    font-size: .7em;
    /* text-shadow: var(--text-shadow); */
    /* margin: 10px 0 0 0; */
    background: transparent !important;
    text-align: center;
}
.stats-body {
    display: contents;
    color: var(--text-color);
}
.stats-item {
    text-align: center;
    background-color: var(--table-secondary-bg);
    /* margin-bottom: 20px; */
    font-size: 1.25em;
}

#saveHeroImage {
    width: 100%;
}

#defend-dice-header-link {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.0em;
    color: white;
    text-decoration: none; /* Hide the hyperlink underline */
}

#defendInfoIcon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.defend-dice-breakdown-popover {
    --bs-popover-border-color: var(--bs-black) !important;
    --bs-popover-header-bg: var(--table-secondary-bg) !important;
    --bs-popover-header-color: var(--bs-white) !important;
    --bs-popover-body-padding-x: 1rem !important;
    --bs-popover-body-padding-y: .5rem !important;
}


.more-info-popover {
    --bs-popover-border-color: var(--bs-black) !important;
    --bs-popover-header-bg: var(--table-secondary-bg) !important;
    --bs-popover-header-color: var(--bs-white) !important;
    --bs-popover-body-padding-x: 1rem !important;
    --bs-popover-body-padding-y: .5rem !important;
}

.popover-body {
    padding: 0px !important;
}
  

.active-hero-tab-header-row {
    display: flex;
    flex-direction: row;
    margin: 10px;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between; /* Add this to distribute space evenly */
}

/* COMBAT TAB */
.active-hero-tab-header {
    display: flex;
    font-family: var(--font-display);
    font-size: 1.6em;
    font-weight: 400;
    flex: 1; /* Allow it to take up available space */
}


.icon-link {
    display: flex !important;
}
.hero-tab-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}

.hero-tab-actions .btn {
    padding: 8px 12px;
    font-size: 0.95rem;
}



.item-header-row{
    display: flex;
    flex-direction: row;
    flex-grow: 1; /* Allow the item column to grow and shrink */
    margin-top: 20px;
    margin-bottom: 10px;
    margin-right: 10px;
}
.equip-details {
    margin-left: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Allow the item column to grow and shrink */
    align-items: flex-start;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color var(--transition-duration);
}
.equip-action {
    display: flex;
    flex-direction: column;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color var(--transition-duration);
    text-align: right !important;
}
.item-row {
    display: flex;
    flex-direction: row;
    width: calc(100% - 20px); 
    margin: 10px; 
    box-sizing: border-box;
    gap: 10px; 
    justify-content: center;
    align-items: center;
}

.item-button, .equip-name {
    flex-grow: 1; /* Allow it to grow to fill available space */
    min-width: 0;
    overflow-wrap: anywhere;
    padding: 5px;
    border: none;
    border-radius: var(--border-radius);
    background-color: #000000;
    color: white;
    cursor: pointer;
    /* text-shadow: var(--text-shadow); */
    font-size: 1.0em;
    justify-content: left;
    text-align: left;
    transition: width var(--duration-medium) ease; /* Smooth transition for width change */
}

#item-button-themed {
    display: flex;
    flex-grow: 1 !important; /* Allow it to grow to fill available space */
    /* padding: 5px; */
    font-size: 1.0em;
    justify-content: left;
    text-align: left;
    transition: width var(--duration-medium) ease; /* Smooth transition for width change */
    width: 100%;
}

.action-button, .equip-combat {
    /* display: flex; */
    flex: 0 0 20%; /* Take up 20% of the row */
    padding: 10px;
    width: 50px !important;
    border: none;
    border-radius: var(--border-radius);
    background-color: var(--table-secondary-bg);
    color: white;
    cursor: pointer;
    /* text-shadow: var(--text-shadow); */
    font-size: 1.0em;
    justify-content: center;
}
/* .item-button:hover {
    background-color: var(--hover-bg-color);
    width: 100%;
}
.action-button:hover {
    background-color: var(--hover-bg-color);
    width: 100%;
} */
.combat-container {
    display: flex;
    justify-content: space-between;
}
.combat-column {
    width: 48%;
}



/* Delete column style */

#delete-button {
    color: red;
    font-size: 1.5em;
    cursor: pointer;
    justify-content: center !important;
}


.inventory-item.collapsed {
    height: 0;
    opacity: 0;
    transition: all 0.3s ease;
}
.show-delete .equip-delete {
    display: flex;
}


.equip-delete-header {
    width: 40px; /* Set a consistent width */
    text-align: center; /* Center-align the header text */
    transition: max-height var(--duration-medium) ease, opacity var(--duration-medium) ease;
}

.equip-delete {
    text-align: center; /* Center-align the header text */
    transition: max-height var(--duration-medium) ease, opacity var(--duration-medium) ease;
    flex-shrink: 0;
}

.equip-delete .btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    padding: 8px;
}

.equip-delete .btn-outline-danger {
    color: #ff9b9b;
    border-color: #d76565;
}

.equip-delete .btn-outline-danger:hover:not(:disabled),
.equip-delete .btn-outline-danger:active:not(:disabled) {
    background-color: #9d252d;
    color: #fff;
    border-color: #ff9b9b;
}

.equip-delete svg {
    width: 24px;
    height: 24px;
}


.equip-delete.visible {
    max-height: 50px; /* Adjust to match the delete button’s height */
    opacity: 1;
}

/* Delete columns show only in edit mode (applyEditModeVisibility) */
.equip-delete-header:not(.visible),
.equip-delete:not(.visible) {
    display: none;
}

.equip-delete-header.visible,
.equip-delete.visible {
    display: flex;
}


.equip-toggle {
    text-align: center !important; /* Center-align the header text */
    transition: max-height var(--duration-medium) ease, opacity var(--duration-medium) ease;
    width: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
}

button.equip-toggle {
    flex: 0 0 44px;
    min-height: 44px;
    padding: 4px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--gold-light);
    cursor: pointer;
}

button.equip-toggle[aria-pressed="true"] {
    border-color: var(--gold);
    box-shadow: inset 0 0 0 1px var(--ink);
}

button.equip-toggle:hover:not(:disabled) {
    background-color: #454032;
}

button.equip-toggle:active:not(:disabled) {
    background-color: #665325;
}

button.equip-toggle:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

button.equip-toggle svg {
    max-width: 32px;
    max-height: 32px;
}

.equip-toggle.visible {
    max-height: 44px;
    opacity: 1;
}



.equip-action-fixed {
    width: 100px !important; /* Set a fixed width for the damage column */
}



.ability-info-text {
    margin: 10px;
}



/* modal styling */
.modal-content {
    background-color: var(--main-bg-color) !important;
    color: var(--text-color);
    border-radius: var(--border-radius);
    box-shadow: var(--text-shadow);
    width: 80%;
    max-width: 600px;
    margin: 0 auto;
}

#modal-close {
    filter:  brightness(0) invert(1)
}
#itemDetailsContent {
    padding-top: 20px;
    padding-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.item-description {
    font-size: 1.0em;
    display: flex;
    flex-wrap: wrap;
}



/* Optional hover effect for item names */
/* .item-name:hover {
    text-decoration: underline;
    cursor: pointer;
} */



#dice-canvas {
    position: fixed; /* Make the canvas overlay the entire screen */
    top: 0;
    left: 0;
    width: 100vw; /* Full screen width */
    height: 100vh; /* Full screen height */
    z-index: 9999; /* Bring it to the top */
    pointer-events: none; /* Allow clicks to pass through */
}

#diceRollerContainer {
    position: relative;
}

#dice-canvas.fade-out {
    opacity: 0;
    transition: opacity 1s ease-in-out; /* Fade out in 1 second */
}

/* Dice result faces (src/js/logic/dice_render.js): large in the results alert, small in the roll log */
.dice-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
}

.dice-tile-log {
    display: inline-flex;
    width: 26px;
    height: 26px;
}

.dice-tile-combat {
    padding: 7px;
    border: 1px solid black;
    background: white;
    border-radius: 10px;
}

.dice-tile-combat.dice-tile-log {
    padding: 2px;
    border-radius: 5px;
}

.dice-image {
    max-width: 100%;
    max-height: 100%;
}

.dice-tile svg {
    width: 100%;
    height: 100%;
}

.dice-math {
    align-self: center;
    font-size: 1.75rem;
    font-weight: bold;
}

.dice-math-log {
    font-size: 0.9rem;
}


/* BOTTOM MENU CONTAINER */
#heroTabs {
    position: fixed;
    bottom: 0;
    width: 100%;
    background-color: #000; /* Optional: Adjust background color */
    z-index: 1000;
    font-size: 2.0em;
    text-shadow: 
        1px 1px 0 #000, 
        -1px -1px 0 #000, 
        -1px 1px 0 #000, 
        1px -1px 0 #000, 
        1px 0 0 #000, 
        -1px 0 0 #000, 
        0 1px 0 #000, 
        0 -1px 0 #000,
        2px 2px 4px rgba(0, 0, 0, 0.7);
}

#heroTabs .nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px !important;
    color: var(--gold-light);
}

#heroTabs .nav-link:hover {
    background-color: var(--table-secondary-bg);
}

#heroTabs .nav-link.active {
    color: var(--ink);
}

#heroTabs .nav-link:focus-visible {
    outline-offset: -4px;
}

.hero-tab-label {
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.25;
    text-shadow: none;
}

#heroTabContent {
    position: relative;
    top: -40px;
    padding-bottom: 100px;
}

/* Toasts float above the fixed #heroTabs bar */
.app-toast-container {
    position: fixed;
    left: 50%;
    bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    width: min(92vw, 420px);
    z-index: 1090;
}

.app-toast {
    width: 100%;
    background-color: var(--ink);
    color: var(--text-color);
    border: 1px solid var(--gold);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-overlay);
}

.app-toast-action {
    min-height: 44px;
}

.app-toast .btn-close {
    box-sizing: border-box;
    width: 44px;
    height: 44px;
    padding: 0;
}



.page-container {
    position: relative;
    width: 100%;
    overflow: visible;
}

.page-content {
    position: absolute;
    width: 100%;
    transition: transform 0.6s ease-in-out;
    padding: 10px;
}

#mainContent {
    box-sizing: border-box;
    margin-bottom: 80px !important;
}


/* .accordion {
    --bs-accordion-active-color: #fff !important;
} */



#bodyTypeToggle {
    display: none !important;
}

#itemAccordion .accordion-item {
    border: none !important;
}



.spell-button {
    padding: 10px;
    /* margin-bottom: 10px; */
    width: 100%;
    text-align: left;
}

/* .spell-button:hover {
    background-color: var(--hover-bg-color);
} */



.notebook-stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(75px, 1fr));
    grid-auto-rows: minmax(20px, auto); /* Ensure rows have a minimum height */
    column-gap: 10px;
    margin-top: 20px;
    margin-bottom: 20px;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
}



.notebook-stats-header {
    grid-column: span 1; /* Each header spans one column */
    font-size: 0.7em !important;
    /* text-shadow: var(--text-shadow) !important; */
    background: var(--main-bg-color) !important;
    /* padding: 10px; */
    text-align: center !important;
}

.notebook-stats-item {
    font-size: 1.em !important;
    /* text-shadow: var(--text-shadow) !important; */
    background: var(--table-secondary-bg) !important;
    padding: 5px;
    text-align: center !important;
}



/* Ensure headers stay on top */
.notebook-stats-container > .notebook-stats-header:nth-child(-n+4) {
    grid-row: 1 !important;
}

/* Ensure items start from the second row */
.notebook-stats-container > .notebook-stats-item {
    grid-row: 2 / span 1;
}



#notebookTextArea {
    background-color: #000;
    border: 0;
    --bs-secondary-color: #3F3F3F;
    color: #fff;
}

/* 1px past the usual 10px to account for the outline */
#goldTracker {
    margin-right: 11px;
    margin-top: 10px;
    width: 25%;
}

#notebookContent {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 10px;
}



#pretty-placeholder {
    margin: 10px;
}

/* ...existing code... */
.scrollable-content {
    max-height: 100vh;
    overflow-y: auto;
}
/* ...existing code... */
/* Rows whose equip/use toggle is off: dim everything except the toggle itself. The
   name stays a working button, so the dimmed text must still reach 4.5:1 (a11y.spec.js). */
.item-row.unequipped-item > *:not(.equip-toggle):not(.equip-delete) {
    opacity: 0.6;
    filter: grayscale(0.7);
}

#editInventoryModal .modal-content {
    width: 100%;
    max-width: 900px;
    border: 1px solid #6c5625;
}

.compendium-picker {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

/* The flex gap spaces these; default paragraph margins doubled it */
.compendium-picker > p {
    margin: 0;
}

.compendium-context {
    margin: 0;
    color: var(--gold-light);
    font-size: 1rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.compendium-count {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.compendium-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.compendium-toolbar > label {
    display: flex;
    flex: 1 1 200px;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    color: var(--gold-light);
    font-weight: 700;
}

.compendium-toolbar input,
.compendium-toolbar select {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    background-color: var(--ink);
    border: 1px solid #777;
    border-radius: 6px;
    padding: 8px 12px;
    color: #fff;
}

.compendium-toolbar input::placeholder {
    color: #bfbfbf;
}

.compendium-results {
    list-style: none;
    margin: 0;
    padding: 0;
}

.compendium-result {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #555;
}

.compendium-result > details {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.compendium-result summary {
    min-height: 44px;
    padding: 8px 4px;
    color: var(--gold-light);
    font-weight: 700;
    cursor: pointer;
    border-radius: 4px;
}

.compendium-result summary:hover,
.compendium-result details[open] > summary {
    background-color: var(--table-secondary-bg);
}

.compendium-result details > p {
    margin: 8px 4px;
    line-height: 1.5;
}

.compendium-add {
    flex-shrink: 0;
}

.compendium-item-meta {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 400;
    overflow-wrap: anywhere;
}

.compendium-status {
    min-height: 1.5em;
    color: var(--gold-pale);
    overflow-wrap: anywhere;
}

.compendium-empty,
.hero-empty-state {
    padding: 20px;
    border: 1px dashed #8a7235;
    border-radius: var(--border-radius);
    background-color: #202020;
    color: #ddd;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.hero-empty-state {
    margin: 10px;
}

@media (max-width: 380px) {
    .item-row {
        gap: 6px;
    }

    .active-hero-tab-header {
        flex-basis: 100%;
    }

    .hero-tab-actions {
        justify-content: flex-start;
    }

    .compendium-result {
        flex-wrap: wrap;
    }

    .compendium-result > details {
        flex-basis: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --transition-duration: 0.01ms;
        --duration-medium: 0.01ms;
        --duration-slow: 0.01ms;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Hero sheet controls: vitals steppers, roll buttons and item row actions */

.vital-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: 10px;
}

.vital-row .healthBar-container,
.vital-row .mindBar-container {
    flex: 1;
    margin-bottom: 0;
}

.vital-step,
.roll-stat,
.action-button.roll-button,
.item-row-action {
    border: 1px solid var(--gold-muted);
    border-radius: var(--border-radius);
    background-color: var(--table-secondary-bg);
    color: var(--gold-light);
    font-weight: 700;
    touch-action: manipulation;
    cursor: pointer;
}

.vital-step:hover,
.roll-stat:hover,
.action-button.roll-button:hover,
.item-row-action:hover {
    background-color: var(--surface-hover);
}

.vital-step:active,
.roll-stat:active,
.action-button.roll-button:active,
.item-row-action:active {
    background-color: var(--surface-pressed);
}

.vital-step:focus-visible,
.roll-stat:focus-visible,
.action-button.roll-button:focus-visible,
.item-row-action:focus-visible {
    outline: 2px solid var(--gold-light);
    outline-offset: 2px;
}

.vital-step {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1.25rem;
}

.vital-step[aria-disabled="true"] {
    opacity: 0.4;
}

.attack-bonus-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0;
    background-color: transparent;
}

.attack-bonus-stepper .attack-bonus {
    min-width: 1.5em;
    text-align: center;
}

.roll-stat {
    width: 100%;
    min-height: 44px;
}

.action-button.roll-button {
    width: auto !important;
    min-width: 64px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    padding: 0 var(--space-3);
}

.item-row-action {
    flex: 0 0 auto;
    min-width: 64px;
    min-height: 44px;
    padding: 0 var(--space-3);
    font-size: 0.9rem;
}

.item-quantity {
    font-weight: 400;
}

.spell-cast.is-spent {
    border-style: dashed;
    color: var(--text-muted);
}

.item-row.spent-spell .spell-button {
    text-decoration: line-through;
    opacity: 0.55;
}

.new-quest-button {
    margin-left: auto;
}

/* NOTEBOOK: Between quests */
.between-quests {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    width: 100%;
    margin-top: var(--space-4);
    padding: var(--space-3);
    border: 1px solid #4a3f24;
    border-radius: var(--border-radius);
    background: var(--ink);
}

.between-quests-title {
    margin: 0;
    color: var(--gold-light);
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 400;
}

.between-quests-hint {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.between-quests-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.between-quests-actions .btn {
    min-height: 44px;
}

/* MOTION: the one deliberate animation moment (src/js/ui/motion.js). The reduced-motion block
   in styles.css shortens every animation to a single frame, so results simply appear. */

/* Dice results flip in one after another; --i is each face's position (dice.js) */
.dice-reveal > [data-order] {
    animation: dice-reveal var(--duration-medium) cubic-bezier(0.2, 0.8, 0.3, 1.2) both;
    animation-delay: calc(var(--i, 0) * 90ms);
}

@keyframes dice-reveal {
    from {
        opacity: 0;
        transform: perspective(300px) rotateX(-80deg) scale(0.6);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* A changed Body/Mind/attack value: a quick swell, gold for a gain, red for a loss */
.stat-pulse-up,
.stat-pulse-down {
    animation: stat-pulse var(--duration-medium) ease-out;
}

.stat-pulse-up {
    --pulse-glow: var(--gold-light);
}

.stat-pulse-down {
    --pulse-glow: #ff6b6b;
}

@keyframes stat-pulse {
    0% {
        transform: scale(1);
        text-shadow: none;
    }
    35% {
        transform: scale(1.25);
        text-shadow: 0 0 10px var(--pulse-glow), 0 0 2px var(--pulse-glow);
    }
    100% {
        transform: scale(1);
        text-shadow: none;
    }
}

/* PRINT SHEET (src/js/logic/print_sheet.js): exists only while printing, one page, ink on white */
#printSheet {
    display: none;
}

@page {
    size: auto;
    margin: 12mm;
}

@media print {
    body > *:not(#printSheet) {
        display: none !important;
    }

    html,
    body {
        background: #fff !important;
        color: #000 !important;
    }

    #printSheet {
        display: block;
    }

    .print-sheet {
        font-family: Georgia, 'Times New Roman', serif;
        font-size: 11pt;
        line-height: 1.3;
        color: #000;
        break-inside: avoid;
    }

    .print-sheet h2,
    .print-sheet h3 {
        color: #000;
        font-family: var(--font-display);
        font-weight: 400;
        margin: 0;
    }

    .print-header {
        display: flex;
        align-items: center;
        gap: 6mm;
        padding-bottom: 3mm;
        border-bottom: 1.5pt solid #000;
    }

    .print-portrait {
        width: 32mm;
        height: 32mm;
        object-fit: cover;
        border: 1pt solid #000;
        filter: grayscale(1);
    }

    .print-brand {
        font-size: 8pt;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    .print-name {
        font-size: 26pt;
        line-height: 1.1;
    }

    .print-type {
        font-size: 13pt;
    }

    .print-stats {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 3mm;
        margin: 5mm 0;
    }

    .print-stat {
        padding: 2.5mm;
        border: 1.5pt solid #000;
        text-align: center;
    }

    .print-stat-label {
        font-size: 8pt;
        letter-spacing: 0.06em;
        text-transform: uppercase;
    }

    .print-stat-value {
        font-size: 20pt;
        font-weight: 700;
    }

    .print-track {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1mm;
        margin-top: 1.5mm;
    }

    .print-box {
        width: 3.5mm;
        height: 3.5mm;
        border: 0.75pt solid #000;
    }

    .print-columns {
        columns: 2;
        column-gap: 8mm;
    }

    .print-items {
        break-inside: avoid;
        margin-bottom: 4mm;
    }

    .print-items h3 {
        font-size: 12pt;
        border-bottom: 0.75pt solid #000;
        margin-bottom: 1mm;
    }

    .print-items ul {
        margin: 0;
        padding-left: 5mm;
    }

    .print-items p {
        margin: 0;
    }

    .print-notes {
        break-inside: avoid;
        margin-top: 3mm;
    }

    .print-notes h3 {
        font-size: 12pt;
        border-bottom: 0.75pt solid #000;
    }

    .print-notes-text {
        margin: 1.5mm 0;
        white-space: pre-wrap;
    }

    .print-line {
        height: 7mm;
        border-bottom: 0.5pt solid #777;
    }
}

/* Hero lifecycle: app column, welcome, hero creation, roster, bottom sheet, portrait picker.
   Uses the tokens in styles.css :root. */

/* PORTRAIT PICKER */
.hero-image-group-title {
    margin: var(--space-3) 0 var(--space-2);
    color: var(--gold-light);
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 400;
}

.hero-image-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-2);
}

.hero-image-choice {
    position: relative;
    padding: 0;
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    background: var(--ink);
    overflow: hidden;
    aspect-ratio: 1;
}

.hero-image-choice .hero-image-option {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-image-choice[aria-pressed="true"] {
    border-color: var(--gold);
    box-shadow: 0 0 0 2px var(--gold-pale);
}

.hero-image-check {
    display: none;
    position: absolute;
    top: var(--space-1);
    right: var(--space-1);
    border-radius: 50%;
    background: var(--ink);
    color: var(--gold);
    font-size: 22px;
    line-height: 1;
}

.hero-image-choice[aria-pressed="true"] .hero-image-check {
    display: block;
}

/* APP COLUMN: on tablets and desktops the app keeps phone proportions */
:root {
    --app-max-width: 560px;
}

#mainContent,
#navbar-css {
    max-width: var(--app-max-width);
    margin-inline: auto;
}

#heroTabs {
    left: 50%;
    max-width: var(--app-max-width);
    transform: translateX(-50%);
}

/* SHARED */
.lifecycle-primary {
    display: block;
    width: calc(100% - 2 * var(--space-3));
    margin: var(--space-4) auto 0;
}

.lifecycle-secondary {
    display: block;
    margin: var(--space-2) auto 0;
    min-height: 44px;
    color: var(--gold-light);
}

.create-status {
    min-height: 1.5em;
    margin: var(--space-2) 0 0;
    color: #ffb4a9;
}

/* WELCOME */
.welcome-screen {
    padding-bottom: var(--space-6);
}

.welcome-title {
    margin: var(--space-4) var(--space-3) var(--space-3);
    color: var(--gold-light);
    font-family: var(--font-display);
    font-size: 1.9rem;
    font-weight: 400;
    text-align: center;
}

.welcome-points {
    margin: 0 var(--space-4);
    padding: 0;
    list-style: none;
}

.welcome-points li {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) 0;
}

.welcome-points .bi {
    flex: 0 0 auto;
    color: var(--gold);
    font-size: 1.4rem;
}

/* CREATE */
.create-screen form {
    padding: 0 var(--space-3) var(--space-6);
}

.create-step {
    display: block;
    margin: var(--space-4) 0 var(--space-2);
    padding: 0;
    color: var(--gold-light);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.hero-type-gallery {
    display: grid;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    border: 0;
}

.hero-type-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3);
    border: 2px solid var(--gold-muted);
    border-radius: var(--border-radius);
    background-color: var(--table-secondary-bg);
    cursor: pointer;
}

.hero-type-card:hover {
    background-color: var(--surface-hover);
}

.hero-type-card:has(input:checked) {
    border-color: var(--gold);
    background-color: var(--surface-pressed);
}

.hero-type-card:has(input:focus-visible) {
    outline: 2px solid var(--gold-light);
    outline-offset: 2px;
}

.hero-type-portrait {
    flex: 0 0 88px;
    width: 88px;
    height: 88px;
    border-radius: var(--border-radius);
    object-fit: cover;
}

.hero-type-portrait-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--ink);
    color: var(--gold-muted);
    font-size: 2.5rem;
}

.hero-type-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    padding-right: 24px;
}

.hero-type-name {
    color: var(--gold-light);
    font-family: var(--font-display);
    font-size: 1.35rem;
    line-height: 1.1;
}

.hero-type-expansion,
.hero-type-detail {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.hero-type-stats {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
    margin: 2px 0;
    font-size: 0.85rem;
}

.hero-type-stat-value {
    color: var(--gold-light);
    font-weight: 700;
}

.hero-type-check {
    display: none;
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    color: var(--gold);
    font-size: 1.4rem;
}

.hero-type-card:has(input:checked) .hero-type-check {
    display: block;
}

/* Thumb-reach submit below a long gallery */
.create-screen #saveHero {
    position: sticky;
    bottom: var(--space-3);
    width: 100%;
    margin-top: var(--space-2);
    box-shadow: var(--shadow-overlay);
}

/* ROSTER */
.roster-actions {
    display: flex;
    gap: var(--space-2);
    margin: var(--space-3) 10px;
}

.roster-actions .btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

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

.roster-item .player-stats {
    padding-right: 48px;
}

.player-last-played {
    margin-top: 2px;
    color: var(--text-color);
    font-size: 0.85rem;
    font-weight: 600;
    -webkit-text-stroke: 0;
}

.roster-menu-button {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gold-muted);
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.7);
    color: var(--gold-light);
    font-size: 1.25rem;
}

.roster-menu-button:hover {
    background-color: var(--ink);
}

.roster-menu-button:focus-visible {
    outline: 2px solid var(--gold-light);
    outline-offset: 2px;
}

/* The card clips overflow, so the ring sits inside it */
.roster-item .player-button:focus-visible {
    outline: 2px solid var(--gold-light);
    outline-offset: -4px;
}

/* BOTTOM SHEET (roster actions, rename, delete confirmation) */
.hero-sheet.offcanvas-bottom {
    --bs-offcanvas-height: auto;
    max-height: 85vh;
    max-width: var(--app-max-width);
    margin-inline: auto;
    border-top: 1px solid var(--gold-muted);
    border-radius: 16px 16px 0 0;
    background-color: var(--ink);
}

.hero-sheet .offcanvas-title {
    color: var(--gold-light);
    font-family: var(--font-display);
    font-size: 1.5rem;
}

.hero-sheet .btn-close {
    box-sizing: border-box;
    width: 44px;
    height: 44px;
    padding: 0;
}

.sheet-actions {
    display: grid;
    gap: var(--space-2);
}

.sheet-action {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 56px;
    padding: 0 var(--space-4);
    border: 1px solid var(--gold-muted);
    border-radius: var(--border-radius);
    background-color: var(--table-secondary-bg);
    color: var(--gold-light);
    font-size: 1.05rem;
    font-weight: 700;
    text-align: left;
}

.sheet-action:hover {
    background-color: var(--surface-hover);
}

.sheet-action:focus-visible {
    outline: 2px solid var(--gold-light);
    outline-offset: 2px;
}

.sheet-action-danger {
    color: #ffb4a9;
}

.sheet-message {
    margin-bottom: var(--space-4);
}

.sheet-buttons {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.sheet-buttons .btn {
    flex: 1;
}

/* COMPENDIUM PAGES: /compendium, /compendium/:category, /compendium/:category/:item */

.compendium-screen {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-3);
}

.compendium-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.85em;
    font-weight: 400;
    overflow-wrap: anywhere;
}

.compendium-home .compendium-title {
    text-align: center;
}

.compendium-crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
}

.compendium-crumbs a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding-inline: var(--space-1);
    color: var(--gold-light);
}

.compendium-crumb-separator {
    color: var(--text-muted);
}

/* Category tiles: theme header art under a readable label */
.compendium-tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}

.compendium-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 112px;
    padding: var(--space-3);
    overflow: hidden;
    border: 2px solid var(--gold-muted);
    border-radius: var(--border-radius);
    background-color: var(--ink);
    color: #fff;
    text-decoration: none;
    isolation: isolate;
}

.compendium-tile .compendium-art {
    position: absolute;
    inset: 0;
    z-index: -1;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.compendium-tile::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.1) 70%);
}

.compendium-tile:hover {
    border-color: var(--gold);
    color: #fff;
}

.compendium-tile:focus-visible {
    outline: 2px solid var(--gold-light);
    outline-offset: 2px;
}

.compendium-tile-label {
    font-family: var(--font-display);
    font-size: 1.4rem;
    line-height: 1.1;
    text-shadow: var(--text-shadow);
}

.compendium-tile-count {
    color: var(--gold-pale);
    font-size: 0.875rem;
}

/* Category banner */
.compendium-banner {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: 120px;
    padding: var(--space-3);
    overflow: hidden;
    border-radius: var(--border-radius);
    background-color: var(--ink);
    isolation: isolate;
}

.compendium-banner .compendium-art {
    position: absolute;
    inset: 0;
    z-index: -1;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.compendium-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent 75%);
}

.compendium-banner .compendium-title {
    text-shadow: var(--text-shadow);
}

/* Browse lists: each row links to the entry page */
.compendium-result-link {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    padding: var(--space-2) var(--space-1);
    border-radius: 4px;
    color: var(--gold-light);
    font-weight: 700;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.compendium-result-link:hover {
    background-color: var(--table-secondary-bg);
    color: var(--gold-light);
}

.compendium-result-link:focus-visible {
    outline: 2px solid var(--gold-light);
    outline-offset: 2px;
}

/* Entry page and the sheet's item details modal */
.compendium-entry .compendium-item-meta {
    margin: 0;
}

.compendium-entry-add {
    align-self: flex-start;
}

.compendium-entry-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.compendium-entry-description {
    margin: 0;
    line-height: 1.5;
    white-space: pre-line;
}

.compendium-attributes {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: var(--space-2) var(--space-4);
    margin: 0;
}

.compendium-attributes > div {
    display: contents;
}

.compendium-attributes dt {
    color: var(--text-muted);
    font-weight: 400;
}

.compendium-attributes dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.compendium-gear h2 {
    margin: 0 0 var(--space-2);
    color: var(--gold-light);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.compendium-gear ul {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.compendium-gear li > * {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 var(--space-3);
    border: 1px solid var(--gold-muted);
    border-radius: 999px;
    color: var(--gold-light);
    text-decoration: none;
}

.compendium-gear a:hover {
    background-color: var(--table-secondary-bg);
}

.compendium-missing p {
    margin: 0;
}

.compendium-missing .btn {
    align-self: flex-start;
}

#itemDetailsContent .compendium-item-meta {
    margin: 0 0 var(--space-3);
}

@media (min-width: 480px) {
    .compendium-tiles {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* SETTINGS: /settings. Uses the tokens in styles.css :root. */

.settings-screen {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-3) var(--space-6);
}

.settings-title {
    margin: 0;
    color: var(--gold-light);
    font-family: var(--font-display);
    font-size: 1.9rem;
    font-weight: 400;
    text-align: center;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3);
    border: 1px solid #4a3f24;
    border-radius: var(--border-radius);
    background: var(--ink);
}

.settings-section-title {
    margin: 0;
    color: var(--gold-light);
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 400;
}

.settings-hint {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Switch rows: a 44px tap target, the hint under the label */
.settings-switch {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: var(--space-3);
    min-height: 44px;
    margin: 0;
    padding-left: 0;
}

.settings-switch .form-check-input {
    width: 3em;
    height: 1.6em;
    margin: 0;
    float: none;
    cursor: pointer;
}

.settings-screen .form-check-input:checked {
    border-color: var(--gold);
    background-color: var(--gold);
}

.settings-screen .form-check-input:focus {
    border-color: var(--gold-light);
    box-shadow: 0 0 0 0.25rem rgba(255, 193, 7, 0.35);
}

.settings-switch .form-check-label {
    cursor: pointer;
}

.settings-switch .settings-hint {
    grid-column: 2;
}

.settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.settings-actions .btn {
    min-height: 44px;
}

.settings-storage {
    margin: var(--space-2) 0 0;
}

.settings-persist {
    align-self: flex-start;
    min-height: 44px;
    padding-inline: 0;
    color: var(--gold-light);
}

.settings-about-art {
    max-width: 240px;
    align-self: center;
}

.settings-about p {
    margin: 0;
}

.settings-legal summary {
    min-height: 44px;
    display: flex;
    align-items: center;
    color: var(--gold-light);
    cursor: pointer;
}

.settings-legal p + p {
    margin-top: var(--space-2);
}

.settings-legal a {
    color: var(--gold-light);
}

.settings-themes {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    border: 0;
}

.settings-theme {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: var(--space-3);
    min-height: 44px;
    margin: 0;
    padding-left: 0;
}

.settings-theme .form-check-input {
    width: 1.4em;
    height: 1.4em;
    margin: 0;
    float: none;
    cursor: pointer;
}

.settings-theme .form-check-label {
    cursor: pointer;
}

.settings-theme .settings-hint {
    grid-column: 2;
}

.settings-theme-progress {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.settings-theme-progress progress {
    width: 100%;
    height: 10px;
    accent-color: var(--gold);
}

