/* SoberLife III - Responsive Styles */
/* Mobile and tablet optimizations */

/* Mobile-first responsive design */
@media (max-width: 767px) {
    body {
        align-items: flex-start;
        padding: 2px;
        min-height: 100vh;
        /* Fallback for browsers without dvh support */
        min-height: 100dvh;
        -webkit-overflow-scrolling: touch;
    }

    .game-container {
        border-radius: 8px;
        padding: 4px;
        width: 98%;
        max-height: 100vh;
        /* Fallback for browsers without dvh support */
        max-height: 100dvh;
        overflow-y: auto;
        box-sizing: border-box;
        margin: 0;
        /* Ensure container uses available space efficiently */
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        min-height: -webkit-fill-available;
        /* Optimize for no-scroll experience */
        overflow-y: hidden;
    }

    /* Game Header Mobile Styles */
    .game-header {
        position: relative;
        margin-bottom: 1px;
        /* Add padding to avoid overlap with floating help button */
        padding-right: 40px;
        padding-top: 2px;
        padding-bottom: 2px;
    }

    .game-header h1 {
        font-size: 16px;
        margin: 0;
        text-align: center;
    }

    .help-btn {
        padding: 4px 8px;
        font-size: 10px;
        min-height: 28px;
        border-radius: 20px;
        /* Make it more compact */
        flex-shrink: 0;
        gap: 4px;
        /* Alternative: position absolute for minimal space usage */
        position: absolute;
        top: 5px;
        right: 5px;
        z-index: 100;
        /* Remove from normal flow to save space */
        margin: 0;
    }

    .help-icon {
        width: 16px;
        height: 16px;
        font-size: 12px;
    }

    .help-text {
        font-size: 10px;
        /* Hide text on very small screens to save space */
        display: none;
    }

    .avatar-container {
        margin-bottom: 2px;
        flex-wrap: nowrap;
        gap: 4px;
        align-items: center;
        padding: 4px 0;
        flex-shrink: 0;
    }

    .avatar {
        width: 40px;
        height: 40px;
        font-size: 20px;
        margin-right: 6px;
        border: 2px solid #333;
    }

    .stress-meter {
        width: 120px;
        height: 16px;
    }

    .zen-points {
        font-size: 14px;
        margin: 2px 0;
        font-weight: bold;
    }

    .task-info {
        padding: 12px 10px;
        margin: 2px 0;
        border-radius: 12px;
        /* Ensure task remains prominent on mobile */
        box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
        border: 2px solid #FF4757;
        /* Enhanced mobile visibility */
        position: relative;
        /* Ensure task info is always visible above other content */
        z-index: 20;
        /* Reduce animation on mobile for better readability */
        animation: mobilePulse 4s ease-in-out infinite;
        /* Ensure full width usage */
        width: calc(100% - 4px);
        box-sizing: border-box;
        /* Ensure text doesn't overflow */
        overflow: visible;
        word-wrap: break-word;
        flex-shrink: 0;
        min-height: 80px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .task-info h3 {
        font-size: 16px;
        margin-bottom: 6px;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
        line-height: 1.2;
        /* Ensure text fits */
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .task-info p {
        font-size: 14px;
        margin: 4px 0;
        font-weight: 600;
        line-height: 1.3;
        /* Ensure text fits */
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .task-info #taskDescription {
        font-size: 15px;
        padding: 8px;
        margin: 6px 0;
        min-height: 40px;
        /* Ensure text is fully visible */
        line-height: 1.3;
        word-wrap: break-word;
        overflow-wrap: break-word;
        /* Ensure background is readable */
        background: rgba(255, 255, 255, 0.25) !important;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .task-info .step-indicator {
        font-size: 12px;
        padding: 4px 8px;
        margin-bottom: 4px;
        /* Ensure text is readable */
        background: rgba(255, 255, 255, 0.3) !important;
        border: 1px solid rgba(255, 255, 255, 0.4) !important;
    }

    .game-area {
        padding: 12px;
        margin: 2px 0;
        border-radius: 12px;
        flex: 2;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        min-height: 200px;
    }

    .cards-container {
        margin: 12px 0;
        flex-direction: row;
        gap: 12px;
        justify-content: space-around;
        flex: 1;
        display: flex;
        align-items: center;
    }

    .player-area,
    .house-area {
        margin: 0;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .player-area h3,
    .house-area h3 {
        font-size: 18px;
        margin-bottom: 8px;
    }

    .cards {
        gap: 6px;
        margin: 8px 0;
        justify-content: center;
        min-height: 60px;
        display: flex;
        align-items: center;
    }

    .card {
        width: 45px;
        height: 60px;
        font-size: 14px;
        border-radius: 6px;
    }

    .score {
        font-size: 16px;
        margin: 8px 0;
        font-weight: bold;
    }

    .buttons {
        margin: 12px 0;
        flex-shrink: 0;
    }

    button {
        padding: 12px 20px;
        font-size: 14px;
        margin: 4px;
        min-height: 44px;
        border-radius: 20px;
    }

    .survey {
        padding: 4px;
        margin: 1px 0;
        border-radius: 6px;
    }

    .survey>p {
        font-size: 14px;
        margin: 2px 0;
        line-height: 1.3;
    }

    .survey h3 {
        font-size: 18px;
        margin-bottom: 2px;
    }

    .survey-question {
        margin: 2px 0;
    }

    .survey-question strong {
        font-size: 16px;
        display: block;
        margin-bottom: 1px;
        font-weight: bold;
    }

    .survey-question label {
        margin: 0;
        padding: 2px 0;
        font-size: 15px;
        /* Increase touch target area */
        min-height: 30px;
        display: flex;
        align-items: center;
        line-height: 1.2;
        -webkit-user-select: auto;
        user-select: auto;
    }

    .survey-question input[type="radio"] {
        margin-right: 8px;
        /* Increase radio button size for better touch interaction */
        transform: scale(1.1);
        margin-left: 2px;
        flex-shrink: 0;
    }

    .game-over-content {
        padding: 20px;
        border-radius: 15px;
        width: 95%;
        max-width: 350px;
        max-height: 90vh;
        overflow-y: auto;
        border: 3px solid #FF4757;
    }

    .game-over-avatar {
        font-size: 60px;
        margin-bottom: 15px;
    }

    .game-over h2 {
        font-size: 24px;
        margin-bottom: 12px;
    }

    .game-over-message {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .game-over-subtext {
        font-size: 12px;
        margin-bottom: 15px;
    }

    .game-over-stats {
        padding: 12px;
        margin: 15px 0;
        border-radius: 8px;
    }

    .game-over-stats p {
        font-size: 14px;
        margin: 4px 0;
    }

    #tryAgainBtn {
        font-size: 16px;
        padding: 12px 24px;
        margin-top: 15px;
        min-height: 44px;
    }

    .game-success-content {
        padding: 20px;
        border-radius: 15px;
        width: 95%;
        max-width: 350px;
        max-height: 90vh;
        overflow-y: auto;
        border: 3px solid #27AE60;
    }

    .game-success-avatar {
        font-size: 60px;
        margin-bottom: 15px;
    }

    .game-success h2 {
        font-size: 24px;
        margin-bottom: 12px;
    }

    .game-success-message {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .game-success-subtext {
        font-size: 12px;
        margin-bottom: 15px;
    }

    .game-success-stats {
        padding: 12px;
        margin: 15px 0;
        border-radius: 8px;
    }

    .game-success-stats p {
        font-size: 14px;
        margin: 4px 0;
    }

    #playAgainBtn {
        font-size: 16px;
        padding: 12px 24px;
        margin-top: 15px;
        min-height: 44px;
    }

    .zen-activities {
        padding: 12px;
        margin: 2px 0;
        border-radius: 12px;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        min-height: 120px;
    }

    .zen-activities h3 {
        font-size: 18px;
        margin-bottom: 6px;
    }

    .zen-activities p {
        font-size: 14px;
        margin-bottom: 8px;
        line-height: 1.3;
    }

    .activity-buttons {
        gap: 6px;
        justify-content: center;
        flex-wrap: wrap;
        flex: 1;
        display: flex;
        align-items: center;
    }

    .activity-btn {
        padding: 12px 8px;
        font-size: 12px;
        min-width: 100px;
        max-width: 110px;
        min-height: 50px;
        border-radius: 10px;
        line-height: 1.2;
        flex: 1;
    }

    .activity-btn small {
        font-size: 10px;
        margin-top: 3px;
    }

    /* Help Modal Mobile Styles */
    .help-modal {
        padding: 10px;
        /* Improve touch scrolling */
        -webkit-overflow-scrolling: touch;
    }

    .help-modal-content {
        border-radius: 15px;
        max-height: 95vh;
        border: 2px solid #4169E1;
        /* Ensure modal content is touch-friendly */
        touch-action: pan-y;
    }

    .help-modal-header {
        padding: 15px;
    }

    .help-modal-header h2 {
        font-size: 18px;
    }

    .help-close-btn {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }

    .help-modal-body {
        padding: 15px;
        max-height: calc(95vh - 80px);
    }

    .help-section h3 {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .help-section p,
    .help-section li {
        font-size: 14px;
        line-height: 1.5;
    }

    .help-section {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }

    /* Contextual Button Mobile Styles */
    #hitBtn,
    #standBtn {
        min-width: 130px;
        font-size: 16px;
        padding: 14px 18px;
        margin: 6px 4px;
        border-radius: 25px;
        /* Ensure buttons are touch-friendly */
        min-height: 50px;
        /* Add visual feedback for touch */
        transition: all 0.2s ease;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        font-weight: bold;
    }

    #hitBtn:active,
    #standBtn:active {
        transform: scale(0.95);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }

    /* Flavor Text Mobile Styles */
    .flavor-text {
        padding: 6px 8px;
        margin: 6px 0;
        border-radius: 4px;
    }

    .flavor-text p {
        font-size: 11px;
        line-height: 1.2;
        margin: 0;
    }

    /* Round result optimization */
    #roundResult {
        font-size: 12px;
        line-height: 1.2;
        position: relative;
    }

    #roundResult p {
        margin: 4px 0;
        font-size: 12px;
    }

    /* Popup notification styles for mobile */
    .popup-notification {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: rgba(0, 0, 0, 0.9);
        color: white;
        padding: 12px 20px;
        border-radius: 25px;
        font-size: 14px;
        font-weight: bold;
        z-index: 1000;
        animation: popupFadeInOut 2s ease-in-out;
        pointer-events: none;
        text-align: center;
        min-width: 200px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .popup-notification.zen-gain {
        background: linear-gradient(135deg, #2ECC71, #27AE60);
    }

    .popup-notification.stress-change {
        background: linear-gradient(135deg, #E74C3C, #C0392B);
    }

    .popup-notification.stress-decrease {
        background: linear-gradient(135deg, #3498DB, #2980B9);
    }

    @keyframes popupFadeInOut {
        0% {
            opacity: 0;
            transform: translate(-50%, -50%) scale(0.8);
        }

        20%,
        80% {
            opacity: 1;
            transform: translate(-50%, -50%) scale(1);
        }

        100% {
            opacity: 0;
            transform: translate(-50%, -50%) scale(0.8);
        }
    }

    /* Mobile-specific animations */
    @keyframes mobilePulse {

        0%,
        100% {
            box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
        }

        50% {
            box-shadow: 0 12px 25px rgba(255, 107, 107, 0.6);
        }
    }

    /* Ensure touch targets meet accessibility guidelines */
    button,
    .activity-btn,
    input[type="radio"] {
        min-height: 44px;
    }

    /* Optimize for mobile performance */
    * {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }

    input[type="radio"],
    label {
        -webkit-user-select: auto;
        user-select: auto;
    }

    /* Prevent zoom on input focus */
    input,
    button,
    select,
    textarea {
        font-size: 16px;
    }

    /* Optimize for single-screen experience - remove wasted whitespace */
    .game-container>* {
        flex-shrink: 0;
    }

    /* Ensure game content fits in viewport without wasted space */
    .game-container {
        height: 100vh;
        height: 100dvh;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        gap: 4px;
        padding: 6px;
    }

    /* Make game area and zen activities compact */
    .zen-activities,
    .game-area {
        flex: 0 0 auto;
    }
}

/* Viewport unit fallbacks for older browsers */
@supports not (height: 100dvh) {
    @media (max-width: 767px) {
        body {
            min-height: 100vh;
        }

        .game-container {
            max-height: 100vh;
        }
    }
}

/* Tablet-specific optimizations */
@media (min-width: 768px) and (max-width: 1023px) {
    body {
        padding: 10px;
        overflow: hidden;
    }

    .game-container {
        max-width: 600px;
        width: 95%;
        padding: 15px;
        max-height: calc(100vh - 20px);
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .game-header {
        flex-shrink: 0;
        margin-bottom: 8px;
    }

    .game-header h1 {
        font-size: 20px;
        margin: 0;
    }

    .help-btn {
        padding: 6px 12px;
        font-size: 12px;
        min-height: 32px;
    }

    .avatar-container {
        flex-shrink: 0;
        margin-bottom: 8px;
        gap: 10px;
    }

    .avatar {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }

    .stress-meter {
        width: 160px;
        height: 16px;
    }

    .zen-points {
        font-size: 16px;
    }

    .survey {
        flex-shrink: 0;
        padding: 12px;
        margin: 8px 0;
        border-radius: 12px;
    }

    .survey h3 {
        font-size: 18px;
        margin-bottom: 8px;
    }

    .survey-question strong {
        font-size: 15px;
        margin-bottom: 6px;
    }

    .survey-question label {
        font-size: 14px;
        margin: 3px 0;
        min-height: 32px;
    }

    .task-info {
        flex-shrink: 0;
        padding: 15px;
        margin: 8px 0;
        border-radius: 15px;
        background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
        color: white;
        border: 2px solid #FF4757;
        box-shadow: 0 8px 20px rgba(255, 107, 107, 0.3);
        text-align: center;
        position: relative;
    }

    .task-info h3 {
        font-size: 18px;
        margin-bottom: 8px;
        color: white;
        font-weight: bold;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    }

    .task-info p {
        font-size: 15px;
        margin: 6px 0;
        color: white;
        font-weight: 600;
        line-height: 1.3;
    }

    .task-info #taskDescription {
        font-size: 16px;
        padding: 10px;
        margin: 8px 0;
        min-height: 40px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 10px;
        border: 1px solid rgba(255, 255, 255, 0.3);
        color: white;
        font-weight: bold;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .task-info .step-indicator {
        font-size: 12px;
        padding: 4px 8px;
        margin-bottom: 6px;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 15px;
        border: 1px solid rgba(255, 255, 255, 0.4);
        color: white;
        font-weight: bold;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        display: inline-block;
    }

    .zen-activities {
        flex-shrink: 0;
        padding: 12px;
        margin: 8px 0;
        border-radius: 12px;
    }

    .zen-activities h3 {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .zen-activities p {
        font-size: 13px;
        margin-bottom: 8px;
        line-height: 1.3;
    }

    .activity-buttons {
        gap: 8px;
        justify-content: center;
        flex-wrap: wrap;
    }

    .activity-btn {
        padding: 10px 8px;
        font-size: 11px;
        min-width: 90px;
        max-width: 120px;
        min-height: 45px;
        border-radius: 8px;
        line-height: 1.2;
        flex: 0 1 auto;
    }

    .activity-btn small {
        font-size: 9px;
        margin-top: 2px;
    }

    .game-area {
        flex: 1;
        padding: 12px;
        margin: 8px 0;
        border-radius: 12px;
        display: flex;
        flex-direction: column;
        min-height: 200px;
    }

    .game-area h3 {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .cards-container {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: space-around;
        margin: 10px 0;
        gap: 15px;
    }

    .player-area,
    .house-area {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .cards {
        gap: 4px;
        margin: 6px 0;
        justify-content: center;
        min-height: 50px;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
    }

    .card {
        width: 40px;
        height: 55px;
        font-size: 12px;
        border-radius: 4px;
        margin: 1px;
    }

    .score {
        font-size: 14px;
        margin: 6px 0;
        font-weight: bold;
    }

    .buttons {
        flex-shrink: 0;
        margin: 10px 0;
    }

    button {
        padding: 10px 16px;
        font-size: 14px;
        margin: 3px;
        min-height: 40px;
        border-radius: 20px;
    }

    #roundResult {
        flex-shrink: 0;
        margin: 8px 0;
        font-size: 13px;
        padding: 8px;
    }

    .flavor-text {
        padding: 6px 8px;
        margin: 6px 0;
        border-radius: 6px;
    }

    .flavor-text p {
        font-size: 12px;
        line-height: 1.2;
        margin: 0;
    }

    /* Game Over and Success Modals */
    .game-over,
    .game-success {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(0, 0, 0, 0.8);
        z-index: 1000;
    }

    .game-over-content,
    .game-success-content {
        padding: 20px;
        border-radius: 15px;
        width: 90%;
        max-width: 400px;
        max-height: 80vh;
        overflow-y: auto;
    }

    .game-over-avatar,
    .game-success-avatar {
        font-size: 50px;
        margin-bottom: 12px;
    }

    .game-over h2,
    .game-success h2 {
        font-size: 22px;
        margin-bottom: 10px;
    }

    .game-over-message,
    .game-success-message {
        font-size: 15px;
        margin-bottom: 8px;
    }

    .game-over-subtext,
    .game-success-subtext {
        font-size: 12px;
        margin-bottom: 12px;
    }

    .game-over-stats,
    .game-success-stats {
        padding: 10px;
        margin: 12px 0;
        border-radius: 8px;
    }

    .game-over-stats p,
    .game-success-stats p {
        font-size: 13px;
        margin: 3px 0;
    }

    #tryAgainBtn,
    #playAgainBtn {
        font-size: 15px;
        padding: 12px 20px;
        margin-top: 12px;
        min-height: 40px;
    }

    /* Help Modal */
    .help-modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(0, 0, 0, 0.8);
        z-index: 1001;
        padding: 10px;
    }

    .help-modal-content {
        border-radius: 12px;
        max-height: 90vh;
        max-width: 500px;
        width: 95%;
        overflow-y: auto;
        border: 2px solid #4169E1;
    }

    .help-modal-header {
        padding: 12px;
    }

    .help-modal-header h2 {
        font-size: 18px;
    }

    .help-close-btn {
        width: 30px;
        height: 30px;
        font-size: 18px;
    }

    .help-modal-body {
        padding: 12px;
        max-height: calc(90vh - 60px);
    }

    .help-section h3 {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .help-section p,
    .help-section li {
        font-size: 13px;
        line-height: 1.4;
    }

    .help-section {
        margin-bottom: 15px;
        padding-bottom: 12px;
    }

    /* Popup notification styles for tablet */
    .popup-notification {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: rgba(0, 0, 0, 0.9);
        color: white;
        padding: 12px 18px;
        border-radius: 20px;
        font-size: 14px;
        font-weight: bold;
        z-index: 1000;
        animation: popupFadeInOut 2s ease-in-out;
        pointer-events: none;
        text-align: center;
        min-width: 160px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .popup-notification.zen-gain {
        background: linear-gradient(135deg, #2ECC71, #27AE60);
    }

    .popup-notification.stress-change {
        background: linear-gradient(135deg, #E74C3C, #C0392B);
    }

    .popup-notification.stress-decrease {
        background: linear-gradient(135deg, #3498DB, #2980B9);
    }

    /* Stress Management Tip Tablet Styles */
    .stress-tip {
        position: fixed;
        top: 15px;
        right: 15px;
        max-width: 250px;
        width: auto;
        font-size: 12px;
        padding: 8px 12px;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        z-index: 1001;
        line-height: 1.3;
        background: linear-gradient(135deg, #E3F2FD, #BBDEFB);
        border: 2px solid #2196F3;
        color: #0D47A1;
    }

    .stress-tip strong {
        font-size: 13px;
        margin-bottom: 4px;
        display: block;
        color: #0D47A1;
    }
}



/* Desktop optimizations - ensure no vertical scrolling */
@media (min-width: 1024px) {
    body {
        height: 100vh;
        overflow: hidden;
        padding: 8px;
    }

    /* Popup notification styles for desktop */
    .popup-notification {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: rgba(0, 0, 0, 0.9);
        color: white;
        padding: 15px 25px;
        border-radius: 25px;
        font-size: 16px;
        font-weight: bold;
        z-index: 1000;
        animation: popupFadeInOut 2s ease-in-out;
        pointer-events: none;
        text-align: center;
        min-width: 200px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .popup-notification.zen-gain {
        background: linear-gradient(135deg, #2ECC71, #27AE60);
    }

    .popup-notification.stress-change {
        background: linear-gradient(135deg, #E74C3C, #C0392B);
    }

    .popup-notification.stress-decrease {
        background: linear-gradient(135deg, #3498DB, #2980B9);
    }

    @keyframes popupFadeInOut {
        0% {
            opacity: 0;
            transform: translate(-50%, -50%) scale(0.8);
        }

        20%,
        80% {
            opacity: 1;
            transform: translate(-50%, -50%) scale(1);
        }

        100% {
            opacity: 0;
            transform: translate(-50%, -50%) scale(0.8);
        }
    }

    /* Stress Management Tip Desktop Styles */
    .stress-tip {
        position: fixed !important;
        top: 20px !important;
        right: 20px !important;
        max-width: 300px !important;
        width: auto !important;
        font-size: 14px !important;
        padding: 12px 16px !important;
        border-radius: 8px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
        z-index: 1001 !important;
        line-height: 1.4 !important;
        background: linear-gradient(135deg, #E3F2FD, #BBDEFB) !important;
        border: 2px solid #2196F3 !important;
        color: #0D47A1 !important;
    }

    .stress-tip strong {
        font-size: 15px !important;
        margin-bottom: 6px !important;
        display: block;
        color: #0D47A1 !important;
    }

    .game-container {
        max-width: 800px;
        max-height: calc(100vh - 16px);
        height: calc(100vh - 16px);
        padding: 12px;
        overflow-y: hidden;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }

    /* Compact spacing for desktop to fit everything */
    .game-header {
        margin-bottom: 6px;
        flex-shrink: 0;
    }

    .game-header h1 {
        font-size: 24px;
        margin: 5px 0;
    }

    .avatar-container {
        margin-bottom: 6px;
        flex-shrink: 0;
    }

    .avatar {
        width: 80px;
        height: 80px;
        font-size: 32px;
        margin-right: 15px;
    }

    .stress-meter {
        width: 180px;
        height: 18px;
    }

    .zen-points {
        font-size: 20px;
        margin: 5px 0;
    }

    .survey {
        margin: 6px 0;
        padding: 12px;
        flex-shrink: 0;
    }

    .survey h3 {
        font-size: 20px;
        margin-bottom: 10px;
    }

    .survey-question {
        margin: 6px 0;
    }

    .survey-question strong {
        font-size: 16px;
        margin-bottom: 4px;
    }

    .survey-question label {
        font-size: 14px;
        margin: 2px 0;
    }

    .task-info {
        margin: 6px 0;
        padding: 15px;
        flex-shrink: 0;
        /* Ensure task info displays properly on desktop */
        background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%) !important;
        color: white !important;
        border: 3px solid #FF4757 !important;
        border-radius: 20px !important;
        box-shadow: 0 12px 30px rgba(255, 107, 107, 0.4) !important;
        text-align: center !important;
        position: relative !important;
        overflow: hidden !important;
        z-index: 10 !important;
    }

    .task-info h3 {
        font-size: 22px;
        margin-bottom: 8px;
        color: white !important;
        font-weight: bold !important;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3) !important;
        letter-spacing: 1px !important;
    }

    .task-info p {
        font-size: 16px;
        margin: 8px 0;
        color: white !important;
        font-weight: 600 !important;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2) !important;
        line-height: 1.4 !important;
    }

    .task-info #taskDescription {
        font-size: 18px;
        padding: 10px;
        margin: 10px 0;
        min-height: 40px;
        background: rgba(255, 255, 255, 0.2) !important;
        border-radius: 12px !important;
        border: 2px solid rgba(255, 255, 255, 0.3) !important;
        color: white !important;
        font-weight: bold !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .task-info .step-indicator {
        font-size: 14px;
        padding: 6px 12px;
        margin-bottom: 8px;
        background: rgba(255, 255, 255, 0.3) !important;
        border-radius: 20px !important;
        border: 2px solid rgba(255, 255, 255, 0.4) !important;
        color: white !important;
        font-weight: bold !important;
        text-transform: uppercase !important;
        letter-spacing: 1px !important;
        display: inline-block !important;
    }

    /* Ensure the animated border works on desktop */
    .task-info::before {
        content: '';
        position: absolute;
        top: -2px;
        left: -2px;
        right: -2px;
        bottom: -2px;
        background: linear-gradient(45deg, #FF6B6B, #FF8E53, #FF6B6B, #FF8E53);
        background-size: 400% 400%;
        border-radius: 22px;
        z-index: -1;
        animation: borderGlow 3s ease-in-out infinite;
    }

    .zen-activities {
        margin: 6px 0;
        padding: 12px;
        flex-shrink: 0;
    }

    .zen-activities h3 {
        font-size: 18px;
        margin-bottom: 8px;
    }

    .zen-activities p {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .activity-btn {
        padding: 12px 8px;
        font-size: 13px;
        min-width: 110px;
        max-width: 140px;
    }

    .activity-btn small {
        font-size: 11px;
        margin-top: 4px;
    }

    .game-area {
        margin: 6px 0;
        padding: 12px;
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .game-area h3 {
        font-size: 18px;
        margin-bottom: 8px;
    }

    .cards-container {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: space-around;
        margin: 8px 0;
        min-height: 120px;
    }

    .card {
        width: 55px;
        height: 75px;
        font-size: 16px;
    }

    .score {
        font-size: 18px;
        margin: 8px 0;
    }

    .buttons {
        margin: 8px 0;
        flex-shrink: 0;
    }

    button {
        padding: 10px 20px;
        font-size: 15px;
        margin: 4px;
    }

    #roundResult {
        flex-shrink: 0;
        margin: 6px 0;
        font-size: 14px;
    }

    /* Ensure modals work properly on desktop */
    .game-over,
    .game-success {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(0, 0, 0, 0.8);
        z-index: 1000;
    }

    .game-over-content,
    .game-success-content {
        max-height: 80vh;
        overflow-y: auto;
        padding: 30px;
    }

    .game-over-avatar,
    .game-success-avatar {
        font-size: 60px;
        margin-bottom: 15px;
    }

    .game-over h2,
    .game-success h2 {
        font-size: 28px;
        margin-bottom: 12px;
    }

    .help-modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(0, 0, 0, 0.8);
        z-index: 1001;
    }

    .help-modal-content {
        max-height: 90vh;
        max-width: 600px;
        width: 90%;
        overflow-y: auto;
    }

    .help-modal-header {
        padding: 15px;
    }

    .help-modal-header h2 {
        font-size: 20px;
    }

    .help-modal-body {
        padding: 15px;
        max-height: calc(90vh - 80px);
    }

    .help-section h3 {
        font-size: 18px;
        margin-bottom: 10px;
    }

    .help-section p,
    .help-section li {
        font-size: 14px;
        line-height: 1.5;
    }

    .help-section {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }
}

/* Landscape mobile optimizations */
@media (max-width: 767px) and (orientation: landscape) {
    .game-container {
        max-height: 100vh;
        overflow-y: auto;
    }

    .avatar-container {
        margin-bottom: 5px;
    }

    .survey,
    .zen-activities,
    .game-area {
        margin: 5px 0;
        padding: 6px;
    }

    /* Keep task-info prominent even in landscape */
    .task-info {
        margin: 6px 0;
        padding: 10px 8px;
        box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
        /* Maintain prominence in landscape */
        position: relative;
        z-index: 20;
        /* Reduce animation frequency in landscape for better UX */
        animation: mobilePulse 5s ease-in-out infinite;
        /* Ensure full width and readability */
        width: calc(100% - 2px);
        box-sizing: border-box;
    }

    .task-info h3 {
        font-size: 14px;
        margin-bottom: 4px;
        line-height: 1.2;
    }

    .task-info #taskDescription {
        font-size: 13px;
        padding: 6px;
        margin: 6px 0;
        line-height: 1.2;
        background: rgba(255, 255, 255, 0.25) !important;
    }

    .survey-question {
        margin: 4px 0;
    }

    .survey-question label {
        min-height: 32px;
        padding: 4px 0;
    }
}

/* Ultra-compact mobile survey for very small screens */
@media (max-width: 767px) and (max-height: 600px) {
    .game-container h1 {
        font-size: 18px;
        margin: 3px 0;
    }

    .avatar-container {
        margin-bottom: 5px;
    }

    .avatar {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .survey {
        padding: 6px;
        margin: 3px 0;
    }

    .survey h3 {
        font-size: 14px;
        margin-bottom: 3px;
    }

    .survey>p {
        font-size: 11px;
        margin: 3px 0;
    }

    .survey-question {
        margin: 5px 0;
    }

    .survey-question strong {
        font-size: 12px;
        margin-bottom: 2px;
    }

    .survey-question label {
        min-height: 32px;
        padding: 3px 0;
        font-size: 11px;
        margin: 2px 0;
    }

    /* Ultra-compact help button for very small screens */
    .help-btn {
        padding: 2px 4px;
        font-size: 8px;
        min-height: 20px;
        border-radius: 12px;
        /* Make it just a small circle with ? */
        width: 24px;
        height: 24px;
        top: 3px;
        right: 3px;
    }

    .help-icon {
        width: 12px;
        height: 12px;
        font-size: 9px;
    }

    /* Reduce header padding for very small screens */
    .game-header {
        padding-right: 30px;
    }

    /* Ensure task info remains prominent even on very small screens */
    .task-info {
        padding: 15px 10px;
        margin: 15px 0;
        /* Stronger prominence on small screens */
        box-shadow: 0 10px 25px rgba(255, 107, 107, 0.5);
        border: 3px solid #FF4757;
    }

    .task-info h3 {
        font-size: 16px;
    }

    .task-info #taskDescription {
        font-size: 15px;
        padding: 10px;
    }
}

/* Mobil
e styles for new messaging components */
@media (max-width: 767px) {

    /* Stress Management Tip Mobile Styles */
    .stress-tip {
        position: fixed !important;
        top: 10px !important;
        right: 10px !important;
        left: 10px !important;
        max-width: none !important;
        width: calc(100% - 20px) !important;
        font-size: 11px !important;
        padding: 8px 12px !important;
        border-radius: 6px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
        z-index: 1001 !important;
        line-height: 1.3 !important;
        /* Ensure text wraps properly */
        word-wrap: break-word;
        overflow-wrap: break-word;
        /* Prevent text overflow */
        max-height: 80px;
        overflow-y: auto;
    }

    .stress-tip strong {
        font-size: 12px !important;
        margin-bottom: 4px !important;
        display: block;
    }

    /* Progressive Flavor Text Mobile Styles */
    .progressive-flavor {
        margin: 4px 0 !important;
        padding: 0 !important;
    }

    .progressive-flavor p {
        font-size: 11px !important;
        line-height: 1.3 !important;
        margin: 4px 0 !important;
        padding: 6px 8px !important;
        background: linear-gradient(135deg, #f8f9fa, #e9ecef) !important;
        border-left: 2px solid #6c757d !important;
        border-radius: 3px !important;
        /* Ensure text wraps properly */
        word-wrap: break-word;
        overflow-wrap: break-word;
        /* Prevent overflow */
        max-width: 100%;
        box-sizing: border-box;
    }

    /* DMV Outcome Message Mobile Styles */
    .outcome-message.dmv-themed {
        margin: 6px 0 !important;
        padding: 0 !important;
    }

    .outcome-message.dmv-themed>div {
        padding: 8px 10px !important;
        margin: 4px 0 !important;
        border-radius: 6px !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
        /* Ensure proper text wrapping */
        word-wrap: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
        box-sizing: border-box;
    }

    .outcome-message.dmv-themed p:first-child {
        font-size: 12px !important;
        font-weight: bold !important;
        margin: 0 0 6px 0 !important;
        line-height: 1.3 !important;
        /* Ensure text fits */
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .outcome-message.dmv-themed p:last-child {
        font-size: 10px !important;
        margin: 0 !important;
        line-height: 1.3 !important;
        font-style: italic;
        /* Ensure text fits */
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Round Result Container Mobile Optimization */
    #roundResult {
        font-size: 11px !important;
        line-height: 1.2 !important;
        margin: 6px 0 !important;
        padding: 4px !important;
        /* Ensure content doesn't overflow */
        max-width: 100%;
        box-sizing: border-box;
        overflow: visible;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    #roundResult p {
        margin: 3px 0 !important;
        font-size: 11px !important;
        line-height: 1.3 !important;
        /* Ensure text wraps properly */
        word-wrap: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
    }

    /* Game Area Mobile Optimization for New Messages */
    .game-area {
        /* Ensure game area can accommodate new messaging */
        min-height: 220px !important;
        padding: 8px !important;
        /* Allow content to flow properly */
        overflow: visible;
    }

    /* Buttons Container Mobile Optimization */
    .buttons {
        margin: 8px 0 !important;
        /* Ensure buttons don't get cut off */
        flex-shrink: 0;
        padding: 4px 0;
    }

    /* Contextual Button Mobile Enhancements */
    #hitBtn,
    #standBtn {
        font-size: 14px !important;
        padding: 12px 16px !important;
        margin: 4px 2px !important;
        min-width: 120px !important;
        min-height: 48px !important;
        /* Ensure button text wraps if needed */
        word-wrap: break-word;
        overflow-wrap: break-word;
        text-align: center;
        line-height: 1.2;
    }

    /* Next Step Button Mobile Optimization */
    #nextStepBtn {
        font-size: 14px !important;
        padding: 12px 20px !important;
        margin: 8px auto !important;
        min-height: 48px !important;
        display: block;
        width: fit-content;
        max-width: 200px;
    }

    /* Ensure all new messaging components respect mobile viewport */
    .flavor-text,
    .outcome-message,
    .stress-tip,
    .progressive-flavor {
        /* Prevent horizontal overflow */
        max-width: 100vw;
        box-sizing: border-box;
        /* Ensure proper text rendering */
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Ultra-small screen optimizations for new messaging */
@media (max-width: 767px) and (max-height: 600px) {
    .stress-tip {
        font-size: 10px !important;
        padding: 6px 8px !important;
        max-height: 60px !important;
        top: 5px !important;
        right: 5px !important;
        left: 5px !important;
    }

    .stress-tip strong {
        font-size: 10px !important;
        margin-bottom: 2px !important;
    }

    .progressive-flavor p {
        font-size: 10px !important;
        padding: 4px 6px !important;
    }

    .outcome-message.dmv-themed p:first-child {
        font-size: 11px !important;
    }

    .outcome-message.dmv-themed p:last-child {
        font-size: 9px !important;
    }

    #roundResult {
        font-size: 10px !important;
    }

    #roundResult p {
        font-size: 10px !important;
        margin: 2px 0 !important;
    }
}

/* Landscape mobile optimizations for new messaging */
@media (max-width: 767px) and (orientation: landscape) {
    .stress-tip {
        top: 5px !important;
        right: 5px !important;
        left: auto !important;
        width: 250px !important;
        max-width: 40vw !important;
        font-size: 10px !important;
        padding: 6px 8px !important;
        max-height: 70px !important;
    }

    .progressive-flavor p {
        font-size: 10px !important;
        padding: 4px 6px !important;
        line-height: 1.2 !important;
    }

    .outcome-message.dmv-themed p:first-child {
        font-size: 11px !important;
        line-height: 1.2 !important;
    }

    .outcome-message.dmv-themed p:last-child {
        font-size: 9px !important;
        line-height: 1.2 !important;
    }

    #roundResult {
        font-size: 10px !important;
        margin: 4px 0 !important;
    }
}

/* Ensure new messaging animations work well on mobile */
@media (max-width: 767px) {
    @keyframes fadeInSlide {
        from {
            opacity: 0;
            transform: translateY(5px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @keyframes slideInRight {
        from {
            opacity: 0;
            transform: translateX(20px);
        }

        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    /* Reduce animation duration on mobile for better performance */
    .progressive-flavor,
    .outcome-message.dmv-themed,
    .stress-tip {
        animation-duration: 0.2s !important;
    }
}

/* Keyframe
me animations for tablet and all viewports */
@keyframes popupFadeInOut {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }

    20%,
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

@keyframes taskHighlight {
    0% {
        box-shadow: 0 8px 20px rgba(255, 107, 107, 0.3);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 12px 25px rgba(255, 107, 107, 0.5);
        transform: scale(1.02);
    }

    100% {
        box-shadow: 0 8px 20px rgba(255, 107, 107, 0.3);
        transform: scale(1);
    }
}

@keyframes borderGlow {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

@keyframes taskPulse {

    0%,
    100% {
        background: rgba(255, 255, 255, 0.2);
    }

    50% {
        background: rgba(255, 255, 255, 0.3);
    }
}