:root {
    --primary-color: #ffffff;
    --primary-color-transparent: rgba(184, 168, 205, 0.85);
    --secondary-color: rgb(0, 189, 91);
    --secondary-color-dark: rgb(0, 189, 91);
    --text-colour-one: rgb(255, 0, 234);
    --text-colour-two: rgb(0, 189, 91);
    --text-colour-three: rgb(255, 255, 255);
    /* ── User-themeable colour vars ─────────────────────── */
    --label-colour: rgb(255, 255, 255);
    --critical-colour: rgb(220, 50, 50);
    --error-colour: var(--critical-colour);
    --success-colour: rgb(0, 189, 91);
    --tracker-fill-colour: rgb(0, 153, 74);
    --level-colour: rgb(255, 0, 234);
    --title-colour: rgb(0, 0, 0);
    --button-icon-colour: rgb(255, 255, 255);
    --field-bg-colour: rgba(0, 0, 0, 0.85);
    --navbar-bg-colour: rgb(0, 0, 0);
    --navbar-border-colour: rgb(255, 255, 255);
    --navbar-text-colour: rgb(255, 255, 255);
    /* ── Layout measurements ────────────────────────────── */
    --navbar-height: 3rem;
    --character-bar-height: 2rem;
    --sub-bar-height: 1.7rem;
    --total-header-height: calc(var(--navbar-height) + var(--character-bar-height) + var(--sub-bar-height));
}

.buff-indicator {
    color: var(--text-colour-one);
    font-weight: bold;
    font-size: 1.2em;
    pointer-events: none;
    user-select: none;
}

.buff-title-indicator {
    color: var(--text-colour-one);
    font-weight: bold;
}

html {
    font-size: 17px;
    scrollbar-width: none;
}

html::-webkit-scrollbar {
    display: none;
}

body {
    background-color: var(--primary-color);
    /* background-image: linear-gradient(
        to bottom right,
        rgba(0, 0, 0, 0.28) 0%,
        rgba(0, 0, 0, 0.14) 35%,
        rgba(0, 0, 0, 0) 70%
    );
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-attachment: fixed; */
    color: var(--text-colour-three);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: calc(var(--total-header-height) + env(safe-area-inset-top));
    padding-bottom: 0;
}

body.guest-page {
    padding-top: calc(var(--navbar-height) + env(safe-area-inset-top));
}

.page-container {
    width: 100%;
    max-width: 1850px;
    margin: 0 auto;
    padding: 0 1.25rem;
    box-sizing: border-box;
}

.site-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: var(--navbar-height);
    background: var(--navbar-bg-colour);
    border-bottom: 1px solid var(--text-colour-one);
    z-index: 1000;
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top);
}

.site-navbar .page-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--navbar-height);
    max-width: none;
}

/* ── Auth empty state ───────────────────────────────────────────────────── */
.auth-empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--secondary-color-dark);
    font-size: 1.1rem;
}

.site-navbar-title {
    color: var(--navbar-text-colour);
    font-family: "Tourney", sans-serif !important;
    font-optical-sizing: auto;
    font-weight: 500;
    font-style: normal;
    font-variation-settings: "wdth" 100;
    font-size: 2rem;
    padding: 0;
    text-decoration: none;
}

.site-navbar-title-outline-word {
    text-shadow: 8px 2px 0 var(--secondary-color-dark);
}

.site-navbar-title-asterisk-word {
    text-shadow: 1px 6px 0 var(--text-colour-one);
}

.site-navbar-title:hover,
.site-navbar-title:focus-visible {
    color: var(--navbar-text-colour);
    text-decoration: none;
}

@media (max-width: 700px) {
    :root {
        --character-bar-height: 2.4rem;
        --sub-bar-height: 4rem;
    }

    .site-navbar-title {
        font-size: 1.2rem;
        max-width: 48vw;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

.sheet-page-content {
    width: 100%;
    max-width: 100%;
    flex: 1 0 auto;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

#guest-landing-panel {
    margin-bottom: 0.85rem;
}

#guest-landing-panel:empty {
    margin-bottom: 0;
}

.guest-landing-panel-card {
    width: 100%;
    max-width: 44rem;
    border: 1px solid var(--secondary-color-dark);
    background: var(--field-bg-colour);
    color: var(--text-colour-three);
    padding: 0.8rem 1rem;
    box-sizing: border-box;
}

.guest-landing-title {
    margin: 0 0 0.35rem;
    color: var(--label-colour);
    font-size: 1rem;
}

.guest-landing-text {
    margin: 0;
    font-size: 0.85rem;
}

.guest-landing-link {
    color: var(--text-colour-one);
    font-weight: 700;
    text-decoration: none;
}

.guest-landing-link:hover,
.guest-landing-link:focus-visible {
    color: var(--text-colour-one);
    text-decoration: underline;
}

.sheet-page-content form {
    width: 100%;
    max-width: 100%;
}

@media (max-width: 600px) {
    .page-container {
        padding: 0 0.75rem;
    }
}

@media (max-width: 499px) {
    .page-container {
        padding: 0;
    }
}

.sheet-layout {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 0.75rem;
    width: 100%;
}

/* Guest sheet columns should wrap naturally as width decreases. */
body.guest-page .sheet-layout {
    flex-wrap: wrap;
}

#char-group-container,
#abilities-section-container {
    flex: 0 1 auto;
    min-width: 0;
}

#feats-section-container {
    flex: 1 1 0;
    min-width: 0;
}

body.guest-page #feats-section-container {
    flex: 1 1 20rem;
}

#guest-combat-death-container {
    flex: 0 0 30rem;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

body.guest-page #guest-combat-death-container {
    flex: 1 1 30rem;
    max-width: 30rem;
}

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

.sheet-section {
    min-width: 0;
}

h4 {
    color: var(--title-colour);
}

.section-help-text {
    margin: -0.25rem 0 0.6rem;
    color: var(--title-colour);
    font-size: 0.62rem;
    line-height: 1.35;
    opacity: 0.9;
}

[data-locked='true'] .section-help-text {
    display: none;
}

.empty-state-text {
    margin: -0.25rem 0 0.6rem;
    color: var(--title-colour);
    font-size: 0.62rem;
    line-height: 1.35;
    opacity: 0.9;
}

.global-feedback {
    position: fixed;
    right: max(0.75rem, env(safe-area-inset-right));
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    z-index: 1100;
    min-height: 0;
    min-width: 0;
    width: fit-content;
    max-width: min(22rem, calc(100vw - 1.5rem));
    padding: 0.14rem 0.34rem;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    background: var(--field-bg-colour);
    color: var(--text-colour-three);
    box-shadow: 0 0 0 1px transparent;
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1.1;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.global-feedback.is-visible {
    opacity: 1;
    visibility: visible;
}

.global-feedback.is-success {
    border-color: transparent;
    box-shadow: none;
}

.global-feedback.is-error {
    border-color: transparent;
    box-shadow: none;
}

.global-feedback.is-success .global-feedback-icon {
    color: var(--success-colour);
}

.global-feedback.is-error .global-feedback-icon {
    color: var(--error-colour);
}

.global-feedback-icon {
    flex: 0 0 auto;
    font-size: 0.84rem;
    line-height: 1;
}

.global-feedback-text {
    white-space: nowrap;
    overflow-wrap: anywhere;
}

@media (max-width: 499px) {
    .global-feedback {
        right: max(0.35rem, env(safe-area-inset-right));
        bottom: max(0.35rem, env(safe-area-inset-bottom));
        max-width: calc(100vw - 0.7rem);
        font-size: 0.68rem;
        padding: 0.1rem 0.28rem;
    }

    .global-feedback-icon {
        font-size: 0.82rem;
    }
}

/* ══════════════════════════════════════════════════════════════════════════════
   Generic field primitives — shared across all sections
   ══════════════════════════════════════════════════════════════════════════════ */

.field {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

.field-input {
    width: 100%;
    box-sizing: border-box;
    background: var(--field-bg-colour);
    color: var(--text-colour-three);
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 0;
    outline: none;
    font-size: 0.8rem;
    transition: background 0.2s;
    display: block;
}

.field-label {
    background: var(--field-bg-colour);
    color: var(--label-colour);
    padding: 0;
    border: none;
    border-radius: 0;
    font-weight: bold;
    margin-bottom: 0;
    display: block;
    font-size: 0.5rem;
    width: 100%;
    box-sizing: border-box;
    transition: background 0.2s;
    line-height: 1;
    text-align: left;
    overflow-wrap: break-word;
    padding-left: 0.5rem;
    padding-top: 0.5rem;
}

.field-btn {
    cursor: pointer;
    text-align: center;
    background: var(--field-bg-colour);
    color: var(--button-icon-colour);
    border: none;
    font-size: 1.5rem;
    box-sizing: border-box;
    height: 2.65rem;
    width: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.field-input--no-spinner {
    appearance: textfield;
    -moz-appearance: textfield;
}

.field-input--no-spinner::-webkit-outer-spin-button,
.field-input--no-spinner::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.field-input--center {
    text-align: center;
    padding-left: 0;
    padding-right: 0;
}

/* ══════════════════════════════════════════════════════════════════════════════
   Responsive breakpoints
   ══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1600px) {
    .sheet-layout {
        flex-wrap: wrap;
    }

    #char-group-container,
    #abilities-section-container {
        flex: 1 1 0;
    }

    #feats-section-container {
        flex: 0 0 100%;
    }

    #guest-combat-death-container {
        flex: 0 0 100%;
    }

    /* Keep guest layout fluid instead of forcing an abrupt full-width flip. */
    body.guest-page #char-group-container,
    body.guest-page #abilities-section-container {
        flex: 0 1 auto;
    }

    body.guest-page #feats-section-container {
        flex: 1 1 20rem;
    }

    body.guest-page #guest-combat-death-container {
        flex: 1 1 30rem;
        max-width: 30rem;
    }
}

@media (max-width: 1000px) {
    #char-group-container,
    #abilities-section-container,
    #feats-section-container {
        flex: 0 0 100%;
    }

    #guest-combat-death-container {
        flex: 0 0 100%;
    }

    /* Preserve the same guest behavior through mid-range widths. */
    body.guest-page #char-group-container,
    body.guest-page #abilities-section-container {
        flex: 0 1 auto;
    }

    body.guest-page #feats-section-container {
        flex: 1 1 20rem;
    }

    body.guest-page #guest-combat-death-container {
        flex: 1 1 30rem;
        max-width: 30rem;
    }

    /* Give extra breathing room before the skills column once stacked. */
    body:not(.guest-page) #char-group-container + #abilities-section-container {
        margin-top: 0.6rem;
    }
}

@media (max-width: 768px) {
    .sheet-layout {
        column-gap: 0;
        row-gap: 0.75rem;
    }
}

@media (max-width: 700px) {
    body.guest-page #char-group-container,
    body.guest-page #abilities-section-container,
    body.guest-page #feats-section-container,
    body.guest-page #guest-combat-death-container {
        flex: 0 0 100%;
        max-width: 100%;
        width: 100%;
    }

    body.guest-page #char-group-container + #abilities-section-container {
        margin-top: 0.6rem;
    }
}


.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0 0.5rem;
    font-size: 0.78rem;
    margin-top: auto;
}

.site-footer p {
    margin: 0;
}

.site-footer-right {
    color: var(--title-colour);
}

.site-footer-right a,
.site-footer-right i,
.site-footer-right .liam-link {
    color: var(--title-colour);
    text-decoration: none;
}

.site-footer-right .liam-link {
    color: var(--text-colour-one);
}

.site-footer-right a:hover,
.site-footer-right a:focus-visible,
.site-footer-left a:hover,
.site-footer-left a:focus-visible {
    text-decoration: underline;
    opacity: 0.85;
}

.site-footer-right .liam-link:hover,
.site-footer-right .liam-link:focus-visible {
    color: var(--text-colour-one);
}

.site-footer-left a {
    color: var(--title-colour);
    text-decoration: none;
    font-weight: 600;
}

@media (max-width: 700px) {
    .site-footer {
        padding: 0 0.35rem;
        font-size: 0.72rem;
    }
}