* {
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(180deg, #ffc107, #ffb300);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 10px;
}

.landing-container {
    width: 92%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    margin-bottom: 16px;
    font-size: 32px;
    font-weight: 700;
    color: #111;
    text-align: center; /* center heading */
}

/* FORM DI ATAS & TENGAH */
.search-box {
    width: 100%;
    display: flex;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0,0,0,.18);
    margin-bottom: 16px;
}

.search-box input {
    flex: 1;
    border: none;
    padding: 12px 14px;
    font-size: 15px;
    outline: none;
}

.search-box button {
    background: #ffb300;
    border: none;
    padding: 0 18px;
    font-size: 18px;
    cursor: pointer;
}

/* CHAT CARD */
.card {
    width: 100%;
    background: #fff;
    border-radius: 14px;
    padding: 12px;
    min-height: 180px;
    max-height: 360px;
    overflow-y: auto;
    box-shadow: 0 10px 24px rgba(0,0,0,.18);
}

/* CHAT BUBBLE */
.chat {
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    font-size: 14px;
}

.chat.user {
    background: #e3f2fd;
    text-align: right;
}

.chat.ai {
    background: #f5f5f5;
}

/* Loader overlay */
.loader {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0,0,0,0.28);
    z-index: 9999;
    transition: opacity 160ms ease;
}
.loader.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}
.spinner {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 6px solid rgba(255,255,255,0.9);
    border-top-color: rgba(255,255,255,0.18);
    animation: spin 900ms linear infinite;
    box-shadow: 0 6px 18px rgba(0,0,0,0.28);
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* credit link (footer) */
.credit {
    display: block;
    text-align: right;       /* rata kanan */
    font-size: 12px;         /* kecil */
    color: rgba(0,0,0,0.65); /* warna halus */
    text-decoration: none;   /* tanpa garis bawah */
    margin-top: 10px;
}
.credit:hover {
    text-decoration: none;
    opacity: 0.9;
}

/* Responsive tweaks untuk HP */
@media (max-width: 480px) {
    html { font-size: 16px; } /* basis font lebih besar untuk keterbacaan */

    body {
        padding-top: env(safe-area-inset-top, 10px);
    }

    .landing-container {
        width: 96%;
        max-width: 420px;
        padding: 12px;
    }

    h1 {
        font-size: 22px;
        margin-bottom: 12px;
    }

    .search-box {
        padding: 6px;
    }

    .search-box input {
        padding: 14px 12px;
        font-size: 16px;
    }

    .search-box button {
        padding: 0 14px;
        font-size: 20px;
        min-width: 48px;
        min-height: 44px; /* target sentuh minimal */
        border-radius: 8px;
    }

    .card {
        padding: 10px;
        min-height: 220px;
        max-height: calc(100vh - 220px);
        -webkit-overflow-scrolling: touch;
    }

    .chat {
        font-size: 16px;
        padding: 10px 12px;
        border-radius: 10px;
    }

    .credit { font-size: 11px; } /* tweak untuk HP */
}

/* Optional: tweak untuk layar sangat kecil */
@media (max-width: 360px) {
    h1 { font-size: 20px; }
    .landing-container { max-width: 360px; }
}

/* Minor tweak: pastikan chat card terlihat lebih baik di layar kecil */
@media (max-width: 480px) {
    .card {
        padding: 12px;
        min-height: 260px;
    }
}

@media (min-width: 900px) {
    .landing-container {
        width: 84%;
        max-width: 900px;
        padding: 20px;
        align-items: stretch; /* biarkan anak mengambil lebar penuh */
    }

    h1 {
        font-size: 36px;
        margin-bottom: 18px;
    }

    .search-box {
        border-radius: 12px;
    }

    .card {
        min-height: 420px; /* lebih tinggi untuk tampilan PC */
        max-height: calc(100vh - 180px); /* sisa ruang layar */
        padding: 18px;
    }

    .chat {
        font-size: 15px;
        padding: 10px 14px;
    }
}
