/* Оформление портала (шапка, меню, карточки, календарь) — в духе нового дизайна bridgemoscow.ru */
:root {
  --ink: #006699; --link: #0c479d; --gold: #f2a900; --red: #c62828;
  --bg: #f2f5fa; --paper: #fff; --text: #1b3560; --muted: #5f7391; --rule: #d9e1ec; --tint: #eaf1fb;
  --res: #c5effa; --res-ink: #063e72; --teal-l: #bff0ea;
  --serif: Alegreya, Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Segoe UI", system-ui, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1717; --paper: #152221; --text: #e3e9f1; --muted: #92a0b4; --rule: #263b3a; --tint: #1b2f2f;
    --link: #8dbdff; --ink: #6fd6cc; --res: #17506a; --res-ink: #d2f1fb; --red: #ff8d8d;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.5 var(--sans); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
h1, h2, h3 { font-family: var(--serif); color: var(--ink); line-height: 1.15; font-variant-numeric: lining-nums; }
h1 { font-size: 2rem; margin: 22px 0 10px; font-weight: 800; }
h2 { font-size: 1.45rem; margin: 26px 0 8px; font-weight: 800; }
h3 { font-size: 1.15rem; font-weight: 700; }
main.wrap { padding-bottom: 48px; }

/* шапка и меню */
.hero { color: #fff; background: linear-gradient(#057275, #108b89 60%, #057f84); }
.brand { display: flex; align-items: center; gap: 14px; padding: 12px 0 10px; color: inherit; }
.brand:hover { text-decoration: none; }
.brand .suits { font: 700 1.9rem/1 var(--serif); letter-spacing: 3px; color: #ffa81f; text-shadow: 0 2px 5px rgba(0,0,0,.35); }
.brand .suits i { font-style: normal; color: #ffd0d0; }
.brand .title { color: #ffa81f; font: 800 clamp(1.4rem, 2.8vw, 2rem)/1.1 var(--serif); text-shadow: 0 2px 5px rgba(0,0,0,.35); }
.brand .sub { margin: 2px 0 0; color: var(--teal-l); font-size: .95rem; }
.menu { background: rgba(255,255,255,.14); border-top: 1px solid rgba(255,255,255,.4); border-bottom: 1px solid rgba(255,255,255,.4); }
.menu .wrap { display: flex; flex-wrap: wrap; align-items: center; }
.menu a, .menu button { display: flex; align-items: center; height: 46px; padding: 0 16px; color: #fff; font: 700 .95rem var(--sans);
  background: none; border: 0; border-bottom: 3px solid transparent; cursor: pointer; }
.menu a:hover, .menu button:hover { background: rgba(255,255,255,.22); border-bottom-color: var(--gold); text-decoration: none; }
.menu .spacer { flex: 1; }
.menu form { display: inline; margin: 0; }
.menu .who { padding: 0 8px; color: var(--teal-l); font-weight: 600; }

/* сообщения, формы, таблицы */
.msg { padding: 10px 14px; margin: 12px 0 0; background: #eaf6ea; border-left: 5px solid #4a4; border-radius: 4px; color: #17351a; }
.msg.error { background: #fbeaea; border-color: #c44; color: #4a1313; }
.errorlist { color: #b00; margin: 0; padding-left: 1rem; }
.muted { color: var(--muted); }
table { border-collapse: collapse; width: 100%; background: var(--paper); }
th, td { text-align: left; padding: 7px 12px; border-bottom: 1px solid var(--rule); }
th { font: 700 .85rem var(--sans); color: var(--ink); background: var(--tint); }
.num { text-align: right; }
form p { margin: 0 0 12px; }
input[type=text], input[type=password], input[type=email], input[type=date], input[type=number], input[type=url], select, textarea {
  font: inherit; padding: 6px 10px; border: 1.5px solid var(--rule); border-radius: 8px; background: var(--paper); color: var(--text); max-width: 100%; }
button, .btn { font: 600 .95rem var(--sans); padding: 7px 18px; border-radius: 999px; border: 0; background: var(--gold); color: #2a1d00; cursor: pointer; }
button:hover, .btn:hover { background: #ffc23d; text-decoration: none; }
.helptext { display: block; color: var(--muted); font-size: .88rem; }

/* карточки и список турниров с плиткой даты */
.card { background: var(--paper); border: 1px solid var(--rule); border-top: 4px solid var(--ink); padding: 4px 18px 12px; margin-top: 18px; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 4px 14px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.date { display: block; width: 88px; padding: 4px 6px 5px; text-align: center; background: var(--paper); border: 1.5px solid var(--ink);
  border-radius: 7px; line-height: 1.05; color: var(--ink); }
.date:hover { text-decoration: none; background: var(--tint); }
.date i { display: block; font: 700 .74rem/1 var(--sans); font-style: normal; opacity: .8; margin-bottom: 2px; }
.date b { font: 800 1.45rem/1 var(--serif); }
.date em { display: block; font-style: normal; font-size: .76rem; color: var(--muted); margin-top: 2px; }
.row .name { font-weight: 700; font-size: 1.05rem; }
.row .info { color: var(--muted); font-size: .92rem; margin-left: 8px; }
.row .where { color: var(--muted); font-size: .9rem; }
.row .where a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.more { margin: 10px 0 0; font-weight: 600; }

/* календарь результатов */
.years { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.years a, .years span { padding: 2px 12px; border: 1.5px solid var(--ink); border-radius: 999px; font-weight: 600; font-size: .9rem; color: var(--ink); }
.years .on { background: var(--ink); color: var(--paper); }
.years a:hover { background: var(--tint); text-decoration: none; }
.cals { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; margin-top: 14px; }
.cal { background: var(--paper); border: 1px solid var(--rule); border-top: 3px solid var(--ink); padding: 8px 12px 10px; }
.cal h3 { margin: 0 0 4px; display: flex; justify-content: space-between; align-items: baseline; }
.cal h3 small { font: 600 .8rem var(--sans); color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; font-size: .82rem; }
.grid i { font-style: normal; color: var(--ink); font-size: .68rem; font-weight: 700; padding: 3px 0; }
.grid span, .grid a { display: flex; align-items: center; justify-content: center; height: 28px; border-radius: 8px; color: var(--muted); }
.grid span.we { color: #b55a5a; }
.grid a { background: var(--res); color: var(--res-ink); font-weight: 800; position: relative; }
.grid a:hover { background: #8fdcf2; text-decoration: none; }
.grid a sup { position: absolute; top: 1px; right: 4px; font-size: .6rem; font-weight: 700; }
.grid .today { background: #fff3cc; color: #5a4300; font-weight: 800; }
.grid a.today { box-shadow: inset 0 0 0 2px var(--gold); background: var(--res); color: var(--res-ink); }
.filter { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0 0; font-size: .95rem; }
.filter .on { font-weight: 700; color: var(--text); }

@media (max-width: 640px) {
  body { font-size: 16px; }
  h1 { font-size: 1.6rem; }
  .menu a, .menu button { height: 42px; padding: 0 10px; }
  .row { grid-template-columns: 76px minmax(0, 1fr); }
  .date { width: 76px; }
  table { display: block; overflow-x: auto; }
}

/* карточка игрока */
.pc { display: flex; gap: 18px; align-items: flex-start; padding: 12px 0 4px; }
.pc-foto { flex: none; border-radius: 8px; border: 1px solid var(--rule); }
.pc-data { display: grid; grid-template-columns: max-content 1fr; gap: 3px 18px; margin: 0; align-items: baseline; }
.pc-data dt { color: var(--muted); font-size: .92rem; }
.pc-data dd { margin: 0; font-weight: 600; }

.pc-foto { width: 170px; height: auto; }
th a.sorted { color: var(--text); text-decoration: underline; }
th.num a { color: inherit; }
th.num a:hover { text-decoration: underline; }
@media (max-width: 520px) { .pc { flex-direction: column; } .pc-foto { width: 150px; } }

/* итоги соревнования */
.calc { margin: 8px 0; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.calc input[type=number] { width: 4.5em; }
td.counted { font-weight: 700; }
td.skipped { color: var(--muted); }
.table-scroll { overflow-x: auto; }

.sessions-nav { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sessions-nav .btn-s { padding: 2px 10px; border: 1.5px solid var(--ink); border-radius: 8px; font-weight: 600; font-size: .9rem; }
th.skipped, td.skipped, td.skipped a { color: var(--muted); }
td.skipped a { opacity: .75; }

details.archive { margin: 10px 0 0; }
details.archive > summary { cursor: pointer; font-weight: 600; color: var(--link); padding: 4px 0; }
details.archive[open] > summary { margin-bottom: 4px; }

.sessions-nav .btn-s.off { color: var(--muted); border-color: var(--rule); font-weight: 500; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.page-head h1 { margin-right: 0; }
a.btn { display: inline-block; text-decoration: none; }

/* кнопки редактирования — оранжевые */
a.btn.btn-edit, .btn-edit { background: #f57c00; color: #fff; }
a.btn.btn-edit:hover, .btn-edit:hover { background: #e65100; color: #fff; text-decoration: none; }

a.btn.btn-sm { font-size: .8rem; padding: 1px 10px; margin-left: 8px; vertical-align: middle; }
ul.comp-list li { margin: 4px 0; }

/* Итоги соревнования: заголовок и первые столбцы (место, игрок) «липкие», имя не переносится */
.table-scroll { max-height: 78vh; overflow: auto; }
table.standings { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
table.standings th { position: sticky; top: 0; z-index: 2; background: var(--tint); white-space: nowrap; }
table.standings td { background: var(--paper); }
table.standings .c-rk, table.standings .c-name { position: sticky; z-index: 1; }
table.standings .c-rk { left: 0; width: 3rem; min-width: 3rem; max-width: 3rem; text-align: right; }
table.standings .c-name { left: 3rem; white-space: nowrap; box-shadow: 1px 0 0 var(--rule); }
table.standings th.c-rk, table.standings th.c-name { z-index: 3; }              /* угловые ячейки выше обычных */
/* на телефоне общее правило делает таблицы блоками с прокруткой — для итогов оно не нужно, прокручивается .table-scroll */
table.standings { display: table; overflow: visible; }

table.sessions-edit { border-collapse: collapse; margin: 8px 0 16px; }
table.sessions-edit th, table.sessions-edit td { padding: 6px 12px; border-bottom: 1px solid var(--rule); text-align: left; }
form.session-add { display: flex; gap: 8px; align-items: center; }

/* числовые поля без стрелок вверх-вниз */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
h2[id] { scroll-margin-top: 12px; }

form.tform fieldset.form-block { border: 1px solid var(--rule); border-radius: 8px; margin: 14px 0; padding: 6px 14px 10px; }
form.tform fieldset.form-block legend { font-weight: 700; padding: 0 6px; }
form.tform fieldset.form-block.off .inner { display: none; }
form.tform label.sub { margin-left: 18px; }
form.tform .kind-row ul { display: inline-flex; gap: 14px; list-style: none; margin: 0 0 0 8px; padding: 0; }
form.tform .form-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
form.tform .kind-row > div { display: inline-flex; gap: 16px; margin-left: 8px; vertical-align: middle; }

ul.suggest { list-style: none; margin: 0 0 8px; padding: 0; max-width: 420px; }
ul.suggest li { padding: 6px 10px; border: 1px solid var(--rule); border-top: none; cursor: pointer; background: #fff; }
ul.suggest li:first-child { border-top: 1px solid var(--rule); }
ul.suggest li:hover { background: #e0f2fe; }
ul.suggest li.none { cursor: default; color: var(--muted); }
p.chosen { margin: 4px 0; }
.reg-info { border-left: 3px solid #0c479d; padding: 2px 12px; margin: 10px 0; background: #fff; }
ol.reg-list { columns: 2; max-width: 700px; }
input.player-q { width: min(420px, 100%); padding: 8px 10px; border: 1px solid var(--rule); border-radius: 8px; font: inherit; background: #fff; box-sizing: border-box; }

table.reg-table { border-collapse: collapse; margin: 8px 0 16px; min-width: 60%; }
table.reg-table th, table.reg-table td { padding: 6px 12px; border-bottom: 1px solid var(--rule); text-align: left; }
table.reg-table th:first-child, table.reg-table td:first-child { width: 2.5em; color: var(--muted); }
p.consent { margin: 14px 0; }

table.upcoming { border-collapse: collapse; margin: 6px 0 14px; }
table.upcoming td { padding: 6px 12px 6px 0; border-bottom: 1px solid var(--rule); vertical-align: middle; }
table.upcoming td.when { white-space: nowrap; font-weight: 600; color: var(--blue, #0c479d); }
table.upcoming td.acts { white-space: nowrap; }
table.upcoming td.acts .btn { margin-right: 6px; }

details.participants { margin: 18px 0; }
details.participants > summary { cursor: pointer; font-weight: 700; font-size: 1.1rem; color: var(--blue, #0c479d); }

.share-box { border: 1px solid var(--rule); border-radius: 8px; background: #fff; padding: 4px 16px 10px; margin: 12px 0 20px; max-width: 760px; }
input.share-link { width: 100%; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 8px; font: inherit; box-sizing: border-box; }
.share-buttons .btn { color: #fff; margin-right: 8px; padding: 8px 16px; border-radius: 999px; text-decoration: none; font-weight: 600; display: inline-block; }
.btn-wa { background: #25d366; }
.btn-tg { background: #2aabee; }
form.delete-reg { margin: 24px 0; }
button.btn-danger { background: #fff; color: #b91c1c; border: 1px solid #b91c1c; border-radius: 999px; padding: 8px 16px; cursor: pointer; font: inherit; }
button.btn-danger:hover { background: #fee2e2; }

/* кнопки «Регистрация» и «Участники» в будущих турнирах клуба — одинаковые (ссылка и button выглядят одинаково) */
table.upcoming .btn.btn-sm { display: inline-block; box-sizing: border-box; font: 600 .8rem/1.4 var(--sans); padding: 3px 12px; margin: 0 6px 0 0;
  border: 0; border-radius: 999px; background: var(--gold); color: #2a1d00; text-decoration: none; cursor: pointer; vertical-align: middle; }
table.upcoming .btn.btn-sm:hover { background: #ffc23d; text-decoration: none; }

/* компактная форма регистрации */
form.compact .reg-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
form.compact fieldset.form-block { margin: 0 0 10px; padding: 2px 12px 8px; }
form.compact .mode-select { margin: 4px 0 8px; }
form.compact .mode-select select, form.compact input[type=text], form.compact input[type=email], form.compact input[type=search], form.compact textarea {
  width: 100%; box-sizing: border-box; padding: 6px 8px; font: inherit; border: 1px solid var(--rule); border-radius: 6px; background: #fff; }
form.compact p { margin: 4px 0; }
form.compact .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
form.compact .grid2 label, form.compact .info-row label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 2px; }
form.compact .contacts { margin: 4px 0 8px; }
form.compact ul.suggest { max-width: none; margin-bottom: 4px; }
form.compact .muted { font-size: .85rem; margin: 4px 0; }
@media (max-width: 700px) { form.compact .reg-cols { grid-template-columns: 1fr; } }
.share-line { display: flex; gap: 8px; }
.share-line .share-link { flex: 1; }
button.btn-copy { white-space: nowrap; }

p.org-links .btn, a.btn-sm-gap { margin-right: 8px; display: inline-block; }
a.btn.btn-sm-gap { font-size: .85rem; padding: 4px 14px; text-decoration: none; }
form.inline-del { display: inline; }
button.link-danger { background: none; border: 0; color: #b91c1c; cursor: pointer; font: inherit; padding: 0 0 0 8px; text-decoration: underline; }
table.sessions-edit td.acts { white-space: nowrap; }

.dup-badge { display: inline-block; background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; border-radius: 999px; padding: 0 8px; font-size: .75rem; font-weight: 700; }
tr.dup-row td { background: #fff7ed; }
.dup-warning { color: #b45309; margin-top: 4px; font-size: .9rem; }
.msg.warning { background: #fff7ed; border-left: 4px solid #f59e0b; color: #78350f; }

/* расписание клуба на телефоне: каждый турнир в три строки — дата и время, название, кнопки */
@media (max-width: 700px) {
  table.upcoming, table.upcoming tbody, table.upcoming tr, table.upcoming td { display: block; width: 100%; box-sizing: border-box; }
  table.upcoming tr { padding: 8px 0; border-bottom: 1px solid var(--rule); }
  table.upcoming td { border: 0; padding: 1px 0; }
  table.upcoming td.when { font-size: .95rem; }
  table.upcoming td.acts { padding-top: 4px; }
  table.upcoming tr.participants-row[hidden] { display: none; }
  table.upcoming tr.participants-row { border-bottom: 0; padding: 0 0 8px; }
  table.upcoming tr.participants-row > td:first-child:empty { display: none; }
}

form.inline-form { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.share-box code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; word-break: break-all; }

form.compact .round2-row { margin: 8px 0; }
form.compact .round2-row input[type=checkbox] { width: auto; margin-right: 4px; }

.btn-max { background: #7b4dff; }

p.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
p.admin-actions .btn { text-decoration: none; }

/* заглушка главной страницы */
.home-stub { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: center; padding: 28px 0 18px; }
.home-stub h1 { font-size: 2.4rem; margin: 0 0 6px; }
.home-stub .lead { font-size: 1.2rem; color: var(--text); margin: 0 0 12px; }
.home-stub-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.home-stub-buttons .btn { text-decoration: none; font-size: 1rem; padding: 9px 22px; }
.home-stub-art svg { width: 100%; max-width: 380px; height: auto; display: block; margin: 0 auto; }
@media (max-width: 700px) { .home-stub { grid-template-columns: 1fr; } .home-stub h1 { font-size: 1.9rem; } .home-stub-art { order: -1; } }

/* клубы и регионы */
a.club-banner { display: block; margin: 12px 0 26px; padding: 26px 30px; border-radius: 14px; color: #fff; text-decoration: none;
  background: linear-gradient(120deg, #0b6f6a 0%, #2f9c93 60%, #3fb3a8 100%); box-shadow: 0 6px 20px rgba(11, 111, 106, .25); }
a.club-banner:hover { filter: brightness(1.05); text-decoration: none; }
a.club-banner .kicker { display: block; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; color: #ffe08a; font-weight: 700; }
a.club-banner .name { display: block; font: 800 2rem/1.15 var(--serif, Georgia, serif); margin: 6px 0; }
a.club-banner .sub { display: block; opacity: .92; margin-bottom: 12px; }
a.club-banner .go { display: inline-block; background: var(--gold); color: #2a1d00; padding: 7px 18px; border-radius: 999px; font-weight: 700; }
details.region-block { background: #fff; border: 1px solid var(--rule); border-radius: 10px; margin: 8px 0; padding: 0; }
details.region-block > summary { cursor: pointer; padding: 12px 16px; font-size: 1.05rem; list-style-position: inside; }
details.region-block > summary .region-name { font-weight: 700; color: var(--blue, #0c479d); }
details.region-block[open] > summary { border-bottom: 1px solid var(--rule); }
ul.region-clubs { list-style: none; margin: 0; padding: 8px 16px 12px; columns: 2; column-gap: 28px; }
ul.region-clubs li { padding: 3px 0; break-inside: avoid; }
ul.region-clubs li.region-link { font-weight: 600; column-span: all; padding-bottom: 6px; }
@media (max-width: 700px) { ul.region-clubs { columns: 1; } a.club-banner { padding: 20px 18px; } a.club-banner .name { font-size: 1.6rem; } }
