.exhaustion-badge {
    color: #f97316;
    background: rgba(249, 115, 22, 0.15);
    padding: 4px 12px;
    border: 1px solid rgba(249, 115, 22, 0.3);
    white-space: nowrap;
}

/* Action Reset */

.stat-box-compact {
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 0.65rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
    width: 100%;
}

.stat-box-compact:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: color-mix(in srgb, var(--accent-primary) 70%, transparent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.stat-box-compact i {
    width: 12px;
    height: 12px;
    opacity: 0.8;
}

.stat-box-compact .value {
    font-family: var(--font-primary);
    font-size: 0.9rem;
    line-height: 1;
}

.stat-box-compact .mod {
    font-size: 0.5rem;
    color: var(--accent-primary);
    font-weight: 700;
}

.mobile-sheet-container {
    width: 100%;
    min-height: 100vh;
}

.stat-roll-result {
    font-family: var(--font-primary);
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--accent-primary);
    text-shadow: 0 0 10px var(--accent-glow);
    animation: statRollIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.stat-rolling {
    pointer-events: none;
}

#test-tabs-card.tabs-card {
    padding: 0.5rem 0.75rem;
    border-radius: 18px;
    border: 1.5px solid color-mix(in srgb, var(--accent-primary) 70%, transparent);
    background: linear-gradient(135deg, rgba(24, 23, 28, 0.5) 0%, rgba(12, 11, 14, 0.5) 100%);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.tabs-card.gm-mode-active {
    cursor: default;
    user-select: text;
}

.tabs-card .test-tab-pane {
    min-height: auto;
}

#char-form textarea:focus,
#char-form select:focus,
#char-form .clickable-input:focus,
#char-form textarea:hover,
#char-form select:hover,
#char-form .clickable-input:hover {
    outline: none;
    border-color: color-mix(in srgb, var(--accent-primary) 70%, transparent);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 15px var(--accent-glow);
}

#char-form input:read-only:not(.clickable-input):hover,
#char-form input:read-only:not(.clickable-input):focus {
    border-color: rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.2);
    box-shadow: none;
}

#mobile-sheet-view {
    padding-top: calc(70px + env(safe-area-inset-top, 0px));
    max-width: 800px;
    margin: 0 auto;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
}

body.on-test-page .stats-card,
body.on-test-page .tabs-card {
    padding-top: 1rem;
    padding-bottom: 1.25rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

body.on-test-page .tabs-card .tab-nav {
    justify-content: flex-start;
    gap: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
    margin: 0 0 0.75rem;
    width: 100%;
    scroll-snap-type: x mandatory;
}

.conditions-panel,
.languages-panel,
.actions-panel {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    margin-top: 1.5rem;
}

.conditions-wrapper.expanded {
    max-height: 2000px;
    opacity: 1;
    padding-bottom: 1rem;
}



.conditions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem 1.5rem;
}

.languages-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
}

.condition-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    user-select: none;
    padding: 0.3rem 0.5rem;
    background: rgba(10, 10, 15, 0.4);
    border: 1px solid transparent;
    border-radius: 12px;
}

.condition-item:hover {
    color: var(--text-primary);
}

.language-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    user-select: none;
    padding: 0.3rem 0.5rem;
    background: rgba(10, 10, 15, 0.4);
    border: 1px solid transparent;
    border-radius: 12px;
    flex: 1 1 calc(33.333% - 1rem);
    min-width: 160px;
}

.language-item:hover {
    color: var(--text-primary);
}

.language-item:has(input:checked) {
    background: rgba(139, 92, 246, 0.12);
    border-color: rgba(139, 92, 246, 0.3);
    color: var(--text-primary);
}

.condition-item:has(input:checked) {
    background: rgba(139, 92, 246, 0.12);
    border-color: rgba(139, 92, 246, 0.3);
    color: var(--text-primary);
}

.circle-toggle {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.condition-item input:checked+.circle-toggle {
    background: var(--accent-primary);
    border-color: color-mix(in srgb, var(--accent-primary) 70%, transparent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.exhaustion-dots {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    padding: 1rem 0 0.5rem 0;
}

.exhaustion-toggle {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.exhaustion-toggle i {
    width: 20px;
    height: 20px;
    color: rgba(255, 255, 255, 0.15);
    transition: color 0.2s ease, transform 0.2s ease;
}

.exhaustion-toggle:hover i {
    color: rgba(255, 255, 255, 0.4);
}

.exhaustion-dots .exhaustion-toggle:has(input:checked) {
    color: var(--color-danger);
    filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.6));
}

.exhaustion-dots .exhaustion-toggle:has(input:checked) i {
    color: var(--color-danger);
    transform: scale(1.15);
}

.condition-item input {
    display: none;
}

.rest-toast {
    position: absolute;
    background: rgba(239, 68, 68, 0.95);
    color: #EAE6DF;
    padding: 0.5rem 0.85rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: var(--z-toast);
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: toastPop 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}


body.on-test-page:not(.tour-active) .mobile-sheet-container {
    padding-top: 5.5rem;
    min-height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
}

#test-tabs-card {
    height: calc(100vh - 15rem);
    display: flex;
    flex-direction: column;
    margin-bottom: 0.5rem;
}

#test-tabs-card .tab-nav {
    flex-shrink: 0;
    padding-top: 0.35rem;
    margin-bottom: 0.5rem;
    overflow: visible;
}

#test-tabs-card .tab-pane {
    height: auto;
}



.action-item,
.action-item * {
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

.action-item .u-text-white {
    color: #EAE6DF;
}

.action-item .u-opacity-0-5 {
    color: #A39E93;
    opacity: 1;
}

.action-item {
    padding: 0.2rem 0.25rem;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--glass-border);
    background: rgba(10, 10, 15, 0.4);
}

#test-actions-list,
#test-cond-content,
#test-restoration-grid {
    padding-left: 0.15rem;
    padding-right: 0.15rem;
}

.action-item:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

.action-item:active {}

.action-icon-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(var(--accent-rgb, 253, 230, 138), 0.1);
    border: 1px solid rgba(var(--accent-rgb, 253, 230, 138), 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-bonus {
    font-family: var(--font-secondary);
    font-size: 1rem;
    font-weight: 800;
    color: var(--accent-primary);
}

/* Action Rolling Animation */

.action-rolling {
    pointer-events: none;
}

.action-roll-result {
    font-family: var(--font-primary);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--accent-primary);
}

.confirm-bar-actions {
    display: flex;
    gap: 0.6rem;
}

#test-tabs-card .test-tab-pane {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 1rem;
}

body.on-test-page:not(.tour-active) #test-tabs-card .test-tab-pane {
    padding-bottom: 0.5rem;
}



.stat-confirm-bar {
    position: relative;
    width: calc(100% + 1.5rem);
    margin: 0 -0.75rem;
    height: 0;
    background: rgba(20, 20, 25, 0.95);
    border-top: 1px solid color-mix(in srgb, var(--accent-primary) 70%, transparent);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    z-index: var(--z-menu);
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    transform: translateY(20px);
}

.stat-confirm-bar.active {
    height: 54px;
    margin: 15px -0.75rem -5px -0.75rem;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.confirm-bar-text {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--accent-primary);
    text-transform: uppercase;
}

.confirm-btn-mini {
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 900;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
}

.confirm-btn-mini.yes {
    background: var(--accent-primary);
    color: black;
    border: none;
}

.confirm-btn-mini.no {
    background: rgba(255, 255, 255, 0.05);
    color: #EAE6DF;
    border: 1px solid rgba(255, 255, 255, 0.1);
}


.section-toggle-btn {
    background: none;
    border: none;
    color: var(--accent-primary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-smooth);
    border-radius: 4px;
}

.section-toggle-btn:hover {
    color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.05);
}


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

.modal-btn-cancel {
    padding: 0.8rem 1.5rem;
    min-width: 160px;
    background: rgba(255, 255, 255, 0.1);
    color: #EAE6DF;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn-confirm {
    padding: 0.8rem 1.5rem;
    min-width: 160px;
    color: #EAE6DF;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
}

/* ==========================================================================
   CONSOLIDATED MEDIA QUERIES
   ========================================================================== */

@media (min-width: 1025px) {
    .combat-side-grid {
        display: flex;
        flex-direction: column;
        gap: 0;
        margin-top: 0;
        align-items: center;
    }

    .combat-side-grid .damage-calc-form-group,
    .combat-side-grid .restoration-panel,
    .combat-side-grid .conditions-panel {
        width: 100%;
        margin-top: 1.5rem;
        margin-left: auto;
        margin-right: auto;
    }

    .rest-actions-grid {
        margin-left: calc(60px + 0.75rem);
    }
}

body.on-test-page:not(.tour-active) .mobile-sheet-container {
    gap: 0.75rem;
    padding-bottom: 4.5rem;
}

body.on-test-page:not(.tour-active) #test-tabs-card {
    margin-bottom: 0.25rem;
}

body.on-test-page:not(.tour-active) .tabs-card,
body.on-test-page:not(.tour-active) .stats-card {
    padding-top: 0.75rem;
    padding-bottom: 0.85rem;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
}

body.on-test-page:not(.tour-active) .actions-panel {
    margin-bottom: 0.75rem;
}

body.on-test-page:not(.tour-active) .conditions-panel,
body.on-test-page:not(.tour-active) .restoration-panel,
body.on-test-page:not(.tour-active) .languages-panel,
body.on-test-page:not(.tour-active) .damage-calculator,
body.on-test-page:not(.tour-active) .actions-panel {
    margin-top: 0.35rem;
}

body.on-test-page:not(.tour-active) .conditions-wrapper.expanded,
body.on-test-page:not(.tour-active) details[open] .restoration-content-wrapper,
body.on-test-page:not(.tour-active) .restoration-content-wrapper.expanded,
body.on-test-page:not(.tour-active) .damage-calc-content-wrapper.expanded {
    margin-top: 0.35rem;
}

body.on-test-page:not(.tour-active) .exhaustion-track {
    gap: 0.55rem;
}

body.on-test-page:not(.tour-active) .exhaustion-dots {
    gap: 0.25rem;
}

@media (max-width: 1024px) {


    .restoration-panel,
    .conditions-panel,
    .languages-panel,
    .actions-panel {
        margin-top: 0.4rem;
    }

    .damage-calc-content-wrapper.expanded,
    details[open] .restoration-content-wrapper,
    .restoration-content-wrapper.expanded,
    .conditions-wrapper.expanded {
        margin-top: 0.5rem;
    }

    .combat-side-grid .damage-calc-form-group,
    .combat-side-grid .restoration-panel,
    .combat-side-grid .conditions-panel {
        width: 94%;
        max-width: 480px;
        margin-left: auto;
        margin-right: auto;
    }

    .health-mana-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .armor-stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .physical-traits-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 1.25rem;
    }

    .full-width-span {
        grid-column: span 4;
    }
}

@media (max-width: 360px) {
    body .info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    body .info-grid .form-group {
        grid-column: span 1;
        min-width: 0;
    }

    body .info-grid .form-group label {
        white-space: normal;
        word-break: break-word;
    }

    body .info-grid .form-group.full-width {
        grid-column: span 2;
    }
}

@media (max-width: 600px) {
    .languages-grid {
        flex-direction: column;
    }

    .language-item {
        flex: 1 1 100%;
    }
}

#custom-action-cancel,
#unarmed-stat-cancel,
#custom-action-cancel:hover,
#unarmed-stat-cancel:hover {
    border-color: color-mix(in srgb, var(--accent-primary) 70%, transparent);
}

#active-conditions-badge,
.restoration-badge-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    padding: 1px 0 0 0;
    line-height: 1;
    flex-shrink: 0;
    font-family: var(--font-primary);
    font-size: 0.85rem;
    box-sizing: border-box;
    text-align: center;
    transform: translateY(1px);
}

#active-conditions-badge span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    height: 100%;
    width: 100%;
}