:root {
    --blue:          #1d4ed8;
    --blue-dark:     #1e3a8a;
    --blue-light:    #eff6ff;
    --green:         #16a34a;
    --green-light:   #f0fdf4;
    --yellow:        #d97706;
    --yellow-light:  #fffbeb;
    --red:           #dc2626;
    --red-light:     #fef2f2;
    --gray:          #6b7280;
    --gray-light:    #f9fafb;
    --border:        #e5e7eb;
    --text:          #111827;
    --text-muted:    #6b7280;
    --shadow-sm:     0 1px 3px rgba(0,0,0,.08);
    --shadow:        0 4px 16px rgba(0,0,0,.08);
    --radius:        10px;
    --radius-lg:     16px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f1f5f9;
    color: var(--text);
    line-height: 1.6;
}

a { color: var(--blue); }
a:hover { text-decoration: none; }

.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Header ── */
.header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.logo-icon {
    width: 28px;
    height: 28px;
    color: var(--blue);
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

/* ── Hero ── */
.hero {
    background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 100%);
    color: #fff;
    padding: 64px 0 56px;
    text-align: center;
}

.hero-title {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.2;
    margin-bottom: 16px;
}

.hero-sub {
    font-size: 1.05rem;
    opacity: .9;
    max-width: 580px;
    margin: 0 auto 40px;
}

/* ── Search form ── */
.search-form {
    max-width: 600px;
    margin: 0 auto;
}

.search-row {
    display: flex;
    gap: 8px;
}

.search-input {
    flex: 1;
    height: 52px;
    padding: 0 18px;
    font-size: 1rem;
    border: 2px solid transparent;
    border-radius: var(--radius);
    outline: none;
    background: rgba(255,255,255,.12);
    color: #fff;
    transition: background .2s, border-color .2s;
}

.search-input::placeholder { color: rgba(255,255,255,.55); }

.search-input:focus {
    background: rgba(255,255,255,.2);
    border-color: rgba(255,255,255,.5);
}

.search-input.error {
    border-color: #fca5a5;
    background: rgba(252,165,165,.1);
}

.search-btn {
    height: 52px;
    padding: 0 26px;
    background: #fff;
    color: var(--blue);
    font-size: .95rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity .2s, transform .1s;
    white-space: nowrap;
}

.search-btn:hover  { opacity: .92; }
.search-btn:active { transform: scale(.98); }
.search-btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-spinner svg {
    width: 18px;
    height: 18px;
    animation: spin 1s linear infinite;
}

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

.search-autocomplete {
    flex: 1;
    position: relative;
    min-width: 0;
}

.search-autocomplete .search-input {
    width: 100%;
}

/* ── Suggestions dropdown ── */
.suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
    list-style: none;
    overflow: hidden;
    z-index: 200;
    max-height: 320px;
    overflow-y: auto;
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background .12s;
}

.suggestion-item:last-child { border-bottom: none; }

.suggestion-item:hover,
.suggestion-item.active {
    background: var(--blue-light);
}

.suggestion-cn {
    font-size: .88rem;
    font-weight: 700;
    color: var(--blue);
}

.suggestion-address {
    font-size: .82rem;
    color: var(--text);
    margin-top: 2px;
    line-height: 1.4;
}

.suggestion-category {
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.suggestion-empty {
    padding: 14px 16px;
    font-size: .88rem;
    color: var(--text-muted);
    text-align: center;
}

.search-hint {
    margin-top: 12px;
    font-size: .82rem;
    opacity: .75;
}
.search-hint a { color: rgba(255,255,255,.9); }

.search-error {
    margin-top: 10px;
    color: #fca5a5;
    font-size: .88rem;
}

/* ── Results ── */
.results-section {
    padding: 40px 0 16px;
}

.parcel-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.parcel-card h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--blue-dark);
}

.parcel-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
}

.parcel-meta-item {
    font-size: .9rem;
    color: var(--text-muted);
}

.parcel-meta-item strong {
    color: var(--text);
    font-weight: 600;
}

/* ── Map ── */
.parcel-map {
    height: 380px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

/* ── Risk grid ── */
.risks-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.risk-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--border);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 16px;
    align-items: start;
    transition: box-shadow .2s;
}

.risk-card:hover { box-shadow: var(--shadow); }

.risk-card.green  { border-left-color: var(--green); }
.risk-card.yellow { border-left-color: var(--yellow); }
.risk-card.red    { border-left-color: var(--red); }
.risk-card.unknown{ border-left-color: var(--gray); }

.risk-card-body { grid-column: 1; }

.risk-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.risk-desc {
    font-size: .9rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.risk-rec {
    margin-top: 8px;
    font-size: .85rem;
    color: var(--blue);
}

.risk-badge {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}

.risk-badge.green  { background: var(--green-light);  color: var(--green); }
.risk-badge.yellow { background: var(--yellow-light); color: var(--yellow); }
.risk-badge.red    { background: var(--red-light);    color: var(--red); }
.risk-badge.unknown{ background: var(--gray-light);   color: var(--gray); }

.risk-badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.green  .risk-badge-dot { background: var(--green); }
.yellow .risk-badge-dot { background: var(--yellow); }
.red    .risk-badge-dot { background: var(--red); }
.unknown .risk-badge-dot { background: var(--gray); }

.disclaimer {
    margin: 24px 0 8px;
    font-size: .82rem;
    color: var(--text-muted);
    text-align: center;
    padding: 12px 16px;
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* ── How it works ── */
.how-it-works {
    padding: 56px 0;
}

.section-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -.02em;
    margin-bottom: 36px;
}

.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.step {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.step-num {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--blue-light);
    color: var(--blue);
    font-size: 1.2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.step h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.step p {
    font-size: .88rem;
    color: var(--text-muted);
    line-height: 1.55;
}

/* ── Dev banner ── */
.dev-banner {
    background: #fefce8;
    border-top: 1px solid #fde68a;
    border-bottom: 1px solid #fde68a;
    padding: 12px 0;
    text-align: center;
    font-size: .83rem;
    color: #92400e;
}

/* ── Footer ── */
.footer {
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
    font-size: .82rem;
    color: var(--text-muted);
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .hero { padding: 44px 0 40px; }
    .search-row { flex-direction: column; }
    .search-btn { width: 100%; justify-content: center; }
    .steps { grid-template-columns: 1fr; gap: 16px; }
    .risk-card {
        grid-template-columns: 1fr;
    }
    .risk-badge {
        grid-column: 1;
        grid-row: auto;
        width: fit-content;
        margin-bottom: 4px;
    }
    .parcel-card { padding: 18px 16px; }
}