/* Horse race: sky, dirt track with six lanes, odds cards and the bet dock (one layout for computer and phone) */
#game:has(.hr){background:radial-gradient(ellipse at 50% 0,rgba(120,200,120,.16),transparent 55%),linear-gradient(#0f1a10,#080b06)}
.hr{display:flex;flex-direction:column;gap:8px;width:100%;max-width:980px;margin:0 auto;user-select:none}
.hr-top{flex:none;display:flex;align-items:center;justify-content:space-between;gap:10px}
.hr-state{font-family:var(--display);font-size:20px;color:#ffe9a8;white-space:nowrap}.hr-state[data-ph=racing]{color:#8dffa4}
.hr-hist{display:flex;gap:5px;overflow:hidden;min-width:0;direction:rtl}
.hr-hist i{flex:none;display:flex;flex-direction:column;align-items:center;font-style:normal;line-height:1.1}
.hr-hist b{width:22px;height:22px;border-radius:50%;background:var(--hc);color:#111;font:800 13px/22px Arial;text-align:center;border:1px solid #0008}
.hr-hist small{font-size:10px;opacity:.75}
.hr-track{position:relative;height:clamp(300px,44dvh,440px);border-radius:16px;overflow:hidden;border:3px solid #d9b45a;box-shadow:0 8px 24px #000a;container-type:size;display:flex;flex-direction:column}
.hr-sky{flex:none;height:11cqh;position:relative;background:linear-gradient(#2f6fb4,#9fd0f0)}
/* a crowd and the white rail between the sky and the track */
.hr-sky::before{content:"";position:absolute;left:0;right:0;bottom:3px;height:55%;background:radial-gradient(circle,#e9b48f 28%,transparent 32%) 0 0/11px 9px,radial-gradient(circle,#c62828 36%,transparent 40%) 4px 4px/17px 11px,radial-gradient(circle,#f0c35a 36%,transparent 40%) 9px 3px/23px 12px,#3a2a3f}
.hr-sky::after{content:"";position:absolute;left:0;right:0;bottom:-4px;height:7px;background:repeating-linear-gradient(90deg,#fff 0 4px,#b8b8b8 4px 6px,transparent 6px 34px),linear-gradient(transparent 0 1px,#fff 1px 4px,transparent 4px)}
.hr-track.run .hr-sky::before,.hr-track.run .hr-sky::after{animation:hrscroll 1.6s linear infinite}
@keyframes hrscroll{to{background-position:-187px 0,-183px 4px,-178px 3px,0 0}}
.hr-lanes{flex:1;position:relative;display:flex;flex-direction:column;background:linear-gradient(#a4713f,#8a5a2e);--hw:min(15cqw,calc(20cqh * 1.41))}
.hr-lane{flex:1;position:relative;border-top:1px dashed #ffffff45}
.hr-lane:nth-child(even){background:#00000012}
.hr-gate{position:absolute;left:4px;top:50%;transform:translateY(-50%);width:20px;height:20px;border-radius:5px;background:var(--hc);color:#111;font:800 13px/20px Arial;text-align:center;border:1px solid #0008}
.hr-finish{position:absolute;top:0;bottom:0;right:10cqw;width:12px;background:conic-gradient(#fff 25%,#111 0 50%,#fff 0 75%,#111 0) 0 0/12px 12px;box-shadow:0 0 8px #000a}
/* --p goes 0..1: the nose of the horse starts after the gate number and reaches the finish line at 1 */
.hr-runner{--p:0;position:absolute;bottom:2px;left:calc(28px + var(--p) * (90cqw - 28px - var(--hw)));width:var(--hw);height:calc(var(--hw)/1.41);z-index:2}
.hr-lane:nth-child(1) .hr-runner{z-index:1}
.hr-art{display:block;width:100%;height:100%;filter:drop-shadow(0 3px 2px #0007)}.hr-art svg{width:100%;height:100%;display:block;overflow:visible}
.hr-place{position:absolute;right:2px;top:50%;transform:translateY(-50%);min-width:20px;height:20px;border-radius:50%;font:800 12px/20px Arial;text-align:center;color:#fff}
.hr-place:not(:empty){background:#0009}.hr-place.p1{background:#d9a62e;color:#221400}.hr-place.p2{background:#b9c2cc;color:#111}.hr-place.p3{background:#b0713a}
/* gallop */
.hr-runner.go .hr-body{animation:hrbob .36s ease-in-out infinite}
.hr-runner.go .hr-leg{animation:hrleg .36s linear infinite}
.hr-runner.go .hr-leg .hr-shin{animation:hrshin .36s linear infinite}
.hr-runner.go .l2,.hr-runner.go .l2 .hr-shin{animation-delay:-.06s}
.hr-runner.go .l3,.hr-runner.go .l3 .hr-shin{animation-delay:-.18s}
.hr-runner.go .l4,.hr-runner.go .l4 .hr-shin{animation-delay:-.24s}
.hr-runner.go .hr-tail{animation:hrtail .36s ease-in-out infinite;transform-origin:34px 41px}
.hr-runner.go .hr-jockey{animation:hrride .36s ease-in-out infinite}
@keyframes hrbob{0%,100%{transform:translateY(0) rotate(0)}30%{transform:translateY(-3.500px) rotate(-2.500deg)}70%{transform:translateY(1px) rotate(1.500deg)}}
@keyframes hrleg{0%{transform:rotate(38deg)}50%{transform:rotate(-36deg)}100%{transform:rotate(38deg)}}
@keyframes hrshin{0%{transform:rotate(-8deg)}35%{transform:rotate(4deg)}65%{transform:rotate(62deg)}100%{transform:rotate(-8deg)}}
@keyframes hrtail{50%{transform:rotate(11deg)}}
@keyframes hrride{50%{transform:translateY(2px)}}
.hr-dust{position:absolute;left:-22%;bottom:0;width:45%;height:36%;opacity:0;background:radial-gradient(circle at 25% 65%,#e8c79c 0 18%,transparent 40%),radial-gradient(circle at 65% 75%,#e8c79c 0 14%,transparent 34%),radial-gradient(circle at 45% 35%,#e8c79c 0 10%,transparent 28%)}
.hr-runner.go .hr-dust{animation:hrdust .36s linear infinite}
@keyframes hrdust{from{opacity:.8;transform:translateX(25%) scale(.6)}to{opacity:0;transform:translateX(-45%) scale(1.35)}}
.hr-call{position:absolute;left:50%;top:2px;transform:translateX(-50%);direction:rtl;white-space:nowrap;font-weight:800;font-size:13px;padding:1px 12px;border-radius:12px;background:#000b;color:#fff3b0;z-index:4}
.hr-call:empty{display:none}
.hr-banner{position:absolute;left:50%;top:52%;transform:translate(-50%,-50%);direction:rtl;z-index:5;width:max-content;max-width:92%;text-align:center;padding:10px 24px;border-radius:18px;background:linear-gradient(#2a1016f2,#0d0508f2);border:3px solid var(--hc);box-shadow:0 0 30px #000;animation:hrpop .45s cubic-bezier(.2,1.5,.4,1)}
.hr-banner[hidden]{display:none}
.hr-banner small{display:block;font-size:12px;opacity:.8}.hr-banner b{font-family:var(--display);font-weight:400;font-size:28px;color:var(--hc);margin-inline-end:8px}.hr-banner>span{font-size:20px;color:#ffd54f}
.hr-banner em{display:block;font-style:normal;font-weight:800;font-size:18px}.hr-banner em.win{color:#8dffa4}.hr-banner em.lose{color:#ffab9e}
.hr-banner p{margin:4px 0 0;font-size:12px;opacity:.85}
@keyframes hrpop{from{opacity:0;transform:translate(-50%,-50%) scale(.6)}}
.hr-horses{flex:none;display:grid;grid-template-columns:repeat(3,1fr);gap:7px}
.hr-horses .hr-card{position:relative;display:grid;grid-template-columns:30px minmax(0,1fr) auto;grid-template-rows:auto auto;column-gap:8px;align-items:center;text-align:start;padding:6px 10px;border-radius:12px;background:linear-gradient(#22151c,#100a0e);border:2px solid #ffffff1f;color:var(--txt)}
.hr-card:not(:disabled):hover{border-color:var(--hc)}.hr-card:disabled{opacity:.75}
.hr-no{grid-row:span 2;width:30px;height:30px;border-radius:8px;background:var(--hc);color:#111;font:800 17px/30px Arial;text-align:center}
.hr-nm{font-family:var(--display);font-size:17px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hr-odds{grid-row:span 2;font-size:20px;color:#ffd54f}
.hr-sub{font-size:11px;opacity:.75;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hr-mine{position:absolute;top:-8px;inset-inline-end:8px;font-style:normal;font-size:12px;font-weight:800;padding:0 8px;border-radius:9px;background:#f6d36a;color:#241400}.hr-mine:empty{display:none}
.hr-horses .hr-card.mine{border-color:#f6d36a;box-shadow:0 0 12px #f6d36a66}
.hr-horses .hr-card.won{opacity:1;border-color:#8dffa4;box-shadow:0 0 18px #8dffa4aa;background:linear-gradient(#1d4a2c,#0c2415)}
.hr-dock{flex:none;display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:center;padding:8px;border-radius:14px;background:linear-gradient(#1d1218,#0b070a);border:1px solid #e8b42266}
.hr-quick{display:flex;gap:5px}.hr-quick button{min-width:48px;height:36px;padding:0 6px;font-size:13px}.hr-quick button.on{background:linear-gradient(#f6d36a,#c9931c);color:#241400}
.hr-amt{display:flex;align-items:center;gap:6px;font-size:13px}.hr-amt input{width:110px;height:36px;text-align:center;direction:ltr}
.hr-dock>button{height:36px}
@media(max-height:820px){body:not(.phone) .hr{gap:5px}body:not(.phone) .hr-track{height:clamp(230px,38dvh,330px)}body:not(.phone) .hr-horses .hr-card{padding:2px 10px}body:not(.phone) .hr-nm{font-size:15px}body:not(.phone) .hr-dock{padding:4px}}
/* who bet and who won: a side panel on a wide screen, a window behind a button otherwise */
.hr-tools{flex:none;display:flex;gap:6px;align-items:center}
.hr-who{height:30px;padding:0 10px;font-size:13px;white-space:nowrap}.hr-who b{color:#ffd54f;margin-inline-start:3px}
.hr-board{display:none;flex-direction:column;min-height:0;border-radius:14px;border:1px solid #e8b42266;background:linear-gradient(#1d1218,#0b070a);overflow:hidden}
.hr-board .hr-bhead{flex:none;display:flex;justify-content:space-between;align-items:center;padding:7px 10px;font-family:var(--display);color:var(--gold);border-bottom:1px solid #ffffff1a}
.hr-board .hr-bhead button{width:28px;height:28px;padding:0}
.hr-blist{flex:1;min-height:0;overflow-y:auto;padding:6px;display:flex;flex-direction:column;gap:5px}
.hr-row{flex:none;padding:5px 8px;border-radius:10px;background:#0006;border:1px solid transparent}
.hr-row.me{border-color:#f6d36a88}.hr-row.up{background:#123d22}.hr-row.down{background:#2c1014}
.hr-who-line{display:flex;justify-content:space-between;align-items:baseline;gap:6px;font-size:13px}
.hr-who-line b{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.hr-net{font-weight:800;font-size:15px}.hr-row.up .hr-net{color:#8dffa4}.hr-row.down .hr-net{color:#ffab9e}
.hr-picks{display:flex;flex-wrap:wrap;gap:4px;margin-top:3px}
.hr-picks span{display:flex;align-items:center;gap:4px;padding:1px 6px 1px 2px;border-radius:8px;background:#0007;direction:ltr}
.hr-picks i{width:17px;height:17px;border-radius:5px;background:var(--hc);color:#111;font:800 11px/17px Arial;text-align:center}
.hr-picks em{font-style:normal;font-size:11px}.hr-picks span.hit{box-shadow:0 0 0 1px #8dffa4}
.hr-row small{display:block;margin-top:2px;font-size:11px;opacity:.75}
.hr-nobody{text-align:center;font-size:13px;opacity:.7;margin:14px 4px}
.hr-veil{display:none;position:fixed;inset:0;z-index:65;background:#000a}
.hr.show-board .hr-veil{display:block}
.hr.show-board .hr-board{display:flex;position:fixed;z-index:66;left:50%;top:50%;transform:translate(-50%,-50%);width:min(420px,92vw);height:min(520px,76dvh);box-shadow:0 20px 50px #000}
.hr-banner ul{list-style:none;margin:6px 0 0;padding:0;min-width:200px}
.hr-banner li{display:flex;justify-content:space-between;gap:14px;font-size:13px;line-height:1.5}.hr-banner li.up span{color:#8dffa4;font-weight:800}.hr-banner li.down span{color:#ffab9e}
@media(min-width:1200px){
  body:not(.phone) .hr{display:grid;grid-template-columns:minmax(0,1fr) 230px;grid-auto-rows:auto;column-gap:10px;max-width:1220px;align-content:start}
  body:not(.phone) .hr>.hr-top,body:not(.phone) .hr>.hr-track,body:not(.phone) .hr>.hr-horses,body:not(.phone) .hr>.hr-dock{grid-column:1}
  body:not(.phone) .hr>.hr-board{display:flex;grid-column:2;grid-row:1/span 4;position:static;transform:none;width:auto;height:0;min-height:100%}
  body:not(.phone) .hr-board .hr-bhead button,body:not(.phone) .hr-who,body:not(.phone) .hr-veil{display:none}
}

/* phone: one screen, the track takes what is left */
body.phone.ingame #game:has(.hr){padding:0}
body.phone .hr{flex:1;min-height:0;max-width:100%;gap:5px;padding-top:5px}
body.phone .hr-top{padding:0 8px}body.phone .hr-state{font-size:15px}
body.phone .hr-hist i:nth-child(n+6){display:none}
body.phone .hr-track{flex:1;height:auto;min-height:150px;margin:0 4px;border-width:2px}
body.phone .hr-lanes{--hw:min(23cqw,calc(18cqh * 1.41))}
body.phone .hr-gate{width:16px;height:16px;font-size:11px;line-height:16px;left:2px}
body.phone .hr-runner{left:calc(19px + var(--p) * (88cqw - 19px - var(--hw)))}
body.phone .hr-finish{right:12cqw;width:8px;background-size:8px 8px}
body.phone .hr-place{right:1px;min-width:17px;height:17px;line-height:17px;font-size:11px}
body.phone .hr-horses{grid-template-columns:1fr 1fr;gap:6px;padding:3px 8px 0}
body.phone .hr-horses .hr-card{grid-template-columns:26px minmax(0,1fr) auto;column-gap:6px;padding:3px 6px;min-width:0}
body.phone .hr-no{width:26px;height:26px;line-height:26px;font-size:15px}
body.phone .hr-nm{font-size:14px}body.phone .hr-odds{font-size:16px}body.phone .hr-sub{font-size:10px}
body.phone .hr-dock{display:grid;grid-template-columns:1fr 1fr;gap:6px;border:0;border-top:2px solid var(--gold2);border-radius:0;padding:7px 8px calc(env(safe-area-inset-bottom) + 7px)}
body.phone .hr-quick{grid-column:1/-1}body.phone .hr-quick button{flex:1;min-width:0;height:34px}
body.phone .hr-amt{display:none}
body.phone .hr-dock>button{height:34px;padding:0}
@media(max-height:680px){body.phone .hr-sub{display:none}body.phone .hr-horses .hr-card{grid-template-rows:auto}body.phone .hr-horses{gap:4px}body.phone .hr-dock{gap:4px;padding-top:4px}body.phone .hr-quick button,body.phone .hr-dock>button{height:30px}}
body.phone .hr.show-board .hr-board{left:0;right:0;top:auto;bottom:0;transform:none;width:100%;height:62dvh;border-radius:18px 18px 0 0;padding-bottom:env(safe-area-inset-bottom)}
body.phone .hr-banner{padding:8px 16px}body.phone .hr-banner ul{min-width:170px}body.phone .hr-banner li{font-size:12px;line-height:1.4}
body.phone .hr-hist i:nth-child(n+4){display:none}
body.phone .hr-who{height:28px;padding:0 8px;font-size:12px}
