:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --fg: #121417;
    --muted: #5b616b;
    --border: #dfe3ea;
    --primary: #1d4ed8;
    --primary-fg: #ffffff;
    --error: #b91c1c;
    --level-official: #15803d;
    --level-neutral: #374151;
    --level-warning: #c2410c;
    --level-danger: #b91c1c;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f1115;
        --surface: #181b21;
        --fg: #eceef2;
        --muted: #9aa1ad;
        --border: #2a2f38;
        --primary: #3b82f6;
        --error: #f87171;
        --level-neutral: #2b313b;
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0f1115;
    --surface: #181b21;
    --fg: #eceef2;
    --muted: #9aa1ad;
    --border: #2a2f38;
    --primary: #3b82f6;
    --error: #f87171;
    --level-neutral: #2b313b;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    min-height: 100dvh;
    background: var(--bg);
    color: var(--fg);
    font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-text-size-adjust: 100%;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.home {
    max-width: 560px;
    margin: 0 auto;
    padding: calc(env(safe-area-inset-top) + 20px) 16px calc(env(safe-area-inset-bottom) + 24px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--muted); margin-bottom: 28px; }
.brand img { border-radius: 10px; }
h1 { font-size: clamp(26px, 7vw, 34px); line-height: 1.15; margin: 0 0 10px; letter-spacing: -0.01em; }
.intro { margin: 0 0 20px; color: var(--muted); }

textarea {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    color: var(--fg);
    font: inherit;
    resize: vertical;
}
textarea:focus { outline: none; border-color: var(--primary); }
.error { color: var(--error); margin: 8px 0 0; font-weight: 600; }
.buttons { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 12px; }
button, .result-secondary { font: inherit; font-weight: 700; border-radius: 14px; padding: 15px 16px; cursor: pointer; text-align: center; text-decoration: none; }
.primary { background: var(--primary); color: var(--primary-fg); border: 0; }
.secondary { background: var(--surface); color: var(--fg); border: 2px solid var(--border); }

.tips { margin-top: 32px; padding: 18px 18px 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.tips h2 { margin: 0 0 8px; font-size: 18px; }
.tips ul { margin: 0; padding-left: 20px; }
.tips li { margin-bottom: 12px; }
.footer { margin-top: 20px; font-size: 13px; color: var(--muted); }

.result {
    position: fixed;
    inset: 0;
    display: flex;
    overflow-y: auto;
    padding: calc(env(safe-area-inset-top) + 24px) 16px calc(env(safe-area-inset-bottom) + 24px);
    background: var(--level-neutral);
    color: #fff;
    animation: appear .15s ease-out;
}
.result[hidden] { display: none; }
@keyframes appear { from { opacity: 0; } }
.result[data-level="official"], .result[data-level="trusted"] { background: var(--level-official); }
.result[data-level="warning"] { background: var(--level-warning); }
.result[data-level="danger"] { background: var(--level-danger); }
.result-panel { width: 100%; max-width: 560px; margin: auto; text-align: center; }
.result-icon { font-size: clamp(56px, 16vw, 84px); line-height: 1; margin-bottom: 8px; }
.result h1 { font-size: clamp(30px, 9vw, 56px); font-weight: 900; line-height: 1.05; margin: 0; text-transform: uppercase; }
.result-subtitle { font-size: clamp(19px, 5vw, 24px); font-weight: 700; margin: 14px 0 18px; }
.result-host {
    display: inline-block;
    max-width: 100%;
    margin: 0 0 18px;
    padding: 8px 14px;
    border-radius: 10px;
    background: rgba(0, 0, 0, .28);
    font: 700 18px/1.3 ui-monospace, Menlo, Consolas, monospace;
    word-break: break-all;
}
.result-reasons { text-align: left; margin: 0 0 14px; padding: 14px 16px 14px 34px; border-radius: 12px; background: rgba(0, 0, 0, .2); }
.result-reasons:empty { display: none; }
.result-reasons li { margin: 4px 0; }
.result-age { margin: 0 0 14px; opacity: .9; font-size: 15px; }
.result-age:empty { display: none; }
.result-advice { font-weight: 600; margin: 0 0 20px; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 14px; }
.result-actions:not(:has(:not([hidden]))) { display: none; }
.result-secondary { color: #fff; border: 2px solid rgba(255, 255, 255, .75); padding: 11px 16px; }
.result-primary { display: block; width: 100%; border: 0; background: #fff; color: #111; font-size: 19px; padding: 17px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
