/* ==========================================================
   MOBILE CONTROL VITALS PANEL (Optimized for ≤768px) - DARK MODE
   ========================================================== */

/* Fix horizontal overflow due to padding */
* {
    box-sizing: border-box;
}

.resus-settings-panel {
    background: linear-gradient(145deg, #1a1a1a, #1e1e1e);
    color: #e0e0e0;
    padding: 1.5rem;
    border-radius: 14px;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    width: 92%;
    min-width: unset;
    max-width: none;
    margin: 1rem auto;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    border: 1px solid #2a2a2a;
    position: relative;
    overflow: hidden;
}

.resus-settings-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #F90618, #2E3192);
}

.resus-settings-title {
    color: #ffffff;
    margin: 0 0 1.5rem 0;
    font-size: 1.4rem;
    font-weight: 600;
    text-align: center;
    position: relative;
    padding-bottom: 0.8rem;
}

.resus-settings-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 2px;
    background: linear-gradient(90deg, #F90618, #2E3192);
    border-radius: 1px;
}

.resus-template-selector {
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    padding: 1.2rem;
    border-radius: 10px;
    border: 1px solid #333;
}

.resus-select-label {
    display: block;
    margin-bottom: 0.75rem;
    color: #e0e0e0;
    font-weight: 500;
    font-size: 1rem;
}

.resus-template-select {
    width: 100%;
    padding: 12px 40px 12px 16px;
    /* Right padding for custom arrow */
    background-color: #252525;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%232E3192' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    color: #ffffff;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    font-size: 16px;
    /* Prevents auto-zoom on iOS */
    font-weight: 400;
    transition: all 0.2s ease;
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    line-height: 1.3;
}

.resus-template-select:focus {
    outline: none;
    border-color: #2E3192;
    box-shadow: 0 0 0 2px rgba(46, 49, 146, 0.1);
    background-color: #2a2a2a;
}

@keyframes inputPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

/* Optional styling for options (limited support on mobile) */
.resus-template-select optgroup {
    background-color: #1a1a1a;
    color: #b0b0b0;
    font-weight: 600;
}

.resus-template-select option {
    background-color: #252525;
    color: #ffffff;
    padding: 10px;
}

.resus-template-select:hover {
    border-color: #4a4a4a;
}

.resus-current-values {
    margin: 1.5rem 0;
    background: rgba(255, 255, 255, 0.02);
    padding: 1.2rem;
    border-radius: 10px;
    border: 1px solid #333;
}

.resus-values-title {
    color: #ffffff;
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
    position: relative;
}

.resus-values-title::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 35px;
    height: 1px;
    background: linear-gradient(90deg, #F90618, #2E3192);
}

/* FIXED: Properly Centered Table Layout */
.resus-values-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 auto;
}

.resus-values-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin: 0 auto;
    min-width: 280px;
    table-layout: fixed;
}

.resus-table-header th {
    text-align: center;
    color: #b0b0b0;
    font-weight: 500;
    padding: 0.8rem 0.5rem;
    border-bottom: 1px solid #333;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.03);
}

.resus-table-header th:first-child {
    text-align: left;
    width: 45%;
    min-width: 120px;
}

.resus-table-header th:nth-child(2),
.resus-table-header th:nth-child(3) {
    width: 27.5%;
    min-width: 70px;
}

.resus-values-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid #2a2a2a;
    text-align: center;
    vertical-align: middle;
}

.resus-values-table tr:last-child td {
    border-bottom: none;
}

.resus-values-table td:first-child {
    color: #e0e0e0;
    font-weight: 400;
    text-align: left;
    padding-left: 0.75rem;
}

.resus-values-table td:nth-child(2) {
    color: #F90618;
    font-weight: 600;
    font-size: 0.95rem;
}

.resus-values-table td:nth-child(3) {
    color: #2E3192;
    font-weight: 600;
    font-size: 0.95rem;
}

.resus-controls {
    margin: 1.5rem 0;
    background: rgba(255, 255, 255, 0.02);
    padding: 1.2rem;
    border-radius: 10px;
    border: 1px solid #333;
}

.resus-slider-control {
    margin-bottom: 1.25rem;
    position: relative;
}

.resus-slider-control:last-child {
    margin-bottom: 0;
}

.resus-slider-control label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    color: #e0e0e0;
    font-weight: 500;
    font-size: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.resus-slider-container {
    width: 100%;
    position: relative;
    margin-bottom: 0.5rem;
}

.resus-slider {
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, #333, #444);
    outline: none;
    border-radius: 3px;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.resus-slider:hover {
    background: linear-gradient(90deg, #3a3a3a, #4a4a4a);
}

.resus-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #F90618, #2E3192);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.resus-slider::-webkit-slider-thumb:active {
    transform: scale(1.15);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.resus-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #F90618, #2E3192);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.resus-slider::-moz-range-thumb:active {
    transform: scale(1.15);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.resus-slider-value {
    display: inline-block;
    min-width: 45px;
    text-align: right;
    color: #2E3192;
    font-weight: 600;
    font-size: 0.9rem;
    background: rgba(46, 49, 146, 0.1);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    border: 1px solid rgba(46, 49, 146, 0.2);
}

.resus-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.resus-apply-btn,
.resus-reset-btn,
.resus-display-btn {
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    font-family: inherit;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.resus-apply-btn {
    background: linear-gradient(135deg, #2E3192, #25287a);
    color: white;
    box-shadow: 0 4px 12px rgba(46, 49, 146, 0.2);
}

.resus-reset-btn {
    background: linear-gradient(135deg, #F90618, #d40514);
    color: white;
    box-shadow: 0 4px 12px rgba(249, 6, 24, 0.2);
}

.resus-display-btn {
    background: linear-gradient(135deg, #0078ff, #005fcc);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 120, 255, 0.2);
}

.resus-apply-btn:active,
.resus-reset-btn:active,
.resus-display-btn:active {
    transform: translateY(-1px);
}

.resus-apply-btn:active {
    background: linear-gradient(135deg, #25287a, #1e2166);
    box-shadow: 0 6px 16px rgba(46, 49, 146, 0.3);
}

.resus-reset-btn:active {
    background: linear-gradient(135deg, #d40514, #b80412);
    box-shadow: 0 6px 16px rgba(249, 6, 24, 0.3);
}

.resus-display-btn:active {
    background: linear-gradient(135deg, #005fcc, #004799);
    box-shadow: 0 6px 16px rgba(0, 120, 255, 0.3);
}

/* ============================================
   MOBILE COMPACT AED TRAINER SECTION - DARK MODE
   ============================================ */

.compact-aed-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #333;
    border-radius: 10px;
    margin: 1.5rem 0;
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

.compact-aed-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #F90618, #2E3192);
}

.compact-aed-title {
    color: #ffffff;
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #333;
}

.compact-aed-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.aed-column {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.left-column,
.center-column,
.right-column {
    background: rgba(255, 255, 255, 0.02);
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid #333;
}

.rhythm-status-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rhythm-status-header {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #333;
}

.status-label {
    color: #b0b0b0;
    font-size: 0.8rem;
    font-weight: 500;
}

.rhythm-name {
    color: #ffffff;
    font-weight: 600;
    font-size: 0.9rem;
}

.shock-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.6rem;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.2rem;
    width: fit-content;
}

.shock-indicator.shockable {
    background: rgba(244, 67, 54, 0.15);
    color: #F44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.shock-indicator.non-shockable {
    background: rgba(76, 175, 80, 0.15);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.shockable-guide h5 {
    color: #e0e0e0;
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.rhythm-guide-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.4rem;
}

.guide-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.guide-item:active {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-1px);
}

.guide-rhythm {
    color: #ffffff;
    font-weight: 600;
    font-size: 0.8rem;
    margin-bottom: 0.2rem;
}

.guide-values {
    color: #b0b0b0;
    font-size: 0.7rem;
    margin-bottom: 0.2rem;
}

.guide-energy {
    color: #FF9800;
    font-size: 0.65rem;
    font-weight: 500;
}

.compact-aed-status {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #333;
}

.status-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-light {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4CAF50;
    box-shadow: 0 0 6px #4CAF50;
}

.status-light.analyzing {
    background: #FF9800;
    box-shadow: 0 0 6px #FF9800;
    animation: pulse 1s infinite;
}

.status-light.ready {
    background: #2196F3;
    box-shadow: 0 0 6px #2196F3;
}

.status-light.charging {
    background: #FF9800;
    box-shadow: 0 0 6px #FF9800;
    animation: pulse 0.8s infinite;
}

.status-light.charged {
    background: #FF5722;
    box-shadow: 0 0 8px #FF5722;
    animation: pulse 0.5s infinite;
}

.status-light.shocking {
    background: #F44336;
    box-shadow: 0 0 12px #F44336;
    animation: shockFlash 0.2s infinite;
}

.status-light.post-shock {
    background: #9C27B0;
    box-shadow: 0 0 6px #9C27B0;
    animation: fadePulse 1s infinite;
}

.status-value {
    color: #ffffff;
    font-weight: 600;
    font-size: 0.85rem;
}

.aed-readings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.reading-label {
    color: #b0b0b0;
    font-size: 0.7rem;
}

.reading-value {
    color: #ffffff;
    font-weight: 600;
    font-size: 0.8rem;
}

.compact-aed-controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
    margin-top: 0.4rem;
}

.aed-control-btn {
    padding: 0.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    text-align: center;
    min-height: 36px;
    color: white;
}

.aed-control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.aed-control-btn:active:not(:disabled) {
    transform: translateY(-1px);
}

.analyze-btn {
    background: linear-gradient(135deg, #2196F3, #1976D2);
}

.charge-btn {
    background: linear-gradient(135deg, #FF9800, #F57C00);
}

.shock-btn {
    background: linear-gradient(135deg, #F44336, #D32F2F);
}

.reset-btn {
    background: linear-gradient(135deg, #9E9E9E, #757575);
}

.compact-energy-control {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #333;
}

.energy-slider-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.energy-slider-container label {
    color: #b0b0b0;
    font-size: 0.75rem;
    min-width: 70px;
}

#compactEnergySlider {
    flex: 1;
    height: 4px;
    background: linear-gradient(90deg, #333, #444);
    border-radius: 2px;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

#compactEnergySlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #FF5722, #F90618);
    border-radius: 50%;
    border: 2px solid #ffffff;
    cursor: pointer;
}

.energy-value {
    color: #FF5722;
    font-weight: 600;
    font-size: 0.8rem;
    min-width: 45px;
    text-align: right;
}

/* FIXED: Properly Centered Comparison Table */
.shock-comparison h5 {
    color: #e0e0e0;
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.comparison-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 auto;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    margin: 0 auto;
    min-width: 280px;
    table-layout: fixed;
}

.comparison-table th {
    background: rgba(46, 49, 146, 0.1);
    color: #b0b0b0;
    padding: 0.6rem 0.4rem;
    text-align: center;
    font-weight: 500;
    border-bottom: 1px solid #333;
    white-space: nowrap;
}

.comparison-table th:first-child {
    text-align: left;
    width: 35%;
    min-width: 100px;
}

.comparison-table th:nth-child(2),
.comparison-table th:nth-child(3),
.comparison-table th:nth-child(4) {
    width: 21.6%;
    min-width: 60px;
}

.comparison-table td {
    padding: 0.6rem 0.4rem;
    text-align: center;
    border-bottom: 1px solid #2a2a2a;
    vertical-align: middle;
}

.comparison-table tr:last-child td {
    border-bottom: none;
}

.comparison-table td:first-child {
    text-align: left;
    color: #e0e0e0;
    font-weight: 500;
    padding-left: 0.75rem;
}

.before-value {
    color: #b0b0b0;
    font-weight: 500;
}

.after-value {
    color: #ffffff;
    font-weight: 600;
}

.change-value {
    font-weight: 600;
}

.change-value.positive {
    color: #4CAF50;
}

.change-value.negative {
    color: #F44336;
}

.change-value.neutral {
    color: #FF9800;
}

.last-shock-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    padding-top: 0.5rem;
    border-top: 1px solid #333;
    margin-top: 0.5rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    align-items: center;
    text-align: center;
}

.info-label {
    color: #b0b0b0;
    font-size: 0.65rem;
}

.info-value {
    color: #ffffff;
    font-weight: 600;
    font-size: 0.75rem;
}

.training-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem;
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 6px;
    margin-top: 0.75rem;
    color: #FF9800;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Animation Keyframes */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes shockFlash {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

@keyframes fadePulse {

    0%,
    100% {
        opacity: 0.7;
    }

    50% {
        opacity: 0.3;
    }
}

/* ==========================================================
   SMALL MOBILE OPTIMIZATIONS (≤480px)
   ========================================================== */
@media (max-width: 480px) {
    .resus-settings-panel {
        width: 90%;
        padding: 1.25rem;
        margin: 0.75rem auto;
        border-radius: 12px;
    }

    .resus-settings-title {
        font-size: 1.3rem;
        margin-bottom: 1.25rem;
        padding-bottom: 0.6rem;
    }

    .resus-template-selector,
    .resus-current-values,
    .resus-controls {
        padding: 1rem;
        margin: 1.25rem 0;
        border-radius: 8px;
    }

    .resus-select-label {
        font-size: 0.95rem;
        margin-bottom: 0.6rem;
    }

    .resus-template-select {
        padding: 0.9rem;
        font-size: 0.9rem;
    }

    .resus-values-title {
        font-size: 1rem;
        margin-bottom: 0.8rem;
    }

    .resus-values-table {
        font-size: 0.85rem;
        min-width: 260px;
    }

    .resus-table-header th {
        padding: 0.7rem 0.4rem;
        font-size: 0.8rem;
    }

    .resus-values-table td {
        padding: 0.7rem 0.4rem;
    }

    .resus-values-table td:nth-child(2),
    .resus-values-table td:nth-child(3) {
        font-size: 0.9rem;
    }

    .resus-slider-control {
        margin-bottom: 1rem;
    }

    .resus-slider-control label {
        font-size: 0.95rem;
        margin-bottom: 0.6rem;
    }

    .resus-slider-value {
        font-size: 0.85rem;
        padding: 0.25rem 0.5rem;
    }

    .resus-action-buttons {
        margin-top: 1.25rem;
        gap: 0.6rem;
    }

    .resus-apply-btn,
    .resus-reset-btn,
    .resus-display-btn {
        padding: 0.9rem 1.25rem;
        font-size: 0.9rem;
        min-height: 44px;
    }

    /* AED Mobile Optimizations */
    .compact-aed-section {
        padding: 0.75rem;
        margin: 1.25rem 0;
    }

    .compact-aed-title {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    .left-column,
    .center-column,
    .right-column {
        padding: 0.6rem;
    }

    .aed-control-btn {
        font-size: 0.7rem;
        padding: 0.4rem;
        min-height: 34px;
    }

    .comparison-table {
        font-size: 0.7rem;
        min-width: 260px;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 0.5rem 0.3rem;
    }
}

/* ==========================================================
   VERY SMALL MOBILE OPTIMIZATIONS (≤360px)
   ========================================================== */
@media (max-width: 360px) {
    .resus-settings-panel {
        width: 88%;
        padding: 1rem;
    }

    .resus-settings-title {
        font-size: 1.2rem;
    }

    .resus-template-selector,
    .resus-current-values,
    .resus-controls {
        padding: 0.8rem;
    }

    .resus-values-table {
        font-size: 0.8rem;
        min-width: 240px;
    }

    .resus-table-header th {
        font-size: 0.75rem;
        padding: 0.6rem 0.3rem;
    }

    .resus-values-table td {
        padding: 0.6rem 0.3rem;
    }

    .resus-slider-control label {
        font-size: 0.9rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }

    .resus-slider-value {
        align-self: flex-end;
    }

    .resus-apply-btn,
    .resus-reset-btn,
    .resus-display-btn {
        font-size: 0.85rem;
    }

    /* AED Very Small Mobile */
    .compact-aed-section {
        padding: 0.6rem;
    }

    .compact-aed-title {
        font-size: 0.9rem;
    }

    .rhythm-name {
        font-size: 0.8rem;
    }

    .aed-control-btn {
        font-size: 0.65rem;
        min-height: 32px;
    }

    .compact-aed-controls {
        grid-template-columns: 1fr;
    }

    .last-shock-info {
        grid-template-columns: 1fr;
    }

    .comparison-table {
        min-width: 240px;
        font-size: 0.65rem;
    }
}

/* ==========================================================
   ACCESSIBILITY & TOUCH OPTIMIZATIONS
   ========================================================== */

/* Focus states for touch devices */
.resus-template-select:focus,
.resus-slider:focus,
.resus-apply-btn:focus,
.resus-reset-btn:focus,
.resus-display-btn:focus,
.aed-control-btn:focus,
#compactEnergySlider:focus {
    outline: 2px solid #2E3192;
    outline-offset: 1px;
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {

    .resus-apply-btn:hover,
    .resus-reset-btn:hover,
    .resus-display-btn:hover,
    .resus-template-select:hover,
    .guide-item:hover,
    .aed-control-btn:hover {
        transform: none;
    }

    .resus-apply-btn:active,
    .resus-reset-btn:active,
    .resus-display-btn:active,
    .resus-template-select:active,
    .guide-item:active,
    .aed-control-btn:active:not(:disabled) {
        transform: translateY(-1px);
    }

    .resus-slider::-webkit-slider-thumb:hover,
    .resus-slider::-moz-range-thumb:hover,
    #compactEnergySlider::-webkit-slider-thumb:hover {
        transform: none;
    }

    .resus-slider::-webkit-slider-thumb:active,
    .resus-slider::-moz-range-thumb:active,
    #compactEnergySlider::-webkit-slider-thumb:active {
        transform: scale(1.15);
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {

    .resus-template-select,
    .resus-slider,
    .resus-apply-btn,
    .resus-reset-btn,
    .resus-display-btn,
    .resus-slider::-webkit-slider-thumb,
    .resus-slider::-moz-range-thumb,
    .aed-control-btn,
    .guide-item,
    .status-light {
        transition: none !important;
    }

    .resus-apply-btn:active,
    .resus-reset-btn:active,
    .resus-display-btn:active,
    .aed-control-btn:active,
    .guide-item:active {
        transform: none !important;
    }

    .status-light.analyzing,
    .status-light.charging,
    .status-light.charged,
    .status-light.shocking,
    .status-light.post-shock {
        animation: none !important;
    }
}

/* Loading states */
.resus-apply-btn:disabled,
.resus-reset-btn:disabled,
.resus-display-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Success and error message styles */
.resus-message {
    margin: 1rem 0;
    padding: 0.8rem;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    font-size: 0.9rem;
}

.resus-message.success {
    background: rgba(46, 49, 146, 0.1);
    border: 1px solid rgba(46, 49, 146, 0.3);
    color: #e0e0e0;
}

.resus-message.error {
    background: rgba(249, 6, 24, 0.1);
    border: 1px solid rgba(249, 6, 24, 0.3);
    color: #e0e0e0;
}

/* Landscape orientation support */
@media (max-width: 768px) and (orientation: landscape) {
    .resus-settings-panel {
        margin: 0.5rem auto;
        padding: 1rem;
    }

    /* Change action buttons to row layout in landscape */
    .resus-action-buttons {
        flex-direction: row;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .resus-apply-btn,
    .resus-reset-btn,
    .resus-display-btn {
        padding: 0.8rem 1rem;
        min-height: 42px;
        flex: 1 1 30%;
    }

    .resus-values-table {
        font-size: 0.8rem;
    }

    /* AED Landscape Optimizations */
    .compact-aed-container {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .aed-column {
        flex: 1 1 48%;
        min-width: 200px;
    }
}

/* Ensure proper touch targets for all interactive elements */
.resus-template-select,
.resus-slider,
.resus-apply-btn,
.resus-reset-btn,
.resus-display-btn,
.aed-control-btn {
    min-height: 44px;
}

/* Improve slider touch target */
.resus-slider-container {
    padding: 8px 0;
}

/* Table mobile optimization */
@media (max-width: 480px) {

    .resus-values-table-container,
    .comparison-table-container {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: #2E3192 #1a1a1a;
    }

    .resus-values-table-container::-webkit-scrollbar,
    .comparison-table-container::-webkit-scrollbar {
        height: 6px;
    }

    .resus-values-table-container::-webkit-scrollbar-track,
    .comparison-table-container::-webkit-scrollbar-track {
        background: #1a1a1a;
        border-radius: 3px;
    }

    .resus-values-table-container::-webkit-scrollbar-thumb,
    .comparison-table-container::-webkit-scrollbar-thumb {
        background: #2E3192;
        border-radius: 3px;
    }
}

/* Tablet optimization (481px to 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .resus-settings-panel {
        width: 94%;
        padding: 1.75rem;
    }

    .compact-aed-container {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .aed-column {
        flex: 1 1 48%;
        min-width: 200px;
    }

    .resus-values-table {
        min-width: 320px;
        font-size: 0.95rem;
    }

    .comparison-table {
        min-width: 300px;
        font-size: 0.85rem;
    }

    .resus-values-table td,
    .comparison-table td {
        padding: 0.8rem 0.5rem;
    }
}

/* Add smooth scrolling for iOS devices */
@supports (-webkit-touch-callout: none) {

    .resus-values-table-container,
    .comparison-table-container {
        -webkit-overflow-scrolling: touch;
    }
}

/* ==========================================================
   ADDITIONAL TABLE FIXES FOR PERFECT ALIGNMENT
   ========================================================== */

/* Center alignment for all table headers and data cells */
.resus-table-header th,
.resus-values-table td,
.comparison-table th,
.comparison-table td {
    vertical-align: middle;
}

/* Ensure equal width distribution for value columns */
.resus-values-table td:nth-child(2),
.resus-values-table td:nth-child(3),
.comparison-table td:nth-child(2),
.comparison-table td:nth-child(3),
.comparison-table td:nth-child(4) {
    text-align: center;
    width: 27.5%;
}

/* Perfect horizontal alignment */
.resus-values-table tr,
.comparison-table tr {
    display: table-row;
}

/* Remove any border spacing */
.resus-values-table,
.comparison-table {
    border-spacing: 0;
}

/* Mobile scrollbar styling */
.resus-values-table-container::-webkit-scrollbar-thumb:active,
.comparison-table-container::-webkit-scrollbar-thumb:active {
    background: #F90618;
}