.race-entry { display:flex; align-items:center; gap:14px; margin-top:16px; padding:18px; flex-wrap:wrap; }
.race-entry__star { font-size:2rem; color:var(--color-accent); }
.race-entry > div { flex:1; min-width:160px; }
.race-entry p { margin:5px 0 0; color:var(--color-text-secondary); font-size:.9rem; }
.daily-race { position:relative; color:var(--color-text-main); line-height:1.65; }
.casino-entry-btn { font-size:1.35rem; }
body[data-theme] #view-tasks .casino-entry-btn { width:44px; height:44px; min-width:44px; border:0; border-radius:50%; background:#ffffff08; color:var(--qn-scene-text,var(--color-text-main)); }
.casino-coin-rain { position:absolute; inset:0; overflow:hidden; pointer-events:none; z-index:5; border-radius:18px; }
.casino-coin-rain > span { position:absolute; top:-36px; left:var(--coin-x); width:24px; height:24px; display:grid; place-items:center; border:2px solid #ffe4a3; border-radius:50%; background:#b97c22; color:#fff3bc; box-shadow:0 0 14px #ffd87655; font-size:15px; animation:casino-coin-fall 2.3s var(--coin-delay) ease-in both; }
@keyframes casino-coin-fall { 0% { transform:translateY(0) rotate(0); opacity:0; } 10% { opacity:1; } 85% { opacity:.85; } 100% { transform:translateY(560px) rotate(var(--coin-spin)); opacity:0; } }
@media (prefers-reduced-motion:reduce) { .casino-coin-rain { display:none; } }
body.reduce-motion .casino-coin-rain { display:none; }
.daily-race *, .daily-race *::before, .daily-race *::after { box-sizing:border-box; }
.daily-race h2, .daily-race h3, .daily-race p { margin:0 0 12px; }
.race-kicker { display:block; font-size:.72rem; letter-spacing:.12em; color:var(--color-text-secondary); margin-bottom:8px; }
.race-heading { padding:12px 0; }
.race-heading p, .race-note { color:var(--color-text-secondary); font-size:.88rem; }
.race-rounds { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; margin-bottom:20px; }
.race-rounds .btn { white-space:normal; padding:10px 5px; min-height:44px; }
.race-rounds [aria-pressed="true"] { border:2px solid var(--color-primary); background:var(--color-primary-soft); }
.race-track-title { display:flex; gap:14px; align-items:center; padding:18px; border:1px solid var(--color-border); border-radius:18px; background:var(--color-bg-card); }
.race-track-title > span { font-size:2.5rem; color:var(--color-accent); }
.race-track-title h3 { margin:0; }
.race-track-title p { font-size:.9rem; margin:4px 0 0; color:var(--color-text-secondary); }
.daily-race fieldset { border:0; padding:0; margin:16px 0; min-width:0; }
.daily-race legend { margin-bottom:12px; font-weight:600; }
.race-entrants { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.race-entrant { position:relative; cursor:pointer; min-width:0; }
.race-entrant input { position:absolute; top:12px; right:12px; width:20px; height:20px; z-index:1; accent-color:var(--color-primary); }
.race-entrant__card { display:flex; flex-direction:column; align-items:center; gap:8px; padding:14px 10px; min-height:164px; border:2px solid var(--color-border); border-radius:16px; background:var(--color-bg-card); text-align:center; }
.race-entrant input:checked + .race-entrant__card { border-color:var(--color-primary); background:var(--color-primary-soft); }
.race-entrant input:focus-visible + .race-entrant__card { outline:3px solid var(--color-accent); outline-offset:2px; }
.race-entrant strong { overflow-wrap:anywhere; line-height:1.4; }
.race-entrant small { color:var(--color-text-secondary); }
.race-number { align-self:flex-start; font-size:.75rem; letter-spacing:.1em; color:var(--color-text-secondary); }
.race-entrant .pet-image-frame { width:72px; height:72px; }
.race-entrant .pet-img { width:100%; height:100%; object-fit:cover; }
.race-stake { padding:16px; margin:16px 0; border:1px solid var(--color-border); border-radius:14px; }
.race-stake label { display:block; margin-bottom:8px; }
.race-stake input { width:100%; min-height:48px; padding:10px; border:1px solid var(--color-border); border-radius:8px; color:var(--color-text-main); background:var(--color-bg-surface); font:inherit; font-size:1.25rem; }
.race-amounts { display:flex; gap:8px; flex-wrap:wrap; margin:10px 0; }
.race-amounts .btn { flex:1; min-height:44px; }
.race-actions { display:flex; flex-wrap:wrap; gap:10px; margin:16px 0; }
.race-actions .btn { flex:1; min-height:48px; white-space:normal; }
.race-ledger { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; padding:16px 8px; background:var(--color-bg-card); border-radius:14px; text-align:center; }
.race-ledger dt { font-size:.78rem; color:var(--color-text-secondary); }
.race-ledger dd { margin:6px 0 0; font-size:1.35rem; font-weight:700; overflow-wrap:anywhere; }
.race-risk { padding:14px; border-left:3px solid var(--color-accent); background:var(--color-accent-soft); }
.race-error { color:var(--color-danger); }
.race-error:empty { display:none; }
.race-receipt { text-align:center; padding:22px 8px; }
.race-receipt > .pet-image-frame { width:88px; height:88px; margin:12px auto; }
.race-receipt .pet-img { width:100%; height:100%; object-fit:cover; }
.race-history, .race-rules { border-top:1px solid var(--color-border); padding:16px 0; margin-top:12px; }
.race-history summary, .race-rules summary { cursor:pointer; min-height:32px; font-weight:600; }
.race-rules p { margin-top:12px; font-size:.9rem; }
.race-history ol { padding:0; list-style:none; }
.race-history li { display:flex; gap:12px; border-bottom:1px solid var(--color-border); padding:12px 0; font-size:.86rem; }
.race-history li > span:first-child { font-size:1.6rem; color:var(--color-accent); }
.race-day-done { padding:14px; background:var(--color-primary-soft); border-radius:12px; }
.race-arena { padding:12px; border:1px solid var(--color-border); border-radius:18px; background:var(--color-bg-card); overflow:hidden; }
.race-lane { border-bottom:1px dashed var(--color-border); padding:8px 0; }
.race-lane:last-child { border-bottom:0; }
.race-lane__name { font-size:.8rem; color:var(--color-text-secondary); }
.race-path { position:relative; height:58px; margin-right:52px; }
.race-path::after { content:'✦'; position:absolute; right:-40px; top:15px; color:var(--color-accent); }
.race-runner { position:absolute; left:0; top:5px; z-index:1; }
.race-runner .pet-image-frame { width:44px; height:44px; }
.race-runner .pet-img { width:100%; height:100%; object-fit:cover; }
.race-commentary { min-height:3.5em; padding-top:16px; }
@media (max-width:360px) { .race-entrant__card { padding:10px 6px; } .race-ledger dd { font-size:1.1rem; } }
@media (prefers-reduced-motion:reduce) { .daily-race * { animation:none !important; transition:none !important; } }

.race-show { color:var(--color-text-main,#edf2fc); }
.race-show__heading h2 { margin:0 0 6px; font-size:1.45rem; }
.race-show__heading p { font-size:.8rem; color:var(--color-text-secondary,#afbcd1); margin-bottom:18px; }
.race-show__arena { position:relative; overflow:hidden; isolation:isolate; border:1px solid #79839455; border-radius:20px; background:linear-gradient(165deg,#1c3547,#16253b 55%,#243346); color:#edf2fc; padding:52px 12px 14px; }
.race-show__sky { position:absolute; inset:8px 20px auto; display:flex; justify-content:space-between; color:#ebd292; opacity:.5; }
.race-show__notice { position:absolute; top:17px; left:0; right:0; text-align:center; font-size:.85rem; font-weight:700; color:#f6dfa5; }
.race-show__lane { padding:5px 0; border-bottom:1px dashed #c8d8ee28; }
.race-show__lane:last-child { border-bottom:0; }
.race-show__name { display:block; font-size:.68rem; color:#c2cfdf; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; max-width:80%; }
.race-show__path { position:relative; height:58px; margin:0 26px; }
.race-show__runner { position:absolute; top:10px; transform:translateX(-50%); z-index:2; }
.race-show__portrait { display:block; width:40px; height:40px; border:2px solid #dfd4ff; border-radius:12px; background:#29394b; box-shadow:0 6px 9px #0005; overflow:hidden; }
.race-show__portrait .pet-image-frame { display:block; width:100%; height:100%; margin:0; border:0; border-radius:0; }
.race-show__portrait img { width:100%; height:100%; object-fit:cover; display:block; }
.race-show__reaction { position:absolute; top:-22px; left:7px; color:#202b40; background:#fff3cb; border-radius:7px; font-size:.7rem; font-weight:900; padding:1px 5px; opacity:0; }
.race-show__dust { position:absolute; right:100%; bottom:0; font-size:1.3rem; color:#dac998; opacity:0; }
.race-show__finish { position:absolute; top:0; width:22px; height:55px; transform:translateX(-50%); background:repeating-linear-gradient(0deg,#fff9 0 5px,#16253b99 5px 10px); border-radius:4px; text-align:center; z-index:1; }
.race-show__broadcast { padding:16px 0 8px; min-height:104px; }
.race-show__live { font-size:.68rem; letter-spacing:.12em; color:var(--color-text-secondary,#bdc9df); }
.race-show__broadcast p { font-size:.95rem; line-height:1.6; margin:5px 0 0; }
.race-show > button { min-height:44px; }
.race-show:is([data-phase="run"],[data-phase="chase"],[data-phase="tease"],[data-phase="sprint"]) .race-show__portrait { animation:race-trot .23s infinite alternate ease-in-out; }
.race-show:is([data-phase="chase"],[data-phase="tease"],[data-phase="sprint"]) .race-show__dust { opacity:.8; }
.race-show[data-phase="escape"] .race-show__reaction { opacity:1; }
.race-show .is-winner .race-show__portrait { border-color:#ffe3a2; box-shadow:0 0 0 4px #ffe3a233,0 0 25px #ffd98670; }
.race-show .is-winner .race-show__reaction { opacity:1; font-size:0; }
.race-show .is-winner .race-show__reaction::after { content:'冠軍'; font-size:.65rem; }
@keyframes race-trot { from { transform:translateY(1px) rotate(-4deg); } to { transform:translateY(-4px) rotate(4deg); } }
@media (prefers-reduced-motion:reduce) { .race-show * { animation:none !important; transition:none !important; } }

.race-show__eye { position:absolute; top:20px; left:3px; width:17px; height:15px; border-radius:50%; background:#fffbea; border:1px solid #263347; box-shadow:0 1px 4px #0005; overflow:hidden; animation:race-blink 5s infinite; }
.race-show__eye::after { content:''; position:absolute; top:4px; left:5px; width:6px; height:7px; border-radius:50%; background:#172437; transform:translateX(var(--eye-look,-3px)); transition:transform .3s; }
.race-show__broadcast { min-height:106px; margin:0 0 12px; padding:12px 14px; background:#243649; border-left:3px solid #dfc58a; border-radius:10px; }
.race-show__broadcast p { color:#edf2fc; font-size:1rem; }
.race-show > button { margin-top:16px; }
.race-show.is-reduced * { animation:none !important; transition:none !important; }
@keyframes race-blink { 0%,45%,49%,100% { transform:scaleY(1); } 47% { transform:scaleY(.12); } }
@media (prefers-reduced-motion:reduce) { .race-show__eye { animation:none; } }

/* The eye stays attached to the moving striped finish line. */
.race-show__finish--eye { width:24px; }
.race-show__finish--eye .race-show__eye { top:19px; left:0; width:24px; height:20px; }
.race-show__finish--eye .race-show__eye::after { top:5px; left:8px; width:7px; height:9px; }
.race-show[data-script="living-finish"] .race-show__path { background:linear-gradient(#3e5755,#304644); border-top:2px solid #b5c8b280; border-bottom:2px solid #b5c8b280; border-left:3px solid #e9dfbb; border-radius:3px; }
.race-show[data-script="living-finish"] .race-show__path::before { content:''; position:absolute; top:26px; left:0; right:0; height:2px; background:repeating-linear-gradient(90deg,#e9dfbb70 0 12px,transparent 12px 26px); pointer-events:none; }
.race-show:is([data-phase="sleep"],[data-phase="wake"],[data-phase="wrong"],[data-phase="turn"]) .race-show__portrait { animation:race-trot .23s infinite alternate ease-in-out; }
.race-show .is-sleeping .race-show__portrait { animation:race-doze 1.4s infinite alternate ease-in-out; }
.race-show .is-sleeping .race-show__reaction { opacity:1; color:#6e5196; background:#eee4ff; }
.race-show .is-sleeping .race-show__dust { opacity:0; }
.race-show .is-backwards .race-show__portrait img { transform:scaleX(-1); }
.race-show[data-phase="turn"] .race-show__reaction { opacity:1; }
@keyframes race-doze { from { transform:translateY(2px) rotate(-15deg); } to { transform:translateY(4px) rotate(-10deg); } }
@media (prefers-reduced-motion:reduce) { .race-show * { animation:none !important; transition:none !important; } }

.casino-coin-rain > span::after { content:"✦"; }
