/* Spin Battle (games/tops.js) */
.tp-modes .md-row { grid-template-columns: repeat(3, 1fr); }
.tp-modes button { min-height: 104px; padding: 8px 4px; }
.tp-modes button b { font-size: 16px; }
.tp-modes button small { font-size: 12px; }

.tp-count-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tp-count-row button { min-height: 60px; }
.tp-count-row b { font: 800 26px var(--font-display); }
.tp-count { font-weight: 800; font-size: 18px; }
.tp-h4 { row-gap: 4px; }
.tp-side.out { opacity: .4; }
.tp-c2 i { background: #f08c00 !important; }
.tp-c3 i { background: #16915f !important; }
.tp-c1 i { background: #ef5350; }
.tp-c0 i { background: #4b55f5; }
.tp-hud { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 480px; margin: 0 auto 4px; }
.tp-side { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tp-name { font: 700 14px var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; }
.tp-bar { display: block; height: 14px; border-radius: 8px; background: var(--tint-grey); overflow: hidden; }
.tp-bar i { display: block; height: 100%; width: 100%; transition: width .12s linear; }
.tp-bar i.low { background: #ff9f1c !important; }
.tp-msg { min-height: 24px; margin: 2px 0 4px; text-align: center; font-weight: 700; font-size: 15px; }

.tp-wrap { position: relative; width: 100%; max-width: 480px; margin: 0 auto; }
.tp-canvas { display: block; width: 100%; aspect-ratio: 1; touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.tp-banner { position: absolute; inset: 35% 8% auto; padding: 12px; border-radius: 16px; background: rgba(255,255,255,.95); box-shadow: 0 8px 24px rgba(10,19,48,.25); text-align: center; animation: tp-pop .3s ease-out; }
.tp-banner[hidden] { display: none; }
.tp-banner b { display: block; font: 800 26px var(--font-display); }
.tp-banner small { font-size: 15px; font-weight: 700; color: var(--muted); }
.tp-banner.tp-win b { color: #16915f; }
.tp-banner.tp-lose b { color: #d0433f; }
@keyframes tp-pop { from { transform: scale(.7); opacity: 0; } }

.tp-panel { max-width: 480px; margin: 8px auto 0; text-align: center; }
.tp-go { width: 100%; min-height: 64px; font-size: 22px; }
.tp-meter { position: relative; height: 26px; margin-bottom: 10px; border-radius: 13px; overflow: hidden; background: linear-gradient(90deg, #ffe08a 0 70%, #6fdba8 70% 85%, #ff9a94 85%); }
.tp-meter i { position: absolute; top: 0; bottom: 0; width: 6px; margin-left: -3px; background: #17233f; border-radius: 3px; }
.tp-acts { display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); gap: 8px; }
.tp-n1 { --n: 1; } .tp-n3 { --n: 3; } .tp-n4 { --n: 4; }
.tp-act { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 76px; padding: 6px 2px; border: 2px solid var(--line); border-radius: 14px; background: var(--card); font: inherit; color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--line); }
.tp-act span { font-size: 26px; line-height: 1.1; }
.tp-act b { font-size: 14px; line-height: 1.2; }
.tp-act small { min-height: 15px; font-size: 13px; font-weight: 700; color: var(--muted); }
.tp-act.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 3px 0 var(--primary); }
.tp-act:disabled { opacity: .4; cursor: default; }
.tp-n1 .tp-act { min-height: 92px; }
.tp-n1 .tp-act span { font-size: 36px; }
.tp-n1 .tp-act b { font-size: 21px; }

.tp-builds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tp-build { display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 10px 4px; border: 2px solid var(--line); border-radius: 14px; background: var(--card); font: inherit; color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--line); }
.tp-build b { font-size: 17px; }
.tp-build small { font-size: 12px; line-height: 1.35; color: var(--muted); }
.tp-stats { display: flex; gap: 4px; font-size: 12px; font-weight: 700; flex-wrap: wrap; justify-content: center; }
.tp-stats i { font-style: normal; white-space: nowrap; }
.tp-tune { margin-top: 10px; }
.tp-tune p { margin: 4px 0; font-weight: 700; }
.tp-tune-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 6px; font-size: 20px; }
.tp-tune-row button { width: 44px; height: 44px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); font-size: 22px; font-weight: 800; color: var(--ink); cursor: pointer; }
.tp-tune-row b { width: 28px; text-align: center; }

.tp-lobby { max-width: 420px; margin: 0 auto; padding: 8px 0; text-align: center; }
.tp-lobby h3 { margin: 4px 0; font-size: 22px; }
.tp-lobby p { margin: 6px 0; }
.tp-big { display: flex; flex-direction: column; align-items: center; width: 100%; margin: 10px 0; padding: 12px; border: 2px solid var(--line); border-radius: 16px; background: var(--card); font: inherit; color: var(--ink); cursor: pointer; box-shadow: 0 4px 0 var(--line); }
.tp-big span { font-size: 38px; line-height: 1.1; }
.tp-big b { font-size: 21px; }
.tp-big small { color: var(--muted); font-weight: 600; }
.tp-note { font-size: 14px; color: var(--muted); }
.tp-code { margin: 10px auto; padding: 8px 14px; max-width: 280px; border-radius: 14px; background: var(--primary-soft); font: 800 44px var(--font-display); letter-spacing: 6px; }
.tp-wait { font-weight: 700; animation: tp-breathe 1.4s ease-in-out infinite; }
@keyframes tp-breathe { 50% { opacity: .45; } }
.tp-err { min-height: 22px; color: #d0433f; font-weight: 700; }
.tp-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 280px; margin: 0 auto 12px; }
.tp-pad button { min-height: 60px; border: 2px solid var(--line); border-radius: 14px; background: var(--card); font: 800 24px var(--font-display); color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--line); }
.tp-pad .tp-pad-go { background: var(--primary); border-color: var(--primary); color: #fff; }
.tp-pad .tp-pad-go:disabled { opacity: .4; }

.tp-result { display: flex; flex-direction: column; gap: 2px; max-width: 420px; margin: 0 auto 10px; padding: 10px; border-radius: 14px; background: var(--tint-purple); }
.tp-result b { font: 800 24px var(--font-display); }
.tp-result small { color: var(--muted); font-weight: 600; }
.tp-result.tp-win { background: var(--tint-green); }
.tp-result.tp-lose { background: var(--tint-red); }

/* How to play */
.tp-tu { position: relative; width: 210px; margin: 0 auto; text-align: center; }
.tp-tu-bowl { position: relative; width: 150px; height: 150px; margin: 0 auto 8px; border-radius: 50%; background: radial-gradient(circle, #fff6d6, #e8924a); border: 5px solid #7a3e12; }
.tp-tu-top { position: absolute; top: 58px; width: 26px; height: 26px; border-radius: 50%; border: 6px dotted #fff; transition: left .7s ease-in; animation: tp-tu-spin .5s linear infinite; }
.tp-tu-top.me { left: 8px; background: #4b55f5; }
.tp-tu-top.them { right: 8px; background: #ef5350; transition: right .7s ease-in; }
.tp-tu.go .tp-tu-top.me { left: 48px; }
.tp-tu.go .tp-tu-top.them { right: 40px; }
.tp-tu.hit .tp-tu-top.them { right: 4px; transition-delay: .5s; }
.tp-tu-btn { min-height: 44px; padding: 6px 22px; border: 0; border-radius: 12px; background: var(--primary); color: #fff; font: 800 17px var(--font-display); }
.tp-tu-cards { display: grid; gap: 8px; }
.tp-tu-cards > * { padding: 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); font-weight: 700; font-size: 16px; color: var(--ink); }
.tp-tu-cards .on { border-color: var(--primary); background: var(--primary-soft); }
@keyframes tp-tu-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .tp-tu-top { animation: none; transition: none; } .tp-wait { animation: none; } }
