body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: 'Montserrat', sans-serif;
    background: #FFFFFF; /* White-label blending */
    color: #4A4341;
    overflow-x: hidden;
}

#app-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.screen {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: none;
    flex-direction: column;
    justify-content: flex-start; /* Zamiast center, żeby wysoki panel nie wychodził poza top */
    align-items: center;
    padding: 30px 15px 50px 15px; /* Wiekszy padding pionowy by zostawić miejsce na powered by */
    opacity: 0;
    transition: opacity 0.5s ease;
    background: #FFFFFF;
    overflow-y: auto; /* Pozwala na płynne przewijanie samej ramki */
}

.screen.active {
    display: flex;
    opacity: 1;
}

.phlov-panel {
    background: #FFFFFF;
    border: none; /* Czyste wtapianie w strone */
    border-radius: 8px; /* Lekkie, eleganckie zaokrąglenie */
    padding: 20px 10px; /* Nieco mniejszy padding żeby oszczędzic miejsce na komórce bez ciem */
    text-align: center;
    max-width: 440px;
    width: 100%;
    margin: 0 auto; /* Utrzymuje do góry (zero) ale centruje w osi poziomej */
    box-shadow: none; /* Pozbycie się shadowa do lepszego natywnego blendunku */
    box-sizing: border-box;
    animation: fadeIn 0.8s ease forwards;
}

.result-panel {
    padding: 30px 20px;
}

@keyframes fadeIn {
    0% { transform: translateY(20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.phlov-panel h1, .phlov-panel h2 {
    margin-top: 0;
    color: #393433;
    font-size: 1.7rem;
    font-weight: 500;
    line-height: 1.3;
}

.phlov-panel h3 {
    font-size: 0.85rem;
    color: #8C8481;
    letter-spacing: 1.5px;
    margin-bottom: 15px;
}

.phlov-panel p {
    color: #6C6461;
    line-height: 1.7;
    margin-bottom: 25px;
    font-size: 0.95rem;
    font-weight: 400;
}

/* Pro Tips na ekranie startowym */
.pro-tips {
    background: #FDFBF8; /* Delikatniejsza różnica od bieli */
    border: 1px dashed #E3A8A3;
    border-radius: 6px;
    padding: 18px 20px;
    margin-bottom: 25px;
    text-align: left;
}

.pro-tips h4 {
    margin: 0 0 12px 0;
    font-size: 0.85rem;
    color: #393433;
    letter-spacing: 0.5px;
}

.pro-tips ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pro-tips li {
    font-size: 0.8rem;
    color: #6C6461;
    margin-bottom: 12px; /* wiekszy odstep miely wskazowkami */
    display: flex;
    flex-direction: column; /* Opis zchodzi grzecznie pod tytuł Protipa! */
    line-height: 1.5;
    position: relative;
    padding-left: 14px;
}

.pro-tips li::before {
    content: "•";
    position: absolute;
    left: 0;
    top: -2px; /* wyrownanie do stronga */
    color: #E3A8A3;
    font-size: 1.2rem;
    font-weight: bold;
}

.pro-tips li:last-child {
    margin-bottom: 0;
}

.pro-tips strong {
    color: #4A4341;
    display: block;
    margin-bottom: 2px;
}

.btn-phlov {
    background: #E3A8A3; /* Phlov Pink/Peach */
    color: white;
    border: none;
    padding: 18px 30px;
    border-radius: 4px; /* Ostrzejsze kąty dla czystego fashion look */
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background 0.3s, transform 0.2s;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.btn-phlov:hover {
    background: #D99590;
}

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

/* Kamera */
#videoElement {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0; left: 0;
    z-index: 1;
    transform: scaleX(-1); /* Efekt lustra dla przyjemniejszego UX */
}

.camera-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(250,247,245,0.7) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Duży Owal - responsywny */
.face-guide {
    width: 320px;
    height: 480px;
    border: 2px solid rgba(227, 168, 163, 0.8);
    border-radius: 50%;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45); 
}

/* Na tabletach powiększamy */
@media (min-width: 768px) {
    .face-guide {
        width: 440px;
        height: 640px;
    }
}

/* Na dużych monitorach stacjonarnych powiększamy jeszcze mocniej */
@media (min-width: 1200px) {
    .face-guide {
        width: 550px;
        height: 750px;
    }
}

.controls-glass {
    position: absolute;
    bottom: 40px;
    z-index: 3;
    padding: 15px;
    display: flex;
    justify-content: center;
}

.btn-capture {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    background: #E3A8A3;
    border: 3px solid #FAF7F5;
    outline: 2px solid #E3A8A3;
    outline-offset: 4px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}
.btn-capture:active {
    transform: scale(0.85);
    background: #D99590;
}

/* --- Spinner --- */
#screen-analyzing {
    justify-content: center; /* Przywrócenie centrowania pionowego specjalnie dla krótkiego ekranu ładowania */
}

#screen-analyzing .phlov-panel {
    margin: auto; /* Zmusza panel loadingu do pływania na środku bez względu na top-margin innych ekranów */
}
.spinner-phlov {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid #F0EBE6;
    border-top-color: #E3A8A3;
    animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    margin: 0 auto 25px auto;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

/* Result Images */
.result-images {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px 10px; /* wiekszy odstep w pionie bo mamy 2 rzedy */
    margin-bottom: 25px;
}

.img-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.img-box img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #F0EBE6;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    margin-bottom: 6px;
}

.img-box span {
    font-size: 0.75rem;
    color: #8C8481;
    text-transform: uppercase;
    font-weight: 500;
}

/* Summary Box */
.summary-box {
    background: #FDFBF8;
    border: 1px solid #F0EBE6;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: left;
}

.metrics-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metric-item {
    font-size: 0.9rem; /* Delikatnie zwiekszone bo pojedyncza kolumna sie zmiesci */
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed #EAE3DE;
    padding-bottom: 6px;
}

.metric-label {
    color: #6C6461;
}

.metric-val {
    font-weight: 600;
    color: #393433;
}

.desc-final {
    font-size: 1.05rem;
}

/* Watermark: Powered By */
.powered-by-link {
    display: block;
    margin-top: 35px;
    color: #8C8481; /* Delikatny szaro-brązowy pasujący do Phlov */
    text-decoration: none;
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    opacity: 0.8;
    transition: opacity 0.3s, color 0.3s;
    text-align: center;
    width: 100%;
}

.powered-by-link:hover, .powered-by-link:hover strong {
    opacity: 1;
    color: #E3A8A3; /* Podbicie pod firmowy peach/pink na hoverze wspólnie dla całości */
}

.powered-by-link strong {
    font-weight: 800; /* Gruby i wyraźny PRO */
    font-size: 0.75rem;
    color: #FFC107; /* Złoto-żółty nawiązujący do głównego logo FaceGleam */
    transition: color 0.3s;
}

/* --- DESKTOP LAYOUT --- */
@media (min-width: 800px) {
    /* Ekran startowy Grid */
    .phlov-panel.start-panel {
        max-width: 850px;
        text-align: left;
        padding: 0; /* Usunięty wymuszony padding górny, by zlikwidować wielką szparę */
    }
    .phlov-panel.start-panel h1 {
        text-align: left;
    }
    .start-grid {
        display: grid;
        grid-template-areas: 
            "text tips"
            "action tips";
        grid-template-columns: 1fr 1.1fr;
        gap: 0px 50px;
        align-items: center;
    }
    .start-text { grid-area: text; }
    .start-tips { grid-area: tips; }
    .start-action { grid-area: action; margin-top: 15px; }

    .start-powered-by {
        margin-top: 30px;
        text-align: left;
    }

    /* Ekran wyników Grid */
    .phlov-panel.result-panel {
        max-width: 900px; /* Rozszerzenie kontenera z 440px do 900px */
        text-align: left; /* Tytuł wyrównany do lewej */
        padding: 0; /* Usunięty wymuszony padding górny, by zlikwidować wielką szparę */
    }
    #result-title {
        text-align: center;
        margin-bottom: 30px;
        font-size: 2rem;
    }
    .desktop-layout-split {
        display: grid;
        grid-template-columns: 360px 1fr;
        gap: 50px;
        align-items: start;
    }
    .result-images {
        margin-bottom: 0;
    }
    .summary-box {
        margin-bottom: 30px;
        background: transparent;
        border: none;
        padding: 0;
    }
    .btn-phlov {
        width: auto;
        padding-left: 40px;
        padding-right: 40px;
    }
}

.hidden { display: none !important; }
