:root {
  --bg-1: #eef3ff;
  --bg-2: #e6ebfb;
  --bg-3: #fff2e6;
  --dots: rgba(59, 91, 255, .12);
  --surface: #ffffff;
  --text: #1b2140;
  --muted: #59607e;
  --ink: #1b2140;
  --accent: #ff7a1a;
  --accent-2: #3b5bff;
  --accent-text: #ffffff;
  --bot: #ffffff;
  --mark: #ffd23f;
  --c1: #ffe0c7;
  --c2: #d9e3ff;
  --c3: #ffd9e3;
  --spark-1: #ff7a1a;
  --spark-2: #3b5bff;
  --shadow: 5px 5px 0 var(--ink);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-1: #0f1428;
    --bg-2: #131a35;
    --bg-3: #1d1526;
    --dots: rgba(90, 120, 255, .12);
    --surface: #182042;
    --text: #edf1ff;
    --muted: #a6afd6;
    --ink: #5b7cff;
    --accent: #ff8a33;
    --accent-2: #7d96ff;
    --accent-text: #120d05;
    --bot: #1f2950;
    --mark: #3b5bff;
    --c1: #4a2a14;
    --c2: #1c2c5c;
    --c3: #4a1f33;
    --spark-1: #ff8a33;
    --spark-2: #7d96ff;
    --shadow: 5px 5px 0 var(--ink);
  }
}

* { box-sizing: border-box; }

html { background: var(--bg-2); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 16px/1.55 "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(var(--dots) 1.6px, transparent 1.7px) 0 0 / 18px 18px,
    linear-gradient(135deg, var(--bg-1), var(--bg-2) 50%, var(--bg-3));
  background-attachment: fixed;
  overflow-x: hidden;
}

h1, h2, .logo, .chat-head strong, .bubble, .langs button, .chat-form button {
  font-family: "M PLUS Rounded 1c", "Nunito", system-ui, sans-serif;
}

a { color: var(--accent-2); font-weight: 700; }

.petals { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.petal {
  position: absolute;
  top: -40px;
  width: 12px;
  height: 12px;
  background: var(--spark-1);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  opacity: .7;
  animation: fall linear infinite;
}
.petal:nth-child(even) { background: var(--spark-2); }
@keyframes fall {
  0%   { transform: translate(0, -40px) rotate(0deg); }
  50%  { transform: translate(40px, 50vh) rotate(180deg); }
  100% { transform: translate(-20px, 105vh) rotate(360deg); }
}

.top, .layout { position: relative; z-index: 1; }

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

.logo { font-weight: 800; font-size: 22px; color: var(--text); text-decoration: none; }
.logo span { color: var(--accent); }
.logo i { font-style: normal; color: var(--accent-2); display: inline-block; margin-left: 4px; animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); opacity: 1; } 50% { transform: scale(1.35) rotate(45deg); opacity: .6; } }

.langs { display: flex; gap: 6px; }
.langs button {
  border: 2px solid var(--ink);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s;
}
.langs button:hover { transform: translateY(-2px); }
.langs button.active { background: var(--accent); color: var(--accent-text); box-shadow: 2px 2px 0 var(--ink); }

.layout {
  max-width: 1160px;
  margin: 0 auto;
  padding: 8px 16px 48px;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 44px;
  align-items: start;
}

.hero { display: flex; align-items: center; gap: 14px; }
.hero-mascot { width: 104px; height: 104px; flex: none; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }

.bubble {
  position: relative;
  margin: 0;
  background: var(--surface);
  border: 2.5px solid var(--ink);
  border-radius: 18px;
  padding: 8px 16px;
  font-weight: 800;
  box-shadow: 3px 3px 0 var(--ink);
}
.bubble::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  width: 16px;
  height: 16px;
  background: var(--surface);
  border-left: 2.5px solid var(--ink);
  border-bottom: 2.5px solid var(--ink);
  transform: translateY(-50%) rotate(45deg);
}

h1 { font-size: 40px; line-height: 1.2; margin: 18px 0 14px; font-weight: 800; }
.mark {
  background: linear-gradient(transparent 62%, var(--mark) 62%, var(--mark) 92%, transparent 92%);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.lead { color: var(--muted); font-size: 18px; margin: 0 0 26px; }

.cards { display: grid; gap: 14px; }
.card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--surface);
  border: 2.5px solid var(--ink);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translate(-2px, -3px) rotate(-.6deg); box-shadow: 8px 8px 0 var(--ink); }
.card h2 { font-size: 18px; margin: 0 0 4px; }
.card p { margin: 0; color: var(--muted); }
.icon {
  flex: none;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  font-size: 23px;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
}
.c1 .icon { background: var(--c1); }
.c2 .icon { background: var(--c2); }
.c3 .icon { background: var(--c3); }
.card-link { display: inline-block; margin-top: 8px; }

.contacts { margin-top: 26px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }

.chat {
  background: var(--surface);
  border: 2.5px solid var(--ink);
  border-radius: 20px;
  box-shadow: 8px 8px 0 var(--ink);
  display: flex;
  flex-direction: column;
  height: min(680px, calc(100vh - 110px));
  position: sticky;
  top: 16px;
  overflow: hidden;
}

.chat-head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 2.5px solid var(--ink);
  background:
    repeating-linear-gradient(115deg, transparent 0 14px, rgba(255, 255, 255, .22) 14px 17px),
    linear-gradient(90deg, var(--c2), var(--c1));
}
.chat-head > div:last-child { display: grid; gap: 1px; }
.chat-head strong { font-size: 17px; }
.chat-head small { color: var(--muted); font-size: 12px; }
.avatar {
  width: 48px;
  height: 48px;
  flex: none;
  background: var(--surface);
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  overflow: hidden;
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: radial-gradient(var(--dots) 1.4px, transparent 1.5px) 0 0 / 16px 16px;
}

.msg {
  max-width: 88%;
  padding: 10px 14px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: pop .22s ease-out;
}
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-text);
  border-bottom-right-radius: 4px;
  box-shadow: 3px 3px 0 var(--ink);
}
.msg.bot { align-self: flex-start; background: var(--bot); border-bottom-left-radius: 4px; box-shadow: 3px 3px 0 var(--ink); }
.msg.bot ul { margin: 4px 0; padding-left: 20px; white-space: normal; }

.typing { display: inline-flex; gap: 5px; padding: 4px 2px; }
.typing span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: hop 1s ease-in-out infinite; }
.typing span:nth-child(2) { animation-delay: .15s; background: var(--accent-2); }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-7px); } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 16px 12px; }
.chips button {
  border: 2px solid var(--ink);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform .12s;
}
.chips button:hover { transform: translateY(-2px) rotate(-1deg); }

.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 2.5px solid var(--ink); }
.chat-form textarea {
  flex: 1;
  resize: none;
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 10px 12px;
  font: inherit;
  background: var(--bg-1);
  color: var(--text);
  max-height: 140px;
}
.chat-form textarea:focus { outline: 3px solid var(--accent); outline-offset: 1px; }
.chat-form button {
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 0 18px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .1s, box-shadow .1s;
}
.chat-form button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.chat-form button:disabled { opacity: .55; cursor: default; }

.mascot .eye { transform-box: fill-box; transform-origin: center; animation: blink 4.5s infinite; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }

@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; gap: 30px; }
  h1 { font-size: 30px; }
  .hero-mascot { width: 84px; height: 84px; }
  .chat { position: static; height: 580px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .petals { display: none; }
}