/* «Керлинг» (0.55 winter, curling.js): the «Сезонное» row in «Игры в зале», the start dialog, the card — a sheet of ice
   on a canvas over the whole window, the scores and ends above it, the curl, the power meter, «Бросок» / «Тереть!» below. */
.cu-card, .cu-modal, .cu-season { --cu-a: #ff7a6e; --cu-b: #f6cf4a; --cu-ink: #2f3b52; --cu-night: #1b2440; }

/* The way in */
.cu-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); }
.cu-season-l { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #b9cff0; margin-bottom: 6px; }
.cu-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; }
.cu-entry-btn:hover, .cu-entry-btn:focus-visible { border-color: #9fc2f0; background: rgba(255, 255, 255, .08); }
.cu-entry-ico { font-size: 28px; line-height: 1; }
.cu-entry-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cu-entry-text small { color: var(--muted); font-size: 12px; }

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

/* The card */
.cu-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); }
.cu-card.hidden { display: none; }
.cu-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 8px 12px; background: var(--cu-night); }
.cu-score { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cu-score[data-team="b"] { flex-direction: row-reverse; }
.cu-score[data-team="a"], .cu-team[data-team="a"], .cu-rows li[data-team="a"], .cu-table tr[data-team="a"], .cu-who[data-team="a"], .cu-banner[data-team="a"] { --cu-team: var(--cu-a); }
.cu-score[data-team="b"], .cu-team[data-team="b"], .cu-rows li[data-team="b"], .cu-table tr[data-team="b"], .cu-who[data-team="b"], .cu-banner[data-team="b"] { --cu-team: var(--cu-b); }
.cu-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--cu-team); flex: none; box-shadow: 0 0 0 1.5px var(--cu-ink); }
.cu-sname { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cu-snum { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; color: #fff; }
.cu-left { display: flex; gap: 3px; flex: none; }
.cu-left i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .35); }
.cu-left i.on { background: var(--cu-team); border-color: var(--cu-ink); box-shadow: 0 0 0 1px rgba(255, 255, 255, .5); }
.cu-hammer { font-size: 13px; flex: none; }
.cu-hammer[hidden] { display: none; }
.cu-clock { display: flex; flex-direction: column; align-items: center; min-width: 84px; }
.cu-end { font-size: 14px; font-weight: 800; white-space: nowrap; }
.cu-time { font-size: 13px; color: #b9cff0; font-variant-numeric: tabular-nums; min-height: 16px; }
.cu-card.cu-hurry .cu-time { color: #ff8a7a; font-weight: 800; }
.cu-tools { position: absolute; top: 8px; right: 8px; z-index: 3; display: flex; gap: 6px; }
.cu-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, .7); backdrop-filter: blur(4px); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.cu-tools button[hidden] { display: none; }
.cu-min { font-size: 18px !important; font-weight: 700; }
.cu-stage { position: relative; flex: 1 1 0; min-height: 0; touch-action: none; overflow: hidden; }
.cu-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.cu-card.cu-myturn .cu-canvas { cursor: ew-resize; }
.cu-card[data-step="slide"] .cu-canvas { cursor: pointer; }
.cu-who { position: absolute; top: 8px; left: 8px; z-index: 2; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 130px); padding: 4px 10px 4px 4px; border-radius: 999px; background: rgba(16, 22, 40, .78); border: 2px solid var(--cu-team); pointer-events: none; }
.cu-who[hidden] { display: none; }
.cu-who img, .cu-who .cu-ava { width: 28px; height: 28px; border-radius: 50%; flex: none; background: #2a3550; }
.cu-who span { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.cu-who b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cu-who small { font-size: 11px; color: var(--cu-team); font-weight: 700; }
.cu-banner { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); z-index: 2; max-width: calc(100% - 24px); padding: 10px 16px; border-radius: 14px; background: rgba(255, 255, 255, .95); color: var(--cu-ink); font-weight: 800; font-size: 17px; text-align: center; box-shadow: 0 8px 26px rgba(10, 16, 34, .45); border: 3px solid var(--cu-team, #9fc2f0); pointer-events: none; }
.cu-banner[hidden] { display: none; }
.cu-over { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; padding: 14px; background: rgba(22, 32, 64, .32); pointer-events: none; }
.cu-over[hidden] { display: none; }
.cu-card[data-phase="podium"] .cu-over { pointer-events: auto; overflow: auto; align-items: flex-start; padding-top: 22px; background: rgba(14, 20, 38, .88); }
.cu-prep { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; width: min(620px, 100%); }
.cu-team { padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .94); color: var(--cu-ink); box-shadow: 0 6px 20px rgba(20, 30, 60, .25); border-top: 5px solid var(--cu-team); }
.cu-team b { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.cu-team ul { margin: 0; padding: 0; list-style: none; font-size: 13px; display: grid; gap: 2px; }
.cu-team li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cu-count { font-size: 56px; font-weight: 900; color: #fff; text-shadow: 0 3px 0 var(--cu-ink), 0 0 24px rgba(160, 200, 255, .7); min-width: 70px; text-align: center; }
.cu-big { font-size: 26px; font-weight: 900; color: #fff; text-align: center; text-shadow: 0 2px 0 var(--cu-ink), 0 0 18px rgba(160, 200, 255, .6); }
.cu-podium { width: min(560px, 100%); display: grid; gap: 10px; }
.cu-table { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-variant-numeric: tabular-nums; }
.cu-table th, .cu-table td { padding: 5px 6px; text-align: center; font-size: 14px; }
.cu-table thead th { color: #b9cff0; font-size: 12px; font-weight: 700; }
.cu-table tbody th { text-align: left; white-space: nowrap; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.cu-table tbody tr { background: rgba(255, 255, 255, .07); }
.cu-table tbody tr th { border-left: 3px solid var(--cu-team); border-radius: 8px 0 0 8px; }
.cu-table tbody td:last-child { border-radius: 0 8px 8px 0; }
.cu-sum { font-weight: 900; font-size: 17px !important; color: #fff; }
.cu-titles { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.cu-titles li { padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, .1); }
.cu-titles small { color: #b9cff0; }
.cu-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.cu-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(--cu-team); }
.cu-rows li.me { background: rgba(255, 255, 255, .13); }
.cu-rows .cu-place { grid-area: p; } .cu-rows img, .cu-rows .cu-ava { grid-area: a; width: 24px; height: 24px; border-radius: 50%; background: #2a3550; }
.cu-rows b { grid-area: n; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .cu-rows small { grid-area: s; color: var(--muted); font-size: 12px; }
.cu-rows em { grid-area: c; font-style: normal; font-weight: 800; color: var(--accent); }
.cu-why { margin: 0; text-align: center; color: #b9cff0; font-size: 13px; }

/* The bar: the hint, the curl, the power meter, «Бросок» / «Тереть!» */
.cu-bar { display: flex; flex-direction: column; gap: 6px; padding: 6px 12px calc(8px + env(safe-area-inset-bottom, 0px)); background: var(--cu-night); }
.cu-hint { font-size: 13px; color: #cfe0f7; line-height: 1.3; min-height: 17px; }
.cu-ctrl { display: flex; align-items: center; gap: 10px; min-height: 60px; }
.cu-card[data-phase="over"] .cu-bar, .cu-card[data-phase="podium"] .cu-bar { display: none; }
.cu-spin { flex: none; width: 60px; height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .08); color: var(--text); font: inherit; cursor: pointer; }
.cu-spin b { font-size: 22px; line-height: 1; }
.cu-spin small { font-size: 10px; color: #b9cff0; }
.cu-spin[hidden], .cu-meter[hidden], .cu-throw[hidden], .cu-sweep[hidden], .cu-seat[hidden] { display: none; }
.cu-spin:disabled, .cu-throw:disabled { opacity: .45; cursor: default; }
.cu-meter { position: relative; flex: 1 1 auto; min-width: 0; height: 30px; border-radius: 10px; overflow: hidden; display: flex; border: 2px solid var(--cu-ink); background: #0e1426; --cu-p: 0; }
.cu-z { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; overflow: hidden; }
.cu-z small { font-size: 10px; font-weight: 800; letter-spacing: .02em; color: rgba(255, 255, 255, .9); white-space: nowrap; text-shadow: 0 1px 0 rgba(0, 0, 0, .5); }
.cu-z-g { flex: 0 0 calc(var(--cu-h0, .29) * 100%); background: #3a4c74; }
.cu-z-h { flex: 0 0 calc((var(--cu-h1, .72) - var(--cu-h0, .29)) * 100%); background: #3f7fd6; }
.cu-z-t { flex: 1 1 auto; background: #b8433b; }
.cu-needle { position: absolute; top: -2px; bottom: -2px; left: calc(var(--cu-p) * 100%); width: 6px; margin-left: -3px; border-radius: 3px; background: #fff; box-shadow: 0 0 0 2px var(--cu-ink); }
.cu-throw { position: relative; flex: none; min-width: 104px; height: 60px; padding: 0 14px; border-radius: 16px; border: 0; background: var(--accent); color: #111; font: inherit; font-weight: 800; font-size: 16px; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.cu-throw.on { background: #f4ede4; color: var(--cu-ink); box-shadow: inset 0 0 0 3px var(--accent); }
.cu-sweep { position: relative; flex: 1 1 auto; height: 60px; border-radius: 16px; border: 0; background: var(--accent); color: #111; font: inherit; font-weight: 900; font-size: 18px; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overflow: hidden; }
.cu-sweep.tap { animation: cu-tap .22s ease-out; }
@keyframes cu-tap { from { background: #f4ede4; transform: scale(.97); } to { background: var(--accent); transform: none; } }
.cu-heat { position: absolute; left: 0; bottom: 0; height: 6px; width: calc(var(--cu-w, 0) * 100%); background: var(--cu-ink); }
.cu-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; margin-left: auto; }
.cu-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cu-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); }
.cu-pill.hidden { display: none; }
body.cu-on { overflow: hidden; }

@media (max-width: 760px) {
  .cu-card { inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; border: 0; z-index: 1900; }
  .cu-head { gap: 6px; padding: 6px 8px; padding-top: calc(6px + env(safe-area-inset-top, 0px)); }
  .cu-score { flex-wrap: wrap; gap: 2px 6px; }
  .cu-sname { font-size: 12px; flex: 1 0 calc(100% - 16px); }
  .cu-score[data-team="b"] .cu-sname { text-align: right; }
  .cu-snum { font-size: 20px; }
  .cu-clock { min-width: 70px; }
  .cu-end { font-size: 13px; }
  .cu-tools { top: 6px; right: 6px; }
  .cu-tools button { min-height: 44px; min-width: 44px; }
  .cu-who { top: 6px; left: 6px; max-width: calc(100% - 150px); }
  .cu-prep { grid-template-columns: 1fr 1fr; } .cu-count { grid-column: 1 / -1; order: -1; }
  .cu-banner { font-size: 15px; top: 14%; }
}
@media (max-width: 360px) {
  .cu-bar { padding-left: 8px; padding-right: 8px; }
  .cu-ctrl { gap: 6px; }
  .cu-hint { font-size: 12px; }
  .cu-spin { width: 50px; }
  .cu-throw { min-width: 86px; padding: 0 10px; font-size: 15px; }
  .cu-z small { font-size: 9px; }
  .cu-hammer { display: none; }
}
@media (prefers-reduced-motion: reduce) { .cu-sweep.tap { animation: none; } }
