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

body {
    font-family: 'Courier New', monospace;
    overflow-y: hidden;
    height: 100vh;
    height: calc(var(--vh, 1vh)*100);
    -webkit-user-select: none;
    user-select: none;
}

html {
    height: 100vh;
    height: calc(var(--vh, 1vh)*100);
    overflow: hidden;
}

/*pop up*/
.popup-overlay {
    position: fixed;
    inset: 0;
    display: none;
    /* JS setzt auf flex */
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .6);
    z-index: 3500;
}

.popup-card {
    width: min(92vw, 520px);
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    position: relative;
    box-shadow: 0 15px 40px rgba(0, 0, 0, .35);
}

.popup-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
}

.popup-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
    gap: 12px;
}


.beach-container {
    position: relative;
    width: 150vw;
    height: 100vh;
    height: calc(var(--vh, 1vh)*100);
    overflow-y: hidden;
    overflow-x: auto;
    background-image: url('img/strand.png');
    background-size: cover;
    background-position: bottom;
    background-repeat: no-repeat;
    image-rendering: pixelated;

    /*Fallback color*/
    background-color: #87CEEB;
}

/* Strand Szene */
.beach-scene {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 100%;
}

/* Große Flaschenpost aus Bild */
.giant-bottle {
    position: absolute;
    right: 5%;
    bottom: 5%;
    width: 135px;
    height: 200px;
    cursor: pointer;
    transition: all 0.3s ease;
    image-rendering: pixelated;
    background-image: url('img/flaschenpost.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    animation: pulse 1.7s infinite;
}

.giant-bottle:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* UI Elemente */
.ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1000;
}

.gallery-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    background: linear-gradient(145deg, #FF6347, #FF4500);
    color: white;
    border: 3px solid #CD5C5C;
    border-radius: 15px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    pointer-events: all;
    box-shadow:
        0 5px 15px rgba(0, 0, 0, 0.3),
        inset 0 2px rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.gallery-btn:hover {
    transform: translateY(-3px);
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.4),
        inset 0 2px rgba(255, 255, 255, 0.3);
    background: linear-gradient(145deg, #FF7F50, #FF6347);
}

.gallery-btn:active {
    transform: translateY(-1px);
    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.3),
        inset 0 2px rgba(255, 255, 255, 0.2);
}

.scroll-hint {
    position: absolute;
    bottom: 30px;
    left: 15%;
    z-index: 1100;
    transform: translateX(-50%);
    color: #654321;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 1px 1px rgba(255, 255, 255, 0.7);
    animation: pulse 2s infinite;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 20px;
    border: 2px solid #8B4513;
}

@keyframes pulse {

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

    50% {
        opacity: 1;
        transform: translateX(-50%) scale(1.2);
    }
}

/* Modal für Flaschenpost */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.message-paper {
    width: 90%;
    max-width: 450px;
    height: 550px;
    background: linear-gradient(135deg, #F5E6D3, #FFF8DC);
    border: 4px solid #8B4513;
    border-radius: 15px;
    padding: 35px;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.5),
        inset 0 2px rgba(255, 255, 255, 0.3);
    position: relative;
    animation: paperSlideIn 0.4s ease;
}

@keyframes paperSlideIn {
    from {
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }

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

.paper-decoration {
    position: absolute;
    top: -8px;
    left: 30px;
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, #CD853F, #8B4513);
    border-radius: 50%;
    box-shadow:
        0 3px 8px rgba(0, 0, 0, 0.3),
        inset 0 2px rgba(255, 255, 255, 0.2);
}

.paper-decoration::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 15px;
    height: 15px;
    background: #654321;
    border-radius: 50%;
}

.paper-title {
    font-size: 22px;
    text-align: center;
    margin-bottom: 25px;
    color: #8B4513;
    text-decoration: underline;
    text-decoration-color: #CD853F;
    text-shadow: 1px 1px rgba(255, 255, 255, 0.5);
}

.name-input {
    width: 100%;
    padding: 15px;
    margin-bottom: 20px;
    border: 3px solid #8B4513;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    background: linear-gradient(135deg, #FFF8DC, #F5F5DC);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.name-input:focus {
    outline: none;
    border-color: #CD853F;
    box-shadow:
        inset 0 2px 5px rgba(0, 0, 0, 0.1),
        0 0 10px rgba(205, 133, 63, 0.3);
    transform: translateY(-2px);
}

.message-textarea {
    width: 100%;
    height: 220px;
    padding: 20px;
    border: 3px solid #8B4513;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    resize: none;
    background: linear-gradient(135deg, #FFF8DC, #F5F5DC);
    line-height: 1.6;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.message-textarea:focus {
    outline: none;
    border-color: #CD853F;
    box-shadow:
        inset 0 2px 5px rgba(0, 0, 0, 0.1),
        0 0 10px rgba(205, 133, 63, 0.3);
    transform: translateY(-2px);
}

.button-container {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    justify-content: space-between;
}

.btn {
    padding: 15px 25px;
    border: 3px solid;
    border-radius: 12px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-send {
    background: linear-gradient(145deg, #32CD32, #228B22);
    color: white;
    border-color: #228B22;
    box-shadow:
        0 5px 15px rgba(0, 0, 0, 0.3),
        inset 0 2px rgba(255, 255, 255, 0.2);
    flex: 1;
}

.btn-send:hover {
    transform: translateY(-3px);
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.4),
        inset 0 2px rgba(255, 255, 255, 0.3);
    background: linear-gradient(145deg, #3CB371, #32CD32);
}

.btn-cancel {
    background: linear-gradient(145deg, #FF6347, #CD5C5C);
    color: white;
    border-color: #CD5C5C;
    box-shadow:
        0 5px 15px rgba(0, 0, 0, 0.3),
        inset 0 2px rgba(255, 255, 255, 0.2);
}

.btn-cancel:hover {
    transform: translateY(-3px);
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.4),
        inset 0 2px rgba(255, 255, 255, 0.3);
    background: linear-gradient(145deg, #FF7F50, #FF6347);
}

.btn:active {
    transform: translateY(-1px);
}

/* Gallery Modal */
.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    animation: modalFadeIn 0.3s ease;
}

.gallery-content {
    width: 90%;
    max-width: 550px;
    height: 80%;
    background: linear-gradient(135deg, #F5E6D3, #FFF8DC);
    border: 4px solid #8B4513;
    border-radius: 20px;
    padding: 25px;
    overflow-y: auto;
    box-shadow:
        0 15px 40px rgba(0, 0, 0, 0.6),
        inset 0 2px rgba(255, 255, 255, 0.3);
    position: relative;
}

.gallery-title {
    font-size: 24px;
    text-align: left;
    margin-bottom: 25px;
    color: #8B4513;
    text-shadow: 1px 1px rgba(255, 255, 255, 0.5);
    border-bottom: 3px solid #CD853F;
    padding-bottom: 10px;
}

.close-gallery {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #8B4513;
    font-weight: bold;
    transition: all 0.3s ease;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.close-gallery:hover {
    background: rgba(255, 100, 71, 0.2);
    transform: scale(1.1);
    color: #CD5C5C;
}

.message-bottle {
    background: linear-gradient(145deg, #90EE90, #98FB98);
    border: 4px solid #228B22;
    border-radius: 20px;
    padding: 20px;
    margin: 15px 0;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow:
        0 5px 15px rgba(0, 0, 0, 0.2),
        inset 0 2px rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.message-bottle::before {
    content: '';
    position: absolute;
    top: 10px;
    right: 15px;
    width: 24px;
    height: 24px;
    background:
        repeating-linear-gradient(0deg,
            #4CAF50 0px,
            #4CAF50 4px,
            #66BB6A 4px,
            #66BB6A 8px);
    border: 2px solid #2E7D32;
    border-radius: 0 0 8px 8px;
    opacity: 0.7;
}

.message-bottle:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow:
        0 10px 25px rgba(0, 0, 0, 0.3),
        inset 0 2px rgba(255, 255, 255, 0.4);
    background: linear-gradient(145deg, #98FB98, #ADFF2F);
}

.bottle-preview {
    font-weight: bold;
    color: #006400;
    margin-bottom: 8px;
    font-size: 16px;
    text-shadow: 1px 1px rgba(255, 255, 255, 0.5);
}

.bottle-content {
    display: none;
    margin-top: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #FFF8DC, #F5F5DC);
    border-radius: 10px;
    border: 3px solid #8B4513;
    box-shadow: inset 0 2px rgba(0, 0, 0, 0.1);
    animation: contentSlideDown 0.3s ease;
    max-height: none;
}


@keyframes contentSlideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding: 0 15px;
    }

    to {
        opacity: 1;
        max-height: 2000px;
        padding: 15px;
    }
}

.bottle-content strong {
    color: #8B4513;
    text-decoration: underline;
}

.bottle-content hr {
    margin: 15px 0;
    border: none;
    height: 2px;
    background: linear-gradient(to right, transparent, #8B4513, transparent);
}

.bottle-content small {
    color: #666;
    font-style: italic;
}

/* Scrollbar Styling */
.gallery-content::-webkit-scrollbar {
    width: 10px;
}

.gallery-content::-webkit-scrollbar-track {
    background: rgba(139, 69, 19, 0.1);
    border-radius: 10px;
}

.gallery-content::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #CD853F, #8B4513);
    border-radius: 10px;
    box-shadow: inset 0 2px rgba(255, 255, 255, 0.2);
}

.gallery-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #DEB887, #CD853F);
}

/* Responsive Design */
.mobile-arrow {
    position: absolute;
    bottom: 20px;
    left: 25%;
    transform: translateX(-50%);
    padding: 12px 20px;
    background: linear-gradient(145deg, #FF6347, #FF4500);
    color: white;
    border: 3px solid #CD5C5C;
    border-radius: 25px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    pointer-events: all;
    display: none;
    /* Standardmäßig versteckt */
    box-shadow:
        0 5px 15px rgba(0, 0, 0, 0.3),
        inset 0 2px rgba(255, 255, 255, 0.2);
    animation: arrowPulse 1.5s infinite;
    z-index: 1001;
    white-space: nowrap;
}

@keyframes arrowPulse {
    0% {
        transform: translateX(-50%) scale(1);
        box-shadow:
            0 5px 15px rgba(0, 0, 0, 0.3),
            0 0 0 0 rgba(255, 99, 71, 0.4);
    }

    50% {
        transform: translateX(-50%) scale(1.1);
        box-shadow:
            0 8px 20px rgba(0, 0, 0, 0.4),
            0 0 0 10px rgba(255, 99, 71, 0.1);
    }

    100% {
        transform: translateX(-50%) scale(1);
        box-shadow:
            0 5px 15px rgba(0, 0, 0, 0.3),
            0 0 0 20px rgba(255, 99, 71, 0);
    }
}

.mobile-arrow:active {
    transform: translateX(-50%) scale(0.95);
}

@media (max-width: 768px) {
    .mobile-arrow {
        display: flex;
    }

    .scroll-hint {
        display: none;
    }
}

@media (max-width: 480px) {
    .beach-container {
        width: 210vw;
    }

    .message-paper {
        width: 95%;
        height: 500px;
        padding: 25px;
    }

    .message-textarea {
        height: 180px;
        font-size: 16px;
    }

    .name-input {
        font-size: 16px;
    }

    .giant-bottle {
        position: absolute;
        right: 4%;
        bottom: 20px;
        width: 80px;
        height: 120px;
    }

    .gallery-btn {
        padding: 12px 18px;
        font-size: 12px;
        top: 15px;
        right: 15px;
    }

    .scroll-hint {
        font-size: 14px;
        padding: 8px 15px;
        left: 20px;
        right: 20px;
        transform: none;
        text-align: center;
        bottom: 20px;
    }
}

@media (max-width: 320px) {
    .beach-container {
        width: 170vw;
    }

    .giant-bottle {
        position: absolute;
        right: 3%;
        bottom: 20px;
        width: 64px;
        height: 96px;
    }

    .message-paper {
        padding: 20px;
        height: 480px;
    }

    .message-textarea {
        height: 160px;
    }

    .gallery-btn {
        padding: 10px 15px;
        font-size: 11px;
        top: 10px;
        right: 10px;
    }
}

/* Touch-spezifische Verbesserungen */
@media (hover: none) and (pointer: coarse) {

    .giant-bottle:hover,
    .gallery-btn:hover,
    .btn:hover {
        transform: none;
    }

    .giant-bottle:active {
        transform: scale(1.05);
    }

    .gallery-btn:active {
        transform: translateY(-2px);
    }

    .btn:active {
        transform: translateY(-2px);
    }
}

.install-btn {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 12px 20px;
    background: linear-gradient(145deg, #32CD32, #228B22);
    color: white;
    border: 3px solid #228B22;
    border-radius: 25px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 12px;
    cursor: pointer;
    pointer-events: all;
    z-index: 1001;
    box-shadow:
        0 5px 15px rgba(0, 0, 0, 0.3),
        inset 0 2px rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    animation: installPulse 2s infinite;
    display: none;
}

.install-btn:hover {
    transform: translateY(-3px);
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.4),
        inset 0 2px rgba(255, 255, 255, 0.3);
    background: linear-gradient(145deg, #3CB371, #32CD32);
}

.install-btn:active {
    transform: translateY(-1px);
    animation: none;
}

@keyframes installPulse {

    0%,
    100% {
        box-shadow:
            0 5px 15px rgba(0, 0, 0, 0.3),
            0 0 0 0 rgba(50, 205, 50, 0.4);
    }

    50% {
        box-shadow:
            0 8px 20px rgba(0, 0, 0, 0.4),
            0 0 0 10px rgba(50, 205, 50, 0.1);
    }
}

/* PWA Modus spezifische Styles */
.pwa-mode {
    /* Verhindere Zooming in PWA */
    touch-action: manipulation;
}

.pwa-mode .ui-overlay {
    /* Berücksichtige iPhone Notch */
    padding-top: env(safe-area-inset-top, 0);
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
}

.pwa-mode .gallery-btn,
.pwa-mode .install-btn {
    top: calc(20px + env(safe-area-inset-top, 0));
}

/* Splash Screen Styles (iOS) */
@media (display-mode: standalone) {
    body {
        -webkit-user-select: none;
        -ms-user-select: none;
        user-select: none;

        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
    }

    /* Entferne Scroll-Bounce auf iOS */
    body,
    html {
        overscroll-behavior: none;
    }

    /* Status Bar für PWA */
    .beach-container::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: env(safe-area-inset-top, 0);
        background: #87CEEB;
        z-index: 9999;
    }
}

@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes bottleBob {

    0%,
    100% {
        transform: translateY(0px) rotate(-5deg);
    }

    50% {
        transform: translateY(-20px) rotate(5deg);
    }
}

@keyframes textFade {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* Responsive Anpassungen für PWA */
@media (max-width: 480px) {
    .install-btn {
        right: 15px;
        top: calc(70px + env(safe-area-inset-top, 0));
        padding: 10px 16px;
        font-size: 11px;
    }

    .pwa-mode .scroll-hint {
        bottom: calc(20px + env(safe-area-inset-bottom, 0));
    }
}