/* General body styles */
html {
    overflow-y: auto;
    font-size: calc(18px * var(--font-size-multiplier));
    min-height: 100vh;
}

html.loading {
    overflow: hidden;
}

img {
    width: 100%;
    height: auto;
    display: block;
}
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    text-align: center;
    overflow: auto;
    background-color: #c0c0c0 !important;
    font-size: calc(1rem * var(--font-size-multiplier));
    min-height: 100vh;
}

body.loading {
    overflow: hidden;
}

/* Override MudBlazor background variables */
:root {
    --mud-palette-background: #c0c0c0 !important;
    --mud-palette-surface: #c0c0c0 !important;
}

p {
    font-size: 1.05rem;
    line-height: 1.5;
}

strong {
    font-weight: 600;
}

h2 {
    font-size: 1.6rem;
}

h3 {
    font-size: 1.3rem;
}

/* Header styles */
header {
    font-family: 'Georgia', serif;
    color: #2c3e50;
    margin: calc(2rem * var(--spacing-multiplier)) 0;
    padding: 0 calc(2rem * var(--spacing-multiplier));
    position: relative;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo-left {
    width: auto;
    height: auto;
    max-width: 200px;
    max-height: 200px;
    margin-right: auto;
    background-color: transparent;
    transition: transform 0.2s ease-in-out;
}
.logo-left:hover {
    transform: scale(1.1); /* Scale effect on hover */
}
/* Stack for MMP and The Gamers logos */
.logo-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: calc(15px * var(--spacing-multiplier)); /* space between logos */
    margin-top: calc(5px * var(--spacing-multiplier));
}

.logo-row img {
    height: 40px; /* adjust size as needed */
    width: auto;
    transition: transform 0.2s ease;
}

.logo-row img:hover {
    transform: scale(1.1);
}


.title-container {
    text-align: center;
    flex-grow: 1;
}

    .title-container h1 {
        font-size: 2.5rem;
        font-weight: bold;
        text-transform: uppercase;
        letter-spacing: 2px;
        margin: 0;
    }

    .title-container .subtitle {
        font-size: 1.5rem;
        font-weight: normal;
        text-transform: none;
        letter-spacing: normal;
        display: block;
        margin-top: calc(0.5rem * var(--spacing-multiplier));
        color: #666;
    }

h1:focus {
    outline: none;
}

/* Tab Styles */
.custom-tabs {
    margin-bottom: calc(20px * var(--spacing-multiplier));
}

    .custom-tabs .mud-tabs-toolbar {
        background-color: #c0c0c0 !important;
        padding: 10px 0;
    }

    .custom-tabs .mud-tabs-toolbar-content {
        gap: 8px !important;
        display: flex !important;
    }

.mud-tab {
    font-weight: 600;
    font-size: 1.05em;
    padding: calc(12px * var(--spacing-multiplier)) calc(24px * var(--spacing-multiplier)) !important;
    margin: 0 calc(4px * var(--spacing-multiplier)) !important;
    border-radius: 10px !important;
    transition: all 0.3s ease;
    text-transform: none;
    min-height: 48px;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    width: 13rem !important;
}

/* Target the button wrapper that MudBlazor creates */
.custom-tabs .mud-tab-wrapper,
.custom-tabs .mud-button-root {
    margin: 0 calc(4px * var(--spacing-multiplier)) !important;
}

.mud-tab + .mud-tab {
    margin-left: calc(8px * var(--spacing-multiplier)) !important;
}

/* Target any flex items in toolbar */
.custom-tabs .mud-tabs-toolbar .mud-tabs-toolbar-content > * {
    margin: 0 calc(4px * var(--spacing-multiplier)) !important;
}

/* Responsive tab styles for smaller devices */
@media (max-width: 768px) {
    .mud-tab {
        font-size: 0.75em !important;
        padding: 6px 8px !important;
        margin: 0 3px !important;
        min-height: 36px !important;
        max-width: none !important;
        flex: 0 1 auto !important;
    }

    .mud-tab + .mud-tab {
        margin-left: 6px !important;
    }

    .custom-tabs .mud-tab-wrapper,
    .custom-tabs .mud-button-root {
        margin: 0 3px !important;
    }

    .custom-tabs .mud-tabs-toolbar .mud-tabs-toolbar-content > * {
        margin: 0 3px !important;
    }

    .custom-tabs .mud-tabs-toolbar {
        padding: 6px 0 !important;
    }

    .custom-tabs .mud-tabs-toolbar-content {
        gap: 6px !important;
    }
    .logo-row img {
        height: 20px; /* adjust size as needed */

    }
}

@media (max-width: 600px) {
    .mud-tab {
        font-size: 0.65em !important;
        padding: 5px 6px !important;
        margin: 0 3px !important;
        min-height: 32px !important;
        border-radius: 6px !important;
        flex: 0 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
    }

    .mud-tab + .mud-tab {
        margin-left: 6px !important;
    }

    .custom-tabs .mud-tab-wrapper,
    .custom-tabs .mud-button-root {
        margin: 0 3px !important;
    }

    .custom-tabs .mud-tabs-toolbar .mud-tabs-toolbar-content > * {
        margin: 0 3px !important;
    }

    .custom-tabs .mud-tabs-toolbar {
        padding: 10px 0 !important;
    }

    .custom-tabs .mud-tabs-toolbar-content {
        gap: 6px !important;
    }
}

@media (max-width: 480px) {
    .mud-tab {
        font-size: 0.6em !important;
        padding: 4px 5px !important;
        margin: 0 2px !important;
        min-height: 28px !important;
        border-radius: 5px !important;
        flex: 0 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
    }

    .mud-tab + .mud-tab {
        margin-left: 5px !important;
    }

    .custom-tabs .mud-tab-wrapper,
    .custom-tabs .mud-button-root {
        margin: 0 2px !important;
    }

    .custom-tabs .mud-tabs-toolbar .mud-tabs-toolbar-content > * {
        margin: 0 2px !important;
    }

    .custom-tabs .mud-tabs-toolbar {
        padding: 4px 0 !important;
    }

    .custom-tabs .mud-tabs-toolbar-content {
        gap: 5px !important;
    }
}

@media (max-width: 380px) {
    .mud-tab {
        font-size: 0.55em !important;
        padding: 3px 4px !important;
        margin: 0 2px !important;
        min-height: 26px !important;
        border-radius: 4px !important;
        flex: 0 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
        white-space: nowrap !important;
    }

    .mud-tab + .mud-tab {
        margin-left: 4px !important;
    }

    .custom-tabs .mud-tab-wrapper,
    .custom-tabs .mud-button-root {
        margin: 0 2px !important;
    }

    .custom-tabs .mud-tabs-toolbar .mud-tabs-toolbar-content > * {
        margin: 0 2px !important;
    }

    .custom-tabs .mud-tabs-toolbar {
        padding: 3px 0 !important;
    }

    .custom-tabs .mud-tabs-toolbar-content {
        gap: 4px !important;
    }

    .custom-tabs {
        margin-bottom: calc(10px * var(--spacing-multiplier)) !important;
    }
}

.mud-tab:not(.mud-tab-active) {
    background: linear-gradient(180deg, #a0a0a0 0%, #808080 100%);
    color: #ffffff;
}

.custom-tabs .mud-tab-active {
    background: linear-gradient(180deg, #2c3e50 0%, #1a252f 100%);
    color: #ffffff !important;
    box-shadow: 0 -2px 8px rgba(44, 62, 80, 0.4);
    transform: translateY(-2px);
    --mud-palette-primary: #ffffff;
}

/* Customize the hover effect */
.mud-tab:not(.mud-tab-active):hover {
    background: linear-gradient(180deg, #909090 0%, #707070 100%);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.2);
}

/* Tab slider (indicator) */
.custom-tabs .mud-tabs-slider {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
}

.custom-tabs .mud-tab-slider {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
}

.custom-tabs .mud-tab-slider-horizontal {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
}

.custom-tabs .mud-tabs-toolbar-wrapper {
    border-bottom: none !important;
}

.custom-tabs .mud-tabs-toolbar-content {
    border-bottom: none !important;
}

/* Customize the tab panel */
.mud-tab-panel {
    padding: 0;
    background-color: transparent;
    border-radius: 0;
    border: none;
    box-shadow: none;
}
/* Form checkboxes and labels */
.form-check {
    display: flex;
    align-items: center;
    margin-bottom: calc(12px * var(--spacing-multiplier));
}

.form-check-input {
    margin-right: calc(12px * var(--spacing-multiplier));
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.form-check-label {
    flex: 1;
    text-align: left;
    font-size: 1.05rem;
    cursor: pointer;
}

/* Main container */
.container {
    width: 100%;
    padding-left: calc(16px * var(--spacing-multiplier));
    padding-right: calc(16px * var(--spacing-multiplier));
    margin: 0 auto;
    box-sizing: border-box;
}

    .container > div {
        height: auto !important;
        flex-grow: 0;
        flex-shrink: 0;
    }

/* Card styles */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    height: auto !important;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.card-body {
    padding: calc(5px * var(--spacing-multiplier));
}

/* Specific styles for the Fire Sequence card */
.fire-sequence-card {
    background-color: #e0e0e0;
    border: 1px solid #dee2e6;
    border-radius: 1rem;
    padding: calc(5px * var(--spacing-multiplier));
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: calc(20px * var(--spacing-multiplier));
}

.fire-sequence-card h1 {
    color: #2c3e50;
}

    .fire-sequence-card .card-body > div > h2 {
        text-align: left;
        margin-left: 0;
        padding-left: 0;
    }

    .fire-sequence-card .form-group {
        text-align: left;
        margin-left: 0;
        padding-left: 0;
    }

    .fire-sequence-card .form-check {
        justify-content: flex-start;
        margin-left: 0;
        padding-left: 0;
    }

    .fire-sequence-card .form-check-label {
        text-align: left;
    }

    .fire-sequence-card .form-group.total-fire-points {
        text-align: center;
        margin-bottom: calc(2rem * var(--spacing-multiplier));
    }

        .fire-sequence-card .form-group.total-fire-points label {
            display: block;
            margin-bottom: calc(0.5rem * var(--spacing-multiplier));
        }

        .fire-sequence-card .form-group.total-fire-points .form-control {
            width: auto;
            margin: 0 auto;
        }

    /* Grid layout for buttons in the Fire Sequence */
    .fire-sequence-card .button-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: calc(1.5rem * var(--spacing-multiplier));
        justify-content: center;
        align-items: flex-start;
        width: 100%;
    }

    .fire-sequence-card .button-group {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: calc(0.5rem * var(--spacing-multiplier));
    }

    .fire-sequence-card .button-row {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
    }

        .fire-sequence-card .button-row .btn-block {
            width: 100%;
            max-width: calc(200px * var(--spacing-multiplier));
        }

.form-group {
    margin-bottom: calc(20px * var(--spacing-multiplier));
}

.form-group label {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Button styles */
.button-group {
    display: inline-flex;
    gap: calc(4px * var(--spacing-multiplier));
    margin-top: calc(4px * var(--spacing-multiplier));
    flex-direction: row !important;
    flex-wrap: wrap;
}

.selector-button {
    min-width: calc(45px * var(--spacing-multiplier)); /* Fixed minimum width for all buttons */
    padding: calc(8px * var(--spacing-multiplier)) calc(10px * var(--spacing-multiplier));
    border: 1px solid #ccc;
    background-color: white;
    cursor: pointer;
    text-align: center; /* Ensure text is centered */
    white-space: nowrap;
    font-size: 1rem;
    font-weight: 500;
}

    .selector-button:hover {
        background-color: #f0f0f0;
    }

    .selector-button.selected {
        background-color: #007bff;
        color: white;
        border-color: #0056b3;
    }
.btn-block {
    display: block;
    width: 100%;
    padding: calc(1rem * var(--spacing-multiplier)) calc(1.5rem * var(--spacing-multiplier));
    font-size: 1.3rem;
    font-weight: 600;
    color: #fff;
    background-color: #00698f;
    border: none;
    cursor: pointer;
    border-radius: 10px;
    margin-bottom: calc(1rem * var(--spacing-multiplier));
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease;
}

    .btn-block:hover {
        background-color: #00a0d9;
    }

    .btn-block.fixed-size {
        min-width: calc(280px * var(--spacing-multiplier));
        width: auto;
        height: calc(60px * var(--spacing-multiplier));
        display: flex;
        justify-content: center;
        align-items: center;
        white-space: nowrap;
        padding: calc(1rem * var(--spacing-multiplier)) calc(2rem * var(--spacing-multiplier));
        font-size: 1.3rem;
    }

/* Result text styles */
.result-text {
    font-size: 1.25rem;
    font-weight: bold;
    text-align: center;
    width: 100%;
}

/* Grid container */
/* cross out rounding table results */
.crossedRounding::before,
.crossedRounding::after {
    content: '';
    position: absolute;
    width: 100%; /* Use width instead of left/right */
    height: 2px;
    background-color: red;
    top: 50%; /* Center vertically */
    left: 0; /* Start from left edge */
    transform-origin: center;
}

.crossedRounding::before {
    transform: translateY(-50%) rotate(10deg);
}

.crossedRounding::after {
    transform: translateY(-50%) rotate(-10deg);
}
/* cross out straggler table drm */
.crossedStragglerDRM::before,
.crossedStragglerDRM::after {
    content: '';
    position: absolute;
    width: 100%; /* Use width instead of left/right */
    height: 2px;
    background-color: red;
    top: 50%; /* Center vertically */
    left: 0; /* Start from left edge */
    transform-origin: center;
}

.crossedStragglerDRM::before {
    transform: translateY(-50%) rotate(25deg);
}

.crossedStragglerDRM::after {
    transform: translateY(-50%) rotate(-25deg);
}
/* cross out straggler table results */
.crossedStragglerResults::before,
.crossedStragglerResults::after {
    content: '';
    position: absolute;
    width: 100%; /* Use width instead of left/right */
    height: 2px;
    background-color: red;
    top: 50%; /* Center vertically */
    left: 0; /* Start from left edge */
    transform-origin: center;
}

.crossedStragglerResults::before {
    transform: translateY(-50%) rotate(18deg);
}

.crossedStragglerResults::after {
    transform: translateY(-50%) rotate(-18deg);
}

.grid-item {
    background-color: #e3e3e3;
    border: 1px solid #dee2e6;
    border-radius: 1rem;
    padding: calc(15px * var(--spacing-multiplier));
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.grid-item-morale {
    background-color: #e3e3e3;
    border: 1px solid #dee2e6;
    border-radius: 1rem;
    padding: calc(15px * var(--spacing-multiplier));
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.grid-item-closeCombat {
    background-color: #e3e3e3;
    border: 1px solid #dee2e6;
    border-radius: 1rem;
    padding: calc(15px * var(--spacing-multiplier));
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align:left;
}

.grid-item:empty {
    visibility: hidden;
}

.result-highlight {
    font-size: 20px;
    font-weight: bold;
    color: #00698f;
}

/* Responsive adjustments */
@media (max-width: 1300px) {
    .logo-left {
        position: static;
        transform: none;
        margin-bottom: 1rem;
    }

    .logo-right {
        position: static;
        transform: none;
        margin-bottom: 1rem;
    }

    .title-container {
        text-align: center;
    }
}



@media (max-width: 768px) {
    /* Header adjustments for mobile */
    .header-container {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center;
        align-items: center;
        gap: 15px;
    }

    /* Title takes full width on first row */
    .title-container {
        order: 1;
        width: 100%;
        text-align: center;
        margin-bottom: 0.5rem;
    }

    /* FTS logo on second row */
    .header-container > a {
        order: 2;
        margin: 0 auto;
    }

    /* Logo stack on second row, next to FTS logo */
    .logo-stack {
        order: 2;
        margin: 0 auto;
        flex-direction: row !important;
        gap: 25px;
        align-items: center;
        justify-content: center;
    }

    .logo-left {
        max-width: 100px !important;
        max-height: 100px !important;
    }

    .logo-right {
        max-width: 100px !important;
        max-height: 100px !important;
    }
}

/* Utility classes */
.d-flex {
    display: flex;
}

.justify-content-center {
    justify-content: center;
}

.align-items-center {
    align-items: center;
}

/* Flash animation */
@keyframes flash {
    0% {
        background-color: black;
    }

    100% {
        background-color: transparent;
    }
}

.flash {
    animation: flash 0.5s ease-in-out;
}
/* Add a fade-in animation to the tab panels */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.mud-tab-panel {
    animation: fadeIn 0.3s ease-in-out;
}

/* CSS Variables for common colors */
:root {
    --primary-red: #ff5722;
    --info-bg: #fff9e6;
    --info-border: #ffa500;
    --section-bg: #f8f9fa;
    --section-border: #dee2e6;
    --success-bg: #d4edda;
    --success-text: #155724;
    --success-border: #28a745;
    --error-bg: #f8d7da;
    --error-text: #721c24;
    --warning-bg: #fff3cd;
    --warning-border: #ffc107;
    --warning-text: #856404;
    --highlight-yellow: #f9e4a0;
    --table-header: #f4a460;
    --light-salmon: #FFA07A;

    /* UI Settings Multipliers - Default values */
    --font-size-multiplier: 1;
    --panel-width-multiplier: 1;
    --table-font-multiplier: 1;
    --spacing-multiplier: 1;
}

/* Override MudBlazor spacing utility classes with our spacing multiplier */
/* Use attribute selectors to override inline styles */
[class*="mud-m-"], [class*="m-"],
.mud-m-0, .m-0 { margin: 0 !important; }
[class*="mud-m-1"], [class*="m-1"],
.mud-m-1, .m-1 { margin: calc(0.25rem * var(--spacing-multiplier)) !important; }
[class*="mud-m-2"], [class*="m-2"],
.mud-m-2, .m-2 { margin: calc(0.5rem * var(--spacing-multiplier)) !important; }
[class*="mud-m-3"], [class*="m-3"],
.mud-m-3, .m-3 { margin: calc(1rem * var(--spacing-multiplier)) !important; }
[class*="mud-m-4"], [class*="m-4"],
.mud-m-4, .m-4 { margin: calc(1.5rem * var(--spacing-multiplier)) !important; }
[class*="mud-m-5"], [class*="m-5"],
.mud-m-5, .m-5 { margin: calc(3rem * var(--spacing-multiplier)) !important; }

.mud-mt-0, .mt-0 { margin-top: 0 !important; }
.mud-mt-1, .mt-1 { margin-top: calc(0.25rem * var(--spacing-multiplier)) !important; }
.mud-mt-2, .mt-2 { margin-top: calc(0.5rem * var(--spacing-multiplier)) !important; }
.mud-mt-3, .mt-3 { margin-top: calc(1rem * var(--spacing-multiplier)) !important; }
.mud-mt-4, .mt-4 { margin-top: calc(1.5rem * var(--spacing-multiplier)) !important; }
.mud-mt-5, .mt-5 { margin-top: calc(3rem * var(--spacing-multiplier)) !important; }

.mud-mb-0, .mb-0 { margin-bottom: 0 !important; }
.mud-mb-1, .mb-1 { margin-bottom: calc(0.25rem * var(--spacing-multiplier)) !important; }
.mud-mb-2, .mb-2 { margin-bottom: calc(0.5rem * var(--spacing-multiplier)) !important; }
.mud-mb-3, .mb-3 { margin-bottom: calc(1rem * var(--spacing-multiplier)) !important; }
.mud-mb-4, .mb-4 { margin-bottom: calc(1.5rem * var(--spacing-multiplier)) !important; }
.mud-mb-5, .mb-5 { margin-bottom: calc(3rem * var(--spacing-multiplier)) !important; }

.mud-ml-0, .ml-0 { margin-left: 0 !important; }
.mud-ml-1, .ml-1 { margin-left: calc(0.25rem * var(--spacing-multiplier)) !important; }
.mud-ml-2, .ml-2 { margin-left: calc(0.5rem * var(--spacing-multiplier)) !important; }
.mud-ml-3, .ml-3 { margin-left: calc(1rem * var(--spacing-multiplier)) !important; }
.mud-ml-4, .ml-4 { margin-left: calc(1.5rem * var(--spacing-multiplier)) !important; }
.mud-ml-5, .ml-5 { margin-left: calc(3rem * var(--spacing-multiplier)) !important; }

.mud-mr-0, .mr-0 { margin-right: 0 !important; }
.mud-mr-1, .mr-1 { margin-right: calc(0.25rem * var(--spacing-multiplier)) !important; }
.mud-mr-2, .mr-2 { margin-right: calc(0.5rem * var(--spacing-multiplier)) !important; }
.mud-mr-3, .mr-3 { margin-right: calc(1rem * var(--spacing-multiplier)) !important; }
.mud-mr-4, .mr-4 { margin-right: calc(1.5rem * var(--spacing-multiplier)) !important; }
.mud-mr-5, .mr-5 { margin-right: calc(3rem * var(--spacing-multiplier)) !important; }

.mud-mx-0, .mx-0 { margin-left: 0 !important; margin-right: 0 !important; }
.mud-mx-1, .mx-1 { margin-left: calc(0.25rem * var(--spacing-multiplier)) !important; margin-right: calc(0.25rem * var(--spacing-multiplier)) !important; }
.mud-mx-2, .mx-2 { margin-left: calc(0.5rem * var(--spacing-multiplier)) !important; margin-right: calc(0.5rem * var(--spacing-multiplier)) !important; }
.mud-mx-3, .mx-3 { margin-left: calc(1rem * var(--spacing-multiplier)) !important; margin-right: calc(1rem * var(--spacing-multiplier)) !important; }
.mud-mx-4, .mx-4 { margin-left: calc(1.5rem * var(--spacing-multiplier)) !important; margin-right: calc(1.5rem * var(--spacing-multiplier)) !important; }
.mud-mx-5, .mx-5 { margin-left: calc(3rem * var(--spacing-multiplier)) !important; margin-right: calc(3rem * var(--spacing-multiplier)) !important; }

.mud-my-0, .my-0 { margin-top: 0 !important; margin-bottom: 0 !important; }
.mud-my-1, .my-1 { margin-top: calc(0.25rem * var(--spacing-multiplier)) !important; margin-bottom: calc(0.25rem * var(--spacing-multiplier)) !important; }
.mud-my-2, .my-2 { margin-top: calc(0.5rem * var(--spacing-multiplier)) !important; margin-bottom: calc(0.5rem * var(--spacing-multiplier)) !important; }
.mud-my-3, .my-3 { margin-top: calc(1rem * var(--spacing-multiplier)) !important; margin-bottom: calc(1rem * var(--spacing-multiplier)) !important; }
.mud-my-4, .my-4 { margin-top: calc(1.5rem * var(--spacing-multiplier)) !important; margin-bottom: calc(1.5rem * var(--spacing-multiplier)) !important; }
.mud-my-5, .my-5 { margin-top: calc(3rem * var(--spacing-multiplier)) !important; margin-bottom: calc(3rem * var(--spacing-multiplier)) !important; }

.mud-p-0, .p-0 { padding: 0 !important; }
.mud-p-1, .p-1 { padding: calc(0.25rem * var(--spacing-multiplier)) !important; }
.mud-p-2, .p-2 { padding: calc(0.5rem * var(--spacing-multiplier)) !important; }
.mud-p-3, .p-3 { padding: calc(1rem * var(--spacing-multiplier)) !important; }
.mud-p-4, .p-4 { padding: calc(1.5rem * var(--spacing-multiplier)) !important; }
.mud-p-5, .p-5 { padding: calc(3rem * var(--spacing-multiplier)) !important; }

.mud-pt-0, .pt-0 { padding-top: 0 !important; }
.mud-pt-1, .pt-1 { padding-top: calc(0.25rem * var(--spacing-multiplier)) !important; }
.mud-pt-2, .pt-2 { padding-top: calc(0.5rem * var(--spacing-multiplier)) !important; }
.mud-pt-3, .pt-3 { padding-top: calc(1rem * var(--spacing-multiplier)) !important; }
.mud-pt-4, .pt-4 { padding-top: calc(1.5rem * var(--spacing-multiplier)) !important; }
.mud-pt-5, .pt-5 { padding-top: calc(3rem * var(--spacing-multiplier)) !important; }

.mud-pb-0, .pb-0 { padding-bottom: 0 !important; }
.mud-pb-1, .pb-1 { padding-bottom: calc(0.25rem * var(--spacing-multiplier)) !important; }
.mud-pb-2, .pb-2 { padding-bottom: calc(0.5rem * var(--spacing-multiplier)) !important; }
.mud-pb-3, .pb-3 { padding-bottom: calc(1rem * var(--spacing-multiplier)) !important; }
.mud-pb-4, .pb-4 { padding-bottom: calc(1.5rem * var(--spacing-multiplier)) !important; }
.mud-pb-5, .pb-5 { padding-bottom: calc(3rem * var(--spacing-multiplier)) !important; }

.mud-pl-0, .pl-0 { padding-left: 0 !important; }
.mud-pl-1, .pl-1 { padding-left: calc(0.25rem * var(--spacing-multiplier)) !important; }
.mud-pl-2, .pl-2 { padding-left: calc(0.5rem * var(--spacing-multiplier)) !important; }
.mud-pl-3, .pl-3 { padding-left: calc(1rem * var(--spacing-multiplier)) !important; }
.mud-pl-4, .pl-4 { padding-left: calc(1.5rem * var(--spacing-multiplier)) !important; }
.mud-pl-5, .pl-5 { padding-left: calc(3rem * var(--spacing-multiplier)) !important; }

.mud-pr-0, .pr-0 { padding-right: 0 !important; }
.mud-pr-1, .pr-1 { padding-right: calc(0.25rem * var(--spacing-multiplier)) !important; }
.mud-pr-2, .pr-2 { padding-right: calc(0.5rem * var(--spacing-multiplier)) !important; }
.mud-pr-3, .pr-3 { padding-right: calc(1rem * var(--spacing-multiplier)) !important; }
.mud-pr-4, .pr-4 { padding-right: calc(1.5rem * var(--spacing-multiplier)) !important; }
.mud-pr-5, .pr-5 { padding-right: calc(3rem * var(--spacing-multiplier)) !important; }

.mud-px-0, .px-0 { padding-left: 0 !important; padding-right: 0 !important; }
.mud-px-1, .px-1 { padding-left: calc(0.25rem * var(--spacing-multiplier)) !important; padding-right: calc(0.25rem * var(--spacing-multiplier)) !important; }
.mud-px-2, .px-2 { padding-left: calc(0.5rem * var(--spacing-multiplier)) !important; padding-right: calc(0.5rem * var(--spacing-multiplier)) !important; }
.mud-px-3, .px-3 { padding-left: calc(1rem * var(--spacing-multiplier)) !important; padding-right: calc(1rem * var(--spacing-multiplier)) !important; }
.mud-px-4, .px-4 { padding-left: calc(1.5rem * var(--spacing-multiplier)) !important; padding-right: calc(1.5rem * var(--spacing-multiplier)) !important; }
.mud-px-5, .px-5 { padding-left: calc(3rem * var(--spacing-multiplier)) !important; padding-right: calc(3rem * var(--spacing-multiplier)) !important; }

.mud-py-0, .py-0 { padding-top: 0 !important; padding-bottom: 0 !important; }
.mud-py-1, .py-1 { padding-top: calc(0.25rem * var(--spacing-multiplier)) !important; padding-bottom: calc(0.25rem * var(--spacing-multiplier)) !important; }
.mud-py-2, .py-2 { padding-top: calc(0.5rem * var(--spacing-multiplier)) !important; padding-bottom: calc(0.5rem * var(--spacing-multiplier)) !important; }
.mud-py-3, .py-3 { padding-top: calc(1rem * var(--spacing-multiplier)) !important; padding-bottom: calc(1rem * var(--spacing-multiplier)) !important; }
.mud-py-4, .py-4 { padding-top: calc(1.5rem * var(--spacing-multiplier)) !important; padding-bottom: calc(1.5rem * var(--spacing-multiplier)) !important; }
.mud-py-5, .py-5 { padding-top: calc(3rem * var(--spacing-multiplier)) !important; padding-bottom: calc(3rem * var(--spacing-multiplier)) !important; }

/* Common Layout Patterns */
.two-column-layout {
    display: flex;
    gap: calc(5px * var(--spacing-multiplier));
}

.column-flex {
    flex: 1;
}

/* Section Styling */
.panel-section {
    margin: calc(5px * var(--spacing-multiplier));
    padding: calc(20px * var(--spacing-multiplier));
    background-color: #e3e3e3;
    border: 1px solid var(--section-border);
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.panel-section-light {
    margin: calc(5px * var(--spacing-multiplier));
    padding: calc(20px * var(--spacing-multiplier));
    background-color: var(--section-bg);
    border: 1px solid var(--section-border);
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.panel-section h2 {
    color: var(--primary-red);
    font-weight: bold;
    margin-bottom: calc(10px * var(--spacing-multiplier));
}

.panel-section h2.centered {
    text-align: center;
    margin-bottom: calc(15px * var(--spacing-multiplier));
}

.panel-section h2 .rule-reference {
    font-size: 0.8em;
}

.panel-section h3 {
    margin-top: calc(15px * var(--spacing-multiplier));
    margin-bottom: calc(10px * var(--spacing-multiplier));
    font-size: 1.1em;
}

/* Info/Note Boxes */
.info-box {
    padding: calc(10px * var(--spacing-multiplier));
    background-color: var(--info-bg);
    border: 2px solid var(--info-border);
    border-radius: 5px;
    margin-bottom: calc(15px * var(--spacing-multiplier));
}

.info-box p {
    margin: 0;
}

.info-box ul {
    margin: calc(5px * var(--spacing-multiplier)) 0 0 0;
    padding-left: calc(20px * var(--spacing-multiplier));
    font-size: 0.85em;
}

.info-box-inline {
    display: inline-block;
    width: auto;
}

/* Result Display Boxes */
.result-box-success {
    padding: calc(12px * var(--spacing-multiplier));
    background-color: var(--success-bg);

    border-radius: 5px;
    text-align: center;
}

.result-box-success p {
    margin: 0;
    font-size: 1.2em;
    font-weight: bold;
    color: var(--success-text);
}

.result-box-failure {
    padding: calc(12px * var(--spacing-multiplier));
    background-color: var(--error-bg);

    border-radius: 5px;
    text-align: center;
}

.result-box-failure p {
    margin: 0;
    font-size: 1.2em;
    font-weight: bold;
    color: var(--error-text);
}

.result-box-warning {
    padding: calc(12px * var(--spacing-multiplier));
    background-color: var(--warning-bg);
    border: 2px solid var(--warning-border);
    border-radius: 5px;
    text-align: center;
}

.result-box-warning p {
    margin: 0;
    font-size: 1.2em;
    font-weight: bold;
    color: var(--warning-text);
}

.result-box-neutral {
    padding: calc(8px * var(--spacing-multiplier));
    background-color: #f0f0f0;
    border-radius: 5px;
    margin-bottom: calc(15px * var(--spacing-multiplier));
}

.result-box-neutral p {
    margin: 0;
    font-weight: bold;
}

/* Modifier Lists */
.modifier-list {
    font-size: 0.9em;
    margin-left: auto;
    margin-right: auto;
    width: fit-content;
    text-align: left;
    padding-left: calc(20px * var(--spacing-multiplier));
}

/* Morale modifier notes default */
.morale-modifier-notes {
    font-size: 0.75em;
}

.morale-modifier-notes p {
    margin: calc(2px * var(--spacing-multiplier)) 0;
}

/* Flex Layouts for Controls */
.control-layout-horizontal {
    display: flex;
    gap: calc(5px * var(--spacing-multiplier));
    align-items: flex-start;
}

.control-column {
    flex: 1;
}

.table-column {
    flex: 0 0 300px;
}

.table-column-medium {
    flex: 0 0 400px;
}

.table-column-large {
    flex: 0 0 450px;
}

/* Form styling improvements */
.form-section {
    margin-bottom: calc(15px * var(--spacing-multiplier));
}

/* Display fields */
.display-field {
    padding: calc(8px * var(--spacing-multiplier));
    background-color: #e9ecef;
    border-radius: 5px;
    text-align: center;
}

.display-field p {
    margin: 0;
    font-weight: bold;
}

/* Spacing utilities */
.mb-small {
    margin-bottom: calc(10px * var(--spacing-multiplier));
}

.mb-medium {
    margin-bottom: calc(15px * var(--spacing-multiplier));
}

.mb-large {
    margin-bottom: calc(20px * var(--spacing-multiplier));
}

.mt-small {
    margin-top: calc(10px * var(--spacing-multiplier));
}

.mt-medium {
    margin-top: calc(15px * var(--spacing-multiplier));
}

.mt-large {
    margin-top: calc(20px * var(--spacing-multiplier));
}

/* Text utilities */
.text-small {
    font-size: 0.85em;
}

.text-medium {
    font-size: 0.9em;
}

/* Footer */
footer {
    text-align: center;

}

.footer-dice-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

.footer-buttons {
    display: flex;
    gap: 10px;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
}

footer p {
    margin: 0;
    color: #666;
    font-size: 0.9em;
    text-align: center;
    flex: 1;
}

@media (max-width: 600px) {
    .footer-dice-container {
        flex-direction: column;
        gap: 15px;
    }

    .footer-buttons {
        justify-content: center;
    }

    .footer-buttons button {
        font-size: 0.5rem !important;
        padding: 8px 12px !important;
    }
}

/* Text Color Utilities */
.text-red {
    color: red;
}

.text-bold {
    font-weight: bold;
}

.text-success-highlight {
    color: #28a745 !important;
    font-weight: bold;
}

.text-failure-highlight {
    color: #dc3545 !important;
    font-weight: bold;
}

/* Combat Table Specific */
.combat-table {
    width: calc(100% * var(--panel-width-multiplier));
    border-collapse: separate;
    border-spacing: 0;
    border: 3px solid #2c3e50;
    table-layout: fixed;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    font-size: calc(1em * var(--table-font-multiplier));
    max-width: 100%;
}

.combat-table-column {
    width: 80px;
}

.combat-table-header {
    background: linear-gradient(180deg, #34495e 0%, #2c3e50 100%);
    font-weight: bold;
}

.combat-table-header-cell {
    border: 1px solid #2c3e50;
    padding: calc(14px * var(--spacing-multiplier)) calc(8px * var(--spacing-multiplier));
    text-align: center;
    background-color: #fff;
    font-weight: bold;
    font-size: 1.1em;
    color: #2c3e50;
    position: relative;
}

.combat-table-header-cell:first-child {
    background: linear-gradient(180deg, #34495e 0%, #2c3e50 100%);
    color: #fff;
    font-size: 1em;
}

/* Slope Table */
.slope-table {
    width: calc(100% * var(--panel-width-multiplier));
    border-collapse: separate;
    border-spacing: 0;
    border: 3px solid #2c3e50;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    font-size: calc(1em * var(--table-font-multiplier));
    max-width: 100%;
}

.slope-table-header {
    background: linear-gradient(180deg, #34495e 0%, #2c3e50 100%);
    font-weight: bold;
}

.slope-table-header-cell {
    border: 1px solid #bdc3c7;
    padding: calc(10px * var(--spacing-multiplier)) calc(8px * var(--spacing-multiplier));
    text-align: center;
    color: #fff;
    font-weight: bold;
    font-size: 1em;
}

.slope-table-row-cell {
    border: 1px solid #bdc3c7;
    padding: calc(10px * var(--spacing-multiplier)) calc(8px * var(--spacing-multiplier));
    text-align: center;
    font-weight: bold;
    transition: all 0.2s ease;
}

.slope-table-row-header {
    font-weight: bold;
    background: linear-gradient(90deg, #ecf0f1 0%, #fff 100%);
    color: #2c3e50;
}

/* Closing/Volley Table */
.closing-table {
    width: calc(100% * var(--panel-width-multiplier));
    border-collapse: separate;
    border-spacing: 0;
    border: 3px solid #2c3e50;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    font-size: calc(1em * var(--table-font-multiplier));
    max-width: 100%;
}

.closing-table-header {
    background: linear-gradient(180deg, #ff9966 0%, #ff8c42 100%);
}

.closing-table-header-cell {
    border: 1px solid #bdc3c7;
    padding: calc(14px * var(--spacing-multiplier)) calc(12px * var(--spacing-multiplier));
    text-align: center;
    font-weight: bold;
    font-size: 1.2em;
    color: #fff;
}

.closing-table-cell {
    padding: calc(12px * var(--spacing-multiplier));
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    transition: all 0.2s ease;
}

.closing-table-cell-border-right {
    border-right: 1px solid #bdc3c7;
}

.closing-table-cell-border-left {
    border-left: 1px solid #bdc3c7;
}

/* Volley Table */
.volley-table {
    width: calc(100% * var(--panel-width-multiplier));
    border-collapse: separate;
    border-spacing: 0;
    border: 3px solid #2c3e50;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    font-size: calc(1em * var(--table-font-multiplier));
    max-width: 100%;
}

.volley-table-header-merge {
    border: 1px solid #bdc3c7;
    padding: calc(10px * var(--spacing-multiplier)) calc(8px * var(--spacing-multiplier));
    text-align: center;
    font-weight: bold;
    font-size: 1.3em;
    font-style: italic;
    background: linear-gradient(180deg, #34495e 0%, #2c3e50 100%);
    color: #fff;
}

.volley-table-header-charge {
    border: 1px solid #bdc3c7;
    padding: calc(10px * var(--spacing-multiplier)) calc(8px * var(--spacing-multiplier));
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    background: linear-gradient(180deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.volley-table-header-shift {
    border: 1px solid #bdc3c7;
    padding: calc(10px * var(--spacing-multiplier)) calc(8px * var(--spacing-multiplier));
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    background: linear-gradient(180deg, #ff9966 0%, #ff8c42 100%);
    color: white;
    font-style: italic;
}

.volley-table-header-loss {
    border: 1px solid #bdc3c7;
    padding: calc(10px * var(--spacing-multiplier)) calc(8px * var(--spacing-multiplier));
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    background: linear-gradient(180deg, #fff9c4 0%, #ffffcc 100%);
    color: #c0392b;
}

.volley-table-header-range {
    border: 1px solid #bdc3c7;
    padding: calc(10px * var(--spacing-multiplier)) calc(8px * var(--spacing-multiplier));
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    background: linear-gradient(180deg, #34495e 0%, #2c3e50 100%);
    color: #fff;
}

.volley-table-header-range-italic {
    border: 1px solid #bdc3c7;
    padding: calc(10px * var(--spacing-multiplier)) calc(8px * var(--spacing-multiplier));
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    font-style: italic;
    background: linear-gradient(180deg, #34495e 0%, #2c3e50 100%);
    color: #fff;
}

.volley-table-row-yellow {
    background-color: #fef9e7;
}

.volley-table-row-white {
    background-color: #fff;
}

.volley-table-cell {
    border: 1px solid #bdc3c7;
    padding: calc(10px * var(--spacing-multiplier)) calc(8px * var(--spacing-multiplier));
    text-align: center;
    font-weight: bold;
    font-size: 1.0em;
    color: #c0392b;
    transition: all 0.2s ease;
}

.volley-table-cell-loss {
    border: 1px solid #bdc3c7;
    padding: calc(10px * var(--spacing-multiplier)) calc(8px * var(--spacing-multiplier));
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    transition: all 0.2s ease;
}

/* LOS Result Box */
.los-result-box {
    margin: calc(15px * var(--spacing-multiplier));
    padding: calc(20px * var(--spacing-multiplier));
    border: 1px solid var(--section-border);
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.los-result-box-blocked {
    background-color: var(--error-bg);
}

.los-result-box-clear {
    background-color: var(--success-bg);
}

.los-result-text {
    text-align: center;
}

.los-result-text p {
    margin: 0 0 calc(10px * var(--spacing-multiplier)) 0;
    font-size: 1.1em;
    font-weight: bold;
}

.los-result-inner {
    padding: calc(15px * var(--spacing-multiplier));
    color: white;
    border-radius: 5px;
}

.los-result-inner-blocked {
    background-color: #721c24;
}

.los-result-inner-clear {
    background-color: #155724;
}

.los-result-inner p {
    margin: 0;
    font-size: 1.5em;
    font-weight: bold;
}

/* Button utilities */
.button-flex-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.button-small-padding {
    padding: calc(6px * var(--spacing-multiplier)) calc(12px * var(--spacing-multiplier));
    min-width: calc(45px * var(--spacing-multiplier));
}

.button-disabled-opacity {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Button that should not be affected by spacing multiplier */
.no-spacing-resize {
    padding: 2px !important;
    min-width: 24px !important;
    height: 24px !important;
    width: 24px !important;
}

/* Centered heading */
.centered {
    text-align: center;
}

/* Dice styling */
.dice-container {
    display: flex;
    gap: calc(15px * var(--spacing-multiplier));
    justify-content: center;
    align-items: center;
    margin: calc(10px * var(--spacing-multiplier)) 0;
    min-height: 80px;
}

.dice-placeholder {
    min-height: 80px;

}

.result-placeholder {
    min-height: 35px;
}

.dice {
    width: 60px;
    height: 60px;
    background-color: white;
    border: 2px solid #333;
    border-radius: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    grid-template-areas:
        "a . c"
        "e g f"
        "d . b";
    padding: calc(6px * var(--spacing-multiplier)) calc(8px * var(--spacing-multiplier)) calc(12px * var(--spacing-multiplier)) calc(8px * var(--spacing-multiplier));
    gap: 0px;
    place-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.dice.rolling {
    animation: diceRoll 0.5s ease-in-out;
}

@keyframes diceRoll {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(90deg) scale(1.1);
    }
    50% {
        transform: rotate(180deg) scale(1.2);
    }
    75% {
        transform: rotate(270deg) scale(1.1);
    }
}

.dice-dot {
    width: 10px;
    height: 10px;
    background-color: #333;
    border-radius: 50%;
}

.dice-sum {
    font-size: 1.2em;
    font-weight: bold;
    color: #00698f;
    margin-left: calc(15px * var(--spacing-multiplier));
}

/* Morale Panel Layout */
.morale-panel-layout {
    display: flex;
    gap: calc(5px * var(--spacing-multiplier));
}

.morale-controls {
    flex: 0 0 400px;
}

.morale-tables {
    flex: 1;
}

/* Table wrapper for horizontal scrolling on mobile */
.table-responsive-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -10px;
    padding: 0 10px;
}

@media (max-width: 768px) {
    .table-responsive-wrapper {
        margin: 0 -5px;
        padding: 0 5px;
    }
}

/* Leader Loss Table Layout */
.leader-loss-layout {
    display: flex;
    gap: calc(5px * var(--spacing-multiplier));
}

.leader-loss-table-column {
    flex: 0 0 450px;
}

.leader-loss-controls {
    flex: 1;
    display: flex;
    gap: calc(5px * var(--spacing-multiplier));
}

.leader-loss-selections {
    flex: 1;
}

.leader-loss-results {
    flex: 1;
}

/* Command Charts Layout */
.command-charts-layout {
    display: flex;
    gap: calc(5px * var(--spacing-multiplier));
    align-items: flex-start;
}

.command-chart-column {
    flex: 1;
    min-width: 0;
}

/* ========================================
   RESPONSIVE STYLES
   ======================================== */

/* Command Charts - stack below 1300px */
@media (max-width: 1100px) {
    .command-charts-layout {
        flex-direction: column;
    }

    .command-chart-column {
        flex: 1 1 auto;
        width: 100%;
    }
}

/* Leader Loss Table - stack below 1050px */
@media (max-width: 1050px) {
    .leader-loss-layout {
        flex-direction: column;
        gap: 5px;
    }
    /* Morale panel stacks vertically */
    .morale-panel-layout {
        flex-direction: column;
    }

    /* Match widths when stacked */
    .morale-controls,
    .morale-tables {
        width: 100% !important;
        max-width: 100% !important;
        flex: 1 1 auto !important;
    }

    /* Ensure panel-section-light panels match width */
    .morale-tables .panel-section-light {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    /* Reduce padding on the entire leader loss section container */
    .morale-tables > div:last-child {
        padding: 15px 15px 10px 15px !important;
    }

    .leader-loss-table-column {
        flex: 1 1 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
        min-height: 0 !important;
    }

    /* Target the table container more specifically */
    .leader-loss-layout .leader-loss-table-column {
        flex-basis: auto !important;
        height: auto !important;
    }

    .leader-loss-controls {
        flex-direction: column;
        margin-top: 0;
        padding-top: 0 !important;
    }

    .leader-loss-selections,
    .leader-loss-results {
        flex: 1 1 auto;
        width: 100%;
    }

    /* Reduce space after the leader loss table */
    .leader-loss-table-column p {
        margin-bottom: 5px !important;
    }

    /* Remove any extra space from the table itself */
    .leader-loss-table-column table {
        margin-bottom: 5px !important;
    }
}

/* Medium screens - stack Closing/Volley tables */
@media (max-width: 1400px) {
    /* Control layout stacks vertically */
    .control-layout-horizontal {
        flex-direction: column;
    }

    /* Table containers */
    .table-column,
    .table-column-small,
    .table-column-medium,
    .table-column-large {
        flex: 1 1 auto;
        width: 100%;
        max-width: 100%;
    }



    .morale-controls,
    .morale-tables {
        flex: 1 1 auto;
        width: 100%;
    }
}

/* Morale and Leader Loss tables - scale down below 1600px */
@media (max-width: 1600px) {
    .morale-rating-table {
        font-size: 0.95em;
        max-width: 100%;
        width: 95%;
    }

    .morale-rating-table td,
    .morale-rating-table th {
        padding: 12px 6px !important;
    }

    .leader-loss-table-column {
        flex: 1 1 auto !important;
        max-width: 100%;
    }

    .leader-loss-table-column table {
        font-size: 0.95em;
    }

    .leader-loss-table-column td,
    .leader-loss-table-column th {
        padding: 9px 6px !important;
    }

    /* Shrink morale side notes */
    .morale-side-notes {
        width: 180px !important;
        font-size: 0.9em;
    }

    .morale-side-notes > div {
        padding: 8px !important;
    }

    /* Shrink morale controls section */
    .morale-controls {
        flex: 0 0 380px;
    }

    /* Constrain morale-tables to prevent overflow */
    .morale-tables {
        max-width: calc(100vw - 400px);
        overflow: hidden;
    }

    .morale-panel-layout {
        gap: 10px;
    }

    /* Stack leader loss layout vertically below 1600px */
    .leader-loss-layout {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .leader-loss-controls {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .leader-loss-selections,
    .leader-loss-results {
        flex: 1 1 auto !important;
        max-width: 100% !important;
    }
}

@media (max-width: 1500px) {
    .morale-rating-table {
        font-size: 0.9em;
        max-width: 100%;
        width: 90%;
    }

    .morale-rating-table td,
    .morale-rating-table th {
        padding: 10px 5px !important;
    }

    .morale-side-notes {
        width: 170px !important;
        font-size: 0.85em;
    }

    .morale-side-notes > div {
        padding: 7px !important;
    }

    .morale-controls {
        flex: 0 0 360px;
    }

    .morale-tables {
        max-width: calc(100vw - 380px);
    }
}

@media (max-width: 1400px) {
    .morale-rating-table {
        font-size: 0.85em;
        max-width: 100%;
        width: 85%;
    }

    .morale-rating-table td,
    .morale-rating-table th {
        padding: 9px 4px !important;
    }

    .morale-side-notes {
        width: 160px !important;
        font-size: 0.8em;
    }

    .morale-side-notes > div {
        padding: 6px !important;
    }

    .morale-controls {
        flex: 0 0 340px;
    }

    .morale-tables {
        max-width: calc(100vw - 360px);
    }
}

@media (max-width: 1300px) {
    .morale-rating-table {
        font-size: 0.8em;
        max-width: 100%;
        width: 80%;
    }

    .morale-rating-table td,
    .morale-rating-table th {
        padding: 8px 4px !important;
    }

    .morale-side-notes {
        width: 150px !important;
        font-size: 0.75em;
    }

    .morale-side-notes > div {
        padding: 5px !important;
    }

    .morale-controls {
        flex: 0 0 320px;
    }

    .morale-tables {
        max-width: calc(100vw - 340px);
    }
}

@media (max-width: 1200px) {
    .morale-rating-table {
        font-size: 0.75em;
        max-width: 100%;
        width: 75%;
    }

    .morale-rating-table td,
    .morale-rating-table th {
        padding: 7px 3px !important;
    }

    .morale-side-notes {
        width: 140px !important;
        font-size: 0.7em;
    }

    .morale-side-notes > div {
        padding: 4px !important;
    }

    .morale-controls {
        flex: 0 0 300px;
    }

    .morale-tables {
        max-width: calc(100vw - 320px);
    }
}

@media (max-width: 1100px) {
    .morale-rating-table {
        font-size: 0.7em;
        max-width: 100%;
        width: 70%;
    }

    .morale-rating-table td,
    .morale-rating-table th {
        padding: 6px 2px !important;
    }

    .morale-side-notes {
        width: 130px !important;
        font-size: 0.65em;
    }

    .morale-side-notes > div {
        padding: 4px !important;
    }

    .morale-controls {
        flex: 0 0 280px;
    }

    .morale-tables {
        max-width: calc(100vw - 300px);
    }
}

/* Tablet (portrait and landscape) */
@media (max-width: 1024px) {
    /* Header adjustments */
    header {
        padding: 0 1rem;
        margin: 2rem 0;
    }

    .header-container {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    /* Title always first */
    .title-container {
        order: 1;
        width: 100%;
        text-align: center;
    }

    /* Logos below title */
    .header-container > a {
        order: 2;
    }

    .logo-stack {
        order: 2;
        flex-direction: row;
        gap: 20px;
        margin-left: 0;
    }

    .logo-left, .logo-right {
        max-width: 120px;
        max-height: 120px;
    }

    .title-container h1 {
        font-size: 2rem;
    }

    .title-container .subtitle {
        font-size: 1.2rem;
    }

    /* Two-column layouts stack on tablets */
    .two-column-layout {
        flex-direction: column;
        gap: 5px;
    }

    /* Form sections */
    .fire-sequence-card {
        max-width: 100%;
        padding: 1.5rem;
    }

    /* Tables - enable horizontal scroll if needed */
    .combat-table,
    .slope-table,
    .closing-table,
    .volley-table {
        font-size: 0.9em;
    }

    .combat-table-header-cell,
    .slope-table-header-cell,
    .closing-table-header-cell {
        padding: 10px 6px;
        font-size: 0.95em;
    }

    /* Dice size adjustment */
    .dice {
        width: 50px;
        height: 50px;
    }

    .dice-dot {
        width: 8px;
        height: 8px;
    }
}

/* Mobile phones (portrait) */
@media (max-width: 768px) {
    /* Header adjustments */
    header {
        padding: 0 0.5rem;
        margin: 2rem 0;
    }

    .logo-left, .logo-right {
        max-width: 80px;
        max-height: 80px;
    }

    .title-container h1 {
        font-size: 1.5rem;
        letter-spacing: 1px;
        margin: 0;
    }

    .title-container .subtitle {
        font-size: 1rem;
        margin-top: 0.25rem;
    }

    /* Card padding - significantly reduced */
    .fire-sequence-card {
        padding: 0.5rem;
        margin-bottom: 0.5rem;
    }

    /* Panel sections - reduced padding */
    .panel-section,
    .panel-section-light {
        padding: 8px;
        margin: 5px;
    }

    /* Reduce heading sizes and margins */
    h1 {
        font-size: 1.4rem !important;
        margin-bottom: 0.5rem !important;
    }

    h2 {
        font-size: 1.1rem !important;
        margin-bottom: 0.4rem !important;
        margin-top: 0.4rem !important;
    }

    h3 {
        font-size: 1rem !important;
        margin-bottom: 0.3rem !important;
        margin-top: 0.5rem !important;
    }

    /* Compact spacing utilities */
    .mb-small {
        margin-bottom: 5px !important;
    }

    .mb-medium {
        margin-bottom: 8px !important;
    }

    .mb-large {
        margin-bottom: 10px !important;
    }

    .mt-small {
        margin-top: 5px !important;
    }

    .mt-medium {
        margin-top: 8px !important;
    }

    .mt-large {
        margin-top: 10px !important;
    }

    /* Compact form groups */
    .form-group {
        margin-bottom: 10px !important;
    }

    /* Compact form sections */
    .form-section {
        margin-bottom: 8px !important;
    }

    /* Remove min-heights from placeholders */
    .dice-placeholder {
        min-height: 0 !important;
        margin: 10px 0 !important;
    }

    .result-placeholder {
        min-height: 0 !important;
        margin: 3px 0 !important;
    }

    /* Compact dice container */
    .dice-container {
        gap: 5px;
        margin: 5px 0 !important;
        min-height: 0 !important;
    }

    /* Button groups - stack vertically */
    .button-flex-wrap {
        gap: 2px;
    }

    .selector-button {
        min-width: calc(35px * var(--spacing-multiplier));
        padding: calc(4px * var(--spacing-multiplier)) calc(8px * var(--spacing-multiplier));
        font-size: 0.85em;
    }

    .button-group {
        gap: calc(3px * var(--spacing-multiplier));
        margin-top: calc(2px * var(--spacing-multiplier));
    }

    /* Compact roll buttons */
    .btn-block {
        padding: calc(0.6rem * var(--spacing-multiplier)) calc(1rem * var(--spacing-multiplier)) !important;
        font-size: 1.1rem !important;
        margin-bottom: calc(0.5rem * var(--spacing-multiplier)) !important;
    }

    .btn-block.fixed-size {
        min-width: calc(200px * var(--spacing-multiplier));
        height: calc(48px * var(--spacing-multiplier)) !important;
        padding: calc(0.6rem * var(--spacing-multiplier)) calc(1rem * var(--spacing-multiplier)) !important;
        font-size: 1.1rem !important;
    }

    /* Form elements */
    .form-group label {
        font-size: 0.9em;
        margin-bottom: 2px !important;
    }

    /* Compact checkboxes */
    .form-check {
        margin-bottom: 6px !important;
    }

    .form-check-input {
        width: 18px;
        height: 18px;
        margin-right: 8px;
    }

    .form-check-label {
        font-size: 0.9rem;
    }

    /* Compact info boxes */
    .info-box {
        padding: 6px;
        margin-bottom: 8px;
    }

    .info-box p {
        font-size: 0.85em;
        line-height: 1.3;
    }

    /* Compact result boxes */
    .result-box-success,
    .result-box-warning,
    .result-box-neutral {
        padding: 6px !important;
        margin-bottom: 8px !important;
    }

    .result-box-success p,
    .result-box-warning p,
    .result-box-neutral p {
        font-size: 1em !important;
        margin: 0 !important;
    }

    /* Compact modifier lists */
    .modifier-list {
        font-size: 0.85em;
        padding-left: 15px;
        margin-bottom: 8px;
    }

    .modifier-list li {
        margin-bottom: 2px;
    }

    /* Tables - make scrollable */
    .combat-table,
    .slope-table,
    .closing-table,
    .volley-table {
        font-size: 0.75em;
        min-width: 100%;
    }

    .combat-table-header-cell,
    .slope-table-header-cell,
    .slope-table-row-cell,
    .closing-table-header-cell,
    .closing-table-cell {
        padding: 6px 4px;
        font-size: 0.85em;
    }

    .volley-table-header-merge,
    .volley-table-header-charge,
    .volley-table-header-shift,
    .volley-table-header-loss,
    .volley-table-header-range,
    .volley-table-header-range-italic {
        padding: 6px 4px;
        font-size: 0.85em;
    }

    .volley-table-cell,
    .volley-table-cell-loss {
        padding: 6px 4px;
        font-size: 0.8em;
    }

    /* Dice adjustments */
    .dice {
        width: 45px;
        height: 45px;
        padding: 3px 6px 9px 6px;
        gap: 0px;
        place-items: center;
    }

    .dice-dot {
        width: 7px;
        height: 7px;
    }

    .dice-sum {
        font-size: 1em;
        margin-left: 10px;
    }

    /* Result text */
    .result-highlight {
        font-size: 0.9em;
    }

    /* Info boxes */
    .info-box {
        padding: 10px;
        font-size: 0.85em;
    }

    /* Two column morale layout */
    .two-column-layout {
        flex-direction: column;
        gap: 5px;
    }

    .column-flex {
        margin-bottom: 0 !important;
    }

    /* Control layout stacks vertically */
    .control-layout-horizontal {
        flex-direction: column;
        gap: 5px !important;
    }

    /* Table containers */
    .table-column,
    .table-column-small,
    .table-column-medium,
    .table-column-large {
        flex: 1 1 auto;
        width: 100%;
        max-width: 100%;
    }

    /* Leader loss table specific */
    table[style*="flex: 0 0 450px"] {
        flex: 1 1 auto !important;
    }

    /* Compact morale panel layout */
    .morale-panel-layout {
        gap: 5px !important;
    }

    .morale-controls {
        margin-bottom: 0 !important;
    }

    .morale-tables {
        margin-top: 0 !important;
    }

    /* Compact leader loss layout */
    .leader-loss-layout {
        gap: 5px !important;
    }

    .leader-loss-controls {
        gap: 5px !important;
    }

    /* Compact morale side notes */
    .morale-side-notes {
        font-size: 0.75em !important;
    }

    .morale-side-notes > div {
        padding: 6px !important;
        margin-bottom: 6px !important;
    }

    .morale-side-notes p {
        font-size: 1em !important;
        line-height: 1.2 !important;
        margin: 3px 0 !important;
    }

    /* Compact morale modifier notes (footnotes) - match side note boxes */
    .morale-modifier-notes {
        font-size: 0.75em !important;
        margin-top: 6px !important;
    }

    .morale-modifier-notes p {
        margin: 2px 0 !important;
        line-height: 1.4 !important;
        font-size: inherit !important;
    }

    /* Compact command note boxes - match morale side note boxes */
    .command-note-box {
        font-size: 0.75em !important;
    }

    .command-note-box p {
        font-size: inherit !important;
        line-height: 1.2 !important;
        margin: 3px 0 !important;
    }

    /* Compact command tables on mobile */
    .command-table {
        font-size: 0.85em !important;
    }

    .command-table th,
    .command-table td {
        padding: 6px 4px !important;
    }
}

/* Small mobile phones */
@media (max-width: 480px) {
    /* Header */
    .logo-stack {
        flex-direction: column;
        gap: 3px;
    }

    .title-container h1 {
        font-size: 1.2rem;
        margin-bottom: 0.3rem !important;
    }

    .title-container .subtitle {
        font-size: 0.9rem;
        margin-top: 0.2rem;
    }

    /* Extremely compact tables */
    .combat-table,
    .slope-table,
    .closing-table,
    .volley-table {
        font-size: 0.65em;
    }

    /* Buttons even smaller */
    .selector-button {
        min-width: calc(30px * var(--spacing-multiplier));
        padding: calc(3px * var(--spacing-multiplier)) calc(6px * var(--spacing-multiplier));
        font-size: 0.75em;
    }

    .button-group {
        gap: calc(2px * var(--spacing-multiplier));
        margin-top: calc(1px * var(--spacing-multiplier));
    }

    /* Fixed size buttons adjust */
    .fixed-size {
        min-width: calc(120px * var(--spacing-multiplier));
        font-size: 0.9em;
    }

    /* Roll Closing and Roll Opening Volley buttons */
    .btn-block {
        font-size: 1em;
        padding: calc(0.5rem * var(--spacing-multiplier)) calc(0.8rem * var(--spacing-multiplier)) !important;
        white-space: normal;
        min-width: auto;
        width: 100%;
        margin-bottom: calc(0.3rem * var(--spacing-multiplier)) !important;
    }

    .btn-block.fixed-size {
        min-width: calc(100px * var(--spacing-multiplier));
        height: calc(42px * var(--spacing-multiplier)) !important;
        font-size: 0.85em;
        padding: calc(0.5rem * var(--spacing-multiplier)) calc(0.5rem * var(--spacing-multiplier)) !important;
        white-space: normal;
    }

    /* Dice */
    .dice {
        width: 40px;
        height: 40px;
        padding: 2px 5px 8px 5px;
        gap: 0px;
        place-items: center;
    }

    .dice-dot {
        width: 6px;
        height: 6px;
    }

    .dice-container {
        gap: 5px;
        margin: 5px 0 !important;
    }

    .dice-placeholder {
        margin: 5px 0 !important;
    }

    /* Reduce margins and padding everywhere */
    .panel-section,
    .panel-section-light {
        padding: 6px;
        margin: 5px 3px;
    }

    .fire-sequence-card {
        padding: 0.4rem;
        margin-bottom: 0.3rem;
    }

    /* Form sections */
    .form-section {
        margin: 6px 0 !important;
    }

    .form-group {
        margin-bottom: 6px !important;
    }

    /* Checkboxes and labels */
    .form-check {
        margin-bottom: 4px !important;
    }

    .form-check-label {
        font-size: 0.85em;
    }

    .form-check-input {
        width: 16px;
        height: 16px;
        margin-right: 6px;
    }

    /* Ultra compact spacing */
    .mb-small {
        margin-bottom: 3px !important;
    }

    .mb-medium {
        margin-bottom: 5px !important;
    }

    .mb-large {
        margin-bottom: 8px !important;
    }

    /* Compact headings */
    h1 {
        font-size: 1.2rem !important;
        margin-bottom: 0.3rem !important;
    }

    h2 {
        font-size: 1rem !important;
        margin-bottom: 0.3rem !important;
        margin-top: 0.3rem !important;
    }

    h3 {
        font-size: 0.9rem !important;
        margin-bottom: 0.2rem !important;
        margin-top: 0.3rem !important;
    }

    /* Info boxes */
    .info-box {
        padding: 4px;
        margin-bottom: 5px;
    }

    /* Result boxes */
    .result-box-success,
    .result-box-warning,
    .result-box-neutral {
        padding: 4px !important;
        margin-bottom: 5px !important;
    }

    /* Result placeholder */
    .result-placeholder {
        margin: 2px 0 !important;
    }

    

    .control-layout-horizontal {
        gap: 6px !important;
    }

    /* Extra compact morale side notes for small phones */
    .morale-side-notes {
        font-size: 0.65em !important;
    }

    .morale-side-notes > div {
        padding: 4px !important;
        margin-bottom: 4px !important;
    }

    .morale-side-notes p {
        margin: 2px 0 !important;
        line-height: 1.1 !important;
    }

    /* Extra compact morale modifier notes (footnotes) - match side note boxes */
    .morale-modifier-notes {
        font-size: 0.65em !important;
        margin-top: 5px !important;
    }

    .morale-modifier-notes p {
        margin: 2px 0 !important;
        line-height: 1.3 !important;
        font-size: inherit !important;
    }

    /* Keep side-by-side layout on small phones too */
    .morale-side-notes {
        display: flex !important;
        flex-direction: row !important;
        gap: 4px !important;
        width: 100% !important;
    }

    .morale-side-notes > div {
        flex: 1 !important;
        min-width: 0 !important;
    }

    /* Extra compact command note boxes - match morale side note boxes */
    .command-note-box {
        font-size: 0.65em !important;
    }

    .command-note-box p {
        font-size: inherit !important;
        line-height: 1.1 !important;
        margin: 2px 0 !important;
    }

    /* Extra compact command tables on small phones */
    .command-table {
        font-size: 0.75em !important;
    }

    .command-table th,
    .command-table td {
        padding: 4px 2px !important;
    }
}

/* Closing and Volley buttons - responsive */
@media (max-width: 600px) {
    .btn-block {
        font-size: 1.1rem;
        padding: calc(0.85rem * var(--spacing-multiplier)) calc(1.2rem * var(--spacing-multiplier));
    }

    .btn-block.fixed-size {
        min-width: calc(200px * var(--spacing-multiplier));
        font-size: 1.1rem;
        white-space: normal;
        height: auto;
    }
}

@media (max-width: 400px) {
    .btn-block {
        font-size: 0.95rem;
        padding: calc(0.7rem * var(--spacing-multiplier)) calc(0.8rem * var(--spacing-multiplier));
    }

    .btn-block.fixed-size {
        min-width: calc(100px * var(--spacing-multiplier));
        font-size: 0.85rem;
        padding: calc(0.7rem * var(--spacing-multiplier)) calc(0.5rem * var(--spacing-multiplier));
        white-space: normal;
        height: auto;
    }
}

@media (max-width: 340px) {
    .btn-block {
        font-size: 0.85rem;
        padding: calc(0.6rem * var(--spacing-multiplier)) calc(0.5rem * var(--spacing-multiplier));
    }

    .btn-block.fixed-size {
        min-width: calc(80px * var(--spacing-multiplier));
        font-size: 0.75rem;
        padding: calc(0.6rem * var(--spacing-multiplier)) calc(0.4rem * var(--spacing-multiplier));
        white-space: normal;
        height: auto;
    }
}

/* Combat table adjustments for narrow screens */
@media (max-width: 670px) {
    .combat-table {
        font-size: 0.6em;
    }

    .combat-table-header-cell {
        padding: 4px 2px;
        font-size: 0.8em;
        text-align: center !important;
    }

    .combat-table td {
        padding: 4px 2px;
        font-size: 0.85em;
        text-align: center !important;
    }

    .combat-table-column {
        width: 50px;
    }
}

/* Combat table adjustments for very narrow screens */
@media (max-width: 450px) {
    .combat-table {
        font-size: 0.45em;
    }

    .combat-table-header-cell {
        padding: 2px 1px;
        font-size: 0.75em;
        text-align: center !important;
    }

    .combat-table td {
        padding: 2px 1px;
        font-size: 0.8em;
        text-align: center !important;
    }

    .combat-table-column {
        width: 35px;
    }
}

/* Combat table adjustments for extra narrow screens */
@media (max-width: 390px) {
    .combat-table {
        font-size: 0.4em;
    }

    .combat-table-header-cell {
        padding: 2px 0px !important;
        font-size: 0.7em !important;
        text-align: center !important;
    }

    .combat-table td {
        padding: 2px 0px !important;
        font-size: 0.75em !important;
        text-align: center !important;
    }

    .combat-table tbody td {
        padding: 2px 0px !important;
        font-size: 0.75em !important;
        text-align: center !important;
    }

    .combat-table-column {
        width: 30px;
    }
}

/* Slope table adjustments for narrow screens */
@media (max-width: 530px) {
    .slope-table {
        font-size: 0.65em;
    }

    .slope-table-header-cell {
        padding: 6px 3px;
        font-size: 0.85em;
        text-align: center !important;
    }

    .slope-table-row-cell {
        padding: 6px 3px;
        font-size: 0.85em;
        text-align: center !important;
    }
}

/* Slope table adjustments for very narrow screens */
@media (max-width: 400px) {
    .slope-table {
        font-size: 0.55em;
    }

    .slope-table-header-cell {
        padding: 4px 2px;
        font-size: 0.8em;
    }

    .slope-table-row-cell {
        padding: 4px 2px;
        font-size: 0.8em;
    }
}

/* Morale Rating Table - ensure cells stay centered */
.morale-rating-table {
    width: calc(100% * var(--panel-width-multiplier));
    border-collapse: separate;
    border-spacing: 0;
    border: 3px solid #2c3e50;
    table-layout: fixed;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    font-size: calc(1em * var(--table-font-multiplier));
    max-width: 100%;
}

.morale-rating-table td,
.morale-rating-table th {
    text-align: center !important;
    vertical-align: middle !important;
    overflow: hidden;
    word-wrap: break-word;
}

/* Morale Rating Table - responsive adjustments */
@media (max-width: 768px) {
    .morale-rating-table {
        font-size: 0.85em;
    }

    .morale-rating-table td {
        padding: 8px 4px !important;
    }

    .morale-rating-table th {
        padding: 10px 4px !important;
    }
}

@media (max-width: 590px) {
    .morale-rating-table {
        font-size: 0.75em;
    }

    .morale-rating-table td {
        padding: 6px 2px !important;
    }

    .morale-rating-table th {
        padding: 8px 2px !important;
        font-size: 0.9em !important;
    }
}

@media (max-width: 480px) {
    .morale-rating-table {
        font-size: 0.65em;
    }

    .morale-rating-table td {
        padding: 4px 1px !important;
    }

    .morale-rating-table th {
        padding: 6px 1px !important;
        font-size: 0.85em !important;
    }
}

@media (max-width: 380px) {
    .morale-rating-table {
        font-size: 0.55em;
    }

    .morale-rating-table td {
        padding: 3px 0px !important;
    }

    .morale-rating-table th {
        padding: 4px 0px !important;
        font-size: 0.8em !important;
    }
}

/* Morale Table Modifiers - move side note boxes to bottom below 590px */
@media (max-width: 590px) {
    .morale-modifiers-container {
        display: flex;
        flex-direction: column;
    }

    .morale-side-notes {
        order: 1;
        width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        gap: 5px !important;
    }

    .morale-side-notes > div {
        flex: 1 !important;
        min-width: 0 !important;
    }

    .morale-modifier-notes {
        order: 2;
        font-size: 0.75em !important;
    }

    .morale-modifier-notes p {
        margin: 2px 0 !important;
        line-height: 1.3 !important;
        font-size: inherit !important;
    }
}

/* Leader Loss Table - responsive styles */
@media (max-width: 600px) {
    .leader-loss-table-column table {
        font-size: 0.8em;
    }

    .leader-loss-table-column td,
    .leader-loss-table-column th {
        padding: 8px 4px !important;
    }
}

@media (max-width: 500px) {
    .leader-loss-table-column table {
        font-size: 0.7em !important;
    }

    .leader-loss-table-column td,
    .leader-loss-table-column th {
        padding: 6px 3px !important;
    }
}

@media (max-width: 420px) {
    .leader-loss-table-column table {
        font-size: 0.6em !important;
    }

    .leader-loss-table-column td,
    .leader-loss-table-column th {
        padding: 5px 2px !important;
    }
}

@media (max-width: 380px) {
    .leader-loss-table-column table {
        font-size: 0.55em !important;
    }

    .leader-loss-table-column td,
    .leader-loss-table-column th {
        padding: 4px 1px !important;
    }
}

@media (max-width: 340px) {
    .leader-loss-table-column table {
        font-size: 0.5em !important;
    }

    .leader-loss-table-column td,
    .leader-loss-table-column th {
        padding: 3px 0px !important;
    }
}

/* Morale Panel - prevent overflow on very small screens */
@media (max-width: 380px) {
    /* Morale controls section */
    .morale-controls {
        font-size: 0.85em;
    }

    /* Selector buttons in morale modifiers */
    .morale-controls .selector-button {
        padding: calc(4px * var(--spacing-multiplier)) calc(6px * var(--spacing-multiplier)) !important;
        font-size: 0.75em !important;
        min-width: calc(30px * var(--spacing-multiplier)) !important;
    }

    /* Roll Morale button */
    .morale-controls .btn-block.fixed-size {
        min-width: calc(100px * var(--spacing-multiplier)) !important;
        font-size: 0.9em !important;
        padding: calc(0.75rem * var(--spacing-multiplier)) calc(1rem * var(--spacing-multiplier)) !important;
        white-space: normal !important;
        height: auto !important;
    }

    /* Labels */
    .morale-controls label {
        font-size: 0.8em !important;
    }

    /* Checkboxes */
    .morale-controls .form-check-label {
        font-size: 0.75em !important;
    }

    /* Leader loss controls */
    .leader-loss-controls .selector-button {
        padding: calc(4px * var(--spacing-multiplier)) calc(6px * var(--spacing-multiplier)) !important;
        font-size: 0.75em !important;
        min-width: calc(30px * var(--spacing-multiplier)) !important;
    }

    .leader-loss-controls .btn-block.fixed-size {
        min-width: calc(100px * var(--spacing-multiplier)) !important;
        font-size: 0.9em !important;
        padding: calc(0.75rem * var(--spacing-multiplier)) calc(1rem * var(--spacing-multiplier)) !important;
    }

    .leader-loss-controls label {
        font-size: 0.8em !important;
    }
}

/* Release Notes Dialog - Non-interactive list items */
.release-notes-list .release-notes-item {
    cursor: default !important;
    pointer-events: none !important;
}

.release-notes-list .release-notes-item:hover {
    background-color: transparent !important;
}

/* Release Notes Dialog - Scroll indicator */
.release-notes-content {
    position: relative;
}

/* Add scroll indicator shadow */
@media (max-width: 768px) {
    .release-notes-content::after {
        content: '';
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        height: 40px;
        background: linear-gradient(to top, rgba(255,255,255,0.95), transparent);
        pointer-events: none;
        z-index: 1;
    }

    /* Add a subtle down arrow indicator */
    .release-notes-content::before {
        content: '\25BC'; /* Down arrow */
        position: sticky;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        color: rgba(0, 0, 0, 0.4);
        font-size: 1.2rem;
        animation: bounce 2s infinite;
        pointer-events: none;
        z-index: 2;
        display: block;
        text-align: center;
    }

    @keyframes bounce {
        0%, 20%, 50%, 80%, 100% {
            transform: translateX(-50%) translateY(0);
        }
        40% {
            transform: translateX(-50%) translateY(-10px);
        }
        60% {
            transform: translateX(-50%) translateY(-5px);
        }
    }
}

/* What's New Button */
.whats-new-button {
    margin-left: calc(15px * var(--spacing-multiplier));
    font-weight: 600 !important;
    font-size: 1rem !important;
    padding: 10px 20px !important;
    box-shadow: 0 4px 8px rgba(23, 162, 184, 0.3) !important;
    transition: all 0.3s ease-in-out !important;
    animation: pulse 2s infinite;
}

.whats-new-button:hover {
    transform: translateY(-2px) scale(1.05) !important;
    box-shadow: 0 6px 12px rgba(23, 162, 184, 0.5) !important;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 8px rgba(23, 162, 184, 0.3);
    }
    50% {
        box-shadow: 0 4px 12px rgba(23, 162, 184, 0.6);
    }
}

/* Mobile adjustments for What's New button */
@media (max-width: 768px) {
    .whats-new-button {
        margin-left: 0;
        margin-top: calc(10px * var(--spacing-multiplier));
        font-size: 0.9rem !important;
        padding: 8px 16px !important;
    }
}

/* Landscape orientation adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    header {
        margin: 2rem 0;
        padding: 0 1rem;
    }

    .header-container {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center;
        gap: 10px;
    }

    /* Title first, full width */
    .title-container {
        order: 1 !important;
        width: 100%;
        text-align: center;
    }

    .title-container h1 {
        font-size: 1rem;
        margin: 0;
    }

    .title-container .subtitle {
        font-size: 0.75rem;
        margin-top: 0.2rem;
    }

    /* Logos after title */
    .header-container > a {
        order: 2 !important;
    }

    .logo-stack {
        order: 2 !important;
        gap: 5px;
    }

    .logo-left, .logo-right {
        max-width: 40px;
        max-height: 40px;
    }
}

/* Landscape orientation - larger screens */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
    header {
        margin: 1rem 0;
    }

    .title-container h1 {
        font-size: 1.8rem;
    }

    .title-container .subtitle {
        font-size: 1.2rem;
    }

    .logo-left, .logo-right {
        max-width: 80px;
        max-height: 80px;
    }
}

/* Collapsible Reference Charts */
.reference-chart-collapsible {

    border-radius: 4px;
    margin-bottom: calc(10px * var(--spacing-multiplier));
    overflow: hidden;
}

.reference-chart-header {
    background: linear-gradient(180deg, #34495e 0%, #2c3e50 100%);
    color: white;
    padding: calc(8px * var(--spacing-multiplier)) calc(12px * var(--spacing-multiplier));
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 0.95em;
    user-select: none;
}

.reference-chart-header:hover {
    background: linear-gradient(180deg, #3d566e 0%, #34495e 100%);
}

.reference-chart-header:active {
    background: linear-gradient(180deg, #2c3e50 0%, #1a252f 100%);
}

.reference-chart-toggle {
    font-size: 1.2em;
    transition: transform 0.3s ease;
}

.reference-chart-toggle.collapsed {
    transform: rotate(-90deg);
}

.reference-chart-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: white;
}

.reference-chart-content.expanded {
    max-height: 800px;
    padding: calc(8px * var(--spacing-multiplier));
}

/* Hide collapsible on desktop, show on mobile */
@media (min-width: 769px) {
    .reference-chart-collapsible .reference-chart-header {
        display: none;
    }

    .reference-chart-collapsible .reference-chart-content {
        max-height: none !important;
        overflow: visible !important;
        padding: 0 !important;
    }
}

/* Combat Reference Charts - Responsive sizing */
.reference-chart-table {
    font-size: 0.75em !important;
}

.reference-chart-table th,
.reference-chart-table td {
    padding: calc(0px * var(--spacing-multiplier)) !important;
}

@media (max-width: 1200px) {
    .reference-chart-table {
        font-size: 0.7em !important;
    }

    .reference-chart-table th,
    .reference-chart-table td {
        padding: calc(3px * var(--spacing-multiplier)) !important;
    }
}

@media (max-width: 1024px) {
    .reference-chart-table {
        font-size: 0.65em !important;
    }

    .reference-chart-table th,
    .reference-chart-table td {
        padding: calc(0px * var(--spacing-multiplier)) !important;
    }
}

@media (max-width: 900px) {
    .reference-chart-table {
        font-size: 0.6em !important;
    }

    .reference-chart-table th,
    .reference-chart-table td {
        padding: 0px !important;
    }
}

@media (max-width: 768px) {
    .reference-chart-table {
        font-size: 0.55em !important;
    }

    .reference-chart-table th,
    .reference-chart-table td {
        padding: 0px !important;
    }
}

@media (max-width: 600px) {
    .reference-chart-table {
        font-size: 0.5em !important;
    }

    .reference-chart-table th,
    .reference-chart-table td {
        padding: 0px !important;
    }
}

@media (max-width: 480px) {
    .reference-chart-table {
        font-size: 0.45em !important;
    }

    .reference-chart-table th,
    .reference-chart-table td {
        padding: 0px !important;
    }
}

@media (max-width: 380px) {
    .reference-chart-table {
        font-size: 0.4em !important;
    }

    .reference-chart-table th,
    .reference-chart-table td {
        padding: 0px !important;
    }
}

/* Loading Screen Styles */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #434343 0%, #666666 50%, #8a8a8a 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease-out;
    overflow: hidden;
}

#loading-screen.fade-out {
    opacity: 0;
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    min-width: 300px;
}

.loading-title {
    color: #ffffff;
    font-family: Georgia, 'Times New Roman', serif;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
    margin: 0 0 20px 0;
    font-size: 2.5rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    line-height: 1.2;
}

.loading-images-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.loading-image {
    width: 200px;
    height: 200px;
    object-fit: contain;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3));
}
@media (max-width: 870px) {
    .loading-image {
        width: 150px;
        height: 150px;
        object-fit: contain;
    }

    .loading-title {
        font-size: 2rem;
    }

    .loading-container {
        padding: 30px;
    }
}
@media (max-width: 650px) {
    .loading-image {
        width: 100px;
        height: 100px;
        object-fit: contain;
    }

    .loading-title {
        font-size: 1.5rem;
        letter-spacing: 1px;
    }

    .loading-container {
        padding: 20px;
    }
}
@media (max-width: 500px) {
    .loading-image {
        width: 85px;
        height: 85px;
        object-fit: contain;
    }

    .loading-title {
        font-size: 1.2rem;
    }

    .loading-container {
        padding: 15px;
        gap: 15px;
    }
}
@media (max-width: 400px) {
    .loading-image {
        width: 75px;
        height: 75px;
        object-fit: contain;
    }

    .loading-title {
        font-size: 1rem;
    }

    .loading-container {
        padding: 12px;
        gap: 12px;
    }

    .loading-text {
        font-size: 14px;
    }
}
.loading-bar {
    width: 300px;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    overflow: hidden;
    margin: 20px auto;
}

.loading-bar-progress {
    width: 0%;
    height: 100%;
    background-color: #ffffff;
    animation: loading-progress 2s ease-in-out infinite;
}

@keyframes loading-progress {
    0% {
        width: 0%;
    }
    50% {
        width: 70%;
    }
    100% {
        width: 100%;
    }
}

.loading-text {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 18px;
    color: #ffffff;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    font-weight: 500;
    letter-spacing: 0.5px;
    line-height: 1.5;
}

/* Misc Dice Roller Styles */
.misc-dice-roller {
    background-color: #8A8A8A;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    min-width: 180px;
}

.misc-dice-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

.misc-dice-display {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    min-height: 70px;
}

.misc-roll-button {
    padding: 8px 20px;
    background-color: #00698f;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1em;
    transition: background-color 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.misc-roll-button:hover {
    background-color: #00a0d9;
}



@media (max-width: 768px) {
    .misc-dice-roller {
        position: relative;
        top: 0;
        left: 0;
        margin: 10px auto;
        max-width: 200px;
    }
}