:root {
  color-scheme: light;
  --ink: #20182e;
  --muted: #50445f;
  --canvas: #f1edf7;
  --border: #e1d6ee;
  --accent: #6535a6;
  --accent-dark: #422072;
  --tint: #f3eafa;
  --shell: 430px;
  --gutter: 12px;
  --radius: 11px;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 77px; }
body {
  margin: 0;
  font: 1rem/1.6 "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
h1, h2, h3 { line-height: 1.19; margin: 0 0 .55em; letter-spacing: -.025em; overflow-wrap: anywhere; }
h1 { font-size: 1.68rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .85rem; }
p:last-child { margin-bottom: 0; }
a { color: var(--accent-dark); text-underline-offset: 3px; }
a:hover { color: #371561; }
:focus-visible { outline: 3px solid #9751cf; outline-offset: 3px; }
button, input { font: inherit; }
img { max-width: 100%; height: auto; }
.skip { position: fixed; top: 8px; left: 8px; z-index: 6; padding: .6rem .8rem; background: white; transform: translateY(-160%); }
.skip:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 4;
  width: min(100%, var(--shell));
  margin-inline: auto;
  border: 1px solid var(--border);
  border-top: 0;
  background: #fff;
}
.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 58px;
  padding: 6px var(--gutter);
}
.brand { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; margin-right: auto; color: var(--ink); text-decoration: none; font-size: 1.04rem; font-weight: 780; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.home-link, .menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 7px 12px;
  border-radius: 9px;
  color: var(--ink);
  font-size: .89rem;
  font-weight: 700;
  text-decoration: none;
}
.home-link { background: #dac5f3; color: #371657; }
.home-link:hover { background: #d0b4ef; }
.menu-toggle { width: 44px; cursor: pointer; list-style: none; }
.menu-toggle::-webkit-details-marker, .menu-group > summary::-webkit-details-marker, .contents > summary::-webkit-details-marker { display: none; }
.menu-icon { display: grid; gap: 4px; }
.menu-icon i { display: block; width: 19px; height: 2px; background: currentColor; }
.main-menu[open] > .menu-toggle { background: var(--tint); }
.main-menu[open] .menu-icon i:first-child { transform: translateY(6px) rotate(45deg); }
.main-menu[open] .menu-icon i:nth-child(2) { opacity: 0; }
.main-menu[open] .menu-icon i:last-child { transform: translateY(-6px) rotate(-45deg); }
.menu-panel {
  position: absolute;
  top: calc(100% + 4px);
  inset-inline: var(--gutter);
  max-height: calc(100vh - 77px);
  max-height: calc(100dvh - 77px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: white;
  box-shadow: 0 15px 35px #35134d25;
}
.menu-panel ul { margin: 0; padding: 0; list-style: none; }
.menu-panel a, .menu-group > summary {
  display: flex; align-items: center; min-height: 44px; padding: 8px 10px;
  color: var(--ink); border-radius: 7px; text-decoration: none; font-weight: 650; font-size: .92rem;
}
.menu-panel li + li, .menu-group { border-top: 1px solid var(--border); }
.menu-panel a:hover, .menu-group > summary:hover, .menu-panel a[aria-current="page"], .menu-panel .menu-topics { background: var(--tint); }
.menu-group > summary { justify-content: space-between; gap: 8px; cursor: pointer; list-style: none; }
.menu-group > summary::after, .answer summary::after, .contents > summary::after {
  content: ""; flex: 0 0 7px; height: 7px; margin-right: 3px;
  border: solid var(--accent); border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg);
}
.menu-group[open] > summary::after, .answer[open] summary::after, .contents[open] > summary::after { transform: translateY(2px) rotate(225deg); }
.menu-group ul { background: #fbf8fd; border-radius: 8px; }

main, .site-footer { width: min(100%, var(--shell)); margin-inline: auto; border-inline: 1px solid var(--border); background: #fff; }
main { padding: var(--gutter); }
.panel {
  margin-bottom: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.hero {
  display: grid;
  gap: 12px;
  padding: 16px;
}
.hero h1 { max-width: 22ch; margin-bottom: .43em; font-size: clamp(1.43rem, 5.9vw, 1.68rem); letter-spacing: -.028em; }
.hero-copy > p { color: var(--muted); font-size: .94rem; }
.hero-copy > .eyebrow { margin-bottom: 12px; font-size: .78rem; }
.hero-logo { display: block; width: 66px; height: 66px; margin-bottom: 14px; border-radius: 15px; }
.eyebrow { font-size: .84rem; color: var(--muted); font-weight: 700; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; font-size: .89rem; }
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 8px 14px; border: 1px solid transparent;
  border-radius: 10px; font-weight: 750; text-decoration: none; text-align: center;
}
.button-primary { background: var(--accent-dark); color: #fff; }
.button-primary:hover { background: #2b124d; color: #fff; }
.button-secondary { background: var(--tint); color: var(--accent-dark); }
.hero-register {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 1px; min-height: 60px; padding: 8px 14px;
  border-color: #6c49a0; background: linear-gradient(110deg, #261639, #42265f);
  color: white; text-align: left; box-shadow: 0 3px 8px #38215c28;
}
.hero-register span { color: #ede0ff; font-size: .8rem; font-weight: 550; }
.hero-register:hover { background: #4c286e; color: white; }
.telegram-guide { display: flex; align-items: center; justify-content: center; min-height: 44px; margin-top: 8px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fbf8fe; font-size: .89rem; font-weight: 650; text-decoration: none; }
.hero-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 0; padding: 0; list-style: none; }
.hero-facts a { display: grid; height: 100%; min-height: 57px; align-content: center; gap: 1px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; background: #fbf8fe; color: var(--ink); text-decoration: none; }
.hero-facts a:hover { background: var(--tint); }
.hero-facts span { color: var(--muted); font-size: .78rem; }
.hero-facts strong { font-size: .93rem; }
.invite {
  display: grid;
  align-content: center;
  gap: 8px;
  border-color: #d9c6ed;
  background: #f7effc;
}
.invite h2, .quick-guides h2 { margin-bottom: 0; }
.hero .invite { margin: 0; padding: 10px 12px; }
.hero .invite h2 { font-size: .88rem; }
.invite-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.invite-heading a { display: inline-flex; align-items: center; min-height: 44px; font-size: .78rem; }
.invite-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.invite-code {
  padding: 8px 6px 8px 0;
  color: var(--accent-dark);
  font: 800 1.4rem/1.2 ui-monospace, monospace;
  overflow-wrap: anywhere;
  user-select: all;
}
.copy-button { background: var(--accent-dark); color: white; cursor: pointer; font-size: .88rem; }
.copy-button[hidden] { visibility: hidden; }
.copy-button:hover { background: #553186; }
.copy-button[data-copied] { color: #245f3e; background: #e1f5e9; }
.copy-status { min-height: 1.6em; margin: 0; color: var(--muted); font-size: .88rem; }

.link-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; padding: 0; margin: 10px 0 0; list-style: none; }
.link-grid a {
  display: flex; align-items: center;
  min-height: 46px; height: 100%; padding: 7px 0;
  border-top: 1px solid var(--border);
  font-size: .93rem; font-weight: 650; text-decoration: none; overflow-wrap: anywhere;
}
.link-grid a:hover { text-decoration: underline; }
.quick-guides h2 { font-size: 1.12rem; }
.home-main > .panel:not(.hero) > h2 { padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.guide-steps { padding-left: 1.35rem; }
.guide-steps li + li { margin-top: 7px; }
.topic-group + .topic-group { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.topic-group h3 { color: var(--muted); }
.contents { padding-block: 4px; }
.contents > summary { display: flex; justify-content: space-between; align-items: center; min-height: 44px; cursor: pointer; list-style: none; font-size: 1.05rem; font-weight: 750; }
.contents ol { margin: 0 0 8px; padding: 0; list-style: none; }
.contents li { border-top: 1px solid var(--border); }
.contents a { display: flex; min-height: 44px; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: .91rem; font-weight: 600; }
.contents a span { flex: 0 0 25px; border-radius: 6px; background: var(--tint); color: var(--accent-dark); text-align: center; font-size: .8rem; font-weight: 700; }
.contents a:hover { color: var(--accent-dark); text-decoration: underline; }

.app-details { margin: 0 0 12px; }
.app-details div { display: grid; grid-template-columns: minmax(80px, 1fr) 2.1fr; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.app-details dt { color: var(--muted); font-weight: 650; }
.app-details dd { margin: 0; overflow-wrap: anywhere; }
.panel details.answer { margin-top: 7px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: #fcfaff; }
.answer summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; gap: 8px; color: var(--ink); font-weight: 650; list-style: none; cursor: pointer; }
.answer summary::-webkit-details-marker { display: none; }
.answer p { padding: 2px 0 10px; color: var(--muted); }
.screenshot { margin: 15px 0; }
.screenshot a { display: block; border-radius: 12px; }
.screenshot img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; border: 1px solid var(--border); border-radius: 12px; background: #f0e9fa; }
.screenshot figcaption { margin-top: 7px; color: var(--muted); font-size: .83rem; }

.breadcrumb { margin: 3px 0 14px; color: var(--muted); font-size: .86rem; }
.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.breadcrumb li + li::before { content: "/"; margin-right: 6px; color: #73677c; }
.article-body { overflow-wrap: anywhere; }
.article-body h2 { margin-top: 1.65rem; }
.article-body ul, .article-body ol { padding-left: 1.3rem; }
.article-body li + li { margin-top: .35rem; }
.byline { margin-block: 12px 16px; color: var(--muted); font-size: .86rem; }

.calculator-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.calculator-fields label { color: var(--ink); font-size: .9rem; font-weight: 650; }
.calculator-fields input {
  display: block; width: 100%; min-width: 0; min-height: 44px; margin-top: 5px; padding: 7px 9px;
  border: 1px solid #88759e; border-radius: 9px; background: white; color: var(--ink);
}
.calculator-result { margin-top: 14px; padding: 13px; border: 1px solid var(--border); border-radius: 11px; background: var(--tint); }
.calculator-result output { display: block; min-height: 1.4em; font-size: 1.8rem; font-weight: 850; line-height: 1.3; color: var(--accent-dark); }
.site-footer { border-top: 1px solid var(--border); padding: 18px var(--gutter) 84px; color: var(--muted); font-size: .88rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 2px 16px; margin: 6px 0 12px; }
.site-footer nav a { display: inline-flex; align-items: center; min-height: 42px; }
.badge-link { position: fixed; z-index: 3; right: max(12px, calc((100vw - var(--shell)) / 2 - 148px)); bottom: max(12px, env(safe-area-inset-bottom)); gap: 7px; box-shadow: 0 5px 16px #210e4433; }

@media (max-width: 600px) {
  .invite-row { justify-content: flex-start; }
  .badge-link { width: 46px; height: 46px; padding: 0; border-radius: 50%; }
  .badge-link span { display: none; }
}
@media (max-width: 345px) {
  :root { --gutter: 9px; }
  .panel { padding-inline: 12px; }
  .calculator-fields { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
  .hero-copy, .hero > .invite, .hero-facts { animation: settle-in 330ms cubic-bezier(.22,.75,.28,1) both; }
  .hero > .invite { animation-delay: 55ms; }
  .hero-facts { animation-delay: 100ms; }
  .main-menu[open] > .menu-panel { animation: panel-in 180ms ease-out; }
  .menu-icon i { transition: transform 160ms ease, opacity 160ms ease; }
  .menu-group[open] > ul, .answer[open] > p, .contents[open] > nav { animation: panel-in 170ms ease-out; }
  .menu-group > summary::after, .answer summary::after, .contents > summary::after { transition: transform 170ms ease; }
  .button, .link-grid a, .screenshot img { transition: transform 170ms ease; }
  .button:active, .link-grid a:active { transform: scale(.98); }
  .screenshot.is-visible { animation: settle-in 280ms ease-out; }
  .copy-button[data-copied] { animation: copy-feedback 220ms ease-out; }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .screenshot a:hover img { transform: translateY(-2px); }
}
@keyframes panel-in {
  from { opacity: .72; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes settle-in {
  from { opacity: .74; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes copy-feedback {
  50% { transform: scale(1.035); }
}
