@import url('https://fonts.googleapis.com/css2?family=Patrick+Hand&display=swap');

@font-face {
    font-family: 'BADABB__';
    src: url('BADABB__.TTF') format('truetype');
    font-weight: normal;
    font-style: normal;
}

body {
    font-family: 'BADABB__', cursive;
    background-color: #f0eadd;
    color: #3a2d21;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    flex-direction: column; /* Allow content to stack vertically */
}

#game-container {
    width: 100%;
    max-width: 800px;
    background: #fff;
    border: 4px solid #7c6c5a;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    text-align: center;
}

h1 {
    color: #4a3c30;
    margin-top: 0;
    font-size: 2.5em;
}

.subtitle {
    margin-top: -15px;
    color: #7c6c5a;
    font-size: 1.2em;
}

#anger-meter-container {
    width: 90%;
    margin: 20px auto;
    background-color: #e0d6c9;
    border-radius: 20px;
    border: 2px solid #bdae9c;
    padding: 5px;
}

#anger-meter-label {
    margin-bottom: 5px;
    font-size: 1.1em;
}

#anger-bar {
    width: 0%;
    height: 20px;
    background: linear-gradient(90deg, #ffd700, #ff8c00, #ff4500, #dc143c);
    background-size: 400%;
    border-radius: 15px;
    transition: width 0.5s ease-in-out;
}

#main-scene {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 20px;
    min-height: 350px;
    position: relative;
}

#bird-feeder-container {
    width: 140px;
    height: 300px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 5px;
    /* Move the container up slightly to prevent its base from covering buttons below */
    bottom: 30px;
}

#food-meter-label {
    font-size: 1.1em;
    color: #7c6c5a;
}

#bird-feeder-img {
    width: 100px;
    height: auto;
}

.bird {
    position: absolute;
    width: 40px;
    height: auto;
    animation: fly-in-out 5s ease-in-out forwards;
    transform: scaleX(-1); /* Face right */
    left: -50px; /* Start off-screen */
}

@keyframes fly-in-out {
    0% {
        opacity: 0;
        top: 20%;
        transform: translateX(0px) scaleX(-1);
    }
    30% {
        opacity: 1;
        top: 35%;
        transform: translateX(130px) rotate(-15deg) scaleX(-1);
    }
    70% {
        opacity: 1;
        top: 35%;
        transform: translateX(130px) rotate(15deg) scaleX(-1); /* Look around sadly */
    }
    100% {
        opacity: 0;
        top: 45%;
        transform: translateX(0px) rotate(0deg) scaleX(-1); /* Fly away sadly */
    }
}

.squirrel {
    position: absolute;
    width: 80px;
    height: auto;
    bottom: 0;
    left: -100px; /* Start off-screen left */
    animation: run-and-steal 2s ease-in-out forwards;
    z-index: 10;
}

@keyframes run-and-steal {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    25% {
        /* Run to the feeder pole */
        transform: translateX(250px);
    }
    30% {
        /* Climb up */
        transform: translateX(250px) translateY(-180px) rotate(-90deg);
    }
    60% {
        /* Stay and steal */
        transform: translateX(250px) translateY(-180px) rotate(-90deg);
    }
    70% {
        /* Climb down */
        transform: translateX(250px) translateY(0) scaleX(-1);
    }
    100% {
        /* Run away */
        transform: translateX(-100px) scaleX(-1);
        opacity: 1;
    }
}

#bob-ross-container {
    width: auto;
    height: 300px;
    display: flex;
    align-items: flex-end;
    position: relative;
    cursor: crosshair; /* Indicate it's clickable */
}

#pow-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 150px;
    height: auto;
    z-index: 15;
    pointer-events: none;
    opacity: 0;
    transition: transform 0.2s ease-out, opacity 0.2s ease-out;
}

#pow-effect.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

#bob-ross-img {
    height: 300px;
    width: auto;
    transition: transform 0.2s ease;
}

#hair-container {
    display: none;
}

#easel {
    background-image: url('easel_stand.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center bottom;
    width: 300px;
    height: 350px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 15px;
    position: relative;
}

#boxing-trophy {
    position: absolute;
    width: 80px;
    height: auto;
    bottom: 0;
    left: 20px;
    z-index: 5;
    animation: trophy-appear 0.5s ease-out;
}

@keyframes trophy-appear {
    from { transform: translateY(100px) scale(0); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.scene-button {
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'BADABB__', cursive;
    font-size: 1.1em;
    padding: 8px 15px;
    border: 2px solid #7c6c5a;
    border-radius: 8px;
    background-color: #e6dac8;
    color: #4a3c30;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.scene-button:hover {
    background-color: #d1c3b2;
    transform: translateX(-50%) translateY(-2px);
}

#canvas {
    width: 250px;
    height: 200px;
    background-image: url('canvas_background.png');
    background-size: cover;
    background-position: center;
    border: 8px solid #8b5a2b;
    border-radius: 3px;
    position: relative;
    overflow: hidden;
    background-color: #f0f0f0;
}

#broken-canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
    display: none; /* Hidden by default */
}

.paint-splat {
    position: absolute;
    width: 100px;
    height: 100px;
    pointer-events: none;
    animation: splat-anim 0.3s ease-out;
}

@keyframes splat-anim {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.thrown-painting {
    position: absolute;
    width: 250px;
    height: 200px;
    background-size: cover;
    background-position: center;
    border: 8px solid #8b5a2b;
    border-radius: 3px;
    z-index: 20;
    /* Starts near the easel */
    top: 50px; 
    right: 30px; 
    animation: throw-at-bob 1s ease-in forwards;
}

@keyframes throw-at-bob {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        /* Ends on Bob Ross */
        transform: translate(-250px, 150px) rotate(720deg) scale(0.2);
        opacity: 0;
    }
}

#dialogue-container {
    background: #fdfaf5;
    border: 2px solid #bdae9c;
    border-radius: 10px;
    padding: 15px;
    margin: 0 auto 20px auto;
    max-width: 90%;
    text-align: left;
    min-height: 60px;
}

#dialogue-text {
    margin: 0;
    font-size: 1.1em;
    color: #7c6c5a;
}

#dialogue-name {
    font-size: 1.1em;
    color: #7c6c5a;
}

#interaction-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

#permanent-actions-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap; /* Allow wrapping for more buttons */
    gap: 10px;
}

.permanent-action-btn {
    font-family: 'BADABB__', cursive;
    font-size: 1.1em;
    padding: 8px 15px;
    border: 2px solid #7c6c5a;
    border-radius: 8px;
    background-color: #e6dac8;
    color: #4a3c30;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.permanent-action-btn:hover {
    background-color: #d1c3b2;
    transform: translateY(-2px);
}

.permanent-action-btn:disabled {
    background-color: #e0e0e0;
    cursor: not-allowed;
    color: #9e9e9e;
    border-color: #c0c0c0;
}

.permanent-action-btn img {
    width: 24px;
    height: 24px;
}

#call-squirrel-btn .flash-text {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #dc143c;
    color: white;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.9em;
    white-space: nowrap;
    animation: fade-out 1s forwards;
    pointer-events: none;
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.action-buttons button {
    font-family: 'BADABB__', cursive;
    font-size: 1.1em;
    padding: 10px 20px;
    border: 2px solid #7c6c5a;
    border-radius: 8px;
    background-color: #d1c3b2;
    color: #4a3c30;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

.action-buttons button:hover {
    background-color: #bdae9c;
    transform: translateY(-2px);
}

.action-buttons button:active {
    transform: translateY(0);
}

.action-buttons p.final-rage {
    font-size: 1.5em;
    padding: 10px 20px;
}

#revive-bob-btn, #cheats-btn, #punch-bob-btn, #mega-punch-btn { /* Added mega-punch-btn */
    display: flex; /* Ensure these are flex for icon+text layout */
}

/* Modal Styles */
#painting-modal,
#repair-modal,
#fight-modal,
#tree-modal,
#hospital-modal,
#cheats-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#painting-modal.modal-hidden,
#repair-modal.modal-hidden,
#fight-modal.modal-hidden,
#tree-modal.modal-hidden,
#hospital-modal.modal-hidden,
#cheats-modal.modal-hidden {
    opacity: 0;
    visibility: hidden;
}

#painting-modal-content,
#repair-modal-content,
#fight-modal-content,
#tree-modal-content,
#hospital-modal-content,
#cheats-modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 15px;
    border: 4px solid #7c6c5a;
    width: 90%;
    max-width: 700px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

#repair-modal-content p, #tree-modal-content p {
    color: #7c6c5a;
    font-size: 1.2em;
}

/* Tree Modal styles */
#tree-modal-content {
    max-width: 450px;
}

#tree-growth-container {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

#tree-stage-img {
    height: 200px;
    width: auto;
    transition: all 0.5s ease-in-out;
}

#tree-stage-img.chopped {
    animation: shake-light 0.2s;
}

@keyframes shake-light {
    0% { transform: translate(2px, 0) rotate(0deg); }
    25% { transform: translate(-2px, 0) rotate(-1deg); }
    50% { transform: translate(2px, 0) rotate(1deg); }
    75% { transform: translate(-2px, 0) rotate(-1deg); }
    100% { transform: translate(2px, 0) rotate(0deg); }
}

.progress-bar-container {
    width: 80%;
    height: 25px;
    background-color: #e0d6c9;
    border-radius: 20px;
    border: 2px solid #bdae9c;
    padding: 3px;
    box-sizing: border-box;
}

#tree-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #87CEEB, #2E8B57); /* Sky blue to sea green */
    border-radius: 15px;
    transition: width 0.3s ease-in-out, background-color 0.3s ease;
}

#tree-actions {
    margin: 15px 0;
}

/* Fight Modal Styles */
#fight-modal-content {
    background-color: #333;
    color: #fff;
    border-color: #c00;
}

#fight-scene {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 20px 0;
}

.fighter-status {
    width: 200px;
}

.fighter-status h3 {
    margin: 0 0 10px 0;
    font-size: 1.5em;
}

.health-bar-container {
    height: 30px;
    background-color: #555;
    border: 2px solid #ccc;
    border-radius: 15px;
    padding: 3px;
    box-sizing: border-box;
}

.health-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(to right, #f00, #ff0, #0f0);
    background-size: 300%;
    background-position: 0% 50%;
    border-radius: 10px;
    transition: background-position 0.5s ease-in-out;
}

#fight-bob-container {
    position: relative;
}

#fight-bob-img {
    height: 200px;
    transition: transform 0.1s ease-in-out;
}

#fight-bob-img.hit {
    transform: scale(1.1) rotate(-5deg);
}

#fight-log {
    min-height: 40px;
    font-size: 1.2em;
    color: #ddd;
    margin-bottom: 20px;
}

#fight-action-buttons, #fight-end-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.fight-btn, #fight-continue-btn {
    font-family: 'BADABB__', cursive;
    font-size: 1.2em;
    padding: 12px 25px;
    border: 2px solid #ffc107;
    border-radius: 8px;
    background-color: #212121;
    color: #ffc107;
    cursor: pointer;
    transition: all 0.2s;
}

.fight-btn:hover, #fight-continue-btn:hover {
    background-color: #ffc107;
    color: #212121;
    transform: translateY(-2px);
}

.fight-btn:disabled {
    background-color: #424242;
    color: #757575;
    border-color: #757575;
    cursor: not-allowed;
}

#repair-modal-content p {
    color: #7c6c5a;
    font-size: 1.2em;
}

#painting-canvas-container, #repair-canvas-container {
    border: 2px dashed #bdae9c;
    margin: 15px 0;
    height: 400px;
}

/* Make repair canvas container a bit smaller for puzzle pieces */
#repair-canvas-container {
    height: 350px;
    width: 500px; /* Width of painting canvas */
    margin-left: auto;
    margin-right: auto;
    position: relative;
}

#painting-canvas, #repair-canvas {
    width: 100%;
    height: 100%;
}

#tape-container {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

#tape-btn {
    font-family: 'BADABB__', cursive;
    font-size: 1.1em;
    padding: 8px 15px;
    border: 2px solid #7c6c5a;
    border-radius: 8px;
    background-color: #e6dac8;
    color: #4a3c30;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

#tape-btn img {
    width: 24px;
    height: 24px;
}

#tape-btn:hover {
    background-color: #d1c3b2;
    transform: translateY(-2px);
}

#tape-btn:disabled {
    background-color: #e0e0e0;
    cursor: not-allowed;
    color: #9e9e9e;
    border-color: #c0c0c0;
}

#tape-count {
    font-size: 1.1em;
    color: #7c6c5a;
}

#painting-tools {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

#tool-selector {
    display: flex;
    gap: 5px;
    border: 2px solid #bdae9c;
    border-radius: 8px;
    padding: 5px;
}

.tool-btn {
    background-color: transparent;
    border: 2px solid transparent;
    border-radius: 5px;
    padding: 5px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn img {
    width: 24px;
    height: 24px;
}

.tool-btn.active-tool, .tool-btn:hover {
    background-color: #e0d6c9;
    border-color: #7c6c5a;
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-group label {
    font-size: 1.1em;
}

#color-picker {
    border: 2px solid #7c6c5a;
    border-radius: 4px;
    height: 40px;
    width: 40px;
    padding: 2px;
    cursor: pointer;
}

#image-upload {
    display: none;
}

.upload-btn, #clear-canvas-btn, #modal-action-buttons button, #add-tree-btn {
    font-family: 'BADABB__', cursive;
    font-size: 1.1em;
    padding: 10px 15px;
    border: 2px solid #7c6c5a;
    border-radius: 8px;
    background-color: #d1c3b2;
    color: #4a3c30;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

.upload-btn:hover, #clear-canvas-btn:hover, #modal-action-buttons button:hover, #add-tree-btn:hover {
    background-color: #bdae9c;
    transform: translateY(-2px);
}

#modal-action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

#finish-painting-btn {
    background-color: #a5d6a7; /* A happy green */
}

#finish-painting-btn:hover {
     background-color: #81c784;
}

#cancel-painting-btn, #cancel-repair-btn {
    background-color: #ef9a9a; /* A soft red */
}

#cancel-painting-btn:hover, #cancel-repair-btn:hover {
    background-color: #e57373;
}

.bob-shake {
    animation: shake 0.5s;
    animation-iteration-count: infinite;
}

@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.final-rage {
    color: #dc143c !important;
    font-weight: bold;
    text-transform: uppercase;
}

#food-meter-container {
    width: 20px;
    height: 80px;
    background-color: #e0d6c9;
    border: 2px solid #bdae9c;
    border-radius: 10px;
    padding: 2px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column-reverse; /* Fill from bottom up */
}

#food-bar {
    width: 100%;
    height: 100%; /* Will be controlled by JS */
    background-color: #a5692a; /* Bird seed color */
    border-radius: 6px;
    transition: height 0.5s ease-in-out;
}

/* Hospital Modal Styles */
#hospital-modal-content {
    background: #f0f8ff; /* Alice blue, a hospital-like color */
    border-color: #add8e6; /* Light blue */
    max-width: 500px;
}

#hospital-scene {
    position: relative;
    margin: 20px auto;
    width: 100%;
    max-width: 400px;
    height: 250px; /* Fixed height for consistent positioning */
}

#hospital-bob-img {
    width: 100%;
    height: auto;
    max-height: 250px; /* Ensure it doesn't overflow scene */
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

#heart-monitor-line {
    position: absolute;
    top: 50px; /* Position it above Bob's head */
    left: 20px;
    width: calc(100% - 40px);
    height: 80px; /* Height for the line drawing area */
    border: 2px solid #0056b3; /* Hospital theme border */
    background-color: #001a33; /* Dark blue background for screen */
    z-index: 10;
    border-radius: 5px;
}

#charge-meter-container {
    width: 80%;
    height: 30px;
    background-color: #555;
    border: 2px solid #ccc;
    border-radius: 15px;
    margin: 15px auto;
    position: relative;
    overflow: hidden;
}

#hospital-charge-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(to right, #ffff00, #ffa500, #ff0000); /* Yellow to orange to red */
}

#charge-target-zone {
    position: absolute;
    top: 0;
    left: 60%; /* Position the green zone */
    width: 15%; /* Width of the green zone */
    height: 100%;
    background-color: rgba(0, 255, 0, 0.4);
    border-left: 2px dashed #00ff00;
    border-right: 2px dashed #00ff00;
}

#hospital-actions {
    margin-bottom: 15px;
}

#charge-defib-btn {
    font-family: 'BADABB__', cursive;
    font-size: 1.2em;
    padding: 12px 25px;
    border: 2px solid #0056b3;
    border-radius: 8px;
    background-color: #007bff;
    color: #fff;
    cursor: pointer;
    user-select: none; /* Prevent text selection on hold */
    transition: background-color 0.2s;
}

#charge-defib-btn:hover {
    background-color: #0056b3;
}

#charge-defib-btn:active {
    background-color: #004494;
}

#hospital-log {
    min-height: 20px;
    font-size: 1.1em;
    color: #333;
}

#hospital-end-buttons {
    display: none; /* managed by JS */
    justify-content: center;
}

#close-hospital-btn {
    font-family: 'BADABB__', cursive;
    font-size: 1.1em;
    padding: 10px 15px;
    border: 2px solid #7c6c5a;
    border-radius: 8px;
    background-color: #d1c3b2;
    color: #4a3c30;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

#close-hospital-btn:hover {
     background-color: #bdae9c;
    transform: translateY(-2px);
}

/* Cheats Modal Styles */
#cheats-modal-content {
    background: #fdfaf5;
    border-color: #7c6c5a;
    max-width: 500px;
}

#cheats-buttons-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.cheat-btn {
    font-family: 'BADABB__', cursive;
    font-size: 1.1em;
    padding: 10px 15px;
    border: 2px solid #7c6c5a;
    border-radius: 8px;
    background-color: #d1c3b2;
    color: #4a3c30;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

.cheat-btn:hover {
    background-color: #bdae9c;
    transform: translateY(-2px);
}

.cheat-btn:disabled {
    background-color: #e0e0e0;
    cursor: not-allowed;
    color: #9e9e9e;
    border-color: #c0c0c0;
}

#version-display {
    margin-top: 20px;
    font-size: 0.9em;
    color: #a0a0a0;
    text-align: right;
    width: 100%;
    max-width: 800px;
}

#update-timer {
    margin-top: 10px;
    font-size: 1.1em;
    color: #4a3c30;
    text-align: center;
    width: 100%;
    max-width: 800px;
}