:root {
  --ink: #1b1b1b;
  --paper: #fbf8f1;
  --yellow: #ffd23f;
  --red: #e8453c;
  --blue: #2f6fe0;
  --green: #2a9d63;
  --purple: #8358d6;
  --orange: #f28a2e;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Rubik", Arial, sans-serif;
  font-size: 18px;
  line-height: 1.55;
}
.wrap { max-width: 980px; margin: 0 auto; padding: 0 24px; }
mark { background: linear-gradient(transparent 55%, var(--yellow) 55%); color: inherit; padding: 0 2px; }
button, input { font: inherit; }

/* Шапка */
.hero { background: var(--yellow); padding: 60px 0 50px; }
.sticker {
  display: inline-block;
  background: var(--ink);
  color: var(--yellow);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: .06em;
  padding: 6px 12px;
  transform: rotate(-3deg);
}
h1 {
  font-size: clamp(44px, 9vw, 104px);
  font-weight: 900;
  line-height: .95;
  margin: 18px 0 16px;
  letter-spacing: -.02em;
}
.subtitle { font-size: 22px; max-width: 620px; margin: 0; }
.hero mark { background: linear-gradient(transparent 55%, #fff 55%); }
.hazard {
  height: 18px;
  background: repeating-linear-gradient(-45deg, var(--ink) 0 18px, var(--yellow) 18px 36px);
}

/* Разделы */
section { padding: 56px 0 10px; }
h2 { font-size: 36px; font-weight: 900; margin: 0 0 20px; display: flex; align-items: baseline; gap: 14px; }
.num { font-size: 18px; font-weight: 700; color: #fff; background: var(--red); padding: 2px 8px; }
h3 { font-size: 22px; margin: 0 0 8px; }

.big { font-size: 22px; max-width: 760px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 26px; }
.fact { padding: 18px; border: 2px solid var(--ink); background: #fff; font-size: 16px; }
.fact b { display: block; font-size: 30px; font-weight: 900; line-height: 1.1; margin-bottom: 6px; }
.f1 b { color: var(--red); }
.f2 b { color: var(--blue); }
.f3 b { color: var(--green); }

/* Угрозы */
.threats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.threat { background: #fff; border: 2px solid var(--ink); border-top-width: 10px; padding: 18px 20px; }
.threat p { margin: 0 0 10px; font-size: 16px; }
.threat .defense { margin: 0; padding-top: 10px; border-top: 1px dashed #aaa; }
.t-red { border-top-color: var(--red); }
.t-blue { border-top-color: var(--blue); }
.t-green { border-top-color: var(--green); }
.t-yellow { border-top-color: var(--yellow); }
.t-purple { border-top-color: var(--purple); }
.t-orange { border-top-color: var(--orange); }

/* Найди подвох */
.spot { display: grid; grid-template-columns: 360px 1fr; gap: 30px; align-items: start; margin-top: 18px; }
.phone { background: #e9e6df; border: 2px solid var(--ink); border-radius: 26px; padding: 18px 16px 26px; }
.phone-top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 12px; }
.sender { font-weight: 700; }
.time { color: #666; }
.bubble { background: #fff; border-radius: 16px 16px 16px 4px; padding: 14px; font-size: 16px; }
.flag { cursor: pointer; border-bottom: 2px dotted #999; }
.flag:hover { background: #fff3c4; }
.flag.found { background: #ffd9d6; border-bottom: 2px solid var(--red); }
.link { color: var(--blue); text-decoration: underline; border-bottom: none; }
.score { font-weight: 700; margin-top: 0; }
.spot-list { padding-left: 22px; margin: 0; }
.spot-list li { margin-bottom: 10px; font-size: 16px; }
.spot-list li b { color: var(--red); }

/* Пароль */
.pw-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: start; }
.example { display: inline-block; font-family: "Courier New", monospace; font-weight: 700; font-size: 22px; background: var(--ink); color: var(--yellow); padding: 6px 12px; margin: 0; }
.note { font-size: 15px; color: #666; }
.pw-box { background: #fff; border: 2px solid var(--ink); padding: 20px; box-shadow: 6px 6px 0 var(--blue); }
.pw-box label { font-weight: 700; }
.pw-input { display: flex; gap: 8px; margin: 10px 0 14px; }
.pw-input input, .chat-form input { flex: 1; min-width: 0; padding: 9px 11px; border: 2px solid var(--ink); background: #fff; font-size: 17px; }
.pw-input input:focus, .chat-form input:focus { outline: 3px solid var(--yellow); }
.pw-input button, .quiz .next, .quiz .again, .chat-form button {
  border: 2px solid var(--ink); background: var(--yellow); font-weight: 700; padding: 8px 14px; cursor: pointer;
}
.pw-input button:hover, .quiz .next:hover, .chat-form button:hover { background: #ffc400; }
.meter { height: 12px; background: #eee; border: 2px solid var(--ink); }
#pw-bar { height: 100%; width: 0; transition: width .25s, background .25s; }
.pw-label { font-weight: 900; font-size: 20px; margin: 12px 0 0; }
.pw-time { margin: 2px 0; color: #555; font-size: 16px; }
.pw-hints { color: #555; font-size: 15px; margin: 8px 0 0; padding-left: 20px; }

/* Правила */
.tips { columns: 2; column-gap: 40px; padding-left: 0; list-style: none; counter-reset: t; }
.tips li { counter-increment: t; break-inside: avoid; margin-bottom: 14px; padding-left: 46px; position: relative; }
.tips li::before {
  content: counter(t);
  position: absolute; left: 0; top: -2px;
  width: 32px; height: 32px; line-height: 30px; text-align: center;
  border: 2px solid var(--ink); border-radius: 50%;
  font-weight: 900; font-size: 15px; background: #fff;
}

/* Тест */
.quiz { background: #fff; border: 2px solid var(--ink); padding: 24px; max-width: 720px; box-shadow: 6px 6px 0 var(--green); }
.quiz .progress { font-size: 14px; color: #777; margin: 0 0 6px; font-weight: 500; }
.quiz .q { font-size: 21px; font-weight: 700; margin-bottom: 14px; }
.quiz .opts { display: grid; gap: 10px; }
.quiz .opt { text-align: left; background: #fff; border: 2px solid var(--ink); padding: 10px 14px; cursor: pointer; font-size: 17px; }
.quiz .opt:hover:not(:disabled) { background: #fff7d6; }
.quiz .opt:disabled { cursor: default; color: var(--ink); }
.quiz .opt.right { background: #d4f0df; border-color: var(--green); }
.quiz .opt.wrong { background: #fbd9d6; border-color: var(--red); }
.quiz .explain { margin: 14px 0; color: #444; }
.quiz .result { font-size: 28px; font-weight: 900; margin: 0 0 6px; }

.about { padding-bottom: 60px; }
.author { font-weight: 500; color: #555; }
.footer { background: var(--ink); color: var(--yellow); padding: 26px 0 90px; font-weight: 700; }

/* Чат */
.chat-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 5;
  background: var(--ink); color: var(--yellow); border: 2px solid var(--yellow);
  padding: 12px 18px; font-weight: 700; cursor: pointer;
  box-shadow: 4px 4px 0 var(--yellow);
}
.chat-fab:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--yellow); }
.chat-fab[hidden] { display: none; }

.chat {
  background: #fff; border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--ink);
  display: flex; flex-direction: column; font-size: 16px; min-width: 0;
}
.chat.inline { width: 100%; height: 100%; }
.chat.inline .chat-head button { display: none; }
.chat.floating {
  position: fixed; right: 20px; bottom: 20px; z-index: 6;
  width: min(390px, calc(100vw - 40px)); height: min(540px, calc(100vh - 40px));
}
.chat.closed { display: none; }

.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; align-items: center; }
.hero-slot { height: 380px; }
.hero-slot:empty { display: none; }
.hero .chat { box-shadow: 8px 8px 0 var(--ink); }
.ask { padding-bottom: 70px; }
.bottom-slot { height: min(520px, 75vh); max-width: 760px; margin-top: 20px; }

.chat-suggest[hidden] { display: none; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--yellow); border-bottom: 2px solid var(--ink); font-weight: 700; }
.chat-head small { font-weight: 400; font-size: 13px; margin-left: 4px; }
.chat-head button { border: none; background: none; font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 9px 12px; white-space: pre-wrap; overflow-wrap: anywhere; border: 2px solid var(--ink); }
.msg.bot { align-self: flex-start; background: #f3f1ec; }
.msg.user { align-self: flex-end; background: var(--yellow); }
.msg.typing { color: #888; }
.msg.error { background: #fbd9d6; border-color: var(--red); }
.chat-suggest { padding: 0 14px 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.chat-suggest button { border: 2px solid var(--ink); background: #fff; padding: 4px 10px; font-size: 14px; cursor: pointer; }
.chat-suggest button:hover { background: #fff7d6; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 2px solid var(--ink); }
.chat-form button:disabled { opacity: .5; cursor: wait; }

@media (max-width: 899px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .chat.floating { right: 10px; bottom: 10px; left: 10px; width: auto; height: min(560px, calc(100dvh - 20px)); }
  .footer { padding-bottom: 90px; }
}
@media (min-width: 900px) {
  h1 { font-size: clamp(40px, 5.4vw, 72px); }
}

@media (max-width: 760px) {
  .facts, .threats, .spot, .pw-wrap { grid-template-columns: 1fr; }
  .tips { columns: 1; }
  h2 { font-size: 28px; }
}

/* Защита от горизонтальной прокрутки на узких экранах */
html, body { overflow-x: hidden; }
.facts > *, .threats > *, .spot > *, .pw-wrap > * { min-width: 0; }
.example { max-width: 100%; overflow-wrap: anywhere; }
.bubble, .threat, .fact { overflow-wrap: break-word; }
@media (max-width: 760px) {
  .spot { grid-template-columns: minmax(0, 1fr); }
  .pw-box { box-shadow: 4px 4px 0 var(--blue); }
}
@media (max-width: 420px) {
  .wrap { padding: 0 14px; }
  .pw-input { flex-wrap: wrap; }
}
