/* «Снежная битва» (0.53, snow-battle.js): the «Сезонное» row in «Игры в зале», the lobby button, the start dialog, the
   card — a snowy field on a canvas over the whole window, the scores and walls above it, «Лепить» and the hand below. */
.sb-card, .sb-modal, .sb-season { --sb-a: #d9534a; --sb-b: #3f7fd6; --sb-ink: #3d4c66; --sb-frost: #eaf2fb; }

/* The way in */
.sb-season { margin: 4px 0 12px; padding: 10px; border-radius: 14px; background: linear-gradient(180deg, rgba(120, 160, 220, .14), rgba(120, 160, 220, .05)); border: 1px solid rgba(170, 200, 240, .25); }
.sb-season[hidden] { display: none; }
.sb-season-l { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #b9cff0; margin-bottom: 6px; }
.sb-entry-btn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 12px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .05); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.sb-entry-btn:hover, .sb-entry-btn:focus-visible { border-color: #9fc2f0; background: rgba(255, 255, 255, .08); }
.sb-entry-ico { font-size: 28px; line-height: 1; }
.sb-entry-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sb-entry-text small { color: var(--muted); font-size: 12px; }

/* The start dialog */
.sb-msheet { max-width: 560px; }
.sb-mhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 18px; }
.sb-x { width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); font-size: 24px; cursor: pointer; }
.sb-mart { border-radius: 12px; overflow: hidden; margin-bottom: 10px; border: 1px solid rgba(255, 255, 255, .1); }
.sb-mcanvas { display: block; width: 100%; height: auto; }
.sb-how { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; line-height: 1.4; }
.sb-mnote { margin: 0 0 8px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.sb-mwarn { margin: 0 0 8px; color: var(--bad, #e5484d); font-size: 13px; }
.sb-mbtns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.sb-mbtns button { min-height: 44px; padding: 0 18px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; }
.sb-cancel { border: 1px solid rgba(255, 255, 255, .16); background: transparent; color: var(--text); }
.sb-go { border: 0; background: var(--accent); color: #111; font-size: 15px; min-width: 120px; }

/* The card */
.sb-card { position: fixed; inset: 10px; margin: auto; z-index: 1800; width: min(1100px, calc(100vw - 20px)); height: min(760px, calc(100vh - 20px)); height: min(760px, calc(100dvh - 20px)); display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; background: #141a2a; border: 1px solid rgba(170, 200, 240, .22); box-shadow: 0 24px 70px rgba(0, 0, 0, .6); color: var(--text); }
.sb-card.hidden { display: none; }
.sb-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 8px 12px; background: #1b2440; }
.sb-score { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sb-score-far { justify-content: flex-end; flex-direction: row-reverse; }
.sb-score .sb-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--sb-team); flex: none; }
.sb-score[data-team="a"] { --sb-team: var(--sb-a); } .sb-score[data-team="b"] { --sb-team: var(--sb-b); }
.sb-sname { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sb-snum { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; color: #fff; }
.sb-fort { display: flex; gap: 2px; flex: none; }
.sb-fort i { width: 9px; height: 14px; border-radius: 3px; background: linear-gradient(to top, #eef4fb calc(var(--hp, 1) * 100%), rgba(255, 255, 255, .12) calc(var(--hp, 1) * 100%)); border: 1px solid rgba(255, 255, 255, .35); }
.sb-clock { display: flex; flex-direction: column; align-items: center; min-width: 64px; }
.sb-time { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sb-step { font-size: 11px; color: #b9cff0; white-space: nowrap; }
.sb-card.sb-hurry .sb-time { color: #ff8a7a; }
.sb-tools { position: absolute; top: 8px; right: 8px; z-index: 2; display: flex; gap: 6px; }
.sb-tools button { min-height: 36px; min-width: 36px; padding: 0 10px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(16, 22, 40, .62); backdrop-filter: blur(4px); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.sb-min { font-size: 18px !important; font-weight: 700; }
.sb-stage { position: relative; flex: 1 1 0; min-height: 0; touch-action: none; overflow: hidden; }
.sb-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.sb-over { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 14px; background: rgba(22, 32, 64, .28); pointer-events: none; }
.sb-over[hidden] { display: none; }
.sb-card[data-phase="podium"] .sb-over { pointer-events: auto; overflow: auto; align-items: flex-start; padding-top: 22px; background: rgba(14, 20, 38, .86); }
.sb-prep { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; width: min(620px, 100%); }
.sb-team { padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .92); color: var(--sb-ink); box-shadow: 0 6px 20px rgba(20, 30, 60, .25); }
.sb-team b { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; color: var(--sb-team); }
.sb-team .sb-dot, .sb-final .sb-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--sb-team); }
.sb-final span { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; color: #cfe0f7; }
.sb-final span[data-team="a"] { --sb-team: var(--sb-a); } .sb-final span[data-team="b"] { --sb-team: var(--sb-b); }
.sb-final b { margin: 0 10px; } .sb-team[data-team="a"] { --sb-team: #b8352e; } .sb-team[data-team="b"] { --sb-team: #2a5698; }
.sb-team ul { margin: 0; padding: 0; list-style: none; font-size: 13px; display: grid; gap: 2px; }
.sb-team li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-count { font-size: 56px; font-weight: 900; color: #fff; text-shadow: 0 3px 0 var(--sb-ink), 0 0 24px rgba(160, 200, 255, .7); min-width: 70px; text-align: center; }
.sb-big { font-size: 26px; font-weight: 900; color: #fff; text-align: center; text-shadow: 0 2px 0 var(--sb-ink), 0 0 18px rgba(160, 200, 255, .6); }
.sb-podium { width: min(560px, 100%); display: grid; gap: 10px; }
.sb-final { text-align: center; font-size: 20px; font-weight: 800; color: #fff; }
.sb-titles { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.sb-titles li { padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, .1); }
.sb-titles small { color: #b9cff0; }
.sb-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.sb-rows li { display: grid; grid-template-columns: 24px 24px minmax(0, 1fr) auto; grid-template-areas: "p a n c" "p a s c"; column-gap: 8px; align-items: center; padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, .06); border-left: 3px solid var(--sb-team); }
.sb-rows li[data-team="a"] { --sb-team: var(--sb-a); } .sb-rows li[data-team="b"] { --sb-team: var(--sb-b); }
.sb-rows li.me { background: rgba(255, 255, 255, .13); }
.sb-rows .sb-place { grid-area: p; } .sb-rows img, .sb-rows .sb-ava { grid-area: a; width: 24px; height: 24px; border-radius: 50%; background: #2a3550; }
.sb-rows b { grid-area: n; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .sb-rows small { grid-area: s; color: var(--muted); font-size: 12px; }
.sb-rows em { grid-area: c; font-style: normal; font-weight: 800; color: var(--accent); }
.sb-why { margin: 0; text-align: center; color: #b9cff0; font-size: 13px; }

/* The bar: «Лепить», the hand, the hint */
.sb-bar { display: flex; align-items: center; gap: 12px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); background: #1b2440; min-height: 64px; }
.sb-build { position: relative; flex: none; width: 84px; height: 56px; border-radius: 16px; border: 0; background: var(--accent); color: #111; font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overflow: hidden; }
.sb-build[hidden] { display: none; }
.sb-build.on { background: #f4ede4; color: var(--sb-ink); }
.sb-ring { position: absolute; left: 0; bottom: 0; height: 5px; width: calc(var(--sb-k, 0) * 100%); background: var(--sb-ink); }
.sb-build-t { position: relative; }
.sb-hand { display: flex; gap: 6px; flex: none; }
.sb-hand i { width: 22px; height: 22px; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .3); }
.sb-hand i.full { border: 2px solid var(--sb-ink); background: radial-gradient(circle at 35% 35%, #fff 0 35%, #dfe9f6 36% 70%, #c7d6ec 71%); }
.sb-hand i.giant { width: 28px; height: 28px; box-shadow: 0 0 0 2px #ffd65a; }
.sb-hint { flex: 1 1 auto; min-width: 0; font-size: 13px; color: #cfe0f7; line-height: 1.3; }
.sb-seat { flex: none; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.sb-seat[hidden] { display: none; }
.sb-card[data-phase="over"] .sb-bar, .sb-card[data-phase="podium"] .sb-bar { display: none; }
.sb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sb-pill { position: fixed; left: 14px; bottom: 90px; z-index: 1801; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid #9fc2f0; background: rgba(20, 26, 42, .96); color: var(--text); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
.sb-pill.hidden { display: none; }
body.sb-on { overflow: hidden; }

@media (max-width: 760px) {
  .sb-card { inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; border: 0; z-index: 1900; }
  .sb-head { gap: 6px; padding: 6px 8px; padding-top: calc(6px + env(safe-area-inset-top, 0px)); }
  .sb-score { flex-wrap: wrap; gap: 2px 6px; }
  .sb-sname { font-size: 12px; flex: 1 0 calc(100% - 16px); } /* the team's dot and its name share the first line */
  .sb-score-far .sb-sname { text-align: right; }
  .sb-fort i { width: 7px; height: 11px; }
  .sb-snum { font-size: 18px; }
  .sb-build { width: 96px; height: 60px; }
  .sb-prep { grid-template-columns: 1fr 1fr; } .sb-count { grid-column: 1 / -1; order: -1; }
}
@media (max-width: 340px) {
  .sb-hint { font-size: 12px; }
  .sb-hand i { width: 18px; height: 18px; }
  .sb-build { width: 84px; }
}
@media (prefers-reduced-motion: reduce) { .sb-ring { transition: none; } }
