/* Goodluck-Bet: clover green and a little gold on a green-grey paper. All colours are the tokens below. */
:root {
  color-scheme: light;
  --bg: #eef2ec; --card: #fbfdfa; --line: #d6dfd5; --ink: #14261d; --soft: #55695d; --fill: #e3ebe1;
  --green: #0b6b43; --on-green: #ffffff; --tint: #d5ecdf; --deep: #0c3b29; --on-deep: #eaf6ee;
  --gold: #a87400; --red: #b3341f; --red-tint: #f8e0da; --home: #0b6b43; --draw: #8b988f; --away: #c98a12;
  --radius: 16px; --nav: 60px; --pad: 16px;
  --font: "Vazirmatn", "Segoe UI", "SF Arabic", "Noto Sans Arabic", Roboto, Tahoma, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1410; --card: #13201a; --line: #25362d; --ink: #e5efe8; --soft: #9bb0a3; --fill: #1c2c24;
    --green: #4fd39a; --on-green: #05281a; --tint: #173a2a; --deep: #0f2f22; --on-deep: #e0f2e7;
    --gold: #efbf55; --red: #ff9180; --red-tint: #3b1f1a; --home: #4fd39a; --draw: #74857b; --away: #efbf55;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1410; --card: #13201a; --line: #25362d; --ink: #e5efe8; --soft: #9bb0a3; --fill: #1c2c24;
  --green: #4fd39a; --on-green: #05281a; --tint: #173a2a; --deep: #0f2f22; --on-deep: #e0f2e7;
  --gold: #efbf55; --red: #ff9180; --red-tint: #3b1f1a; --home: #4fd39a; --draw: #74857b; --away: #efbf55;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.75 var(--font); overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent; min-height: 100dvh; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
a { color: var(--green); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
main:focus { outline: none; }
svg { display: block; }

/* frame */
#top { position: sticky; top: 0; z-index: 5; background: var(--deep); color: var(--on-deep); display: flex; align-items: center; gap: 4px;
  padding: calc(var(--safe-t) + 4px) 8px 4px; min-height: calc(52px + var(--safe-t)); }
#top .name { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px; }
#top button { width: 44px; height: 44px; border: 0; background: none; color: inherit; border-radius: 12px; display: grid; place-items: center; flex: none; }
#top button:active { background: rgb(255 255 255 / .14); }
#top svg { width: 24px; height: 24px; }
#main { max-width: 720px; margin: 0 auto; padding: var(--pad) var(--pad) calc(var(--nav) + var(--safe-b) + 28px); display: grid; gap: 14px;
  grid-template-columns: minmax(0, 1fr); }
body.asking #main { padding-bottom: calc(var(--nav) + var(--safe-b) + 150px); }
#nav { position: fixed; inset-inline: 0; bottom: 0; z-index: 5; background: var(--card); border-top: 1px solid var(--line);
  display: flex; justify-content: center; padding-bottom: var(--safe-b); }
#nav button { flex: 1; max-width: 144px; height: var(--nav); border: 0; background: none; color: var(--soft); display: grid; justify-items: center;
  align-content: center; gap: 2px; font-size: .75rem; line-height: 1.4; padding: 0; }
#nav svg { width: 24px; height: 24px; }
#nav [aria-current] { color: var(--green); font-weight: 700; }
#busy { position: fixed; inset: 0 0 auto; height: 3px; z-index: 9; background: linear-gradient(90deg, transparent, var(--gold), transparent);
  background-size: 40% 100%; background-repeat: no-repeat; animation: run 1.1s linear infinite; }
@keyframes run { from { background-position: -60% 0; } to { background-position: 160% 0; } }
#toast { position: fixed; z-index: 8; inset-inline: 16px; bottom: calc(var(--nav) + var(--safe-b) + 14px); display: grid; justify-items: center; gap: 8px; pointer-events: none; }
#toast > div { max-width: 560px; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: .9375rem; white-space: pre-line; }
body.asking #toast { bottom: calc(var(--nav) + var(--safe-b) + 120px); }

/* a page of the bot */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
h1 { font-size: 1.25rem; line-height: 1.6; font-weight: 700; margin: 2px 2px 0; text-wrap: balance; }
h1 b { font-weight: inherit; }
h2 { font-size: 1rem; line-height: 1.6; font-weight: 700; margin: 8px 2px -4px; }
.text > div { white-space: pre-wrap; }
.text > div + div { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.text i, .text em { color: var(--soft); font-style: normal; font-size: .9375em; }
.text .fine { font-size: .875rem; color: var(--soft); }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; width: 100%; text-align: left; }
.text code { font-family: inherit; background: var(--fill); border-radius: 6px; padding: 1px 6px; cursor: copy; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.text pre { direction: ltr; text-align: left; overflow-x: auto; margin: 4px 0; font: .8125rem/1.7 ui-monospace, Consolas, "Roboto Mono", monospace; white-space: pre; }
.text blockquote { margin: 6px 0; padding: 2px 12px; border-inline-start: 1px solid var(--line); color: var(--soft); }
.spoiler { background: var(--fill); }
.chart { overflow-x: auto; border-radius: 12px; background: #fff; }
.chart img { display: block; width: 100%; min-width: 680px; height: auto; }
#at { scroll-margin-top: 124px; }

.rows { display: grid; gap: 8px; }
.row { display: flex; gap: 8px; direction: ltr; }
.row > * { flex: 1 1 0; min-width: 0; direction: rtl; }
.btn { display: grid; place-content: center; text-align: center; min-height: 48px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); line-height: 1.5; font-size: .9375rem; text-decoration: none; }
.btn:active { background: var(--fill); }
.btn[disabled] { opacity: .55; }
.doing { background-image: linear-gradient(100deg, transparent 35%, var(--tint) 50%, transparent 65%) !important; background-size: 250% 100% !important; animation: sweep 1.2s linear infinite; }
.btn.go.doing { opacity: .75; }
@keyframes sweep { from { background-position: 120% 0; } to { background-position: -60% 0; } }
.btn.on { background: var(--tint); border-color: var(--green); font-weight: 600; }
.btn.go { background: var(--green); border-color: var(--green); color: var(--on-green); font-weight: 700; }
.btn.stop { background: var(--red-tint); border-color: var(--red); color: var(--red); font-weight: 700; }
.btn.del { color: var(--red); }
.btn.back { background: none; color: var(--soft); }
.lbl { display: grid; place-content: center; text-align: center; min-height: 32px; color: var(--soft); font-size: .875rem; }
.row.cells { gap: 4px; }
.row.cells .btn { padding: 4px 0; min-height: 44px; font-size: .875rem; }
.quiet { border: 0; background: none; color: var(--soft); font-size: .875rem; min-height: 44px; justify-self: center; text-decoration: underline; text-underline-offset: 4px; }
.chips { position: sticky; top: calc(52px + var(--safe-t)); z-index: 4; margin: 0 calc(var(--pad) * -1); padding: 8px var(--pad); background: var(--bg);
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; min-height: 44px; padding: 4px 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--card); font-size: .9375rem; white-space: nowrap; }
.chips button[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: var(--on-green); font-weight: 600; }
.wait { display: flex; gap: 12px; align-items: center; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--green); animation: turn .9s linear infinite; flex: none; }
@keyframes turn { to { transform: rotate(1turn); } }
.bones { display: grid; gap: 14px; }
.bones p { margin: 0 2px; color: var(--soft); opacity: 0; animation: later .3s 2s forwards; }
@keyframes later { to { opacity: 1; } }
.bones div { height: 72px; border-radius: var(--radius); background: var(--fill); animation: fade 1.4s ease-in-out infinite alternate; }
@keyframes fade { to { opacity: .45; } }

/* matches */
.list { padding: 0; overflow: hidden; }
.group { padding: 8px 16px; background: var(--fill); font-weight: 600; font-size: .875rem; }
.m { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 12px; align-items: center; width: 100%; padding: 10px 16px; border: 0; background: none; text-align: start; }
.m + .m { border-top: 1px solid var(--line); }
button.m:active { background: var(--fill); }
.m .at { text-align: center; font-size: .875rem; line-height: 1.5; color: var(--soft); border-inline-end: 1px solid var(--line); padding-inline-end: 10px; align-self: stretch; display: grid; align-content: center; justify-items: center; gap: 2px; }
.m .at b { color: var(--ink); font-size: .9375rem; }
.live, .m .at b.live { color: var(--red); }
.side { display: flex; align-items: baseline; gap: 8px; }
.side .n { flex: 1; min-width: 0; direction: ltr; text-align: right; }
.side .n small { display: block; color: var(--soft); font-size: .75rem; line-height: 1.5; }
.side.won .n, .side.won .sc { font-weight: 700; }
.side .sets { direction: ltr; display: flex; gap: 8px; color: var(--soft); font-size: .875rem; font-variant-numeric: tabular-nums; }
.side .sc { min-width: 20px; text-align: center; font-size: 1.0625rem; font-variant-numeric: tabular-nums; }
.side .fav { width: 8px; height: 8px; border-radius: 50%; flex: none; align-self: center; border: 2px solid transparent; }
.fav.first { background: var(--home); } .fav.second { border-color: var(--away) !important; } .fav.even { background: var(--draw); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--draw); }
.dot.g { background: var(--home); } .dot.r { background: var(--red); } .dot.y { background: var(--away); } .dot.w { background: none; border: 2px solid var(--draw); }
details { font-size: .875rem; color: var(--soft); padding: 0 2px; }
summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; text-decoration: underline; text-underline-offset: 4px; width: max-content; }
summary::-webkit-details-marker { display: none; }
.hero { background: var(--deep); color: var(--on-deep); border: 0; display: grid; gap: 10px; }
.hero .when { font-size: .875rem; opacity: .85; }
.hero .side .n { font-size: 1.125rem; font-weight: 600; }
.hero .side .n small, .hero .sets { color: inherit; opacity: .85; }
.hero .sc { font-size: 1.5rem; font-weight: 700; line-height: 1.3; }
.bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; }
.bar i { display: block; min-width: 2px; }
.bar .home { background: #4fd39a; } .bar .draw { background: #8fa398; } .bar .away { background: #efbf55; }
.keys { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 14px; font-size: .875rem; }
.keys span { display: inline-flex; align-items: center; gap: 6px; }
.keys i { width: 10px; height: 10px; border-radius: 3px; }
.keys .home { background: #4fd39a; } .keys .draw { background: #8fa398; } .keys .away { background: #efbf55; }

/* home */
.hello { display: flex; align-items: center; gap: 12px; }
.hello img { width: 44px; height: 44px; border-radius: 12px; }
.hello p { margin: 0; color: var(--soft); font-size: .9375rem; }
.fit { display: grid; gap: 14px; }
.fit .head { display: flex; gap: 16px; align-items: center; }
.ring { width: 96px; height: 96px; flex: none; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; stroke: var(--fill); }
.ring .val { stroke: var(--green); stroke-linecap: round; transition: stroke-dashoffset .6s ease-out; }
.ring p { position: absolute; inset: 0; margin: 0; display: grid; place-content: center; text-align: center; line-height: 1.35; font-size: .75rem; color: var(--soft); }
.ring b { font-size: 1.375rem; color: var(--ink); }
.fit .sum { flex: 1; min-width: 0; }
.fit .sum b { font-size: 1.125rem; }
.fit .sum p { margin: 2px 0 0; color: var(--soft); font-size: .9375rem; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; font-size: .75rem; color: var(--soft); }
.week .col { height: 52px; display: flex; align-items: flex-end; background: var(--fill); border-radius: 6px; overflow: hidden; }
.week .col i { width: 100%; background: var(--green); border-radius: 6px 6px 0 0; }
.week .now { color: var(--ink); font-weight: 700; }
.rep { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.rep .what { flex: 1; min-width: 0; line-height: 1.5; }
.rep small { display: block; color: var(--soft); }
.rep .btn { padding-inline: 14px; flex: none; }
.running { background: var(--deep); color: var(--on-deep); border-radius: 12px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.running .what { flex: 1; }
.clock { font-size: 1.75rem; line-height: 1.3; font-weight: 700; font-variant-numeric: tabular-nums; direction: ltr; text-align: right; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(98px, 1fr)); gap: 10px; }
.tile { display: grid; justify-items: center; align-content: center; gap: 4px; min-height: 84px; padding: 10px 6px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); font-size: .9375rem; line-height: 1.5; text-align: center; }
.tile:active, .item:active { background: var(--fill); }
.tile .e { font-size: 1.625rem; line-height: 1.3; }
.tile.wide { grid-column: 1 / -1; grid-auto-flow: column; justify-content: start; align-items: center; gap: 12px; min-height: 60px; padding-inline: 18px; background: var(--green); border-color: var(--green); color: var(--on-green); font-weight: 700; }
.item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 16px; border: 0; background: none; text-align: start; line-height: 1.6; }
.item + .item, .item + label.item { border-top: 1px solid var(--line); }
.item .grow { flex: 1; min-width: 0; }
.item small { display: block; color: var(--soft); }
.item .e { font-size: 1.25rem; width: 28px; text-align: center; flex: none; }
.item .num { background: var(--tint); border-radius: 10px; padding: 0 9px; font-weight: 600; }
.seg { display: flex; gap: 4px; background: var(--fill); border-radius: 12px; padding: 4px; }
.seg button { border: 0; background: none; border-radius: 9px; min-height: 40px; padding: 0 12px; font-size: .875rem; }
.seg button[aria-pressed="true"] { background: var(--card); font-weight: 700; }
.off { background: var(--red-tint); color: var(--red); border-radius: 12px; padding: 8px 14px; font-size: .9375rem; }

/* typing */
#ask { position: fixed; z-index: 6; inset-inline: 0; bottom: calc(var(--nav) + var(--safe-b)); background: var(--card); border-top: 1px solid var(--line); padding: 10px var(--pad); }
#ask.card { position: static; border: 1px solid var(--line); padding: 10px 12px; }
#ask .in { max-width: 688px; margin: 0 auto; display: grid; gap: 8px; }
#ask .note { white-space: pre-wrap; max-height: 26dvh; overflow-y: auto; font-size: .9375rem; }
#ask .line { display: flex; gap: 8px; align-items: flex-end; }
textarea, input[type="text"], input[type="search"] { width: 100%; background: var(--bg); border: 1px solid var(--soft); border-radius: 12px; padding: 10px 14px; line-height: 1.6; font-size: 1rem; }
textarea { resize: none; max-height: 34dvh; display: block; }
#ask .btn { flex: none; min-width: 76px; }
.find { display: flex; gap: 8px; }
.find .btn { flex: none; min-width: 88px; }

/* signing in */
.login { min-height: calc(100dvh - 64px); display: grid; align-content: center; gap: 18px; max-width: 420px; margin: 0 auto; width: 100%; }
.login img { width: 84px; height: 84px; border-radius: 22px; }
.login h1 { font-size: 1.625rem; margin: 0; }
.login p { margin: 0; color: var(--soft); }
.login ol { list-style: persian; margin: 0; padding-inline-start: 22px; display: grid; gap: 6px; }
.login input { direction: ltr; text-align: center; font-size: 1.625rem; letter-spacing: .18em; font-variant-numeric: tabular-nums; padding: 8px; }
.login form { display: grid; gap: 12px; }
.err { color: var(--red); }

dialog { border: 0; border-radius: var(--radius); background: var(--card); color: var(--ink); padding: 18px; width: min(560px, calc(100vw - 32px)); max-height: 80dvh; }
dialog::backdrop { background: rgb(5 20 13 / .55); }
dialog .text { max-height: 58dvh; overflow-y: auto; margin-bottom: 14px; }

@media (min-width: 1000px) {   /* a desk: the sections at the side */
  body { padding-inline-start: 116px; }
  #nav { inset: 0 0 0 auto; width: 116px; flex-direction: column; justify-content: flex-start; align-items: stretch; border-top: 0; border-inline-end: 1px solid var(--line); padding-top: 64px; }
  #nav button { flex: none; max-width: none; height: 76px; font-size: .8125rem; }
  #ask { bottom: 0; inset-inline-start: 116px; }
  #main, body.asking #main { padding-bottom: 48px; }
  body.asking #main { padding-bottom: 150px; }
  #toast { bottom: 24px; inset-inline-start: 132px; }
  .btn:hover, .tile:hover, .item:hover, button.m:hover { background: var(--fill); }
  .btn.go:hover, .tile.wide:hover { background: var(--green); filter: brightness(1.08); }
  .btn.on:hover { background: var(--tint); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 3s !important; transition: none !important; } }
