/* ==========================================================================
   Соловушка 2026 — общие стили
   Палитра взята из эмблемы турнира: синий, красный, золото на тёплом фоне.
   ========================================================================== */

:root {
  --blue: #1f3d8f;
  --blue-600: #2a4fb3;
  --blue-50: #eef2fc;
  --red: #d33a2c;
  --red-600: #b92b1f;
  --red-50: #fdeeec;
  --gold: #f1b83a;
  --gold-50: #fff6df;
  --green: #22995a;
  --green-50: #e7f6ee;
  --ink: #1d2433;
  --ink-2: #4a5468;
  --ink-3: #7b8498;
  --line: #e6e1d6;
  --paper: #fffdf8;
  --bg: #f7f2e8;
  --card: #ffffff;
  --shadow-sm: 0 1px 2px rgba(29, 36, 51, .06), 0 2px 8px rgba(29, 36, 51, .05);
  --shadow: 0 2px 6px rgba(29, 36, 51, .06), 0 12px 32px rgba(29, 36, 51, .08);
  --shadow-lg: 0 20px 60px rgba(29, 36, 51, .18);
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 24px;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --header-h: 64px;
  /* народный орнамент-полоса */
  --ornament: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='12' viewBox='0 0 32 12'%3E%3Cg fill='none' stroke-width='2'%3E%3Cpath d='M0 6 L6 0 L12 6 L6 12 Z' stroke='%23d33a2c'/%3E%3Cpath d='M16 6 L22 0 L28 6 L22 12 Z' stroke='%231f3d8f'/%3E%3C/g%3E%3Cpath d='M12 6h4M28 6h4' stroke='%23f1b83a' stroke-width='2'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; display: block; }
a { color: var(--blue-600); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; font-weight: 900; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.ornament { height: 12px; background: var(--ornament) repeat-x center / 32px 12px; opacity: .9; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

/* ---------- Кнопки ---------- */
.btn {
  --b: var(--blue);
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: .7em 1.4em;
  border: 2px solid transparent; border-radius: 999px;
  background: var(--b); color: #fff;
  font-weight: 800; font-size: 1rem; text-decoration: none; line-height: 1.1;
  transition: transform .15s var(--ease), box-shadow .2s, background .2s, opacity .2s;
  box-shadow: 0 4px 0 rgba(0,0,0,.12);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(31,61,143,.25); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(0,0,0,.12); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-red { --b: var(--red); }
.btn-red:hover { box-shadow: 0 6px 14px rgba(211,58,44,.3); }
.btn-gold { --b: var(--gold); color: var(--ink); }
.btn-green { --b: var(--green); }
.btn-ghost { background: transparent; color: var(--blue); border-color: currentColor; box-shadow: none; }
.btn-ghost:hover { background: var(--blue-50); box-shadow: none; }
.btn-light { background: #fff; color: var(--ink); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn-sm { min-height: 38px; padding: .45em 1em; font-size: .9rem; }
.btn-lg { min-height: 58px; padding: .85em 1.8em; font-size: 1.1rem; }
.btn-block { width: 100%; }
.btn svg { width: 1.2em; height: 1.2em; flex: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: 50%; border: 0; background: var(--blue-50); color: var(--blue);
  transition: background .2s, transform .15s;
}
.icon-btn:hover { background: #dfe6fa; }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- Шапка ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 253, 248, .92);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 16px; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand img { width: 44px; height: 44px; }
.brand b { display: block; font-size: 1.15rem; font-weight: 900; color: var(--red); line-height: 1; }
.brand small { display: block; font-size: .75rem; color: var(--ink-3); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { padding: 8px 12px; border-radius: 999px; color: var(--ink-2); font-weight: 700; text-decoration: none; font-size: .95rem; }
.nav a:hover { background: var(--blue-50); color: var(--blue); }
.header-cta { margin-left: 8px; }
.menu-btn { display: none; margin-left: auto; }
@media (max-width: 900px) {
  .nav, .header-cta { display: none; }
  .menu-btn { display: inline-grid; }
  .nav.open {
    display: flex; flex-direction: column; position: absolute; top: var(--header-h); left: 0; right: 0;
    background: var(--paper); padding: 12px 20px 20px; border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
  }
  .nav.open a { padding: 12px; font-size: 1.05rem; }
}

/* ---------- Карточки, бейджи ---------- */
.card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px; font-size: .85rem; font-weight: 800;
  background: var(--blue-50); color: var(--blue);
}
.badge-red { background: var(--red-50); color: var(--red); }
.badge-gold { background: var(--gold-50); color: #8a5a00; }
.badge-green { background: var(--green-50); color: var(--green); }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge .dot.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------- Формы ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 800; font-size: .92rem; margin-bottom: 6px; color: var(--ink-2); }
.field > span i { color: var(--red); font-style: normal; }
.field small { display: block; color: var(--ink-3); font-size: .82rem; margin-top: 4px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 12px 14px;
  border: 2px solid var(--line); border-radius: 12px; background: #fff;
  font-size: 1rem; transition: border-color .2s, box-shadow .2s;
  appearance: none; -webkit-appearance: none;
}
textarea.input { min-height: 110px; resize: vertical; }
.input:focus { outline: none; border-color: var(--blue-600); box-shadow: 0 0 0 4px rgba(42,79,179,.15); }
.field.has-error .input { border-color: var(--red); }
.field .err { display: none; color: var(--red); font-size: .85rem; font-weight: 700; margin-top: 4px; }
.field.has-error .err { display: block; }
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%234a5468' stroke-width='2' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: .92rem; color: var(--ink-2); }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--blue); flex: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg); padding: 4px; border-radius: 14px; gap: 4px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: block; text-align: center; padding: 10px 8px; border-radius: 10px; font-weight: 800; color: var(--ink-2); cursor: pointer; transition: background .2s, color .2s; }
.seg input:checked + span { background: #fff; color: var(--blue); box-shadow: var(--shadow-sm); }
.seg input:focus-visible + span { outline: 3px solid var(--gold); }

/* ---------- Диалог ---------- */
dialog.modal {
  width: min(640px, calc(100% - 24px)); max-height: calc(100dvh - 24px);
  padding: 0; border: 0; border-radius: var(--r-lg); background: var(--paper); color: var(--ink);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
dialog.modal::backdrop { background: rgba(20, 26, 40, .55); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: pop .25s var(--ease); display: flex; flex-direction: column; }
@keyframes pop { from { transform: translateY(16px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line); background: #fff; }
.modal-head img { width: 52px; height: 52px; }
.modal-head h2 { font-size: 1.25rem; margin: 0; }
.modal-head p { margin: 0; color: var(--ink-3); font-size: .9rem; font-weight: 700; }
.modal-head .icon-btn { margin-left: auto; }
/* шапка и кнопки всегда на виду, прокручивается только середина окна */
dialog.modal > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; margin: 0; }
.modal-head, .modal-foot { flex: none; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1 1 auto; min-height: 0; overscroll-behavior: contain; }
.modal-foot { padding: 16px 20px; border-top: 1px solid var(--line); background: #fff; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 600px) {
  dialog.modal { width: 100%; max-width: none; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; }
  .modal-foot .btn { flex: 1; }
}

/* ---------- Тосты ---------- */
.toasts { position: fixed; z-index: 200; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100% - 24px)); pointer-events: none; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 700; box-shadow: var(--shadow-lg);
  animation: toastIn .3s var(--ease); pointer-events: auto; display: flex; gap: 10px; align-items: center;
}
.toast.warn { background: var(--red); }
.toast.ok { background: var(--green); }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } }

/* ---------- Подвал ---------- */
.site-footer { background: var(--blue); color: #dfe6fa; padding: 40px 0 28px; margin-top: 60px; }
.site-footer a { color: #fff; }
.site-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 28px; }
.site-footer h4 { color: #fff; font-size: 1rem; margin-bottom: 10px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: .95rem; }
.site-footer .copy { margin-top: 28px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.15); font-size: .85rem; color: #aebce6; }
@media (max-width: 760px) { .site-footer .cols { grid-template-columns: 1fr; } }

/* ---------- Утилиты ---------- */
.muted { color: var(--ink-3); }
.center { text-align: center; }
.stack > * + * { margin-top: 12px; }
.hidden { display: none !important; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--blue-50); border-top-color: var(--blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Год единства народов России (2026), цвета из брендбука ---------- */
:root { --unity-blue: #2134a0; --unity-red: #de2726; }
.unity { display: inline-flex; align-items: center; text-decoration: none; flex: none; }
.unity.has-logo { background: #fff; padding: 12px 14px; border-radius: 14px; }
.unity img { display: block; height: 200px; width: auto; }
.unity-text { display: flex; align-items: center; gap: 7px; line-height: 1.05; }
.unity-text b { font-size: 1.2rem; font-weight: 900; color: var(--unity-red); letter-spacing: -.01em; }
.unity-text b i { font-style: normal; color: var(--unity-blue); }
.unity-text small { font-size: .62rem; font-weight: 800; color: var(--unity-blue); text-transform: uppercase; letter-spacing: .02em; }
.unity-header { margin-left: 2px; padding-left: 14px; border-left: 1px solid var(--line, #e3e7f0); }
@media (max-width: 1100px) { .unity-header { display: none; } }
.unity-hero { position: absolute; left: -28px; bottom: -18px; box-shadow: 0 10px 28px rgba(31,61,143,.18); }
@media (max-width: 860px) { .unity-hero img { height: 128px; } .unity-hero { left: -14px; bottom: -18px; padding: 8px 9px; border-radius: 12px; } }
.site-footer .foot-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-top: 26px; }
.site-footer .foot-bottom .btn { color: var(--blue); }
.unity-footer { background: #fff; padding: 8px 14px; border-radius: 12px; }

/* Ритм и адаптация для страниц турнира. */
.wrap { padding-left: clamp(16px, 3vw, 24px); padding-right: clamp(16px, 3vw, 24px); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field, .grid-2 > *, .adm-head > *, .adm-cols > * { min-width: 0; }
.field > span, .inst-field > label:first-child { line-height: 1.35; }
.input { max-width: 100%; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* Регистрация: компактная прокручиваемая анкета, видимые действия. */
#reg { width: min(620px, calc(100% - 32px)); max-height: min(820px, calc(100vh - 32px)); max-height: min(820px, calc(100dvh - 32px)); }
#reg .modal-head { padding: 14px 20px; gap: 12px; }
#reg .modal-head img { width: 44px; height: 44px; object-fit: contain; }
#reg .modal-head > div { min-width: 0; }
#reg .modal-head h2 { font-size: 1.2rem; }
#reg .modal-head p { line-height: 1.3; }
#reg .modal-body { padding: 18px 20px; scrollbar-gutter: stable; }
#reg .modal-foot { padding: 12px 20px; }
#reg .modal-body .field { margin-bottom: 13px; }
#reg .modal-body .field > span, #reg .inst-field > label:first-child { margin-bottom: 5px; font-size: .9rem; }
#reg .input { min-height: 46px; padding-top: 9px; padding-bottom: 9px; font-size: 16px; }
#reg .teachers { margin-bottom: 14px; padding: 12px 14px 14px; }
#reg .teachers legend { margin-bottom: 8px; font-size: .95rem; }
#reg .teachers .field { margin-bottom: 9px; }
#reg .reg-privacy, #reg .reg-note { padding: 10px 12px; line-height: 1.45; font-size: .88rem; }
#reg .reg-privacy { margin-bottom: 14px; }
#reg .reg-note { margin-top: 2px; }
#reg .check { line-height: 1.45; }
#reg .check input { margin-top: 1px; }
@media (max-width: 600px) {
  #reg { width: 100%; height: 100vh; height: 100dvh; max-height: none; margin: 0; border-radius: 0; }
  #reg .modal-head { padding: max(10px, env(safe-area-inset-top)) 16px 10px; }
  #reg .modal-head img { width: 40px; height: 40px; }
  #reg .modal-body { padding: 14px 16px; }
  #reg .modal-foot { padding: 10px 16px max(10px, env(safe-area-inset-bottom)); flex-wrap: nowrap; }
  #reg .modal-foot .btn { min-width: 0; min-height: 44px; padding: .65em .8em; font-size: .9rem; }
  #reg .modal-foot .btn:first-child { flex: 0 0 auto; }
  #reg .modal-foot .btn:last-child { flex: 1 1 auto; }
}
@media (max-width: 350px) { #reg .modal-foot { flex-wrap: wrap; } #reg .modal-foot .btn { flex: 1 1 100%; } }

/* ---------- Баннеры скачивания приложения (RuStore / Google Play) ---------- */
.store-badges { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.store-badge {
  display: inline-flex; align-items: center; gap: 11px;
  min-height: 54px; padding: 9px 18px 9px 13px;
  border-radius: 14px; background: #141b2d; color: #fff;
  border: 1.5px solid rgba(255,255,255,.16);
  text-decoration: none; box-shadow: 0 6px 16px rgba(20,27,45,.18);
  transition: transform .18s var(--ease), box-shadow .2s, background .2s, border-color .2s;
  -webkit-tap-highlight-color: transparent;
}
.store-badge:hover { transform: translateY(-2px); background: #1c2640; border-color: rgba(255,255,255,.32); box-shadow: 0 10px 24px rgba(20,27,45,.26); }
.store-badge:active { transform: translateY(0); }
.store-ico { width: 30px; height: 30px; flex: none; display: block; }
.store-badge-text { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.store-badge-text small { font-size: .7rem; font-weight: 700; color: #c7d2f0; letter-spacing: .01em; }
.store-badge-text b { font-size: 1.08rem; font-weight: 900; color: #fff; letter-spacing: -.01em; margin-top: 2px; }
.store-badges-footer { gap: 10px; }
.store-badges-footer .store-badge { min-height: 46px; padding: 7px 14px 7px 11px; border-radius: 12px; border-color: rgba(255,255,255,.26); box-shadow: none; }
.store-badges-footer .store-ico { width: 24px; height: 24px; }
.store-badges-footer .store-badge-text b { font-size: .95rem; }
@media (max-width: 480px) {
  .store-badges { width: 100%; }
  .store-badge { flex: 1 1 160px; justify-content: center; }
  .store-badges-footer { width: auto; }
  .store-badges-footer .store-badge { flex: 0 1 auto; }
}
