/* Reset i podstawowe style */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    background: radial-gradient(1200px 600px at 15% -10%, rgba(255, 182, 193, 0.18) 0%, rgba(255, 182, 193, 0) 60%),
                radial-gradient(1000px 500px at 85% 0%, rgba(168, 237, 234, 0.18) 0%, rgba(168, 237, 234, 0) 55%),
                linear-gradient(180deg, #f8fafc 0%, #ffffff 40%, #f7f7fb 100%);
    color: #2c2c2c;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    width: 100%;
    max-width: 1200px;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Główna scena */
.scene {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    position: relative;
    padding-top: calc(env(safe-area-inset-top, 0px) + clamp(28px, 6vh, 80px) + clamp(90px, 12vmin, 150px));
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(40px, 10vh, 160px));
}
/* Tło ceraty pod babcią */
.scene::after {
    content: '';
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: var(--table-top, 60vh);
    background-image: url('img/cerata.png');
    background-repeat: repeat;
    background-position: center top;
    background-size: auto 260px; /* kontrola skali kratki */
    z-index: 0;
    pointer-events: none;
}

/* Kontener babci */
.grandma-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: clamp(24px, 6vmin, 60px);
    z-index: 1;
}

.grandma {
    width: clamp(260px, 28vmin, 360px);
    height: auto;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.grandma:hover {
    transform: scale(1.02);
}

.grandma.nodding {
    animation: nod 1s ease-in-out;
}

.grandma.blinking {
    animation: blink 0.3s ease-in-out;
}

.grandma.fading {
    animation: fadeOut 2s ease-in-out forwards;
}

/* Dymek rozmowy */
.speech-bubble {
    position: absolute;
    top: calc(-1 * clamp(90px, 12vmin, 150px));
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
    padding: 20px 25px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12), 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.8);
    max-width: clamp(240px, 28vmin, 360px);
    text-align: center;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.5s ease;
    font-size: 16px;
    line-height: 1.4;
    font-weight: 400;
    backdrop-filter: blur(10px);
    visibility: hidden;
    z-index: 3;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 15px solid #f8f9fa;
}

.speech-bubble.visible {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

/* Przyciski odpowiedzi */
.buttons-container {
    display: flex;
    gap: 20px;
    margin-top: clamp(-8px, 1vmin, 20px);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    position: relative;
    z-index: 2;
}

.buttons-container.visible {
    opacity: 1;
    transform: translateY(0);
}

.response-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    font-family: 'Nunito', sans-serif;
}

.response-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.response-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.response-button:focus-visible {
    outline: 3px solid rgba(102, 126, 234, 0.55);
    outline-offset: 3px;
}

.yes-button {
    background: linear-gradient(135deg, #34d399 0%, #059669 100%);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
}

.yes-button:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

.yes-button:active {
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}

.yes-button:focus-visible {
    outline: 3px solid rgba(16, 185, 129, 0.55);
    outline-offset: 3px;
}

.no-button {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.35);
}

.no-button:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.45);
}

.no-button:active {
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.35);
}

.no-button:focus-visible {
    outline: 3px solid rgba(239, 68, 68, 0.55);
    outline-offset: 3px;
}

/* Kontener na jedzenie */
.food-container {
    position: fixed;
    bottom: -200px;
    left: 50%;
    transform: translateX(-50%);
    transition: all 0.8s ease;
    z-index: 10;
}

.food-container.visible {
    bottom: calc(32px + env(safe-area-inset-bottom, 0px));
}

.food-item {
    width: 250px;
    height: 180px;
    background: linear-gradient(145deg, #ffffff, #f5f5f5);
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    position: relative;
    overflow: hidden;
}

.food-item.has-image {
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 0;
}

.food-item:hover {
    transform: scale(1.05);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.food-item:active {
    transform: scale(0.98);
}

.food-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.8), rgba(255,255,255,0.2));
    pointer-events: none;
}

.food-item.has-image::before {
    display: none;
}

.food-name {
    font-size: 18px;
    font-weight: 600;
    color: #2c2c2c;
    text-align: center;
    z-index: 1;
    position: relative;
}

.food-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px; /* match container radius */
    box-shadow: none;
}

.food-caption {
    margin-top: 10px;
    font-size: 14px;
    color: #555;
    text-align: center;
}

/* Końcowy ekran */
.end-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 1s ease;
    z-index: 100;
}

.end-screen.visible {
    opacity: 1;
    visibility: visible;
}

.end-message {
    text-align: center;
    max-width: 500px;
    padding: 40px;
}

.end-text {
    font-size: 28px;
    font-weight: 300;
    line-height: 1.4;
    color: #2c2c2c;
    margin-bottom: 40px;
    font-style: italic;
}

.call-button {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #2c2c2c;
    border: none;
    padding: 18px 35px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(252, 182, 159, 0.3);
    margin-bottom: 30px;
    font-family: 'Nunito', sans-serif;
}

.call-button:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(252, 182, 159, 0.4);
}

.call-button.pulse {
    animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(252, 182, 159, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(252, 182, 159, 0.4);
    }
}

.final-message {
    font-size: 16px;
    color: #666;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
    font-style: italic;
}

.final-message.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Responsywność */
@media (max-width: 768px) {
    .grandma {
        width: 250px;
    }

    .speech-bubble {
        max-width: 240px;
        padding: 15px 20px;
        font-size: 14px;
    }

    .response-button {
        padding: 12px 25px;
        font-size: 14px;
    }

    .buttons-container {
        gap: 15px;
        margin-top: -12px;
    }

    .food-item {
        width: 200px;
        height: 140px;
    }

    .food-name {
    font-size: clamp(14px, 1.6vmin, 18px);
    }

    .end-text {
        font-size: 24px;
    }

    .call-button {
        padding: 15px 30px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .grandma {
        width: 200px;
    }

    .speech-bubble {
        max-width: 200px;
        padding: 12px 18px;
        font-size: 13px;
    }

    .response-button {
        padding: 10px 20px;
        font-size: 13px;
    }

    .buttons-container {
        gap: 10px;
        margin-top: -16px;
    }

    .food-item {
        width: 180px;
        height: 120px;
    }

    .food-name {
        font-size: 14px;
    }

    .end-text {
        font-size: 20px;
    }

    .call-button {
        padding: 12px 25px;
        font-size: 14px;
    }
}

/* Animacje keyframes */
@keyframes nod {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg) scale(1.02); }
    75% { transform: rotate(5deg) scale(1.02); }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

@keyframes fadeOut {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0.3; transform: scale(0.98); }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

@keyframes steam {
    0% { opacity: 0; transform: translateY(10px); }
    50% { opacity: 0.6; transform: translateY(-5px); }
    100% { opacity: 0; transform: translateY(-15px); }
}

/* Efekty dla jedzenia */
.food-item.soup .steam-effect {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 20px;
    background: linear-gradient(to top, rgba(255,255,255,0.8), transparent);
    border-radius: 50%;
    animation: steam 2s infinite ease-in-out;
}

.food-item:hover .steam-effect {
    animation-duration: 1.5s;
}

/* Ensure steam stays above the image */
.food-item .steam-effect {
    z-index: 2;
}

/* Remove inner gradient overlay for image panels */
.food-item.has-image::before {
    display: none;
}

/* Delikatne unoszenie się babci */
.grandma-container.floating .grandma {
    animation: float 3s ease-in-out infinite;
}

/* Płynniejsze przejścia */
.speech-bubble.visible {
    animation: speechBubbleAppear 0.5s ease-out;
}

@keyframes speechBubbleAppear {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Dodatkowa kompresja i preferencje ruchu */
@media (max-height: 620px) {
    .scene {
        padding-top: calc(env(safe-area-inset-top, 0px) + clamp(16px, 4vh, 48px) + clamp(80px, 12vmin, 140px));
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(24px, 6vh, 80px));
    }
    .grandma {
        width: clamp(180px, 26vmin, 320px);
    }
    .buttons-container {
        margin-top: -18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* --- Maurycy promo (sticky bottom-right) --- */
.maurycy-promo {
    position: fixed;
    right: calc(16px + env(safe-area-inset-right, 0px));
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 120;
}

.maurycy-fab {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 999px;
    width: 68px;
    height: 68px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
    backdrop-filter: none;
}

.maurycy-fab:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: none;
}

.maurycy-fab:active {
    transform: translateY(0) scale(0.98);
}

.maurycy-fab:focus-visible {
    outline: 3px solid rgba(102, 126, 234, 0.55);
    outline-offset: 3px;
}

.maurycy-icon {
    width: 40px;
    height: 40px;
    display: block;
}

.maurycy-tooltip {
    position: absolute;
    right: 0;
    bottom: 82px;
    background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(248,249,250,0.95) 100%);
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 18px 50px rgba(0,0,0,0.18), 0 8px 24px rgba(0,0,0,0.10);
    border-radius: 14px;
    padding: 14px 16px;
    min-width: 260px;
    max-width: min(86vw, 320px);
    color: #2c2c2c;
    opacity: 0;
    transform: translateY(8px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
    backdrop-filter: blur(10px);
}

.maurycy-tooltip::after {
    content: '';
    position: absolute;
    right: 18px;
    bottom: -10px;
    width: 0; height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid rgba(255,255,255,0.95);
    filter: drop-shadow(0 -1px 0 rgba(0,0,0,0.06));
}

.maurycy-tooltip[aria-hidden="false"] {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.maurycy-tooltip-content {
    display: grid;
    gap: 10px;
}

.maurycy-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.maurycy-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #2c2c2c;
    font-weight: 700;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(252, 182, 159, 0.35);
}

.maurycy-text {
    font-size: 14px;
    line-height: 1.45;
    color: #444;
}

.maurycy-link {
    display: inline-block;
    font-weight: 700;
    color: #2c2c2c;
    text-decoration: none;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    padding: 10px 12px;
    border-radius: 10px;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 6px 16px rgba(168, 237, 234, 0.3);
}

.maurycy-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(168, 237, 234, 0.4);
}

.maurycy-link:active {
    transform: translateY(0);
}

@media (max-width: 480px) {
    .maurycy-promo {
        right: calc(12px + env(safe-area-inset-right, 0px));
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
    .maurycy-fab { width: 60px; height: 60px; }
    .maurycy-icon { width: 36px; height: 36px; }
}
