* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --charity-yellow: #FFC700;
    --charity-red: #C41E3A;
    --charity-blue: #0088CC;
    --dark-text: #333;
    --light-text: #fff;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: var(--app-height, 100vh);
}

/* Logo Corners */
.logo-corners {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    z-index: 100;
    pointer-events: none;
}

.logo {
    font-size: 40px;
    opacity: 1;
    mix-blend-mode: normal;
}

img.logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    opacity: 1;
    filter: none;
    -webkit-filter: none;
    mix-blend-mode: normal;
    background: transparent;
}

/* Ensure logos on game and end screens render identically */
.game-page .logo,
.end-page .logo,
.game-page img.logo,
.end-page img.logo {
    opacity: 1 !important;
    filter: none !important;
    -webkit-filter: none !important;
    mix-blend-mode: normal !important;
    background-color: #ffffff !important;
    isolation: isolate;
}

img.logo {
    filter: none;
    -webkit-filter: none;
    image-rendering: auto;
}

/* ========== START PAGE ========== */
.start-page {
    background: linear-gradient(135deg, var(--charity-yellow) 0%, #FFD700 100%);
    min-height: var(--app-height, 100vh);
    display: flex;
    align-items: center;
    justify-content: center;
}

.start-container {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 25px;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.header {
    margin-bottom: 15px;
}

.charity-header {
    font-size: 2.5em;
    color: var(--charity-red);
    font-weight: bold;
    letter-spacing: 2px;
}

.game-title {
    font-size: 2.2em;
    color: var(--charity-blue);
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.jerry-can-image {
    width: 100%;
    max-width: 300px;
    height: auto;
    margin: 15px auto;
}

.jerry-can-image svg {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.main-image {
    width: 100%;
    height: auto;
    display: block;
}

@media (max-width: 760px) and (orientation: portrait) and (min-aspect-ratio: 23/10) {
    .start-page {
        min-height: var(--app-height, 100vh);
    }

    .jerry-can-image {
        max-width: 92%;
    }

    .main-image {
        max-height: 56vh;
    }
}

.intro-text {
    font-size: 1.1em;
    color: var(--dark-text);
    margin-bottom: 20px;
    line-height: 1.8;
}

.start-main {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ========== GAME PAGE ========== */
.game-page {
    background: var(--charity-yellow);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.game-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    height: 90vh;
    background: linear-gradient(to bottom, #FFF9E6 0%, #FFFAED 100%);
    border-radius: 20px;
    padding: 60px 20px 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.timer-section {
    text-align: center;
    margin-bottom: 20px;
}

.timer-section h2 {
    font-size: 2em;
    color: var(--charity-red);
    font-weight: bold;
}

.side-bar {
    position: absolute;
    top: 0;
    width: 40px;
    height: 100%;
    background: var(--charity-yellow);
    border-radius: 20px 0 0 20px;
    box-shadow: inset 2px 0 5px rgba(0, 0, 0, 0.1);
}

.left-bar {
    left: 0;
}

.right-bar {
    right: 0;
    border-radius: 0 20px 20px 0;
    box-shadow: inset -2px 0 5px rgba(0, 0, 0, 0.1);
}

.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    position: relative;
}

.score-display {
    font-size: 1.5em;
    color: var(--charity-blue);
    font-weight: bold;
    background: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    border-radius: 10px;
}

.score-display.pulse {
    animation: scorePulse 0.5s ease-out;
}

@keyframes scorePulse {
    0% {
        transform: scale(1);
        background: rgba(255, 199, 0, 0.8);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        background: rgba(255, 255, 255, 0.8);
    }
}

/* Water Animation */
.water-animation-container {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 300px;
    pointer-events: none;
    z-index: 10;
}

.water-drops {
    position: relative;
    width: 100%;
    height: 100%;
}

.drop {
    position: absolute;
    width: 16px;
    height: 16px;
    background: radial-gradient(circle at 35% 35%, #00D4FF, var(--charity-blue));
    border-radius: 50%;
    opacity: 0;
    box-shadow: 0 2px 8px rgba(0, 136, 204, 0.7);
    left: 50%;
    transform: translateX(-50%);
}

.drop.active {
    animation: dropInCan 0.6s ease-in-out forwards;
}

@keyframes dropInCan {
    0% {
        top: 0;
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
    100% {
        top: var(--drop-end, 280px);
        opacity: 0;
        transform: translateX(-50%) scale(0.6);
    }
}

/* Jerry Can */
.jerry-can-game {
    position: relative;
    width: 120px;
    height: 160px;
    margin: 20px 0;
}

.can-body {
    position: relative;
    width: 100%;
    height: 140px;
    background: var(--charity-yellow);
    border: 3px solid var(--dark-text);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.can-water {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(to bottom, var(--charity-blue), #006699);
    transition: height 0.9s ease;
    border-radius: 0 0 7px 7px;
}

.can-overflow {
    position: absolute;
    top: -8px;
    left: 0;
    width: 100%;
    height: 18px;
    pointer-events: none;
    opacity: 0;
}

.can-overflow::before,
.can-overflow::after {
    content: '';
    position: absolute;
    bottom: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(0, 212, 255, 0.9);
    opacity: 0;
}

.can-overflow::before {
    left: 18%;
}

.can-overflow::after {
    left: 62%;
}

.overflow-active .can-overflow {
    opacity: 1;
}

.overflow-active .can-overflow::before {
    animation: overflowDrop 1s ease-in-out infinite;
}

.overflow-active .can-overflow::after {
    animation: overflowDrop 1.1s ease-in-out infinite 0.2s;
}

@keyframes overflowDrop {
    0% {
        transform: translateY(0);
        opacity: 0.8;
    }
    30% {
        transform: translateY(-18px);
        opacity: 1;
    }
    70% {
        transform: translateY(-4px);
        opacity: 0.6;
    }
    100% {
        transform: translateY(0);
        opacity: 0;
    }
}

.can-handle {
    position: absolute;
    top: 20px;
    right: -30px;
    width: 30px;
    height: 60px;
    border: 3px solid var(--dark-text);
    border-radius: 0 15px 15px 0;
    background: transparent;
}

/* Buttons */
.btn {
    padding: 15px 40px;
    font-size: 1.1em;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-play {
    background: var(--charity-blue);
    color: white;
    margin-top: 20px;
}

.btn-play:hover {
    background: #0066aa;
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(0, 136, 204, 0.4);
}

.btn-collect {
    background: var(--charity-red);
    color: white;
    padding: 18px 50px;
    font-size: 1.3em;
}

.btn-collect:hover {
    background: #a01630;
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(196, 30, 58, 0.4);
}

.btn-collect:active {
    transform: scale(0.98);
}

/* ========== END PAGE ========== */
.end-page {
    background: linear-gradient(135deg, var(--charity-yellow) 0%, #FFD700 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.end-container {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.end-main {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-title {
    font-size: 2.2em;
    color: var(--charity-blue);
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.final-score-box {
    background: linear-gradient(135deg, var(--charity-yellow), #FFD700);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.final-score-box h3 {
    font-size: 1.3em;
    color: var(--dark-text);
    margin-bottom: 15px;
}

.final-score {
    font-size: 3em;
    font-weight: bold;
    color: var(--charity-red);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.fact-box {
    background: rgba(0, 136, 204, 0.1);
    border-left: 5px solid var(--charity-blue);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: left;
}

.fact-box h3 {
    color: var(--charity-blue);
    margin-bottom: 10px;
    font-size: 1.2em;
}

.fact-box p {
    color: var(--dark-text);
    font-size: 1em;
    line-height: 1.6;
}

.button-group {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-again {
    background: var(--charity-blue);
    color: white;
}

.btn-again:hover {
    background: #0066aa;
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(0, 136, 204, 0.4);
}

.btn-donate {
    background: var(--charity-red);
    color: white;
}

.btn-donate:hover {
    background: #a01630;
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(196, 30, 58, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    .charity-header {
        font-size: 1.8em;
    }

    .game-title {
        font-size: 1.6em;
    }

    .timer-section h2 {
        font-size: 1.5em;
    }

    .game-area {
        padding: 0 20px;
    }

    .btn {
        padding: 12px 30px;
        font-size: 1em;
    }

    .button-group {
        flex-direction: column;
        gap: 15px;
    }

    .btn-again,
    .btn-donate {
        width: 100%;
    }

    .result-title {
        font-size: 1.6em;
    }

    .final-score {
        font-size: 2.2em;
    }
}

@media (max-width: 480px) {
    .start-container,
    .end-container {
        padding: 20px;
    }

    .charity-header {
        font-size: 1.5em;
    }

    .game-title {
        font-size: 1.3em;
    }

    .intro-text {
        font-size: 0.95em;
    }

    .logo-corners {
        top: 10px;
        left: 10px;
        right: 10px;
    }
}


@media (max-width: 600px) {
    html,
    body {
        height: 100%;
        overflow: hidden;
    }

    .start-page,
    .game-page,
    .end-page {
        min-height: 100vh;
        height: 100vh;
    }

    .start-container,
    .end-container {
        max-height: calc(100vh - 18px);
        padding: 16px 14px;
        margin: 0 auto;
        overflow: hidden;
    }

    .game-page {
        padding: 6px 8px;
    }

    .game-container {
        height: calc(100vh - 16px);
        max-height: calc(100vh - 16px);
        padding: 40px 14px 14px;
    }

    .logo-corners {
        top: 8px;
        left: 8px;
        right: 8px;
    }

    .logo {
        width: 60px;
        height: 60px;
    }

    .jerry-can-image {
        max-width: 300px;
        margin: 10px auto;
        padding: 0;
        overflow: hidden;
    }

    .main-image {
        max-width: 100%;
        max-height: 48vh;
        height: auto;
        display: block;
        margin: 0 auto;
    }

    .result-title {
        font-size: 1.8em;
    }

    .final-score {
        font-size: 2.4em;
    }

    .final-score-box {
        padding: 24px;
        margin-bottom: 22px;
    }

    .fact-box {
        padding: 16px;
        margin-bottom: 20px;
    }

    .button-group {
        gap: 12px;
    }

    .btn {
        width: 100%;
        padding: 12px 0;
        font-size: 1em;
    }
}

@media (max-width: 760px) and (orientation: portrait) and (min-aspect-ratio: 23/10) {
    html,
    body {
        min-height: var(--app-height, 100vh);
    }

    .start-page,
    .game-page,
    .end-page {
        min-height: var(--app-height, 100vh);
        height: var(--app-height, 100vh);
    }

    .start-container,
    .end-container {
        max-height: calc(var(--app-height, 100vh) - 18px);
        overflow: visible;
    }

    .main-image {
        max-height: 58vh;
    }
}
