:root {
  --bg: #f6efe3;
  --card: #fffcf6;
  --ink: #1d2b2a;
  --muted: #5b6664;
  --teal: #0f4f4a;
  --teal-2: #13645e;
  --teal-soft: #dcecea;
  --amber: #f8d9a0;
  --amber-line: #e5a93b;
  --amber-bg: #fbe3b7;
  --red: #b3261e;
  --red-bg: #f9d9d4;
  --green: #1f7a4d;
  --green-bg: #dbefe2;
  --line: #e6dccb;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 79, 74, 0.08), 0 1px 2px rgba(15, 79, 74, 0.08);
  --font: "Rubik", "Assistant", "Segoe UI", "Arial Hebrew", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--amber-line); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px clamp(14px, 4vw, 36px);
  padding-top: max(14px, env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--teal); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--teal);
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
}
.brand-mark span { width: 4px; height: 13px; border-radius: 2px; background: #f2b84b; }
.brand-name { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.01em; }
.tabs { display: flex; gap: 6px; margin-inline-start: auto; }
.tab {
  border: 0; background: transparent; padding: 8px 14px; border-radius: 999px; color: var(--muted); font-weight: 500;
}
.tab.is-active { background: var(--teal-soft); color: var(--teal); font-weight: 600; }
.lang { display: inline-flex; border: 2px solid var(--teal); border-radius: 999px; overflow: hidden; }
.lang button { border: 0; background: transparent; padding: 5px 12px; font-weight: 600; font-size: 0.9rem; color: var(--teal); }
.lang button.is-active { background: var(--teal); color: #fff; }

/* ---------- layout ---------- */
main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 8px clamp(14px, 4vw, 36px) 40px; }
.checker-grid { display: grid; grid-template-columns: 1fr; gap: 28px; align-items: start; }
@media (min-width: 900px) {
  .checker-grid.has-results { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .checker-grid:not(.has-results) .intro { max-width: 680px; }
}
h1 {
  color: var(--teal); font-size: clamp(1.9rem, 4.6vw, 2.6rem); line-height: 1.12; margin: 18px 0 12px;
  letter-spacing: -0.02em; font-weight: 800;
}
.lead { color: var(--muted); margin: 0 0 22px; max-width: 60ch; }

/* ---------- form ---------- */
.field-label { display: block; font-weight: 700; margin-bottom: 8px; font-size: 0.95rem; }
textarea {
  width: 100%; min-height: 150px; resize: vertical; padding: 14px 16px; border-radius: var(--radius);
  border: 2px solid #b9b6a8; background: var(--card); color: var(--ink); font: inherit; line-height: 1.6;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
}
textarea:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 4px rgba(15,79,74,0.12); }
.form-error { color: var(--red); margin: 8px 0 0; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0 6px; }
.btn {
  border: 1px solid var(--line); background: var(--card); padding: 10px 16px; border-radius: 10px; font-weight: 600;
  min-height: 44px; transition: background 0.15s, transform 0.05s;
}
.btn:hover { background: #fff; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; padding-inline: 20px; }
.btn-primary:hover { background: var(--teal-2); }
.btn-primary[disabled] { opacity: 0.7; cursor: progress; }
.btn-link { border: 0; background: transparent; text-decoration: underline; text-underline-offset: 3px; padding-inline: 6px; }
.btn-link:hover { background: transparent; color: var(--teal); }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: 0.9rem; }

.switch { display: inline-flex; align-items: center; gap: 10px; margin: 10px 0 4px; cursor: pointer; font-size: 0.95rem; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 40px; height: 24px; border-radius: 999px; background: #c9c3b5; position: relative; transition: background 0.15s; flex: none; }
.switch-track::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.switch input:checked + .switch-track { background: var(--teal); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
[dir="rtl"] .switch input:checked + .switch-track::after { transform: translateX(-16px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--amber-line); outline-offset: 2px; }

.privacy { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 0.85rem; margin: 8px 0 0; max-width: 62ch; }
.privacy svg { flex: none; margin-top: 3px; color: var(--teal); }
.install-row { margin-top: 16px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0; }

/* ---------- results ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: clamp(16px, 3vw, 24px); }
.results { scroll-margin-top: 12px; }
.verdict { border-radius: 10px; padding: 14px 18px; border-inline-start: 4px solid var(--amber-line); background: var(--amber-bg); margin-bottom: 18px; }
.verdict h2 { margin: 0 0 2px; font-size: 1.2rem; }
.verdict p { margin: 0; }
.verdict.level-high { background: var(--red-bg); border-color: var(--red); }
.verdict.level-high h2 { color: var(--red); }
.verdict.level-low { background: #fbf0d6; border-color: #d7b35a; }
.verdict.level-none { background: var(--green-bg); border-color: var(--green); }

.section-label { font-size: 0.85rem; font-weight: 700; color: var(--muted); margin: 18px 0 10px; }
.marked {
  border: 1px dashed #d7ccb8; border-radius: 10px; padding: 14px 16px; background: #fbf7ee; white-space: pre-wrap;
  overflow-wrap: anywhere; line-height: 1.9;
}
mark { background: var(--amber); color: inherit; border-radius: 4px; padding: 1px 3px; }
mark.m-link { background: #f3c77a; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.92em; }

.cats, .links { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.cat { border-inline-start: 3px solid var(--amber-line); padding-inline-start: 14px; }
.cat h4 { margin: 0 0 6px; font-size: 1rem; }
.cat p { margin: 6px 0 0; color: var(--muted); font-size: 0.9rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--amber-bg); border-radius: 999px; padding: 2px 10px; font-size: 0.85rem; unicode-bidi: isolate; }

.link-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; }
.link-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.link-url { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.88rem; overflow-wrap: anywhere; direction: ltr; unicode-bidi: isolate; }
.badge { font-size: 0.8rem; font-weight: 700; border-radius: 999px; padding: 2px 10px; white-space: nowrap; background: #eee; }
.badge.v-danger { background: var(--red); color: #fff; }
.badge.v-suspicious { background: var(--amber-line); color: #2b1c00; }
.badge.v-official { background: var(--green); color: #fff; }
.badge.v-no_known_issues { background: var(--teal-soft); color: var(--teal); }
.badge.v-checking { background: #eee; color: var(--muted); }
.link-meta { margin: 8px 0 0; font-size: 0.88rem; }
.link-meta bdi { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.signals { margin: 8px 0 0; padding-inline-start: 18px; font-size: 0.9rem; }
.signals li { margin: 3px 0; }
.signals li.s-high { color: var(--red); font-weight: 600; }
.signals li.s-good { color: var(--green); font-weight: 600; }
.signals li.s-low, .signals li.s-info { color: var(--muted); }
.checked-against { margin: 6px 0 0; font-size: 0.78rem; color: var(--muted); }

.next { background: var(--teal-soft); border-radius: 12px; padding: 14px 16px; margin: 20px 0 16px; }
.next-label { margin: 0 0 4px; font-size: 0.82rem; font-weight: 700; color: var(--teal); }
.next-text { margin: 0; font-weight: 600; color: #123c38; }
.report { margin: 10px 0 0; font-size: 0.9rem; }

/* ---------- practice ---------- */
.practice { max-width: 760px; }
.practice-score { font-weight: 700; color: var(--teal); min-height: 1.5em; }
.practice-list { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 14px; }
.practice-item { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.bubble { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.practice-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.practice-feedback { margin-top: 12px; border-radius: 10px; padding: 10px 12px; }
.practice-feedback.ok { background: var(--green-bg); }
.practice-feedback.bad { background: var(--red-bg); }
.practice-feedback p { margin: 4px 0; }

/* ---------- footer ---------- */
.footer { color: var(--muted); font-size: 0.82rem; text-align: center; padding: 18px 20px calc(24px + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; }
.noscript { text-align: center; padding: 20px; }

@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .tabs { order: 3; width: 100%; margin-inline-start: 0; }
  .lang { margin-inline-start: auto; }
  .actions .btn-primary { flex: 1 1 100%; }
  .actions .btn:not(.btn-primary):not(.btn-link) { flex: 1 1 0; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
