/* 🔥 たのしみ (patch-fun) */
.tffun-btn { background: linear-gradient(135deg, #ff7a3c, #d93a2b) !important; color: #fff !important; border-color: #ffb08a !important; }
.tff-bg { position: fixed; inset: 0; z-index: 9000; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 12px; }
.tff-box { width: min(560px, 100%); max-height: min(86vh, 760px); overflow: auto; background: #12161c; color: #f2efe6; border: 1px solid rgba(255,190,120,.35); border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.6); }
.tff-box.hi { width: min(760px, 100%); }
.tff-h { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; background: #12161c; border-bottom: 1px solid rgba(255,255,255,.08); z-index: 1; }
.tff-h b { font-size: 1.05rem; }
.tff-tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,.06); }
.tff-tab { flex: none; padding: 7px 10px; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; background: transparent; color: #d8d3c5; font-size: .82rem; cursor: pointer; }
.tff-tab.on { background: #ff7a3c; border-color: #ff7a3c; color: #fff; font-weight: 800; }
.tff-body { padding: 12px 14px 16px; }
.tff-hero { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; background: linear-gradient(135deg, rgba(255,122,60,.18), rgba(255,255,255,.03)); margin-bottom: 10px; }
.tff-hero b { display: block; font-size: 1.05rem; }
.tff-hero small { display: block; color: #bdb7a8; font-size: .78rem; line-height: 1.5; }
.tff-hero.lg-1 { background: linear-gradient(135deg, rgba(200,210,220,.22), rgba(255,255,255,.03)); }
.tff-hero.lg-2 { background: linear-gradient(135deg, rgba(240,200,80,.28), rgba(255,255,255,.03)); }
.tff-hero.lg-3 { background: linear-gradient(135deg, rgba(150,90,230,.35), rgba(240,200,80,.15)); }
.tff-hero.rival { background: linear-gradient(135deg, rgba(200,40,30,.3), rgba(255,255,255,.03)); }
.tff-hero.gp { background: linear-gradient(135deg, rgba(40,60,160,.45), rgba(240,200,80,.12)); }
.tff-big { font-size: 2.2rem; line-height: 1; }
.tff-tiers { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 4px 0 10px; font-size: .78rem; color: #9b968a; }
.tff-tiers span.on { color: #fff; font-weight: 800; }
.tff-tiers i { font-style: normal; opacity: .5; }
.tff-rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tff-rank li { display: grid; grid-template-columns: 2rem 1fr auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; background: rgba(255,255,255,.04); font-size: .88rem; }
.tff-rank li.me { background: rgba(255,122,60,.22); outline: 1px solid rgba(255,122,60,.6); }
.tff-rank b { color: #ffd27a; text-align: center; }
.tff-rank em { font-style: normal; color: #ffd27a; font-weight: 800; }
.tff-rule, .tff-hint { color: #a9a395; font-size: .78rem; line-height: 1.6; margin: 10px 0 0; }
.tff-warn { color: #ffb08a; font-size: .82rem; }
.tff-vs { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; margin: 8px 0; }
.tff-vs b { display: block; font-size: 1.8rem; text-align: center; }
.tff-vs small { display: block; text-align: center; color: #a9a395; font-size: .72rem; }
.tff-vs .bar { height: 10px; border-radius: 99px; background: rgba(200,40,30,.45); overflow: hidden; }
.tff-vs .bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffd27a, #ff7a3c); }
.tff-goals { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; font-size: .82rem; }
.tff-goals li::before { content: "⬜ "; }
.tff-goals li.ok::before { content: "✅ "; }
.tff-stamps { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
.tff-stamps div { display: grid; justify-items: center; gap: 4px; padding: 10px 6px; border-radius: 12px; border: 1px dashed rgba(255,255,255,.18); background: rgba(255,255,255,.02); }
.tff-stamps div.on { border: 2px solid #ff7a3c; background: radial-gradient(circle, rgba(255,122,60,.25), transparent 70%); }
.tff-stamps span { font-size: 1.6rem; }
.tff-stamps small { font-size: .72rem; text-align: center; color: #d8d3c5; }
.tff-gp-today { font-size: .92rem; } .tff-gp-today .ok { color: #7fe0a0; }
.tff-switch { display: flex; gap: 8px; align-items: center; margin: 10px 0; font-size: .85rem; }
.tff-foals { display: grid; gap: 8px; }
.tff-foal { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 10px; border-radius: 10px; background: rgba(255,255,255,.04); }
.tff-foal small { display: block; color: #a9a395; font-size: .75rem; }
.tff-foal input { padding: 8px; border-radius: 8px; border: 1px solid #3c4148; background: #0b0e11; color: #fff; }
.tff-done { color: #7fe0a0; font-size: .8rem; }
.tff-msg { margin: 0 14px 14px; padding: 8px 10px; border-radius: 8px; font-size: .85rem; }
.tff-msg.ok { background: rgba(60,170,100,.2); } .tff-msg.ng { background: rgba(200,60,40,.25); }
/* pills during betting / race / result: small, on the left edge, never over the main buttons */
.tff-pill { position: fixed; left: 8px; z-index: 8000; padding: 7px 11px; border-radius: 999px; border: 1px solid rgba(255,255,255,.3); background: rgba(10,12,16,.82); color: #fff; font-size: .8rem; font-weight: 800; cursor: pointer; backdrop-filter: blur(6px); }
#tff-guess { bottom: 120px; }
#tff-hi { bottom: 120px; background: linear-gradient(135deg, #3a2a7a, #1b1f40); border-color: #a58bff; }
.tff-pill.cheer { top: 42%; padding: 12px 14px; font-size: .9rem; background: linear-gradient(135deg, #ff7a3c, #d93a2b); border-color: #ffd2b0; touch-action: manipulation; user-select: none; }
.tff-pill.cheer:active { transform: scale(.94); }
.tff-meter { position: fixed; left: 8px; top: calc(42% + 52px); z-index: 7999; width: 150px; padding: 6px 8px; border-radius: 10px; background: rgba(10,12,16,.75); color: #fff; font-size: .72rem; pointer-events: none; }
.tff-meter b { display: block; margin-bottom: 3px; }
.tff-meter span { display: block; position: relative; margin: 2px 0; }
.tff-meter i { display: block; height: 4px; border-radius: 4px; background: linear-gradient(90deg, #ffd27a, #ff7a3c); }
.tff-puff { position: fixed; z-index: 8001; pointer-events: none; font-size: 1.4rem; animation: tff-puff .9s ease-out forwards; }
@keyframes tff-puff { to { transform: translate(-10px, -70px) scale(1.4); opacity: 0; } }
.tff-pick { position: fixed; left: 8px; bottom: 160px; z-index: 8002; width: min(320px, calc(100vw - 16px)); max-height: 50vh; overflow: auto; padding: 10px; border-radius: 12px; background: #12161c; color: #fff; border: 1px solid rgba(255,190,120,.4); box-shadow: 0 16px 40px rgba(0,0,0,.5); }
.tff-pick b { display: block; } .tff-pick small { display: block; color: #a9a395; font-size: .72rem; margin-bottom: 6px; }
.tff-pick div { display: grid; gap: 4px; }
.tff-pick button { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.04); color: #fff; text-align: left; cursor: pointer; }
.tff-pick button span { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-weight: 900; font-size: .8rem; background: #eee; color: #111; }
.tff-pick .g2 { background: #212121; color: #fff; } .tff-pick .g3 { background: #d32f2f; color: #fff; } .tff-pick .g4 { background: #1976d2; color: #fff; } .tff-pick .g5 { background: #fbc02d; } .tff-pick .g6 { background: #388e3c; color: #fff; } .tff-pick .g7 { background: #f57c00; } .tff-pick .g8 { background: #f06292; }
.tff-banner { position: fixed; left: 50%; top: 18%; z-index: 8100; transform: translateX(-50%); padding: 12px 22px; border-radius: 14px; background: linear-gradient(135deg, #b3261e, #5a0f0b); color: #fff; font-weight: 900; font-size: clamp(1rem, 3.6vw, 1.5rem); letter-spacing: .04em; box-shadow: 0 10px 40px rgba(179,38,30,.5); border: 2px solid #ffd27a; animation: tff-in .5s cubic-bezier(.2,1.6,.4,1); pointer-events: none; white-space: nowrap; }
.tff-banner.out, .tff-toast.out { opacity: 0; transition: opacity .6s; }
@keyframes tff-in { from { transform: translateX(-50%) scale(.6); opacity: 0; } }
.tff-toast { position: fixed; left: 50%; bottom: 90px; z-index: 9100; transform: translateX(-50%); padding: 9px 14px; border-radius: 10px; background: rgba(20,24,30,.92); color: #fff; font-size: .85rem; pointer-events: none; }
.tff-toast.ng { background: rgba(150,40,30,.92); }
.tff-hi-body { padding: 14px; }
.tff-hi-prog { height: 8px; border-radius: 8px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 10px; }
.tff-hi-prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #a58bff, #ff7a3c); transition: width .2s; }
.tff-hi-video { width: 100%; border-radius: 10px; background: #000; aspect-ratio: 16 / 9; }
.tff-hi-acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
@media (max-width: 520px) { .tff-pill.cheer { top: 36%; } .tff-meter { top: calc(36% + 52px); width: 130px; } }
/* the standings list sits on the left during races: cheering goes to the right, above the stamp button */
.tff-pill.cheer { left: auto; right: 8px; top: 54%; }
.tff-meter { left: auto; right: 8px; top: calc(54% + 52px); }
@media (max-width: 520px) { .tff-pill.cheer { top: 50%; } .tff-meter { top: calc(50% + 52px); } }
/* 🐎 返し馬 */
#tff-warm { bottom: 162px; background: linear-gradient(135deg, #2e6b3f, #173a22); border-color: #8fe0a8; }
.tff-warm-stage { position: relative; height: min(56vh, 420px); background: #000; }
.tff-warm-stage canvas { width: 100% !important; height: 100% !important; display: block; }
.tff-warm-nos { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 8px 14px; }
.tff-warm-nos small { color: #a9a395; margin-right: 4px; }
.tff-warm-nos button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: #eee; color: #111; font-weight: 900; cursor: pointer; }
.tff-warm-nos .g2 { background: #212121; color: #fff; } .tff-warm-nos .g3 { background: #d32f2f; color: #fff; } .tff-warm-nos .g4 { background: #1976d2; color: #fff; } .tff-warm-nos .g5 { background: #fbc02d; } .tff-warm-nos .g6 { background: #388e3c; color: #fff; } .tff-warm-nos .g7 { background: #f57c00; } .tff-warm-nos .g8 { background: #f06292; }
