/* ===== Base layout ===== */
.pce-wrap {
    margin: 36px auto; 
    padding: 0 15px; 
    max-width: 920px;
    width: 100%;
    box-sizing: border-box;
}

.pce-title {
    margin: 0 0 8px; 
    font-weight: 800; 
    text-align: center;
    font-size: 28px;
    line-height: 1.3;
    word-wrap: break-word;
}

.pce-sub {
    margin: 0 0 18px; 
    text-align: center;
    font-size: 16px;
    line-height: 1.5;
}

/* input + button row */
.pce-form {
    display: flex; 
    justify-content: center; 
    margin-bottom: 16px;
    width: 100%;
}

.pce-row {
    display: flex; 
    gap: 10px; 
    width: 100%; 
    max-width: 560px; 
    align-items: center;
}

.pce-input {
    flex: 1; 
    height: 48px; 
    padding: 0 14px; 
    font-size: 16px; /* Prevents zoom on mobile */
    border: 1px solid #e5e7eb; 
    border-radius: 12px; 
    outline: none;
    width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none; /* Removes default iOS styling */
}

.pce-input:focus {
    border-color: #94a3b8; 
    box-shadow: 0 0 0 3px rgba(148,163,184,.25);
}

.pce-btn {
    height: 48px; 
    padding: 0 18px; 
    border: 0; 
    border-radius: 10px;
    font-weight: 700; 
    cursor: pointer; 
    background: #1d4ed8; 
    color: #fff; 
    white-space: nowrap;
    font-size: 16px;
    transition: opacity 0.2s;
    -webkit-appearance: none;
}

.pce-btn:hover {
    opacity: .95;
}

/* result */
.pce-result {
    display: flex; 
    justify-content: center; 
    margin-top: 10px; 
    padding: 0;
    width: 100%;
}

.pce-alert {
    width: 100%; 
    max-width: 560px; 
    padding: 15px; 
    border-radius: 10px; 
    border: 1px solid transparent;
    box-sizing: border-box;
}

.pce-alert.success {
    background: #ecfdf5; 
    border-color: #10b981; 
    color: #065f46;
}

.pce-alert.error {
    background: #fef2f2; 
    border-color: #ef4444; 
    color: #7f1d1d;
}

.pce-success-msg {
    margin: 0 0 12px; 
    line-height: 1.5;
    font-size: 16px;
    word-wrap: break-word;
}

.pce-actions {
    display: flex; 
    align-items: center; 
    gap: 12px; 
    flex-wrap: wrap;
}

.pce-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    background: #111827;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.pce-cta:hover {
    opacity: .95;
}

.pce-cta svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ===== RESPONSIVE FOR MOBILE ===== */
@media screen and (max-width: 768px) {
    .pce-title {
        font-size: 24px;
        margin-bottom: 10px;
    }
    
    .pce-sub {
        font-size: 15px;
        margin-bottom: 20px;
    }
}

@media screen and (max-width: 640px) {
    .pce-wrap {
        margin: 20px auto;
        padding: 0 12px;
    }
    
    .pce-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .pce-input {
        width: 100%;
        height: 50px; /* Slightly larger for better touch */
        font-size: 16px;
    }
    
    .pce-btn {
        width: 100%;
        height: 50px;
        font-size: 16px;
    }
    
    .pce-alert {
        padding: 15px;
    }
    
    .pce-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .pce-cta {
        width: 100%;
        justify-content: center;
        padding: 12px 18px;
        font-size: 16px;
    }
    
    .pce-success-msg {
        text-align: center;
        margin-bottom: 15px;
    }
}

/* Small phones */
@media screen and (max-width: 380px) {
    .pce-title {
        font-size: 22px;
    }
    
    .pce-sub {
        font-size: 14px;
    }
    
    .pce-input,
    .pce-btn {
        height: 48px;
        font-size: 15px;
    }
    
    .pce-alert {
        padding: 12px;
    }
    
    .pce-cta {
        padding: 10px 15px;
        font-size: 15px;
    }
}

/* Landscape mode on phones */
@media screen and (max-width: 896px) and (orientation: landscape) {
    .pce-row {
        flex-direction: row;
    }
    
    .pce-btn {
        width: auto;
        min-width: 160px;
    }
    
    .pce-actions {
        flex-direction: row;
    }
    
    .pce-cta {
        width: auto;
    }
}

/* Touch-friendly improvements */
.pce-input,
.pce-btn,
.pce-cta {
    -webkit-tap-highlight-color: transparent;
}

.pce-btn:active,
.pce-cta:active {
    transform: scale(0.98);
}

/* Fix for very small devices */
@media screen and (max-width: 320px) {
    .pce-wrap {
        padding: 0 10px;
    }
    
    .pce-title {
        font-size: 20px;
    }
    
    .pce-cta {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    .pce-cta svg {
        width: 16px;
        height: 16px;
    }
}