:root {
    --bg-color: #FDFBF7;
    --text-color: #3F3331;
    --accent-color: #E2C2B9;
    --heart-color: #E78895;
    --white: #ffffff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Quicksand', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden; /* Verhindert kosmetisches Scrollen auf Handys */
    height: 100vh;
}

/* MOOD OVERLAY */
.mood-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(253, 251, 247, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.4s ease;
}

.mood-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.mood-box {
    background: var(--white);
    padding: 2rem;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    max-width: 90%;
}

.mood-box h2 {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
}

.mood-buttons {
    display: flex;
    gap: 1.2rem;
    justify-content: center;
}

.mood-btn {
    font-size: 2.5rem;
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.mood-btn:active {
    transform: scale(1.3);
}

/* MAIN CONTAINER */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 500px;
    margin: 0 auto;
    padding: 0.5rem 1rem 1rem 1rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 10%;
}

.logo {
    font-weight: 700;
    font-size: 1.1rem;
}

.action-mini-btn {
    background: none;
    border: 1px solid var(--accent-color);
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--text-color);
}

/* POLAROID STYLING */
.polaroid-section {
    height: 35%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.polaroid {
    background: var(--white);
    padding: 0.8rem 0.8rem 0.4rem 0.8rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.04);
    transform: rotate(-1.5deg);
    border-radius: 4px;
    width: 170px;
}

.polaroid-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #eee;
}

.polaroid img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Auch das Polaroid-Bild wird nicht mehr beschnitten */
    background-color: #fafafa;
}

#polaroid-text {
    font-family: 'Caveat', cursive;
    font-size: 1.1rem;
    text-align: center;
    margin-top: 0.4rem;
    white-space: nowrap;
}

/* FILTER CONTROLS */
.filter-section {
    height: 8%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.segmented-control {
    display: flex;
    background: #EFECE6;
    padding: 0.2rem;
    border-radius: 16px;
    width: 100%;
}

.segmented-control input {
    display: none;
}

.segmented-control label {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0;
    cursor: pointer;
    font-size: 1.2rem;
    border-radius: 14px;
    transition: background 0.2s;
}

.segmented-control input:checked + label {
    background: var(--white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* STREAM PICTURE */
.stream-section {
    height: 37%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.5rem 0;
}

.stream-image-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

/* ÄNDERUNG: Sorgt dafür, dass das Bild IMMER komplett sichtbar ist */
#stream-image {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Zeigt das ganze Bild ohne Abschneiden */
    background-color: #f4f1ea; /* Gibt Querformat-Bildern einen dezenten, hübschen Rahmen */
}

/* FOOTER DAUMEN ZONE */
footer {
    height: 10%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
}

.circle-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: var(--white);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    font-size: 1.2rem;
    cursor: pointer;
}

.main-payload-btn {
    flex: 1;
    height: 50px;
    border-radius: 25px;
    border: none;
    background: var(--accent-color);
    color: var(--text-color);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

/* LOADERS & TOASTS */
.loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid #eee;
    border-top: 3px solid var(--text-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.hidden { display: none !important; }

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    z-index: 2000;
}

/* TABLET & DESKTOP BREAKPOINT */
@media (min-width: 768px) {
    .app-container {
        max-width: 900px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 10% 10% 70% 10%;
        gap: 1.5rem;
        height: 90vh;
        margin: 5vh auto;
    }
    header { grid-column: 1 / span 2; height: auto; }
    .polaroid-section { grid-column: 1; grid-row: 2 / span 2; height: auto; }
    .polaroid { width: 260px; }
    .filter-section { grid-column: 2; grid-row: 2; height: auto; }
    .stream-section { grid-column: 2; grid-row: 3; height: auto; }
    footer { grid-column: 2; grid-row: 4; height: auto; }
}


/* Verhindert das unschöne Aufblitzen des Alt-Textes während des Ladens */
img:not([src]), img[src=""] {
    opacity: 0;
}