/* Форма регистрации. Сначала телефон, потом широкий экран. */

body.public { background: var(--paper); }

.shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.stage { flex: 1; display: flex; flex-direction: column; background: var(--paper); }
.sheet { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 560px; margin: 0 auto; background: var(--paper); }

/* ---------- шапка с турниром ---------- */

.hero {
  position: relative; overflow: hidden; color: #fff; background: var(--ink);
  padding: 14px 20px 16px; padding-top: calc(14px + env(safe-area-inset-top));
}
/* красное солнце: единственная крупная деталь страницы */
.hero::after {
  content: ""; position: absolute; border-radius: 50%; background: var(--red);
  width: 132px; height: 132px; right: -42px; top: -52px;
}
.hero > * { position: relative; z-index: 1; }

.hero-brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.hero-brand svg { width: 30px; height: 30px; }

.hero-body { display: none; margin-top: 12px; padding-right: 56px; }
.hero.has-body .hero-body { display: block; }
.hero-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.hero-lead { display: none; margin-top: 8px; font-size: 16px; line-height: 1.4; color: rgba(255, 255, 255, .78); }
.hero-facts { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 15px; color: rgba(255, 255, 255, .82); }
.hero-facts b { color: #fff; font-weight: 700; }
/* на телефоне срок подачи не нужен в шапке: каждая строка отнимает место у формы */
.hero-deadline { display: none; }

/* «Сменить турнир» показываем, только когда открыто больше одного турнира */
.hero-change {
  display: inline-flex; align-items: center; gap: 2px; margin-left: -4px; padding: 2px 10px 2px 2px; border-radius: 999px;
  color: #fff; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255, 255, 255, .55);
}
.hero-change[hidden] { display: none; }
.hero-change:hover { background: rgba(255, 255, 255, .14); text-decoration-color: #fff; }
.hero-change:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.hero-change svg { width: 16px; height: 16px; }

.hero.is-home { padding-bottom: 22px; }
.hero.is-home .hero-title { font-size: 28px; }
.hero.is-home .hero-lead { display: block; }

/* ---------- экран ---------- */

.loading { flex: 1; display: grid; place-items: center; min-height: 240px; }

.screen { flex: 1; display: flex; flex-direction: column; }
.screen-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; padding: 6px 20px 0 10px; }
.screen-top:empty { display: none; }
.back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 10px 0 4px; border-radius: 12px; color: var(--ink-2); font-weight: 600; font-size: 16px; text-decoration: none; }
.back:hover { background: var(--mist); }
.back svg { width: 24px; height: 24px; }
.screen-step { font-size: 15px; font-weight: 600; color: var(--ink-3); }
/* без ссылки «Назад» подпись шага встаёт на общую левую линию */
.screen-top > .screen-step:first-child { padding-left: 10px; }

.steps { display: flex; gap: 6px; padding: 4px 20px 0; }
.steps i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); transition: background-color .25s var(--ease); }
.steps i.on { background: var(--blue); }

.screen-body { flex: 1; display: grid; align-content: start; gap: 22px; padding: 18px 20px 28px; }
.screen-title { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.12; }
.screen-title:focus { outline: none; }
.screen-lead { margin-top: 8px; color: var(--ink-2); font-size: 17px; }

.form-grid { display: grid; gap: 18px; }
.form-grid .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.actions {
  position: sticky; bottom: 0; z-index: 5; display: grid; gap: 8px;
  padding: 16px 20px; padding-bottom: calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, #fff 72%, rgba(255, 255, 255, 0));
}

/* ---------- турниры ---------- */

.game-list { display: grid; gap: 12px; }
.game-row {
  display: grid; grid-template-columns: 64px 1fr 22px; gap: 16px; align-items: center;
  padding: 14px 16px 14px 14px; border: 1.5px solid var(--line); border-radius: 18px;
  color: inherit; text-decoration: none; transition: border-color .15s var(--ease), background-color .15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.game-row:hover { border-color: var(--blue); background: #fafcff; }
.game-row .chev { color: var(--ink-3); }
.date-block { width: 64px; height: 64px; display: grid; place-content: center; border-radius: 14px; background: var(--blue-50); color: var(--blue); text-align: center; line-height: 1; }
.date-block b { display: block; font-size: 27px; font-weight: 800; }
.date-block span { display: block; margin-top: 3px; font-size: 14px; font-weight: 700; }
.game-info h3 { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.game-info p { margin-top: 2px; font-size: 15px; color: var(--ink-3); }
.game-info .pill { margin-top: 8px; }

.empty { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 36px 12px 12px; color: var(--ink-2); }
.empty .badge { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; background: var(--mist); color: var(--ink-3); }
.empty .badge svg { width: 30px; height: 30px; }
.empty h2 { font-size: 22px; color: var(--ink); }
.empty p { max-width: 32ch; }

/* ---------- команда ---------- */

.team-strip { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--mist); }
.team-strip .who { min-width: 0; }
.team-strip b { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-strip span { display: block; font-size: 14px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.add-trainer { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

/* ---------- возрастная группа и вес ---------- */

.person-line { font-size: 17px; font-weight: 700; }
.person-line span { color: var(--ink-3); font-weight: 600; }

.group-panel { padding: 14px 16px; border-radius: var(--r); background: var(--blue-50); }
.group-panel .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.group-panel .small { font-size: 14px; color: var(--ink-2); }
.group-panel b { display: block; font-size: 18px; letter-spacing: -.01em; }
.group-options { display: grid; gap: 6px; margin-top: 12px; }
.group-options label {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 12px;
  background: var(--paper); border: 1.5px solid transparent; font-weight: 600; cursor: pointer;
}
.group-options input { width: 20px; height: 20px; accent-color: var(--blue); flex: none; }
.group-options input:checked + span { color: var(--blue); }
.group-options label:has(input:checked) { border-color: var(--blue); }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tile { position: relative; }
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile label {
  display: grid; place-items: center; min-height: 62px; border: 1.5px solid var(--line-2); border-radius: 14px;
  font-size: 21px; font-weight: 800; letter-spacing: -.01em; color: var(--ink); background: var(--paper);
  font-variant-numeric: tabular-nums; transition: all .15s var(--ease); -webkit-tap-highlight-color: transparent;
}
.tile label:hover { border-color: #aab4cc; }
.tile input:checked + label { background: var(--ink); border-color: var(--ink); color: #fff; box-shadow: 0 6px 16px rgba(16, 26, 61, .22); }
.tile input:focus-visible + label { outline: 3px solid rgba(36, 87, 214, .45); outline-offset: 2px; }
.tiles[aria-invalid="true"] .tile label { border-color: var(--red); }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- готово ---------- */

.done { text-align: center; justify-items: center; padding-top: 36px; }
.stamp { width: 112px; height: 112px; border-radius: 50%; background: var(--red); display: grid; place-items: center; animation: stamp .45s var(--ease) both; box-shadow: 0 14px 34px rgba(217, 45, 58, .35); }
.stamp svg { width: 56px; height: 56px; }
.stamp path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .35s .2s var(--ease) forwards; }
@keyframes stamp { from { transform: scale(1.5) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.done .summary { color: var(--ink-2); font-size: 17px; }
.done .summary b { color: var(--ink); }

/* ---------- мои заявки и список ---------- */

.mine-list { display: grid; gap: 10px; }
.mine-row { display: grid; grid-template-columns: 1fr auto; gap: 10px 14px; align-items: start; padding: 14px 8px 6px 16px; border: 1.5px solid var(--line); border-radius: 18px; }
.mine-row .name { display: block; font-size: 18px; font-weight: 800; letter-spacing: -.01em; overflow-wrap: anywhere; }
.mine-row .meta { display: block; margin-top: 2px; font-size: 14.5px; color: var(--ink-3); }
.mine-row .placard { margin-right: 8px; }
.placard { min-width: 64px; padding: 9px 10px; border-radius: 12px; background: var(--ink); color: #fff; text-align: center; font-size: 21px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.row-actions { grid-column: 1 / -1; display: flex; gap: 4px; margin-left: -8px; padding-top: 4px; border-top: 1px solid var(--line); }

.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 20px; height: 20px; }
.search .input { padding-left: 44px; }

.roster { display: grid; gap: 22px; }
.roster-group h3 { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; background: var(--paper); font-size: 19px; font-weight: 800; border-bottom: 2px solid var(--ink); }
.roster-group h3 span { font-size: 15px; font-weight: 600; color: var(--ink-3); }
.roster-weight { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.roster-weight .placard { align-self: start; padding: 6px 8px; font-size: 18px; min-width: 0; }
.roster-weight ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.roster-weight li { display: grid; gap: 1px; }
.roster-weight li b { font-weight: 700; }
.roster-weight li span { font-size: 14.5px; color: var(--ink-3); }

.foot-link { text-align: center; padding-top: 4px; }

/* ---------- широкий экран: слева турнир, справа форма ---------- */

@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: minmax(380px, 42%) 1fr; }
  .hero { position: sticky; top: 0; height: 100vh; height: 100dvh; padding: 48px 56px; display: flex; flex-direction: column; }
  .hero::after { width: 560px; height: 560px; right: -170px; top: auto; bottom: -190px; }
  .hero-brand { font-size: 20px; }
  .hero-brand svg { width: 38px; height: 38px; }
  .hero-body { display: block; margin-top: auto; margin-bottom: 18%; padding-right: 0; }
  .hero-title { font-size: 44px; line-height: 1.05; max-width: 14ch; }
  .hero.is-home .hero-title { font-size: 44px; }
  .hero-lead { display: block; margin-top: 16px; font-size: 19px; max-width: 30ch; }
  .hero-facts { margin-top: 18px; font-size: 18px; flex-direction: column; gap: 4px; }
  .hero-deadline { display: inline; }

  .stage { background: var(--tatami); align-items: center; justify-content: center; padding: 48px 40px; }
  .sheet { flex: none; max-width: 520px; border-radius: 28px; box-shadow: 0 1px 0 rgba(16, 26, 61, .05), 0 30px 70px rgba(16, 26, 61, .12); overflow: clip; min-height: 560px; }
  .actions { border-radius: 0 0 28px 28px; }
}

@media (max-width: 380px) {
  .screen-title { font-size: 25px; }
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .form-grid .pair { grid-template-columns: 1fr; }
}
