/* 全壘打吧！ — Let's Fish's cream, sunny yellow and chunky ink outlines. */
/* the zh-TW round font is 來釣魚吧！'s, next door (/fish/ behind the homepage, the root on a bare Node server) */
@font-face { font-family: 'LetsFish Round'; src: url('../../fish/fonts/letsfish-round.woff2') format('woff2'), url('../../fonts/letsfish-round.woff2') format('woff2'); font-display: swap; }

:root {
  --ink: #2b1d2e; --ink2: #4a3550; --cream: #fff6e0; --cream2: #ffeccb;
  --sun: #ffd23f; --coral: #ff5d8f; --sea: #3fa7ff; --mint: #5bd96a;
  --navy2: var(--cream); --navy3: #fff;
  --glass: var(--cream); --glass2: var(--cream); --line: var(--ink);
  --gold: var(--sun); --gold2: var(--ink2); --red: #ff4d4d; --green: var(--mint); --sky: var(--sea);
  --text: var(--ink); --muted: var(--ink2); --shadow: 0 5px 0 var(--ink);
  --title: 'Lilita One', 'LetsFish Round', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  --font: 'LetsFish Round', 'Fredoka', 'PingFang TC', 'Noto Sans TC', 'Microsoft JhengHei', system-ui, sans-serif;
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --gw: 100vw; --gh: 100vh;
}
html.turned { --safe-l: env(safe-area-inset-top, 0px); --safe-r: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-right, 0px); --safe-b: env(safe-area-inset-left, 0px); }
/* The whole game is #app. A phone plays it sideways only: held upright, #app is
   turned a quarter round (landscape.js sets html.turned and --vw/--vh, the
   screen's own size). Its layout asks #app, not the screen: the menus' size and
   orientation rules are container queries and their units cqw/cqh, so an upright
   phone gets the sideways phone's layout. (A page without #app, a review page,
   asks its body instead.) */
#app { position: fixed; left: 0; top: 0; width: var(--vw, 100vw); height: var(--vh, 100vh); overflow: hidden; container: app / size; }
html.turned #app { width: var(--vh); height: var(--vw); transform-origin: 0 0; transform: translateX(var(--vw)) rotate(90deg); }
body:not(:has(#app)) { container: app / size; }
* { box-sizing: border-box; touch-action: pan-x pan-y; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Safari paints the screen it keeps for itself (iPhone's status and tool
   bars, and both sides of the game when it's turned) in the page's colour:
   ink, a frame like the interface's outlines rather than a stray blue */
body { background: var(--ink); color: var(--text); font-family: var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
#stage { position: fixed; inset: 0; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; touch-action: none; }
input, button { font: inherit; }
input { user-select: text; -webkit-user-select: text; font-size: 16px; }
#room, .tabpane, .chat-log, .roster { overscroll-behavior: contain; }

/* ------------------------------------------------------------ bits */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border: 3px solid var(--ink); border-radius: 14px; background: #fff; color: var(--ink); font: 400 18px var(--title); cursor: pointer; box-shadow: 0 4px 0 var(--ink); transition: transform .06s, filter .1s; text-decoration: none; white-space: nowrap; }
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--sun); color: var(--ink); font: 400 22px var(--title); letter-spacing: .5px; }
.btn.danger { background: var(--coral); color: var(--ink); }
.btn.ghost { background: #fff; }
.btn.big { padding: 12px 26px; font-size: 24px; width: 100%; }
.btn.small { padding: 5px 12px; font-size: 14px; border-radius: 10px; }
.btn.tiny { padding: 1px 8px; font-size: 14px; border-radius: 8px; }
.panel { background: var(--cream); border: 4px solid var(--ink); border-radius: 22px; box-shadow: 0 8px 0 var(--ink), 0 14px 40px #0004; }
.row { display: flex; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.row .label { width: 40px; flex: none; font-weight: 700; font-size: 15px; color: var(--muted); }
.seg { display: inline-flex; flex-wrap: wrap; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { border: 0; border-right: 1px solid var(--line); background: transparent; padding: 6px 12px; font-weight: 700; font-size: 15px; cursor: pointer; color: var(--text); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--gold); color: var(--ink); }
.seg.locked button { cursor: default; }
.seg.locked button:not(.on) { color: #6b78a0; }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 15px; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 700; color: var(--muted); font-size: 14px; }
.field input, .join input, #chat-in { border: 2px solid var(--ink); background: #fff; color: var(--ink); border-radius: 10px; padding: 8px 12px; font-size: 16px; outline: none; }
.field input:focus, .join input:focus, #chat-in:focus { border-color: var(--gold); }
.badge { font-size: 13px; padding: 2px 8px; border-radius: 99px; background: var(--green); color: var(--ink); font-weight: 700; }
.badge.private { background: #6b78a0; color: #fff; }
.note { color: var(--muted); font-size: 14px; margin: 6px 0 10px; }
.empty { color: var(--muted); font-size: 14px; }

/* ------------------------------------------------------------ the menu */
.screen { position: fixed; inset: 0; z-index: 3; }
#menu .home { position: absolute; left: calc(14px + var(--safe-l)); top: calc(12px + var(--safe-t)); z-index: 4; }
.logo { position: absolute; left: calc(20px + var(--safe-l)); top: calc(50px + var(--safe-t)); z-index: 4; pointer-events: none; }
.logo h1 { margin: 0; font: 400 clamp(36px, 5cqw, 58px)/1.1 var(--title); color: var(--sun); letter-spacing: 1px; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--ink); transform: rotate(-3deg); }
.logo p { margin: 9px 0 0; font-weight: 600; color: #fff; text-shadow: 0 2px 0 var(--ink); }
.model-control { position: absolute; inset: 0; z-index: 1; background: transparent; border: 0; cursor: grab; }
.model-control.model-dragging { cursor: grabbing; }
.model-hint { position: absolute; left: calc(24px + var(--safe-l)); right: auto; bottom: calc(22px + var(--safe-b)); z-index: 2; color: #fffb; font-size: 14px; text-shadow: 0 1px 3px #000; pointer-events: none; }
.star-plate { position: absolute; left: calc(24px + var(--safe-l)); bottom: calc(48px + var(--safe-b)); z-index: 2; pointer-events: none; text-align: left; padding: 10px 16px; border: 3px solid var(--ink); border-left: 8px solid var(--team, var(--gold)); border-radius: 16px; background: var(--cream); box-shadow: var(--shadow); }
.star-plate small { display: block; color: var(--muted); font-weight: 700; }
.star-plate b { display: block; font: 400 28px var(--title); color: var(--ink); }
.star-plate span { color: var(--gold2); font-weight: 700; }
.menu-panel { position: absolute; z-index: 3; right: calc(16px + var(--safe-r)); top: calc(64px + var(--safe-t)); max-height: calc(100% - 80px - var(--safe-t) - var(--safe-b)); width: min(470px, 56cqw); padding: 12px 16px 16px; display: flex; flex-direction: column; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; flex: none; }
.tab { flex: 1; border: 2px solid var(--ink); background: #fff; color: var(--ink); border-radius: 10px; padding: 10px 6px; font-weight: 700; cursor: pointer; }
.tab.on { background: var(--sun); color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.tabpane { overflow-y: auto; flex: 1; min-height: 0; padding-right: 4px; touch-action: pan-y; }
.tabpane[data-pane="play"] { display: flex; flex-direction: column; }
.tabpane[data-pane="play"] > * { flex-shrink: 0; }
.team-picker { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.team-summary { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.team-summary > div { flex: 1; min-width: 0; }
.team-summary small { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.team-summary b { display: block; font-size: 15px; overflow-wrap: anywhere; }
.team-summary > span { color: var(--muted); font-size: 12px; }
.pick-title { margin: 14px 0 6px; font-size: 15px; color: var(--muted); }
.team-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.team-card { position: relative; text-align: center; border: 2px solid var(--ink); background: #fff; color: var(--ink); border-radius: 12px; padding: 6px 4px 8px; cursor: pointer; overflow: hidden; min-height: 62px; }
.team-card::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--team); }
.team-card .tc-icon { display: block; font-size: 23px; line-height: 1.2; }
.team-card b { display: block; font-size: 13px; }
.team-card.on { background: var(--sun); border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.team-card.random { --team: #555; --team2: #888; }
#solo-go { margin-top: 12px; }
.row.buttons { gap: 8px; }
.join { display: inline-flex; gap: 6px; }
.join input { width: 90px; text-transform: uppercase; }
.rooms-head { margin: 12px 0 6px; font-weight: 700; color: var(--muted); }
.room-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 6px; cursor: pointer; background: rgba(255, 255, 255, .04); }
.room-item:hover { border-color: var(--gold); }
.ri-name { flex: 1; font-weight: 700; }
.ri-name small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.ri-st { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--green); color: var(--ink); font-weight: 700; }
.ri-st.playing { background: #6b78a0; color: #fff; }

/* the rosters */
.team-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.team-tabs button { border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 8px; padding: 4px 8px; font-size: 13px; cursor: pointer; border-bottom: 3px solid var(--team); }
.team-tabs button.on { background: var(--sun); }
.roster .motto { font-weight: 700; color: var(--ink); border-left: 5px solid var(--team); padding-left: 8px; }
.roster h4 { margin: 12px 0 4px; color: var(--gold2); }
.ros-head, .ros-row { display: grid; grid-template-columns: 38px minmax(120px, 1fr) repeat(5, 40px) 30px; gap: 4px; align-items: center; }
.ros-head { font-size: 11px; color: var(--muted); padding: 0 2px; }
.ros-row { padding: 5px 2px; border-bottom: 1px solid var(--line); }
.ros-row .face, .card .face { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #ffffff14; border: 2px solid var(--line); }
.ros-name b { display: block; font-size: 14px; }
.ros-name small { color: var(--muted); font-size: 11px; }
.bar { position: relative; display: block; height: 18px; border-radius: 4px; background: rgba(255, 255, 255, .07); overflow: hidden; font-style: normal; }
.bar::before { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--v); background: linear-gradient(90deg, #3b82f6, #22d3ee 50%, #facc15 80%, #f97316); opacity: .85; }
.bar b { position: relative; display: block; text-align: center; font-size: 12px; line-height: 18px; color: var(--ink); }
.ovr { font: 400 18px var(--title); color: var(--ink); text-align: center; }
.skill-tag { display: inline-block; margin-top: 2px; font-size: 12px; font-weight: 700; color: var(--ink); background: linear-gradient(90deg, var(--gold), #ff9f43); border-radius: 6px; padding: 0 6px; }
.skill-tag small { display: none; }
.ros-row:hover .skill-tag small { display: block; font-weight: 500; color: var(--ink); }

/* ------------------------------------------------------------ the room */
#room { overflow-y: auto; touch-action: pan-y; }
.room-wrap { max-width: 1100px; margin: 0 auto; padding: calc(14px + var(--safe-t)) calc(14px + var(--safe-r)) calc(14px + var(--safe-b)) calc(14px + var(--safe-l)); }
.room-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; flex-wrap: wrap; }
.room-title { flex: 1; display: flex; align-items: center; gap: 8px; }
.room-title h2 { margin: 0; font: 400 24px var(--title); }
.room-code { display: flex; align-items: center; gap: 6px; }
.room-code span { color: var(--muted); }
.room-code b { font: 400 26px var(--title); letter-spacing: 3px; color: var(--ink); }
.room-main { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; margin-top: 14px; }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-content: start; }
.side-card { padding: 14px; border-top: 6px solid var(--team); }
.side-card h3 { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.side-team { display: flex; align-items: center; gap: 8px; }
.side-team .tc-icon { font-size: 34px; }
.side-team b { font: 400 22px var(--title); }
.side-team small { color: var(--gold2); margin-left: auto; font-weight: 700; }
.side-who { margin: 10px 0; font-weight: 700; }
.side-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.side-pick button { border: 2px solid transparent; background: color-mix(in srgb, var(--team) 40%, transparent); border-radius: 8px; font-size: 22px; padding: 4px; cursor: pointer; }
.side-pick button.on { border-color: var(--gold); }
.watchers { grid-column: 1 / -1; color: var(--muted); }
.settings { padding: 14px; }
.settings h3 { margin: 0 0 6px; }
.settings h3 small { color: var(--muted); font-weight: 500; font-size: 13px; }
.settings.locked .check { opacity: .7; }
.wait { color: var(--muted); text-align: center; }
.chatbox { margin-top: 12px; padding: 10px; display: flex; flex-direction: column; height: 240px; }
.chat-log { flex: 1; overflow-y: auto; font-size: 14px; touch-action: pan-y; }
.chat-log .line.sys { color: var(--muted); font-size: 13px; }
.chat-log .side0 { color: #ff8a8a; } .chat-log .side1 { color: #8ac4ff; }
#chat-form { display: flex; gap: 6px; margin-top: 6px; }
#chat-in { flex: 1; }
@container app (max-width: 760px) { .room-main { grid-template-columns: 1fr; } }
@container app (max-width: 520px) { .sides { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ loading */
/* over everything, on the ink frame (turned with the rest of #app) */
.loading { position: fixed; inset: 0; z-index: 60; display: grid; place-content: center; justify-items: center; background: var(--ink); color: var(--cream); font-weight: 600; }
.loading .loading-heading { font: 400 clamp(36px, 7cqw, 58px)/1.1 var(--title); color: var(--sun); letter-spacing: 1px; text-shadow: 0 5px 0 #0007; transform: rotate(-3deg); }
.loading p { margin: 14px 0 0; }
.loading .btn { margin-top: 16px; }

/* ------------------------------------------------------------ the pause menu */
.modal { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .55); display: grid; place-items: center; }
.modal-box { padding: 20px 24px; width: min(420px, calc(100cqw - 32px)); text-align: center; }
.modal-box h2 { margin: 0 0 8px; font: 400 32px var(--title); color: var(--ink); }
.pause-help { color: var(--muted); font-size: 14px; text-align: left; line-height: 1.6; }
.col { display: flex; flex-direction: column; gap: 8px; }

/* ------------------------------------------------------------ the toasts */
.toasts { position: absolute; left: 50%; bottom: calc(80px + var(--safe-b)); transform: translateX(-50%); z-index: 40; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: var(--cream); border: 3px solid var(--ink); color: var(--ink); padding: 8px 14px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; animation: pop .2s ease-out; }
.toast.bad { border-color: var(--red); }
@keyframes pop { from { transform: translateY(8px) scale(.95); opacity: 0; } }

/* ------------------------------------------------------------ the game */
#hud { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
#hud > * { pointer-events: auto; }
/* (the calls, the skills' cut-ins and the captions only show: a tap goes through them to the field) */
#hud > .banner, #hud > .cutins, #hud > .caption { pointer-events: none; }
#hud .overlay { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.manga-lines { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
/* a manga page (manga-pages.js): over the strokes, under the crack's ink burst and the HUD */
.manga-page { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
/* a highlight's drawing over the picture (highlights/layer.js): over the manga's, under the HUD */
.highlight-layer { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.hud-btn { position: absolute; border: 1px solid var(--line); background: var(--glass); color: #fff; border-radius: 12px; width: 44px; height: 44px; font-size: 20px; cursor: pointer; }
.menu-btn { right: calc(12px + var(--safe-r)); top: calc(10px + var(--safe-t)); }
/* how the swing was timed, floating up from the contact circle */
.pop { position: absolute; transform: translate(-50%, -100%); font: 400 clamp(20px, calc(var(--gw) * .028), 30px) var(--title); color: #fff; text-shadow: 0 3px 0 var(--ink), 0 0 14px #000; white-space: nowrap; pointer-events: none; animation: pop-up 1.2s cubic-bezier(.2, 1.3, .4, 1) forwards; }
.pop.good { color: var(--gold); }
.pop.ok { color: var(--green); }
.pop.bad { color: #ff8a8a; }
@keyframes pop-up { 0% { opacity: 0; transform: translate(-50%, -60%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -100%) scale(1.08); } 70% { opacity: 1; transform: translate(-50%, -150%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -190%) scale(.96); } }

/* the score bug */
.bug { position: absolute; left: calc(12px + var(--safe-l)); top: calc(10px + var(--safe-t)); display: flex; align-items: stretch; background: var(--cream); border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); pointer-events: none; font-variant-numeric: tabular-nums; }
.bug-teams { display: flex; flex-direction: column; }
.bug-team { display: flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-left: 5px solid var(--team); min-width: 120px; }
.bug-team + .bug-team { border-top: 1px solid var(--line); }
.bug-team.batting { background: linear-gradient(90deg, color-mix(in srgb, var(--team) 45%, transparent), transparent); }
.bug-icon { font-size: 16px; }
.bug-team b { flex: 1; font-size: 16px; }
.bug-runs { font: 400 24px var(--title); color: var(--ink); min-width: 22px; text-align: right; }
.bug-mid { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2px 10px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.bug-inning { font: 400 18px var(--title); color: var(--ink); }
.bug-inning .arrow { font-size: 12px; margin-right: 2px; }
.bug-diamond { position: relative; width: 34px; height: 30px; }
.bug-diamond i { position: absolute; width: 11px; height: 11px; transform: rotate(45deg); border: 2px solid var(--ink); background: #fff; }
.bug-diamond i.on { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 8px var(--gold); }
.bug-diamond i[data-b="2"] { left: 11px; top: 1px; }
.bug-diamond i[data-b="3"] { left: 2px; top: 11px; }
.bug-diamond i[data-b="1"] { left: 20px; top: 11px; }
.bug-count { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 4px 10px; font-weight: 700; font-size: 13px; }
.bug-count > div { display: flex; align-items: center; gap: 3px; }
.bug-count span { width: 14px; color: var(--muted); }
.bug-count i { width: 10px; height: 10px; border: 1px solid var(--ink); border-radius: 50%; background: #fff; }
.bug-count > div:nth-child(1) i.on { background: var(--green); }
.bug-count > div:nth-child(2) i.on { background: var(--gold); }
.bug-count > div:nth-child(3) i.on { background: var(--red); }

/* the batter and the pitcher */
.live-matchup { position: absolute; left: calc(12px + var(--safe-l)); right: calc(12px + var(--safe-r)); top: calc(104px + var(--safe-t)); display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none !important; }
.live-player { width: 240px; max-width: calc((var(--gw) - 180px) / 2); padding: 9px 11px; border: 2px solid var(--ink); border-left: 5px solid var(--team); border-radius: 13px; background: var(--cream); box-shadow: 0 3px 0 var(--ink); font-variant-numeric: tabular-nums; }
.live-who { display: flex; align-items: center; gap: 6px; }
.live-who > span { flex: none; font-size: 11px; font-weight: 700; color: var(--muted); }
.live-who b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
/* each column as wide as its words, sharing what's left; a word that still
   doesn't fit (English, on a phone) ends in "…" rather than running into the next */
.live-stats { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, auto); justify-content: space-evenly; gap: 5px; margin: 8px 0 6px; }
.live-stats > div { text-align: center; }
.live-stats span { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-stats b { display: block; font-size: 18px; line-height: 1.25; }
.live-today { display: block; font-size: 11px; color: var(--muted); }
html.short .live-matchup { top: calc(116px + var(--safe-t)); }
html.short .live-player { width: min(204px, calc(var(--gw) * .275)); padding: 6px 8px; }
html.short .live-who { gap: 4px; }
html.short .live-who b { font-size: 12px; }
html.short .live-stats { gap: 3px; margin: 5px 0 4px; }
html.short .live-stats span { font-size: 10px; }
html.short .live-stats b { font-size: clamp(12px, calc(var(--gw) * .018), 15px); }
.card { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; background: #fff; border: 2px solid var(--ink); border-radius: 12px; width: 100%; }
.card::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 2px; background: var(--team); }
.batter-card { margin-bottom: 8px; }
.pitcher-card { margin-top: 8px; }
.card .face { width: 46px; height: 46px; }
.card .who b { display: block; font-size: 16px; white-space: nowrap; }
.card .who small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; }
.card .who .today { color: var(--gold2); white-space: normal; }
.card .stats { display: grid; gap: 4px; width: 100%; }
.card .stat, .card .stamina { display: grid; grid-template-columns: 30px 1fr 22px; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.card .stamina { grid-template-columns: 30px 1fr; }
.card .stat i, .card .stamina i { position: relative; height: 6px; border-radius: 3px; background: var(--cream2); overflow: hidden; }
.card .stat i::after, .card .stamina i::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--v); background: linear-gradient(90deg, #22d3ee, #facc15); }
.card .stamina i::after { background: linear-gradient(90deg, #ef4444, #22c55e); }
.card .stat b { font-size: 11px; color: var(--ink); }
.pitch-info { position: absolute; right: calc(120px + var(--safe-r)); top: calc(18px + var(--safe-t)); font: 600 14px var(--font); text-shadow: 0 2px 2px var(--ink); pointer-events: none; }
.pitch-info span { font: 400 26px var(--title); color: #fff; margin-left: 6px; }

/* the pitches, the throw and swing buttons */
.pitchbar { position: absolute; left: calc(16px + var(--safe-l)); right: calc(16px + var(--safe-r)); bottom: calc(20px + var(--safe-b)); display: flex; align-items: flex-end; justify-content: space-between; pointer-events: none !important; }
.pitch-types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ptype { border: 2px solid var(--ink); background: #fff; color: var(--ink); border-radius: 10px; min-height: 44px; padding: 8px 10px; font-weight: 700; cursor: pointer; box-shadow: 0 3px 0 var(--ink); border-left: 6px solid var(--pc, var(--sea)); }
.ptype kbd { font: 600 11px var(--font); color: var(--muted); margin-right: 4px; }
.ptype.on { background: var(--sun); color: var(--ink); }
.ptype.on kbd { color: var(--ink); }
.ptype.sub { --pc: #6b78a0; }
.throw-btn { pointer-events: auto; min-height: 64px; white-space: nowrap; border: 3px solid var(--ink); border-radius: 18px; padding: 12px 28px; font: 400 28px var(--title); color: var(--ink); background: var(--sun); box-shadow: 0 5px 0 var(--ink); cursor: pointer; }
.throw-btn:disabled { opacity: .6; }
.swing-btn { position: absolute; right: calc(24px + var(--safe-r)); bottom: calc(24px + var(--safe-b)); width: 108px; height: 108px; border-radius: 50%; border: 4px solid var(--ink); background: var(--sun); color: var(--ink); font: 400 30px var(--title); box-shadow: 0 6px 0 var(--ink); touch-action: none; }
.swing-btn:active { transform: scale(.94); }
.hint { position: absolute; left: 50%; top: calc(14px + var(--safe-t)); transform: translateX(-50%); max-width: calc(var(--gw) - 580px); padding: 6px 12px; border: 2px solid var(--ink); border-radius: 14px; background: var(--cream); color: var(--ink); font-weight: 600; font-size: 14px; text-align: center; pointer-events: none; }
.hint:empty { display: none; }
#hud .mini-popup { z-index: 12; }
.skip-btn, .hr-replay-btn { position: absolute; right: calc(16px + var(--safe-r)); bottom: calc(16px + var(--safe-b)); border: 1px solid var(--line); background: var(--glass); color: #fff; border-radius: 10px; padding: 8px 14px; font-weight: 700; cursor: pointer; }
/* 重播 stands right over 略過 (a home run's trot) */
.hr-replay-btn { bottom: calc(62px + var(--safe-b)); }

/* the calls */
.banner { position: absolute; left: 0; right: 0; top: 30%; text-align: center; pointer-events: none; opacity: 0; transform: scale(.6); transition: opacity .15s, transform .25s cubic-bezier(.2, 1.6, .4, 1); }
.banner.on { opacity: 1; transform: scale(1); }
.banner span { display: inline-block; font: 400 clamp(40px, calc(var(--gw) * .08), 88px) var(--title); color: #fff; letter-spacing: 2px; transform: skewX(-8deg); text-shadow: 0 4px 0 var(--ink), 0 0 24px rgba(0, 0, 0, .5); padding: 0 30px; }
.banner.strike span { color: var(--gold); }
.banner.ball span { color: var(--green); font-size: clamp(32px, calc(var(--gw) * .06), 64px); }
.banner.k span { color: var(--red); }
.banner.out span { color: #ff8a8a; font-size: clamp(32px, calc(var(--gw) * .06), 64px); }
.banner.safe span, .banner.run span { color: var(--green); font-size: clamp(32px, calc(var(--gw) * .06), 64px); }
.banner.foul span { color: #fff; font-size: clamp(30px, calc(var(--gw) * .05), 56px); }
.banner.meh span, .banner.info span { font-size: clamp(26px, calc(var(--gw) * .04), 44px); }
.banner.perfect span { color: var(--gold); font-size: clamp(30px, calc(var(--gw) * .05), 56px); }
.banner.hr span { font-size: clamp(56px, calc(var(--gw) * .11), 130px); background: linear-gradient(180deg, #fff 20%, var(--gold) 70%, #ff8a00); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 5px 0 var(--ink)) drop-shadow(0 0 30px rgba(255, 180, 0, .7)); animation: hr-pulse .6s ease-in-out infinite alternate; }
.banner.final span { color: var(--gold); }
@keyframes hr-pulse { to { transform: skewX(-8deg) scale(1.06); } }
.caption { position: absolute; left: 50%; bottom: calc(24% + var(--safe-b)); transform: translateX(-50%); font: 400 clamp(22px, calc(var(--gw) * .034), 36px) var(--title); color: #fff; text-shadow: 0 3px 0 var(--ink), 0 0 20px #000; opacity: 0; transition: opacity .3s; pointer-events: none; white-space: nowrap; }
.caption.on { opacity: 1; }

/* a skill firing: the face and the name slide in */
.cutins { position: absolute; left: 0; top: 28%; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
/* (the banner's shape is on ::before, so its flames can burn outside it: anime-fire.js) */
.cutin { position: relative; isolation: isolate; display: flex; align-items: center; gap: 10px; padding: 8px 26px 8px 12px; animation: cut-in .35s cubic-bezier(.2, 1.4, .4, 1); transition: transform .4s, opacity .4s; }
.cutin::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, var(--team), color-mix(in srgb, var(--team) 40%, transparent)); clip-path: polygon(0 0, 100% 0, 92% 100%, 0 100%); }
.cutin.pitch { align-self: flex-start; }
.cutin.out { transform: translateX(-110%); opacity: 0; }
.cutin img { width: 56px; height: 56px; border-radius: 50%; border: 3px solid var(--gold); object-fit: cover; background: #0004; }
.cutin small { display: block; font-weight: 700; color: #fffc; }
.cutin b { display: block; font: 400 28px var(--title); color: #fff; text-shadow: 0 2px 0 var(--ink); }
/* Skill cut-in flames sit behind the banner (js/ui/anime-fire.js). */
.anime-fire { position: absolute; z-index: -2; pointer-events: none; }
@keyframes cut-in { from { transform: translateX(-110%); } }

/* the line score */
.linescore { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 14px 18px; background: var(--glass2); border: 1px solid var(--line); border-radius: 14px; pointer-events: none; }
.linescore h3 { margin: 0 0 8px; text-align: center; font: 400 26px var(--title); color: var(--ink); }
.linescore.end { top: auto; bottom: calc(16px + var(--safe-b)); transform: translateX(-50%); }
.linescore table { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.linescore th, .linescore td { padding: 4px 8px; text-align: center; font-weight: 700; }
.linescore th { color: var(--muted); font-size: 13px; }
.linescore .tn { text-align: left; border-left: 4px solid var(--team); }
.linescore .r { color: var(--ink); font: 400 22px var(--title); }

/* Portrait phones stack setup below the logo; wide screens keep it on the right. */
@container app (max-width: 700px) and (orientation: portrait) { #menu.has-game-settings[data-game-settings-menu="baseball"]:not(.menu) > .menu-panel { top: calc(112px + var(--safe-t)); } }
/* a phone's game, either way up (html.short: the stage is short, see landscape.js) */
html.short .swing-btn { width: 92px; height: 92px; font-size: 24px; bottom: calc(20px + var(--safe-b)); }
html.short .throw-btn { padding: 8px 16px; font-size: 20px; }
html.short .cutin { padding: 4px 18px 4px 8px; }
html.short .cutin img { width: 38px; height: 38px; border-width: 2px; }
html.short .cutin b { font-size: 19px; }
html.short .cutin small { font-size: 11px; }
html.short .banner span { font-size: clamp(32px, calc(var(--gw) * .07), 60px); }
@container app (max-height: 520px) {
  .logo { top: calc(44px + var(--safe-t)); }
  .logo h1 { font-size: 34px; }
  .star-plate { padding: 6px 10px; max-width: 36cqw; }
  .star-plate b { font-size: 22px; }
}
@container app (max-width: 700px) and (orientation: portrait) {
  .menu-panel { width: calc(100cqw - 24px - var(--safe-l) - var(--safe-r)); right: calc(12px + var(--safe-r)); top: calc(112px + var(--safe-t)); max-height: calc(100% - 128px - var(--safe-t) - var(--safe-b)); }
  .logo { top: calc(46px + var(--safe-t)); }
  .logo h1 { font-size: 34px; }
  .logo p { font-size: 13px; }
  .star-plate, .model-hint { display: none; }
}

/* Compact disclosures: the score and the active play stay in view. */
:focus-visible { outline: 3px solid var(--sea); outline-offset: 3px; }
button { touch-action: manipulation; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; padding: 6px; border: 3px solid var(--ink); border-radius: 13px; background: var(--cream); color: var(--ink); box-shadow: 0 3px 0 var(--ink); font-size: 22px; cursor: pointer; }
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--sun); }
.icon-btn:active, .throw-btn:active, .pitch-choice:active { transform: translateY(3px); box-shadow: none; }
.popover-anchor { position: relative; pointer-events: auto; }
.mini-popup { position: absolute; z-index: 12; right: 0; top: calc(100% + 12px); width: 310px; max-width: calc(var(--gw) - 32px); max-height: calc(var(--gh) - 100px); overflow: auto; overscroll-behavior: contain; touch-action: pan-y; padding: 14px; border: 3px solid var(--ink); border-radius: 18px; background: var(--cream); box-shadow: 0 5px 0 var(--ink), 0 12px 24px #0003; color: var(--ink); animation: pop .15s ease-out; }
.mini-popup h3 { font: 400 20px var(--title); margin: 0 0 10px; }
.team-popup { width: 348px; }
.team-popup .pick-title { margin: 12px 0 6px; }
.mini-popup .row { gap: 6px; }
.mini-popup .seg button { min-height: 40px; padding: 6px 9px; }
.match-options { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; border-top: 2px dashed var(--ink2); padding-top: 10px; font-size: 14px; }
.match-options .mini-popup { top: auto; bottom: calc(100% + 12px); width: 348px; }
.hud-tools { position: absolute; top: calc(10px + var(--safe-t)); right: calc(12px + var(--safe-r)); display: flex; gap: 8px; z-index: 6; }
.hud-tools .menu-btn { position: static; }
.matchup-popup { width: 320px; }
#hud .matchup-popup .card .stats { display: grid; }
.pitch-picker .mini-popup { top: auto; bottom: calc(100% + 12px); left: 0; right: auto; }
.pitch-choice { display: flex; align-items: center; gap: 8px; min-height: 48px; border: 3px solid var(--ink); border-left: 8px solid var(--pc); border-radius: 14px; padding: 8px 14px; background: var(--cream); color: var(--ink); box-shadow: 0 4px 0 var(--ink); font-weight: 700; cursor: pointer; }
.pitch-choice[aria-expanded="true"] { background: var(--sun); }
.swing-feedback { position: absolute; left: calc(16px + var(--safe-l)); bottom: calc(20px + var(--safe-b)); width: 252px; padding: 10px 14px; border: 3px solid var(--ink); border-radius: 16px; background: var(--cream); box-shadow: var(--shadow); pointer-events: none !important; animation: pop .18s ease-out; }
.swing-feedback.sweet { background: #fff0a3; }
.feedback-title { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.feedback-title span, .swing-feedback small { font-size: 12px; color: var(--muted); }
.timing-track { position: relative; height: 12px; margin-top: 10px; border: 2px solid var(--ink); border-radius: 7px; background: linear-gradient(90deg, var(--coral), var(--sun) 30%, var(--mint) 46% 54%, var(--sun) 70%, var(--coral)); }
.timing-window { position: absolute; left: 46%; width: 8%; top: 0; bottom: 0; border-inline: 1px solid var(--ink); }
.timing-mark { position: absolute; width: 5px; height: 20px; top: -6px; transform: translateX(-50%); border: 1px solid #fff; border-radius: 4px; background: var(--ink); }
.timing-labels { display: flex; justify-content: space-between; margin: 3px 0; font-size: 10px; color: var(--muted); }
.banner span, .pop { -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.skip-btn, .hr-replay-btn { color: var(--ink); border-width: 3px; box-shadow: var(--shadow); }
.linescore { border-width: 3px; box-shadow: var(--shadow); }
.modal-box { max-height: calc(100cqh - 24px); overflow: auto; }
html.short .hint { top: calc(82px + var(--safe-t)); max-width: 60%; font-size: 12px; padding: 3px 8px; }
html.short .swing-feedback { width: 230px; padding: 7px 10px; }
html.short .throw-btn { min-height: 48px; }
html.short .pitch-info { top: calc(15px + var(--safe-t)); font-size: 12px; }
html.short .pitch-info span { font-size: 20px; }
@container app (max-width: 700px) {
  .menu-panel { padding: 10px 12px 14px; }
  .ros-head, .ros-row { grid-template-columns: 30px minmax(92px, 1fr) repeat(5, 28px) 26px; gap: 2px; }
  .room-head { padding: 10px; gap: 8px; }
  .room-code { flex-wrap: wrap; }
  #chat-in { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Schoolyard tee-ball keeps the same cream, ink and candy-yellow UI family. */
.mode-picker { display: flex; gap: 6px; margin: 12px 0 8px; }
.mode-picker button { flex: 1; min-height: 46px; font-size: 17px; }
.venue-note { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; background: #d5edc9; border: 2px solid var(--ink); border-radius: 15px; }
.venue-note b, .venue-note span { display: block; }
.venue-note b { font-size: 19px; }.venue-note span { font-size: 12px; margin-top: 3px; }
.venue-note .icon-btn { width: 38px; height: 38px; font-size: 18px; }
.lele-rules { width: 355px; line-height: 1.65; font-size: 13px; }
.lele-rules p { margin: 8px 0; }.lele-rules ul { padding-left: 20px; }.lele-rules li { margin: 5px 0; }.lele-rules a { color: #176953; text-decoration: underline; }
.venue-chip { position: absolute; left: 50%; top: calc(13px + var(--safe-t)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 17px; color: var(--ink); background: #fff6e0ee; border: 2px solid var(--ink); border-radius: 10px 10px 20px 20px; box-shadow: 0 3px 0 #27343b; pointer-events: none !important; }
.venue-chip span { font-size: 18px; font-weight: 900; letter-spacing: 2px; }.venue-chip b { font-size: 10px; color: #467665; }
.lele-controls { position: absolute; left: calc(16px + var(--safe-l)); bottom: calc(20px + var(--safe-b)); width: 264px; pointer-events: none !important; }
.tee-charge { padding: 12px 16px; background: var(--cream); border: 3px solid var(--ink); border-radius: 18px; box-shadow: var(--shadow); }
.tee-label { font-size: 15px; font-weight: 800; }.tee-direction { display: block; margin-top: 8px; color: #486655; font-size: 13px; }
.tee-meter { position: relative; height: 17px; margin-top: 11px; background: #d4e8cf; border: 2px solid var(--ink); border-radius: 9px; }
.sweet-band { position: absolute; left: 43.7%; width: 8.6%; top: 0; bottom: 0; background: #ffd54a; border-inline: 1px solid #c09b14; }
.tee-needle { position: absolute; top: -6px; left: 0; height: 25px; width: 6px; transform: translateX(-50%); border: 1px solid white; background: var(--ink); border-radius: 5px; }
.lele-hud .swing-btn { font-size: 23px; width: 116px; height: 116px; padding: 15px; line-height: 1.25; background: var(--sun); color: var(--ink); }
.lele-hud .swing-feedback strong, .lele-hud .swing-feedback span { display: block; }.lele-hud .swing-feedback span { margin-top: 5px; font-size: 12px; }.lele-hud .swing-feedback[data-grade="perfect"] { background: #fff0a3; }
.lele-hud .bug-count { min-width: 65px; }.lele-hud .bug-count span { width: auto; min-width: 20px; font-size: 11px; }.lele-hud .bug-count b { font-size: 13px; }.lele-hud .bug-count > div { gap: 5px; }
.formation-options { display: flex; flex-wrap: wrap; gap: 8px; }.formation-options .on { background: var(--sun); }
html.short .venue-chip { padding: 4px 10px; left: 49%; top: calc(12px + var(--safe-t)); }.short .venue-chip span { font-size: 14px; }
html.short .lele-controls { width: 226px; bottom: calc(12px + var(--safe-b)); }.short .tee-charge { padding: 8px 12px; }.short .tee-label { font-size: 12px; }.short .tee-direction { margin-top: 5px; font-size: 11px; }
html.short .lele-hud .swing-btn { width: 92px; height: 92px; font-size: 19px; }
html.short .lele-hud .hud-tools { gap: 5px; }.short .lele-hud .hud-tools .icon-btn { width: 39px; height: 39px; font-size: 19px; border-radius: 12px; }
.lele-hud .hint { top: calc(78px + var(--safe-t)); max-width: min(560px, 70%); font-size: 12px; }
html.short .lele-hud .hint { top: calc(78px + var(--safe-t)); max-width: 68%; font-size: 11px; }
.lele-hud .swing-btn { white-space: nowrap; }
.solo-start { padding: 5px 0 4px; }
.solo-start .match-options { margin-top: 0; }
@container app (max-height: 520px) and (orientation: landscape) {
  .menu-panel { padding: 8px 10px 10px; }
  .tabs { margin-bottom: 6px; }
  .tab { padding: 8px 4px; }
  .mode-picker { margin: 8px 0 6px; }
  .mode-picker button { min-height: 40px; font-size: 15px; }
  .team-picker { margin: 6px 0; }
  .team-summary { gap: 6px; }
  .team-summary b { font-size: 14px; }
  .solo-start { display: flex; align-items: center; gap: 8px; padding-top: 8px; border-top: 2px dashed var(--ink2); }
  .solo-start .match-options { flex: 1; min-width: 0; gap: 6px; border: 0; padding: 0; font-size: 12px; }
  #solo-go { width: auto; margin: 0; padding: 9px 14px; font-size: 20px; }
}

/* ------------------------------------------------------------ feel
   Presses give (squash and stretch on a spring), the count's dots pop when
   they change, the calls are stamped down at a hand-drawn tilt with an
   overshoot, and the swing's timing is slammed in where the circle was.
   Same cream, ink and sunny yellow as the rest. */
.ink-burst { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }

/* a press gives, and springs back past where it was */
.btn, .icon-btn, .ptype, .throw-btn, .swing-btn, .pitch-choice, .skip-btn, .hr-replay-btn, .tab, .seg button, .team-card {
  transition: transform .45s cubic-bezier(.34, 1.8, .5, 1), box-shadow .2s, background-color .15s, filter .1s;
}
.btn:active, .icon-btn:active, .ptype:active, .throw-btn:active, .pitch-choice:active, .skip-btn:active, .hr-replay-btn:active, .tab:active {
  transform: translateY(3px) scale(1.04, .9);
  transition-duration: .05s;
}
.btn:hover:not(:active) { transform: translateY(-1px) scale(1.015); }
.swing-btn:active, .swing-btn.holding { transform: translateY(5px) scale(1.06, .86); box-shadow: 0 1px 0 var(--ink); transition-duration: .05s; }
.swing-btn.pressed, .throw-btn.pressed, .pitch-choice.pressed { animation: squash .4s cubic-bezier(.3, .7, .4, 1) both; }
@keyframes squash {
  0% { transform: scale(1); }
  16% { transform: translateY(4px) scale(1.12, .8); }
  42% { transform: scale(.93, 1.1); }
  68% { transform: scale(1.03, .98); }
  100% { transform: scale(1); }
}
.ptype.on { animation: pick .4s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pick { 0% { transform: scale(.9, 1.1); } 55% { transform: scale(1.06, .94); } 100% { transform: scale(1); } }

/* the score bug: whatever changed pulses */
.bump { display: inline-block; animation: bump .55s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes bump { 0% { transform: scale(1); } 22% { transform: scale(1.9) rotate(-7deg); } 52% { transform: scale(.86) rotate(3deg); } 100% { transform: scale(1); } }
.bug-count i.fresh { animation: dot-pop .55s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes dot-pop { 0% { transform: scale(.2); } 45% { transform: scale(1.9); } 100% { transform: scale(1); } }
.bug-diamond i.fresh { animation: base-pop .55s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes base-pop { 0% { transform: rotate(45deg) scale(.2); } 45% { transform: rotate(45deg) scale(1.9); } 100% { transform: rotate(45deg) scale(1); } }

/* the calls: stamped down at a tilt, with a squash and an overshoot */
.banner { transform: none; transition: opacity .2s ease-in; }
.banner.on { transform: none; }
.banner.on span { animation: banner-in .6s linear both; }
.banner.on.hr span { animation: banner-in .62s linear both, hr-pulse .6s .62s ease-in-out infinite alternate; }
/* (the home run's gold lettering: the thin round font is fattened by a transparent stroke that the gradient shows through, and its ink edge is a ring of shadows; the 4px ink stroke used elsewhere would cover the gradient) */
.banner.hr span { -webkit-text-stroke: 7px transparent; paint-order: normal; filter: drop-shadow(3px 0 0 var(--ink)) drop-shadow(-3px 0 0 var(--ink)) drop-shadow(0 3px 0 var(--ink)) drop-shadow(0 -3px 0 var(--ink)) drop-shadow(0 6px 0 var(--ink)) drop-shadow(0 0 28px rgba(255, 180, 0, .7)); }
@keyframes banner-in {
  0% { opacity: 0; transform: skewX(-8deg) rotate(calc(var(--tilt, -2deg) * 3)) scale(.25, .12); }
  26% { opacity: 1; transform: skewX(-8deg) rotate(var(--tilt, -2deg)) scale(1.32, .8); }
  46% { transform: skewX(-8deg) rotate(var(--tilt, -2deg)) scale(.92, 1.12); }
  66% { transform: skewX(-8deg) rotate(var(--tilt, -2deg)) scale(1.05, .97); }
  100% { opacity: 1; transform: skewX(-8deg) rotate(var(--tilt, -2deg)) scale(1); }
}

/* how the swing was timed: slammed in, early on the left, late on the right */
.judge { position: absolute; z-index: 3; transform: translate(-50%, -100%); pointer-events: none !important; text-align: center; white-space: nowrap; color: var(--cream); font: 400 clamp(24px, calc(var(--gw) * .036), 42px) var(--title); animation: judge-in 1.45s linear forwards; }
.judge b { display: inline-flex; align-items: center; gap: .16em; font-weight: 400; letter-spacing: 1px; -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink); transform: rotate(var(--tilt, -3deg)) skewX(var(--skew, 0deg)); }
.judge small { display: block; margin-top: 4px; font: 700 clamp(12px, calc(var(--gw) * .0145), 17px) var(--font); letter-spacing: .5px; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.judge.perfect b { color: var(--sun); }
.judge.good b { color: var(--mint); }
.judge.bad b { color: var(--coral); }
.judge.miss b { color: #dfe7f3; }
.judge .chev { font-style: normal; color: var(--sun); animation: chev .36s ease-in-out infinite alternate; }
.judge.early .chev { --dx: -.14em; }
.judge.late .chev { --dx: .14em; }
@keyframes chev { from { transform: translateX(0); } to { transform: translateX(var(--dx, 0)); } }
@keyframes judge-in {
  0% { opacity: 0; transform: translate(-50%, -62%) scale(2.4); }
  9% { opacity: 1; transform: translate(-50%, -100%) scale(.86, 1.14); }
  17% { transform: translate(-50%, -100%) scale(1.1, .92); }
  25% { transform: translate(-50%, -100%) scale(1); }
  70% { opacity: 1; transform: translate(-50%, -128%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -168%) scale(.94); }
}

/* 樂樂棒球: the bar in the gold window */
.tee-meter.in-gold { box-shadow: 0 0 0 3px var(--sun), 0 0 14px 2px #ffd23faa; }
.tee-meter.in-gold .tee-needle { background: #fff; border-color: var(--ink); height: 29px; top: -8px; }
.tee-meter.in-gold .sweet-band { background: #ffe56a; }

@media (prefers-reduced-motion: reduce) {
  .judge, .pop { animation: none !important; opacity: 1; }
  .judge .chev { animation: none !important; }
}

/* Keep full-body pitching and the plate unobstructed on narrow screens.
   Detailed matchup cards remain available through the existing stats button. */
@container app (max-width: 600px) and (orientation: portrait) {
  .live-matchup { display: none; }
  .bug { max-width: calc(100% - 118px); left: 8px; top: 8px; }
  .bug-team { min-width: 0; padding: 3px 4px; gap: 3px; }
  .bug-team b { max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
  .bug-icon { font-size: 12px; }
  .bug-runs { font-size: 19px; min-width: 15px; }
  .bug-mid { padding: 2px 4px; }
  .bug-count { padding: 4px; font-size: 10px; }
  .bug-count i { width: 7px; height: 7px; }
  .hint { top: 90px; width: calc(100% - 28px); max-width: none; box-sizing: border-box; font-size: 12px; }
  .pitch-info { top: 150px; right: 12px; font-size: 11px; }
  .pitch-info span { font-size: 20px; }
  .hud-tools { right: 8px; gap: 4px; top: 8px; }
  .pitch-choice { max-width: 220px; font-size: 12px; padding: 8px; }
}
@container app (max-height: 520px) and (orientation: landscape) {
  .live-matchup { display: none; }
}

/* Close player shots keep the upper frame clear; stats remain in the HUD popup. */
.live-matchup { display: none; }

/* Generated crests and character expressions, shared by menu and match UI. */
.team-logo { display: inline-block; width: 1.6em; height: 1.6em; object-fit: contain; vertical-align: middle; flex: none; }
.tc-icon .team-logo { width: 38px; height: 38px; }
.side-team .tc-icon .team-logo { width: 52px; height: 52px; }
.side-pick .team-logo { width: 26px; height: 26px; }
.face.art, .cutin img.art { object-fit: contain; object-position: center; background: #faf8ef; }
/* ---- the replay (game.js startReplay): the wipe across, the bars, the tag; the game's prompts stand aside */
.replay-frame { position: absolute; inset: 0; overflow: hidden; pointer-events: none !important; }
.replay-frame .rf-bar { position: absolute; left: 0; right: 0; height: 8.5%; background: #140d18; transform: scaleY(0); transition: transform .35s cubic-bezier(.3, .7, .2, 1); }
.replay-frame .rf-top { top: 0; transform-origin: top; }
.replay-frame .rf-bottom { bottom: 0; transform-origin: bottom; }
.replay-frame::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 55%, rgba(16, 8, 24, .45) 100%); opacity: 0; transition: opacity .35s; }
.replay-frame::after { content: ''; position: absolute; inset: 0; background: #fff; opacity: 0; }
.replay-frame.cut::after { animation: rf-cut .16s ease-out; }
@keyframes rf-cut { from { opacity: .5; } to { opacity: 0; } }
#hud.replaying .rf-bar { transform: scaleY(1); }
#hud.replaying .replay-frame::before { opacity: 1; }
.replay-tag { position: absolute; left: 50%; top: calc(1.4% + var(--safe-t)); display: flex; align-items: center; gap: 8px; padding: 3px 14px 4px 10px; background: var(--cream); color: var(--ink); border: 3px solid var(--ink); border-radius: 10px; box-shadow: 0 3px 0 var(--ink); white-space: nowrap; transform: translate(-50%, -170%) skewX(-8deg); transition: transform .3s cubic-bezier(.2, 1.5, .4, 1); }
#hud.replaying .replay-tag { transform: translate(-50%, 0) skewX(-8deg); }
.replay-tag b { font: 400 clamp(16px, calc(var(--gw) * .022), 24px) var(--title); letter-spacing: 1px; }
.replay-tag span { font: 700 clamp(11px, calc(var(--gw) * .013), 15px) var(--font); color: var(--ink2); }
.replay-tag span:empty { display: none; }
.rf-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--ink); animation: rf-blink 1s steps(2, start) infinite; }
@keyframes rf-blink { to { visibility: hidden; } }
/* (and while the sides change over: game/side-change.js) */
#hud:is(.replaying, .changing) :is(.phase-chip, .action-guide, .live-matchup, .hint, .swing-feedback, .flight-readouts, .field-panel, .pitch-dock, .cutins, .caption, .banner) { opacity: 0; pointer-events: none; transition: opacity .2s; }
.replay-wipe { position: absolute; inset: 0; overflow: hidden; z-index: 20; pointer-events: none !important; }
.replay-wipe .rw-band { position: absolute; top: -25%; bottom: -25%; left: 0; width: 240%; transform: translateX(-120%) skewX(-18deg); background: linear-gradient(90deg, var(--sun) 0 3%, var(--ink) 3% 4.6%, var(--rw) 4.6% 95.4%, var(--ink) 95.4% 97%, var(--rw2) 97% 100%); }
.replay-wipe .rw-trail { background: linear-gradient(90deg, transparent 0 84%, var(--sun) 84% 86%, transparent 86% 89%, var(--ink) 89% 90.4%, transparent 90.4%); }
.replay-wipe.on .rw-band { animation: rw-sweep .62s cubic-bezier(.7, 0, .25, 1) both; }
.replay-wipe.on .rw-trail { animation-delay: .05s; }
.replay-wipe.out .rw-band { animation-name: rw-sweep-back; }
@keyframes rw-sweep { 0% { transform: translateX(-120%) skewX(-18deg); } 42%, 52% { transform: translateX(-30%) skewX(-18deg); } 100% { transform: translateX(60%) skewX(-18deg); } }
@keyframes rw-sweep-back { 0% { transform: translateX(60%) skewX(-18deg); } 42%, 52% { transform: translateX(-30%) skewX(-18deg); } 100% { transform: translateX(-120%) skewX(-18deg); } }
.replay-wipe .rw-text { position: absolute; left: 50%; top: 50%; display: flex; flex-direction: column; align-items: center; color: #fff; white-space: nowrap; opacity: 0; transform: translate(-50%, -50%) skewX(-10deg); }
.replay-wipe.on .rw-text { animation: rw-text .62s linear both; }
.replay-wipe .rw-text b { font: 400 clamp(44px, calc(var(--gw) * .09), 110px) var(--title); letter-spacing: 4px; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink); }
.replay-wipe .rw-text span { margin-top: -4px; padding: 2px 14px; background: var(--cream); color: var(--ink); border: 3px solid var(--ink); border-radius: 8px; font: 400 clamp(16px, calc(var(--gw) * .024), 28px) var(--title); }
@keyframes rw-text { 0%, 30% { opacity: 0; transform: translate(-60%, -50%) skewX(-10deg) scale(.9); } 40%, 58% { opacity: 1; transform: translate(-50%, -50%) skewX(-10deg) scale(1); } 70%, 100% { opacity: 0; transform: translate(-40%, -50%) skewX(-10deg) scale(1.04); } }
html.short .replay-frame .rf-bar { height: 6%; }
@media (prefers-reduced-motion: reduce) {
  .replay-wipe.on .rw-band { animation: rw-fade .62s linear both; }
  .replay-wipe.on .rw-trail { display: none; }
  @keyframes rw-fade { 0% { opacity: 0; transform: translateX(-30%) skewX(-18deg); } 42%, 52% { opacity: 1; transform: translateX(-30%) skewX(-18deg); } 100% { opacity: 0; transform: translateX(-30%) skewX(-18deg); } }
}
