/* Пивной тотализатор — спокойный «яблочный» интерфейс, где единственный яркий цвет — пиво. */
:root {
  --canvas: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #aeaeb2;
  --hair: rgba(0, 0, 0, .08);
  --fill: rgba(118, 118, 128, .12);
  --amber: #f6a823;
  --amber-deep: #d77a06;
  --foam: #fffaf0;
  --glass-edge: rgba(29, 29, 31, .2);
  --glass-body: rgba(255, 255, 255, .55);
  --exact: #ff9f0a;
  --diff: #0a84ff;
  --outcome: #30b453;
  --miss: #8e8e93;
  --live: #ff3b30;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 28px rgba(0, 0, 0, .06);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --text: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif;
  --round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #000000;
    --surface: #1c1c1e;
    --surface-2: #161618;
    --ink: #f5f5f7;
    --ink-2: #98989d;
    --ink-3: #636366;
    --hair: rgba(255, 255, 255, .1);
    --fill: rgba(118, 118, 128, .24);
    --glass-edge: rgba(255, 255, 255, .34);
    --glass-body: rgba(255, 255, 255, .06);
    --foam: #fff6e4;
    --outcome: #30d158;
    --shadow: none;
  }
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
    color-scheme: dark;
    --canvas: #000000;
    --surface: #1c1c1e;
    --surface-2: #161618;
    --ink: #f5f5f7;
    --ink-2: #98989d;
    --ink-3: #636366;
    --hair: rgba(255, 255, 255, .1);
    --fill: rgba(118, 118, 128, .24);
    --glass-edge: rgba(255, 255, 255, .34);
    --glass-body: rgba(255, 255, 255, .06);
    --foam: #fff6e4;
    --outcome: #30d158;
    --shadow: none;
  }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; overflow-x: hidden;
  background: var(--canvas);
  color: var(--ink);
  font: 17px/1.47 var(--text);
  letter-spacing: -.022em;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--diff); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--diff) 60%, transparent); outline-offset: 2px; border-radius: 10px; }
.num { font-family: var(--round); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ---------- верхняя панель ---------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: color-mix(in srgb, var(--canvas) 72%, transparent);
  border-bottom: 1px solid var(--hair);
}
.bar-in {
  max-width: 980px; margin: 0 auto; padding: 0 22px; height: 52px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { font-weight: 600; font-size: 17px; color: var(--ink); display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand svg { width: 22px; height: 22px; }
.status { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 7px; white-space: nowrap; min-width: 0; overflow: hidden; }
.status > span:last-child { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) { .status .long { display: none; } .bar-in { padding: 0 16px; } main { padding: 0 16px 80px; } .shelf { margin: 36px -16px 0; padding: 18px 16px 0; } .dock { margin: 28px -16px 0; padding-left: 16px; padding-right: 16px; } }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot.live { background: var(--live); box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 50%, transparent); animation: pulse 1.8s var(--ease) infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

main { max-width: 980px; margin: 0 auto; padding: 0 22px 80px; }

/* ---------- главный экран ---------- */
.hero { text-align: center; padding: 64px 0 8px; }
.hero h1 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(38px, 7vw, 64px); line-height: 1.05; letter-spacing: -.035em;
  margin: 0;
}
.hero h1 span { display: block; color: var(--ink-2); }
.hero p { color: var(--ink-2); font-size: 19px; margin: 16px auto 0; max-width: 34em; }

/* полка с кружками */
.shelf {
  display: flex; gap: 8px; justify-content: flex-start; align-items: flex-end;
  margin: 44px -22px 0; padding: 18px 22px 0;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.shelf::-webkit-scrollbar { display: none; }
.shelf > .glass:first-child { margin-left: auto; }
.shelf > .glass:last-child { margin-right: auto; }
.glass { flex: none; width: 132px; text-align: center; scroll-snap-align: center; }
.glass .pts { font-family: var(--round); font-weight: 700; font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.glass.lead .pts { color: var(--amber-deep); }
.glass svg { display: block; width: 132px; height: 156px; margin: 10px auto 0; overflow: visible; }
.glass .who { font-weight: 600; margin-top: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.glass .place { font-size: 13px; color: var(--ink-2); }
.shelf-line { height: 1px; background: var(--hair); margin: -1px 0 0; }

/* кружка */
.mug-body { fill: var(--glass-body); stroke: var(--glass-edge); stroke-width: 3; }
.mug-handle { fill: none; stroke: var(--glass-edge); stroke-width: 7; stroke-linecap: round; }
.mug-shine { fill: #fff; opacity: .45; }
.mug-shadow { fill: rgba(0, 0, 0, .08); }
.lead .mug-glow { opacity: 1; }
.mug-glow { opacity: 0; }
.beer { transition: transform 1.2s var(--ease); }
.foam { transform-box: fill-box; transform-origin: 50% 100%; animation: wobble 3.6s ease-in-out infinite; }
.over { transform-box: fill-box; transform-origin: 50% 100%; }
.bub { animation: rise var(--t, 3s) linear infinite; animation-delay: var(--bd, 0s); opacity: 0; }
@keyframes wobble { 50% { transform: scaleY(1.06) translateX(.8px); } }
@keyframes rise {
  0% { transform: translateY(0); opacity: 0; }
  15% { opacity: .9; }
  100% { transform: translateY(calc(-1px * var(--h, 60))); opacity: 0; }
}
/* одно большое движение при открытии: пиво наливается по очереди, пена у лидера переливается */
.intro .beer { animation: pour 1.7s var(--ease) both; animation-delay: var(--d, 0s); }
.intro .over { animation: spill .9s var(--spring) both; animation-delay: calc(var(--d, 0s) + 1.35s); }
@keyframes pour { from { transform: translateY(132px); } }
@keyframes spill { from { transform: scale(.2, 0); } }

/* ---------- переключатель разделов ---------- */
.seg-wrap { display: flex; justify-content: center; margin: 56px 0 28px; }
.seg {
  position: relative; display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--fill); border-radius: 10px; padding: 2px; min-width: min(420px, 100%);
}
.seg button {
  position: relative; z-index: 1; border: 0; background: none; cursor: pointer;
  padding: 7px 14px; font-size: 14px; font-weight: 500; border-radius: 8px; white-space: nowrap;
}
.seg button[aria-selected="true"] { font-weight: 600; }
.thumb {
  position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc((100% - 4px) / 3);
  background: var(--surface); border-radius: 8px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04);
  transform: translateX(calc(100% * var(--i, 0)));
  transition: transform .45s var(--spring);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .thumb { background: #636366; } }
:root[data-theme="dark"] .thumb { background: #636366; }

.panel[hidden] { display: none; }
.panel.show { animation: appear .45s var(--ease); }
@keyframes appear { from { opacity: 0; transform: translateY(8px); } }

/* ---------- списки как в настройках iOS ---------- */
.group { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.cap { font-size: 13px; color: var(--ink-2); margin: 26px 18px 8px; }
.cap:first-child { margin-top: 0; }
.row { display: flex; align-items: center; gap: 14px; padding: 13px 18px; position: relative; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 18px; right: 0; height: 1px; background: var(--hair); }
.rank { width: 22px; flex: none; color: var(--ink-2); font-family: var(--round); font-variant-numeric: tabular-nums; text-align: right; }
.grow { flex: 1; min-width: 0; }
.name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { font-size: 13px; color: var(--ink-2); }
.meter { width: 140px; height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; flex: none; }
.meter i { display: block; height: 100%; width: var(--w); border-radius: 4px;
  background: linear-gradient(90deg, var(--amber), var(--amber-deep)); transition: width 1s var(--ease); }
.intro .meter i { animation: grow 1.4s var(--ease) both; animation-delay: var(--d, 0s); }
@keyframes grow { from { width: 0; } }
.pts-big { font-family: var(--round); font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }
@media (max-width: 560px) { .meter { display: none; } }

/* матчи */
.match { display: block; position: relative; }
.match + .match::before { content: ""; position: absolute; top: 0; left: 18px; right: 0; height: 1px; background: var(--hair); }
.match summary { list-style: none; cursor: pointer; }
.match summary::-webkit-details-marker { display: none; }
.match summary .row { padding-top: 14px; padding-bottom: 14px; }
.chev { width: 12px; height: 12px; flex: none; color: var(--ink-3); transition: transform .35s var(--spring); }
.match[open] .chev { transform: rotate(90deg); }
.teams { font-size: 17px; }
.teams b { font-weight: 600; }
.score { font-family: var(--round); font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.time { font-family: var(--round); font-size: 17px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 3px 9px; border-radius: 99px; background: var(--fill); color: var(--ink-2); white-space: nowrap; }
.pill.live { background: color-mix(in srgb, var(--live) 14%, transparent); color: var(--live); }
.pill.live .dot { background: var(--live); }
.side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.drawer { padding: 0 18px 16px 18px; }
.match[open] .drawer { animation: appear .35s var(--ease); }
.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--hair); font-size: 15px; }
.pick .num { font-weight: 700; }
.badge { font-family: var(--round); font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 99px; color: #fff; }
.p3 { background: var(--exact); } .p2 { background: var(--diff); } .p1 { background: var(--outcome); } .p0 { background: var(--miss); }
.ava { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 12px; font-weight: 700; color: #fff; background: var(--c); }
.ava.off { background: none; color: var(--ink-3); box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.avas { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* как играть */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.tile { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 22px; }
.tile .big { font-family: var(--round); font-weight: 700; font-size: 48px; line-height: 1; }
.tile h3 { margin: 12px 0 4px; font-size: 17px; }
.tile p { margin: 0; color: var(--ink-2); font-size: 15px; }
.t3 .big { color: var(--exact); } .t2 .big { color: var(--diff); } .t1 .big { color: var(--outcome); }
.notes { margin-top: 14px; }
.notes .row { align-items: flex-start; }
@media (max-width: 720px) { .tiles { grid-template-columns: 1fr; } .tile { display: flex; gap: 18px; align-items: center; } .tile h3 { margin-top: 0; } }

.foot { text-align: center; color: var(--ink-2); font-size: 13px; margin-top: 48px; }
.empty { text-align: center; color: var(--ink-2); padding: 34px 18px; }

/* ---------- форма прогноза ---------- */
.sheet { max-width: 640px; margin: 0 auto; }
.sheet .hero { text-align: left; padding-top: 40px; }
.sheet .hero p { margin-left: 0; }
.slip { margin-top: 28px; }
.slip .group + .group { margin-top: 14px; }
.slip-head { display: flex; justify-content: space-between; gap: 12px; padding: 14px 18px 4px; font-size: 13px; color: var(--ink-2); }
.line { display: flex; align-items: center; gap: 12px; padding: 8px 18px; }
.line:last-child { padding-bottom: 16px; }
.line .grow { font-size: 17px; }
.line.ours .grow { font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 4px; flex: none; }
.stepper button {
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--fill); display: grid; place-items: center; transition: transform .2s var(--spring), background .2s;
}
.stepper button:active { transform: scale(.88); }
.stepper button svg { width: 16px; height: 16px; }
.stepper button:disabled { opacity: .35; cursor: default; }
.digit { width: 44px; text-align: center; font-family: var(--round); font-weight: 700; font-size: 30px; font-variant-numeric: tabular-nums; }
.digit.bump { animation: bump .35s var(--spring); }
.digit.unset { color: var(--ink-3); }
@keyframes bump { 40% { transform: translateY(-5px) scale(1.12); } }
.locked .line { padding-top: 4px; padding-bottom: 4px; }
.locked .digit { font-size: 22px; width: auto; color: var(--ink-2); }
.locked .line .grow { color: var(--ink-2); }
.locked .slip-head span:last-child { display: inline-flex; gap: 5px; align-items: center; }
.result { display: flex; justify-content: space-between; align-items: center; padding: 6px 18px 16px; font-size: 15px; color: var(--ink-2); }

.dock {
  position: sticky; bottom: 0; margin: 28px -22px 0; padding: 14px 22px calc(14px + env(safe-area-inset-bottom));
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: color-mix(in srgb, var(--canvas) 72%, transparent); border-top: 1px solid var(--hair);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.dock .sub { font-size: 14px; }
.cta {
  border: 0; cursor: pointer; border-radius: 99px; padding: 13px 26px; font-weight: 600; font-size: 17px;
  background: var(--ink); color: var(--canvas); transition: transform .2s var(--spring), opacity .2s;
}
.cta:active { transform: scale(.96); }
.cta:disabled { opacity: .3; cursor: default; }

.toast {
  position: fixed; left: 50%; bottom: 104px; z-index: 30;
  transform: translate(-50%, 20px) scale(.96); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-radius: 99px;
  background: color-mix(in srgb, var(--surface) 94%, transparent); white-space: nowrap;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .16), 0 0 0 1px var(--hair); font-weight: 600;
  transition: transform .5s var(--spring), opacity .3s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast svg { width: 22px; height: 22px; color: var(--outcome); }
.toast path { stroke-dasharray: 30; stroke-dashoffset: 30; }
.toast.on path { animation: draw .5s .15s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.toast.err svg { color: var(--live); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .toast path { stroke-dashoffset: 0; }
}

/* ---------- внутри Telegram ---------- */
.tg .bar { display: none; }
.tg .hero { padding-top: 28px; }
.tg .hero h1 { font-size: clamp(32px, 9vw, 44px); }
.tg .hero p { font-size: 16px; }
.tg .shelf { margin-top: 26px; }
.tg .seg-wrap { margin-top: 30px; position: sticky; top: 0; z-index: 10; padding: 8px 0;
  background: color-mix(in srgb, var(--canvas) 80%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.tg .dock { display: none; }
.tg .toast { bottom: 24px; }
.rules-more { margin-top: 26px; }
.rules-more summary { cursor: pointer; color: var(--diff); font-size: 15px; list-style: none; text-align: center; }
.rules-more summary::-webkit-details-marker { display: none; }
.rules-more[open] summary { margin-bottom: 16px; }
