:root {
    --bg: #f3f7f8;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #6b7280;
    --accent: #0ea5a0;
    --accent-dark: #0b8f8b;
    --danger: #ef4444;
    --ok: #16a34a;
    --border: rgba(15, 23, 42, 0.1);
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --rounded: 16px;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --card: #1e293b;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --accent: #2dd4bf;
    --accent-dark: #14b8a6;
    --danger: #f87171;
    --ok: #4ade80;
    --border: rgba(241, 245, 249, 0.12);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: Inter, system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    background: radial-gradient(circle at 50% -10%, rgba(14, 165, 160, 0.18), transparent 55%);
}

.blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    z-index: -1;
    opacity: 0.35;
    pointer-events: none;
}

.blob-a {
    width: 420px;
    height: 420px;
    background: #0ea5a0;
    top: -120px;
    right: -80px;
}

.blob-b {
    width: 360px;
    height: 360px;
    background: #06b6d4;
    bottom: -140px;
    left: -90px;
}

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
}

.brand img {
    display: block;
    height: 40px;
    width: auto;
    mix-blend-mode: multiply;
}

[data-theme="dark"] .brand img {
    filter: none;
    mix-blend-mode: normal;
    content: url("/haldja kinnisvaraportaal dark mode.webp");
}

.top-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.lang-switch {
    display: flex;
    gap: 4px;
}

.lang-switch button {
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--muted);
    border-radius: 8px;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    padding: 6px 8px;
    cursor: pointer;
}

.lang-switch button.is-active {
    border-color: var(--accent);
    color: var(--accent);
}

.shell {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 8px 20px 48px;
    flex: 1;
}

.hero {
    min-height: calc(100dvh - 120px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero.is-compact {
    min-height: 0;
    margin-bottom: 10px;
}

.hero.is-compact h1 {
    font-size: 1.25rem;
    margin-bottom: 6px;
}

.hero.is-compact .kicker,
.hero.is-compact .lead,
.hero.is-compact .panel {
    display: none;
}

.input-recap {
    display: none;
    margin: 0;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.4;
}

.hero.is-compact .input-recap {
    display: block;
}

.kicker {
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

h1 {
    margin: 0 0 12px;
    font-size: clamp(1.9rem, 7vw, 2.6rem);
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.lead {
    margin: 0 0 24px;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.5;
}

.panel,
.ticket,
.radar {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--rounded);
    box-shadow: var(--shadow);
}

.panel {
    padding: 20px;
}

.field {
    margin: 0 0 16px;
    position: relative;
}

.field label,
.field legend {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

fieldset.field {
    border: 0;
    padding: 0;
}

input[type="text"],
input[type="email"],
select {
    width: 100%;
    height: 52px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 16px;
    padding: 0 14px;
}

input:focus,
select:focus {
    outline: 2px solid rgba(14, 165, 160, 0.45);
    border-color: var(--accent);
}

.area-wrap {
    position: relative;
}

.area-suffix {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-weight: 700;
    pointer-events: none;
}

#areaInput {
    padding-right: 48px;
}

select {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

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

.pill {
    cursor: pointer;
}

.pill input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.pill span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg);
    font-weight: 700;
    font-size: 14px;
}

.pill input:checked + span {
    border-color: var(--accent);
    background: rgba(14, 165, 160, 0.12);
    color: var(--accent-dark);
}

[data-theme="dark"] .pill input:checked + span {
    color: var(--accent);
}

.hint {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--muted);
}

.hint.warn {
    color: #b45309;
}

[data-theme="dark"] .hint.warn {
    color: #fbbf24;
}

.error {
    margin: 0 0 12px;
    color: var(--danger);
    font-size: 14px;
    font-weight: 600;
}

.btn-primary,
.btn-secondary {
    width: 100%;
    height: 52px;
    border: 0;
    border-radius: 14px;
    font: inherit;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 10px 22px rgba(14, 165, 160, 0.35);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: wait;
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.text-btn {
    background: none;
    border: 0;
    color: var(--accent);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    padding: 8px 0;
    cursor: pointer;
}

.suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% - 4px);
    z-index: 20;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    max-height: 240px;
    overflow: auto;
}

.suggestion {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

.suggestion:last-child {
    border-bottom: 0;
}

.suggestion:hover,
.suggestion.is-active {
    background: var(--bg);
}

.suggestion-title {
    font-size: 14px;
    font-weight: 600;
}

.suggestion-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.result {
    padding-bottom: 24px;
    scroll-margin-top: 12px;
}

.ticket {
    padding: 28px 22px 22px;
    text-align: center;
    border-top: 4px solid var(--accent);
    margin-bottom: 16px;
}

.ticket-kicker {
    margin: 0 0 12px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ticket-meta {
    margin: 0 auto 16px;
    max-width: 36rem;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
}

.ticket-recommend {
    margin: 0 0 6px;
    font-size: 12px;
    color: var(--muted);
}

.ticket-range {
    margin: 0;
    font-size: clamp(2rem, 8vw, 3.4rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.1;
}

.ticket-share {
    margin: 18px auto 0;
    max-width: 320px;
}

.ticket-share .btn-secondary {
    height: 44px;
    font-size: 14px;
}

.ticket-share .hint {
    margin: 8px 0 0;
}

.ticket.is-modest .ticket-range {
    font-size: clamp(1.15rem, 3.2vw, 1.45rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.ticket-warn {
    margin: 14px auto 0;
    max-width: 36rem;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(245, 158, 11, 0.12);
    color: var(--text);
    font-size: 14px;
    line-height: 1.45;
}

.ticket-note,
.ticket-estonia {
    margin: 14px 0 0;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.45;
}

.ticket-estonia {
    color: #b45309;
    font-weight: 600;
}

.radar {
    padding: 22px;
    border: 1px solid rgba(14, 165, 160, 0.35);
}

.radar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.radar-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.radar h2 {
    margin: 0 0 8px;
    font-size: 1.15rem;
    line-height: 1.35;
}

.watch-line {
    margin: 0 0 16px;
    font-size: 13px;
    color: var(--muted);
}

.radar-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radar.is-done {
    background: rgba(22, 163, 74, 0.08);
    border-color: var(--ok);
}

.radar.is-done #radarBtn {
    background: var(--ok);
    box-shadow: none;
}

.radar-status {
    margin: 10px 0 0;
    font-size: 14px;
    font-weight: 700;
}

.radar-status.ok {
    color: var(--ok);
}

.radar-status.bad {
    color: var(--danger);
}

.price-box {
    margin-top: 12px;
    padding-top: 4px;
}

.seller-cta {
    margin: 18px 0 0;
    font-size: 14px;
    color: var(--muted);
    line-height: 1.5;
}

.seller-cta a {
    color: var(--accent);
    font-weight: 700;
}

.after-actions {
    display: flex;
    justify-content: center;
    margin-top: 18px;
}

.foot {
    text-align: center;
    padding: 8px 20px 24px;
    color: var(--muted);
    font-size: 11px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (min-width: 640px) {
    .radar-row {
        flex-direction: row;
    }

    .radar-row .btn-primary {
        width: auto;
        padding: 0 22px;
        white-space: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    .blob {
        display: none;
    }
}
