/* Оформление портала (шапка, меню, карточки, календарь) — в духе нового дизайна 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; }
.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; }
