:root {
  --bg: #0b1020;
  --bg2: #0f1630;
  --card: #121a36;
  --card2: #172045;
  --line: #24305c;
  --text: #e8ecf8;
  --muted: #94a0c4;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --blue: #60a5fa;
  --accent: #7c5cff;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, #1d2a6b55, transparent 60%),
              radial-gradient(900px 500px at 110% 10%, #5b21b633, transparent 60%), var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; font-weight: 400; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 14px 28px;
  background: rgba(11, 16, 32, .8); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; font-weight: 600; letter-spacing: -.02em; }
.brand b { color: var(--green); font-weight: 800; }
.logo { width: 30px; height: 30px; }
.logo path:first-child { fill: #16a34a33; stroke: var(--green); stroke-width: 1.6; }
.logo .tick { fill: none; stroke: var(--green); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabs { display: flex; gap: 4px; background: var(--bg2); padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.tab { background: none; border: 0; color: var(--muted); padding: 8px 16px; border-radius: 9px; font-weight: 500; }
.tab.active { background: var(--card2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.tab:hover { color: var(--text); }
.privacy-pill { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: .85rem; color: #bbf7d0;
  background: #14532d55; border: 1px solid #16a34a66; padding: 6px 12px; border-radius: 999px; }
.privacy-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px #22c55e33; }

/* ---------- layout ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 0 24px 40px; }
.view { display: none; animation: fade .35s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hero { text-align: center; padding: 44px 0 28px; }
.hero h1 { font-size: clamp(1.8rem, 3.6vw, 2.9rem); line-height: 1.12; letter-spacing: -.03em; margin: 0 0 14px; font-weight: 800; }
.hero p { color: var(--muted); max-width: 720px; margin: 0 auto; font-size: 1.05rem; }
.grad { background: linear-gradient(90deg, #4ade80, #60a5fa 50%, #a78bfa); -webkit-background-clip: text; background-clip: text; color: transparent; }
.card { background: linear-gradient(180deg, var(--card), #10183299); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card-title { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.02rem; margin-bottom: 14px; }
.grid-top { display: grid; grid-template-columns: 1.35fr 1fr; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-top > .card, .grid-2 > .card { margin-bottom: 20px; }

/* ---------- input ---------- */
textarea {
  width: 100%; min-height: 190px; resize: vertical;
  background: #0a1028; color: var(--text); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; font: 15px/1.6 Inter, sans-serif; outline: none; transition: border-color .2s, box-shadow .2s;
}
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px #7c5cff26; }
.input-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; color: var(--muted); font-size: .85rem; }
.actions { display: flex; gap: 8px; }
.btn { border: 1px solid var(--line); background: var(--card2); color: var(--text); padding: 9px 16px; border-radius: 10px; font-weight: 600; transition: transform .1s, background .2s, border-color .2s; }
.btn:hover { border-color: #3a4a85; }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, #7c5cff, #4f7cff); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.big { padding: 14px 26px; font-size: 1.05rem; border-radius: 12px; flex: 1; }
.btn.danger { background: #7f1d1d55; border-color: #ef444466; }
.btn.danger:hover { background: #7f1d1d99; }
.btn.safe { background: #14532d55; border-color: #22c55e66; }
.btn.safe:hover { background: #14532d99; }
.examples { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; font-size: .88rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--bg2); border: 1px solid var(--line); color: var(--text); padding: 6px 12px; border-radius: 999px; font-size: .86rem; transition: all .15s; }
.chip:hover, .chip.active { border-color: var(--accent); background: #7c5cff22; }

/* ---------- verdict ---------- */
.verdict-card { display: flex; align-items: center; justify-content: center; min-height: 300px; position: relative; overflow: hidden; }
.verdict-card::before { content: ""; position: absolute; inset: -40%; background: radial-gradient(circle at 30% 30%, var(--glow, transparent), transparent 55%); opacity: .5; transition: background .5s; pointer-events: none; }
.empty { text-align: center; color: var(--muted); }
.empty svg { width: 64px; height: 64px; fill: none; stroke: var(--line); stroke-width: 1.2; }
.empty p { margin: 10px 0 2px; color: var(--text); font-weight: 600; }
.verdict { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; position: relative; }
.gauge { position: relative; width: 170px; height: 170px; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 11; }
.gauge .track { stroke: #1e2850; }
.gauge .meter { stroke: var(--lvl, var(--green)); stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset 1s cubic-bezier(.2, .8, .2, 1), stroke .4s; filter: drop-shadow(0 0 8px var(--lvl)); }
.gauge-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge-label span { font-size: 3rem; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.gauge-label small { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: .7rem; margin-top: 4px; }
.level { display: inline-block; font-size: .75rem; font-weight: 800; letter-spacing: .14em; padding: 4px 10px; border-radius: 999px; color: var(--lvl); background: color-mix(in srgb, var(--lvl) 15%, transparent); border: 1px solid color-mix(in srgb, var(--lvl) 45%, transparent); }
.verdict-text h2 { margin: 8px 0 4px; font-size: 1.5rem; letter-spacing: -.02em; }
.type { margin: 0; color: var(--muted); }
.type b { color: var(--text); }
.combos { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
.combo { font-size: .76rem; background: #ef444418; border: 1px solid #ef444455; color: #fecaca; padding: 3px 9px; border-radius: 999px; }

/* ---------- annotated ---------- */
.annotated { background: #0a1028; border: 1px solid var(--line); border-radius: 12px; padding: 18px; font-size: 1.04rem; line-height: 1.9; white-space: pre-wrap; word-break: break-word; }
.hl { position: relative; color: inherit; background: color-mix(in srgb, var(--c) 22%, transparent); border-bottom: 2px solid var(--c); border-radius: 4px; padding: 1px 2px; cursor: help; animation: pop .5s ease backwards; }
.hl.url { font-family: 'JetBrains Mono', monospace; font-size: .92em; }
@keyframes pop { from { background: transparent; border-color: transparent; } }
.tip { position: fixed; z-index: 50; max-width: 320px; background: #0b1020f2; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: .85rem; line-height: 1.45; box-shadow: var(--shadow); pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s; }
.tip.show { opacity: 1; transform: none; }
.tip b { display: block; margin-bottom: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: .8rem; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--c); vertical-align: -1px; }

/* ---------- flags ---------- */
.count { background: var(--card2); border: 1px solid var(--line); border-radius: 999px; padding: 0 9px; font-size: .8rem; color: var(--muted); }
.flags { display: flex; flex-direction: column; gap: 10px; }
.flag { display: grid; grid-template-columns: 4px 1fr; gap: 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 12px 0; animation: slide .4s ease backwards; }
.flag::before { content: ""; background: var(--c); border-radius: 0 4px 4px 0; }
.flag h4 { margin: 0 0 2px; font-size: .95rem; }
.flag p { margin: 0; color: var(--muted); font-size: .87rem; }
.flag .ex { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.flag .ex code { font-family: 'JetBrains Mono', monospace; font-size: .76rem; background: #0a1028; border: 1px solid var(--line); padding: 2px 7px; border-radius: 6px; color: #cbd5f5; }
@keyframes slide { from { opacity: 0; transform: translateX(-8px); } }
.none { color: var(--muted); font-size: .92rem; padding: 10px 0; }

/* ---------- links ---------- */
.links { display: flex; flex-direction: column; gap: 12px; }
.link { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; animation: slide .4s ease backwards; }
.link-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.link-url { font-family: 'JetBrains Mono', monospace; font-size: .85rem; word-break: break-all; }
.link-url .reg { color: #fde68a; font-weight: 600; }
.badge { flex-shrink: 0; font-size: .72rem; font-weight: 800; letter-spacing: .08em; padding: 3px 9px; border-radius: 999px; }
.badge.bad { color: #fecaca; background: #ef444422; border: 1px solid #ef444466; }
.badge.warn { color: #fde68a; background: #f59e0b22; border: 1px solid #f59e0b66; }
.badge.ok { color: #bbf7d0; background: #22c55e22; border: 1px solid #22c55e66; }
.link ul { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: .86rem; }
.link li { margin: 3px 0; }
.real-dest { margin-top: 8px; font-size: .82rem; color: var(--muted); }
.real-dest b { color: var(--text); font-family: 'JetBrains Mono', monospace; }

/* ---------- advice ---------- */
.advice { margin: 0; padding: 0; list-style: none; counter-reset: a; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.advice li { counter-increment: a; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 14px 14px 52px; position: relative; font-size: .93rem; }
.advice li::before { content: counter(a); position: absolute; left: 14px; top: 12px; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; background: linear-gradient(135deg, #7c5cff, #4f7cff); }
.advice-actions { display: flex; align-items: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- quiz ---------- */
.quiz-wrap { max-width: 620px; margin: 0 auto; }
.quiz-progress { display: flex; gap: 6px; justify-content: center; margin-bottom: 16px; }
.quiz-progress span { width: 34px; height: 6px; border-radius: 3px; background: var(--line); transition: background .3s; }
.quiz-progress span.cur { background: var(--accent); }
.quiz-progress span.right { background: var(--green); }
.quiz-progress span.wrong { background: var(--red); }
.phone { background: #0a1028; border: 1px solid var(--line); border-radius: 20px; padding: 16px; }
.phone-head { display: flex; align-items: center; gap: 10px; font-weight: 600; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #334155, #1e293b); font-size: .9rem; }
.bubble { background: #1f2a52; border-radius: 4px 18px 18px 18px; padding: 12px 16px; max-width: 92%; line-height: 1.6; white-space: pre-wrap; }
.quiz-actions { display: flex; gap: 12px; margin-top: 18px; }
.quiz-feedback { margin-top: 18px; }
.fb-head { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; font-weight: 800; margin-bottom: 8px; }
.fb-head.right { color: var(--green); }
.fb-head.wrong { color: var(--red); }
.fb-list { margin: 6px 0 14px; padding-left: 18px; color: var(--muted); font-size: .92rem; }
.final { text-align: center; padding: 10px 0; }
.final .big-score { font-size: 4rem; font-weight: 800; letter-spacing: -.04em; }

/* ---------- how ---------- */
.pipeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; position: relative; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; position: relative; }
.step:not(:last-child)::after { content: "→"; position: absolute; right: -14px; top: 26px; color: var(--accent); font-weight: 800; z-index: 2; }
.step .num { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; background: linear-gradient(135deg, #7c5cff, #4f7cff); margin-bottom: 12px; }
.step h3 { margin: 0 0 6px; }
.step p { margin: 0; color: var(--muted); font-size: .9rem; }
.facts { margin: 0; padding-left: 18px; color: var(--muted); }
.facts li { margin: 8px 0; }
.facts b { color: var(--text); }

footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 24px; border-top: 1px solid var(--line); }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: #16a34a; color: white; padding: 10px 18px; border-radius: 10px; font-weight: 600; opacity: 0; transition: all .3s; pointer-events: none; z-index: 60; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .grid-top, .grid-2, .pipeline, .advice { grid-template-columns: 1fr; }
  .step::after { display: none; }
  .topbar { flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
  .privacy-pill { margin-left: 0; }
  main { padding: 0 16px 32px; }
}
