/* Cartoon baseball UI: navy outlines, cream boards, glossy orange plates */
:root {
  --navy: #16204a; --cream: #fff3d6; --gold: #ffd23f; --orange: #ff9a3c; --sky: #7ee0ff; --red: #ff5a4a; --green: #3ccf6a;
  --ol2: 2px 0 0 #16204a, -2px 0 0 #16204a, 0 2px 0 #16204a, 0 -2px 0 #16204a, 1.5px 1.5px 0 #16204a, -1.5px 1.5px 0 #16204a, 1.5px -1.5px 0 #16204a, -1.5px -1.5px 0 #16204a, 0 4px 0 rgba(0, 0, 0, 0.3);
  --ol3: 3px 0 0 #16204a, -3px 0 0 #16204a, 0 3px 0 #16204a, 0 -3px 0 #16204a, 2.2px 2.2px 0 #16204a, -2.2px 2.2px 0 #16204a, 2.2px -2.2px 0 #16204a, -2.2px -2.2px 0 #16204a, 0 6px 0 rgba(0, 0, 0, 0.35);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1230; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
body {
  display: flex; align-items: center; justify-content: center; color: #fff;
  font-family: var(--font, "Arial Black", "Trebuchet MS", sans-serif);
  background: repeating-linear-gradient(135deg, #0b1230 0 22px, #0e1638 22px 44px);
}
#app { position: relative; overflow: hidden; background: #16204a; font-family: var(--font, "Arial Black", sans-serif); box-shadow: 0 0 40px rgba(0, 0, 0, 0.6); }
#game { position: absolute; left: 0; top: 0; display: block; touch-action: none; }
#flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 8; }
#layer { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
#layer > .screen, #layer > .modal { pointer-events: auto; }
img { -webkit-user-drag: none; }

/* ---------- animations ---------- */
@keyframes popIn { 0% { opacity: 0; transform: scale(0.72); } 70% { opacity: 1; transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slam { 0% { opacity: 0; transform: scale(2.3) rotate(-4deg); } 60% { opacity: 1; transform: scale(0.93) rotate(-4deg); } 100% { opacity: 1; transform: scale(1) rotate(-4deg); } }
@keyframes logoDrop { 0% { opacity: 0; transform: translateY(-70%) scale(0.8); } 65% { opacity: 1; transform: translateY(4%) scale(1.04); } 100% { opacity: 1; transform: none; } }
@keyframes logoFloat { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-8px) rotate(-0.6deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.55; transform: scale(0.95); } }
@keyframes starPop { 0% { transform: scale(0) rotate(-50deg); } 70% { transform: scale(1.28) rotate(8deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes ptsUp { 0% { opacity: 0; transform: translateY(20px) scale(0.6); } 18% { opacity: 1; transform: translateY(0) scale(1.18); } 75% { opacity: 1; transform: translateY(-26px) scale(1); } 100% { opacity: 0; transform: translateY(-48px); } }
@keyframes wobble { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes voIn { 0% { opacity: 0; transform: translateY(8px) scale(0.9); } 70% { opacity: 1; transform: translateY(-1px) scale(1.04); } 100% { opacity: 1; transform: none; } }
@keyframes rwSpin { 0%, 70% { transform: translateX(0); } 80% { transform: translateX(-0.18em); } 90% { transform: translateX(0.04em); } 100% { transform: translateX(0); } }
@keyframes ballSpin { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }
@keyframes shine { 0%, 62% { transform: translateX(-140%) skewX(-18deg); } 100% { transform: translateX(240%) skewX(-18deg); } }

/* ---------- screens ---------- */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 16px 16px 18px; animation: fadeIn 0.22s ease-out; }
.scrTitle, .hdr h2 { margin: 0; font-size: 26px; font-weight: 900; color: #fff; text-shadow: var(--ol3); text-align: center; line-height: 1.15; }

/* ---------- buttons (9-slice plate cropped from ui-button at boot) ---------- */
.btn {
  position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px; min-width: 96px; margin: 0; padding: 4px 8px;
  font-family: inherit; font-size: 19px; font-weight: 900; line-height: 1.15; color: #fff; text-shadow: var(--ol2); text-align: center;
  cursor: pointer; outline: none; background: transparent;
  border-style: solid; border-color: transparent; border-width: 12px 20px;
  border-image: var(--btnimg) 48% 22% fill / 12px 20px stretch;
  transition: transform 0.09s ease-out, filter 0.12s; touch-action: manipulation; user-select: none;
}
html:not(.btnart) .btn { border: 3px solid #16204a; border-radius: 999px; background: linear-gradient(#ffc56d, #ff8a2a); padding: 12px 22px; box-shadow: 0 4px 0 #16204a; }
html:not(.btnart) .btn.blue { background: linear-gradient(#8fd8ff, #2f8fe0); }
html:not(.btnart) .btn.green { background: linear-gradient(#8ff0a8, #22a850); }
html:not(.btnart) .btn.gold { background: linear-gradient(#fff08a, #f0b81a); }
html:not(.btnart) .btn.red { background: linear-gradient(#ff9a8a, #e0402e); }
.btnart .btn.blue { border-image-source: var(--btnimg-blue); }
.btnart .btn.green { border-image-source: var(--btnimg-green); }
.btnart .btn.gold { border-image-source: var(--btnimg-gold); }
.btnart .btn.red { border-image-source: var(--btnimg-red); }
.btn .lb { display: block; }
.btn .sub { display: block; font-size: 13px; font-weight: 800; line-height: 1.25; opacity: 0.96; }
.btn.focus { filter: brightness(1.16) saturate(1.1) drop-shadow(0 0 6px rgba(255, 230, 120, 0.9)); transform: translateY(-2px) scale(1.03); }
.btn.press { transform: translateY(2px) scale(0.95); }
.btn.dis { filter: grayscale(1) brightness(0.8); }
.btn.small { min-height: 48px; min-width: 112px; font-size: 16px; }
.btn.go { min-width: 168px; min-height: 58px; font-size: 22px; }

/* ---------- logo (drawn in code: a ribbon line over a big glossy word) ---------- */
.logo { position: relative; flex: 0 0 auto; display: flex; justify-content: center; width: 100%; padding: 0 4%; pointer-events: none; transform: rotate(-5deg); }
.logo::before { content: ""; position: absolute; left: 6%; right: 6%; top: -12%; bottom: -18%; background: radial-gradient(closest-side, rgba(255, 236, 190, 0.42), rgba(255, 236, 190, 0)); pointer-events: none; }
.logoIn { position: relative; display: flex; flex-direction: column; align-items: center; transform-origin: 50% 60%; filter: drop-shadow(0 6px 0 rgba(10, 16, 48, 0.32)); animation: logoDrop 0.7s cubic-bezier(0.3, 1.5, 0.5, 1) both, logoFloat 3.4s ease-in-out 0.8s infinite; }
.logo.sm .logoIn { animation: popIn 0.4s cubic-bezier(0.3, 1.5, 0.5, 1) both; }
.lgRib { position: relative; display: flex; align-items: center; gap: 0.32em; font-size: var(--f1); padding: 0.16em 0.7em 0.2em; margin-bottom: 0.12em; background: linear-gradient(#ff7466, #e8402f); border: 3px solid #16204a; border-radius: 0.28em; color: #fff3d6; box-shadow: 0 0.14em 0 #16204a; transform: rotate(-1.5deg); }
.lgRib::before, .lgRib::after { content: ""; position: absolute; top: 0.32em; width: 0.95em; height: 100%; background: #b02a1c; z-index: -1; }
.lgRib::before { left: -0.72em; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 36% 50%); }
.lgRib::after { right: -0.72em; clip-path: polygon(0 0, 100% 0, 64% 50%, 100% 100%, 0 100%); }
.lgT1 { font-weight: 900; letter-spacing: 0.08em; line-height: 1.05; white-space: nowrap; text-shadow: 0 0.08em 0 #16204a; }
.lgRw { flex: 0 0 auto; width: 0.86em; height: 0.66em; background: #ffd23f; clip-path: polygon(0 50%, 50% 0, 50% 50%, 100% 0, 100% 100%, 50% 50%, 50% 100%); filter: drop-shadow(0 2px 0 #16204a); animation: rwSpin 2.6s ease-in-out 1s infinite; }
.lgBall { position: relative; flex: 0 0 auto; width: 0.9em; height: 0.9em; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffffff, #f2e8d6 70%); border: 2px solid #16204a; overflow: hidden; animation: ballSpin 3.2s linear infinite; }
.lgBall::before, .lgBall::after { content: ""; position: absolute; top: 8%; bottom: 8%; width: 60%; border-radius: 50%; border: 2px dashed #e8402f; }
.lgBall::before { left: -38%; }
.lgBall::after { right: -38%; }
.lgMain { position: relative; display: grid; font-size: var(--f2); font-weight: 900; line-height: 1.02; letter-spacing: 0.03em; white-space: nowrap; overflow: hidden; padding: 0.1em 0.14em 0.2em; margin: -0.1em -0.14em -0.2em; }
.lgMain > span { grid-area: 1 / 1; text-align: center; }
.lgMain .bk { color: #16204a; -webkit-text-stroke: 0.19em #16204a; text-shadow: 0 0.035em 0 #0a1030, 0 0.07em 0 #0a1030, 0 0.105em 0 #0a1030, 0 0.14em 0 #0a1030, 0 0.2em 0.04em rgba(0, 0, 0, 0.35); }
.lgMain .fr { color: #ffd23f; background: linear-gradient(180deg, #fffbd0 0%, #ffe066 34%, #ffc21a 56%, #ff8a2a 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.lgMain::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 26%; background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0)); mix-blend-mode: overlay; animation: shine 4.2s ease-in-out 1.2s infinite; pointer-events: none; }

/* ---------- title ---------- */
.screen.title { justify-content: space-between; padding: 10% 0 7%; background: linear-gradient(180deg, rgba(10, 16, 48, 0.25), rgba(10, 16, 48, 0) 35%, rgba(10, 16, 48, 0) 70%, rgba(10, 16, 48, 0.55)); }
.titleBottom { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.pressStart { font-size: 22px; font-weight: 900; color: #fff; text-shadow: var(--ol3); animation: pulse 1.5s ease-in-out infinite; text-align: center; padding: 0 16px; }

/* ---------- modes ---------- */
.screen.modes { justify-content: center; gap: 16px; padding: 18px 18px 22px; }
.screen.modes .logo { margin-bottom: 6px; }
.modeBox { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.btn.big { width: 100%; min-height: 104px; font-size: 26px; padding: 6px 10px 6px 76px; align-items: flex-start; text-align: left; animation: slideUp 0.32s ease-out both; }
.btn.big:nth-child(2) { animation-delay: 0.08s; }
.btn.big .sub { font-size: 14px; margin-top: 3px; }
.btn.big .ic { position: absolute; left: 0; top: 50%; width: 66px; height: 66px; margin-top: -33px; object-fit: contain; filter: drop-shadow(0 3px 0 rgba(10, 16, 48, 0.5)); animation: wobble 2.4s ease-in-out infinite; }
.row2 { display: flex; gap: 10px; width: 100%; }
.row2 .btn { flex: 1 1 0; min-width: 0; }

/* ---------- difficulty ---------- */
.screen.diff { justify-content: center; gap: 14px; }
.diffBox { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.btn.diff { width: 100%; min-height: 92px; font-size: 24px; padding: 4px 10px 4px 12px; align-items: flex-start; text-align: left; animation: slideUp 0.3s ease-out both; }
.btn.diff:nth-child(2) { animation-delay: 0.05s; } .btn.diff:nth-child(3) { animation-delay: 0.1s; }
.btn.diff .sub { font-size: 13px; padding-right: 52px; }
.btn.diff.cur::before { content: "▶"; position: absolute; left: -16px; top: 50%; transform: translateY(-50%); color: #ffd23f; font-size: 18px; }
.pips { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); display: flex; gap: 3px; }
.pips i { width: 12px; height: 12px; border-radius: 50%; background: rgba(22, 32, 74, 0.45); border: 2px solid #16204a; }
.pips i.on { background: #fff; box-shadow: inset 0 0 0 2px #ff5a4a; }

/* ---------- scene list ---------- */
.screen.list, .screen.intro, .screen.rules { background: linear-gradient(180deg, rgba(10, 16, 48, 0.72), rgba(10, 16, 48, 0.55) 40%, rgba(10, 16, 48, 0.8)); }
.screen.list { padding: 12px 12px 14px; gap: 10px; }
.hdr { width: 100%; display: flex; align-items: center; gap: 8px; padding-right: 52px; min-height: 48px; }
.hdr h2 { flex: 1 1 auto; text-align: left; font-size: 23px; }
.btn.pill { min-width: 0; min-height: 44px; font-size: 14px; padding: 2px 4px; flex: 0 0 auto; }
.tabs { display: flex; gap: 6px; width: 100%; }
#app .btn.tab { flex: 1 1 0; min-width: 0; min-height: 46px; padding: 4px 4px; font-size: 15px; border: 3px solid #16204a; border-image: none; border-radius: 14px 14px 6px 6px; background: #2b3a7a; box-shadow: 0 3px 0 #16204a; }
#app .btn.tab.on { background: #ffd23f; color: #16204a; text-shadow: none; }
.cards { flex: 1 1 auto; width: 100%; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 14px; padding: 12px 4px 14px; scrollbar-width: none; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.cards::-webkit-scrollbar { display: none; }
.card { position: relative; flex: 0 0 auto; background: #fff3d6; color: #16204a; border: 3px solid #16204a; border-radius: 16px; box-shadow: 0 5px 0 #16204a; padding: 10px 12px 12px; animation: slideUp 0.3s ease-out both; }
.card::before { content: ""; position: absolute; left: -3px; top: 14px; bottom: 14px; width: 7px; border-radius: 0 6px 6px 0; background: #ff5a4a; }
.card.tab-jp::before { background: #3ccf6a; } .card.tab-intl::before { background: #2f8fe0; } .card.tab-cpbl::before { background: #ff5a4a; }
.ctop { display: flex; align-items: center; gap: 8px; min-width: 0; }
.year { flex: 0 0 auto; background: #ff5a4a; color: #fff; border: 2px solid #16204a; border-radius: 999px; padding: 1px 9px; font-size: 14px; font-weight: 900; }
.cs { font-size: 13px; font-weight: 800; color: #4a5486; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ct { font-size: 19px; font-weight: 900; line-height: 1.2; margin: 6px 0 6px; }
.crow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.sit { display: flex; flex-wrap: wrap; gap: 4px; }
.chipS { background: #16204a; color: #fff; border-radius: 8px; padding: 2px 7px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.scoreRow { display: flex; align-items: center; gap: 4px; font-size: 14px; }
.scoreRow .tm { display: inline-flex; align-items: center; gap: 5px; background: #26305e; color: #fff; border-radius: 8px; padding: 2px 7px; border: 2px solid #16204a; }
.scoreRow .tm.bat { background: #ff9a3c; }
.scoreRow b { font-weight: 900; font-size: 13px; }
.scoreRow em { font-style: normal; font-weight: 900; font-size: 17px; color: #ffd23f; text-shadow: 0 2px 0 #16204a; }
.scoreRow .tm.bat em { color: #fff; }
.scoreRow .vs { font-weight: 900; color: #16204a; }
.cbtns { display: flex; gap: 10px; margin-top: 12px; }
.cbtns .btn { flex: 1 1 0; min-width: 0; min-height: 56px; font-size: 16px; }
.cbtns .btn .sub { color: #fff2a0; letter-spacing: 2px; font-size: 14px; }
.heroB { position: absolute; top: -24px; right: -18px; background: #ffd23f; color: #16204a; border: 2px solid #16204a; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 900; text-shadow: none; transform: rotate(6deg); white-space: nowrap; box-shadow: 0 2px 0 #16204a; }

/* ---------- panels (ui-panel 9-slice: cream middle → navy text) ---------- */
.panel { color: #16204a; border-style: solid; border-color: transparent; border-width: 26px; border-image: url("../assets/ui-panel.webp") 88 fill / 30px stretch; padding: 2px 4px; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.45)); }
.panel.enter { animation: popIn 0.32s cubic-bezier(0.3, 1.4, 0.5, 1) both; }
.kicker { display: inline-block; align-self: flex-start; background: #ff5a4a; color: #fff; border: 2px solid #16204a; border-radius: 999px; padding: 1px 10px; font-size: 13px; font-weight: 900; }
.it { margin: 6px 0 2px; font-size: 23px; font-weight: 900; line-height: 1.2; color: #16204a; }
.is { font-size: 14px; font-weight: 800; color: #4a5486; margin-bottom: 8px; }
.idesc { font-size: 15px; font-weight: 700; line-height: 1.5; margin: 10px 0; font-family: inherit; }
.rolePill { display: inline-block; align-self: flex-start; background: #ff9a3c; color: #fff; text-shadow: var(--ol2); border: 3px solid #16204a; border-radius: 12px; padding: 4px 14px; font-size: 18px; font-weight: 900; }
.rolePill.pitch { background: #2f8fe0; }
.rule { margin-top: 10px; background: #ffe1dc; border: 2px dashed #e0402e; color: #b02a1c; border-radius: 10px; padding: 6px 10px; font-size: 14px; font-weight: 900; }

/* ---------- intro / rules ---------- */
.screen.intro, .screen.rules { justify-content: center; padding: 62px 12px 18px; gap: 14px; }
.introP, .rulesP { width: 100%; max-height: calc(100% - 80px); overflow-y: auto; display: flex; flex-direction: column; scrollbar-width: none; }
.introP::-webkit-scrollbar, .rulesP::-webkit-scrollbar, .resPanel::-webkit-scrollbar, .help .panel::-webkit-scrollbar { display: none; }
.ibtns { display: flex; gap: 12px; justify-content: center; width: 100%; animation: slideUp 0.3s 0.1s ease-out both; }
.btn.diff .dpts { display: block; margin-top: 4px; padding-right: 52px; font-size: 12px; font-weight: 800; line-height: 1.35; color: #16204a; text-shadow: none; -webkit-text-stroke: 0; }
.multTag { display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 999px; background: #16204a; color: #ffd23f; font-size: 12px; font-weight: 900; text-shadow: none; -webkit-text-stroke: 0; vertical-align: 1px; }
.kicker .multTag { font-size: 13px; }
.ptsGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 4px 0 8px; }
.pr { display: flex; justify-content: space-between; align-items: center; gap: 6px; background: #16204a; color: #fff; border-radius: 10px; padding: 5px 9px; font-size: 14px; font-weight: 800; }
.pr b { color: #ffd23f; font-weight: 900; }
.best { align-self: center; background: #ffd23f; border: 3px solid #16204a; border-radius: 12px; padding: 4px 14px; font-size: 17px; font-weight: 900; color: #16204a; }

/* ---------- results ---------- */
.screen.result { justify-content: center; padding: 14px 14px 16px; gap: 8px; background: linear-gradient(180deg, rgba(10, 16, 48, 0.9), rgba(10, 16, 48, 0.72) 35%, rgba(10, 16, 48, 0.92)); }
.resTop { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; padding: 0 44px; flex: 0 0 auto; }
.resScene { font-size: 14px; font-weight: 800; color: #ffe9a8; text-shadow: var(--ol2); text-align: center; }
.resCat { font-size: min(38px, calc(var(--u) * 8.6)); font-weight: 900; color: #ffd23f; text-shadow: var(--ol3); text-align: center; line-height: 1.12; animation: slam 0.45s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
.resCat.res_break { color: #7ee0ff; } .resCat.res_alt { color: #3ccf6a; } .resCat.res_tie { color: #ffffff; }
.resCat.res_repeat, .resCat.res_wall { color: #ff8a7a; }
.resCat.res_miss { color: #ffb36b; }
.stars3 { display: flex; gap: 10px; margin: 2px 0; }
.star { position: relative; display: block; width: 46px; height: 44px; background: #16204a; clip-path: polygon(50% 0%, 62% 34%, 98% 35%, 69% 57%, 80% 92%, 50% 71%, 20% 92%, 31% 57%, 2% 35%, 38% 34%); }
.star::after { content: ""; position: absolute; inset: 7px 8px 6px; background: #3a4680; clip-path: inherit; }
.star.on { animation: starPop 0.45s cubic-bezier(0.3, 1.7, 0.5, 1) both; }
.star.on::after { background: linear-gradient(#fff0a0, #ffc21a 55%, #ff9a1a); }
.resDesc { font-size: 15px; font-weight: 800; color: #fff; text-shadow: var(--ol2); text-align: center; }
.resVo { display: inline-block; margin-top: 2px; background: rgba(10, 16, 48, 0.82); border: 2px solid #ffd23f; border-radius: 12px; padding: 3px 12px; font-size: 15px; font-weight: 900; color: #ffd23f; text-align: center; animation: voIn 0.35s 0.7s cubic-bezier(0.3, 1.5, 0.5, 1) both; }
.resPanel { width: 100%; flex: 0 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.blk { padding: 6px 2px 8px; border-bottom: 2px dashed rgba(22, 32, 74, 0.25); }
.blk:last-child { border-bottom: none; }
.blk h3 { margin: 0 0 4px; font-size: 14px; font-weight: 900; color: #d23a2e; letter-spacing: 0.04em; }
.blk .big { font-size: 20px; font-weight: 900; }
.blk p { margin: 2px 0 0; font-size: 15px; font-weight: 700; line-height: 1.5; }
.blk.triv { background: rgba(255, 210, 63, 0.22); border-radius: 10px; padding: 8px 10px; margin-top: 6px; }
.resBtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; width: 100%; flex: 0 0 auto; animation: slideUp 0.3s 0.25s ease-out both; }
.resBtns .btn { min-width: 0; font-size: 17px; }

/* ---------- help modal ---------- */
.modal { position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 56px 12px 18px; background: rgba(6, 10, 30, 0.62); animation: fadeIn 0.18s ease-out; }
.modal .panel { width: 100%; max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; scrollbar-width: none; }
.hp { font-size: 15px; font-weight: 700; line-height: 1.5; margin: 6px 0; }
.modal .panel > .btn { align-self: center; margin-top: 8px; flex: 0 0 auto; }

/* ---------- at-bat overlays: pitch-type chips (tap, keys 1–4, Q / E, LB / RB) ---------- */
.chips { position: absolute; left: 3%; width: 64%; bottom: 13%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 10px; pointer-events: none; z-index: 4; transition: opacity 0.18s, transform 0.18s; }
.chips.side { bottom: auto; right: auto; grid-template-columns: 1fr; gap: 9px; }
.chips.side .chipHint { white-space: normal; justify-self: stretch; text-align: center; font-size: 12px; padding: 1px 6px; letter-spacing: 0; }
.chips.side .chip .cn { font-size: 13.5px; }
.chips.hide { opacity: 0; transform: translateY(12px); visibility: hidden; }
.chipHint { display: none; grid-column: 1 / -1; justify-self: start; margin-bottom: -2px; padding: 1px 10px; border-radius: 999px; background: rgba(10, 16, 48, 0.78); border: 2px solid #ffd23f; font-size: 13px; font-weight: 900; color: #fff; letter-spacing: 0.04em; white-space: nowrap; }
.chips.keys .chipHint { display: block; }
.chip { position: relative; pointer-events: auto; min-height: 48px; padding: 3px 4px; border: 3px solid #16204a; border-radius: 12px; background: rgba(255, 243, 214, 0.95); color: #16204a; font-family: inherit; font-weight: 900; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 4px 0 #16204a; cursor: pointer; transition: transform 0.08s; touch-action: manipulation; }
.chip .cn { font-size: 14px; line-height: 1.15; }
.chip .ck { font-size: 12px; opacity: 0.75; }
.chip .kb { display: none; position: absolute; left: -9px; top: -10px; width: 23px; height: 23px; border-radius: 50%; background: #16204a; border: 2px solid #ffd23f; color: #ffd23f; font-size: 13px; line-height: 19px; text-align: center; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.chips.keys .chip .kb { display: block; }
.chips.pad .chip .kb { display: none; }
.chip.on { background: #ffd23f; transform: translateY(-3px); box-shadow: 0 7px 0 #16204a; }
.chip.on .kb { background: #ff5a4a; color: #fff; border-color: #fff; }
.chip:active { transform: translateY(2px); box-shadow: 0 2px 0 #16204a; }
.ptsPop { position: absolute; left: 0; right: 0; top: 34%; z-index: 7; text-align: center; font-size: 42px; font-weight: 900; color: #ffd23f; text-shadow: var(--ol3); pointer-events: none; animation: ptsUp 1.25s ease-out forwards; }

/* ---------- banners & subtitles ---------- */
#banner { position: absolute; left: 0; right: 0; top: 26%; z-index: 6; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bn { font-size: min(46px, calc(var(--u) * 11)); font-weight: 900; color: #fff; text-shadow: var(--ol3); white-space: nowrap; padding: 0 10px; animation: slam 0.36s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
.bn.small { font-size: min(32px, calc(var(--u) * 8)); }
.bn.small.perfect { color: #ffd23f; font-size: min(40px, calc(var(--u) * 9.5)); }
.bn.small.great { color: #7ee0ff; } .bn.small.good { color: #ffffff; }
.bn.small.early, .bn.small.late { color: #ffb3a8; } .bn.small.wild { color: #ff5a4a; }
.bn.call.strike { color: #ffd23f; } .bn.call.ball { color: #7ee0ff; } .bn.call.whiff { color: #ff8a7a; }
.bn.hr { font-size: min(60px, calc(var(--u) * 13.5)); color: #ffd23f; }
.bn.hit { font-size: min(52px, calc(var(--u) * 12)); color: #3ccf6a; }
.bn.out { color: #ff6a5a; } .bn.k { color: #ff9a3c; font-size: min(50px, calc(var(--u) * 11.5)); } .bn.walk { color: #7ee0ff; }
.bn2 { font-size: 20px; font-weight: 900; color: #fff; text-shadow: var(--ol2); animation: slideUp 0.3s 0.12s ease-out both; text-align: center; padding: 0 12px; }
#subtitle { position: absolute; left: 6%; right: 6%; top: 19.5%; z-index: 7; text-align: center; pointer-events: none; opacity: 0; transition: opacity 0.3s; }
#subtitle span { display: inline-block; background: rgba(10, 16, 48, 0.82); border: 2px solid #ffd23f; border-radius: 12px; padding: 5px 14px; font-size: 16px; font-weight: 900; color: #fff; }
/* the results screen shows its voice line inside its own layout (.resVo) */
#app:has(.screen.result) #subtitle { display: none; }

.logo .lgRib { margin-bottom: 0.22em; }
/* first-time guide: a slim board in the free band (never over the pitcher or the ball) */
.guide { position: absolute; left: 3%; right: 3%; display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; box-sizing: border-box; overflow: hidden;
  background: rgba(14, 22, 58, 0.92); border: 2.5px solid #ffd23f; border-radius: 14px; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35); pointer-events: auto; z-index: 6; animation: popIn 0.25s ease-out both; }
.guide .gTxt { flex: 1 1 auto; margin: 0; font-size: 13.5px; line-height: 1.35; font-weight: 900; color: #fff; text-shadow: var(--ol2); }
.guide.narrow { gap: 6px; padding: 5px 6px 5px 9px; } .guide.narrow .gTxt { font-size: 12.5px; line-height: 1.3; } .guide.narrow .gSkip { min-width: 52px; font-size: 13px; padding: 0 6px; }
.guide .gSkip { flex: 0 0 auto; min-width: 64px; min-height: 44px; font-size: 15px; padding: 0 10px; }

/* rewrite-history comparison on the results page */
.blk.cmp { background: rgba(126, 224, 255, 0.18); border-radius: 10px; padding: 8px 10px; margin-top: 6px; border-bottom: none; }
.cmpGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 8px; }
.cmpCol { background: rgba(255, 255, 255, 0.55); border-radius: 8px; padding: 6px 8px; min-width: 0; }
.cmpCol.you { border-left: 4px solid #ff9a3c; } .cmpCol.hist { border-left: 4px solid #16204a; }
.cmpCol .cmpH { display: block; font-size: 13px; font-weight: 900; color: #d23a2e; margin-bottom: 2px; }
.cmpCol.hist .cmpH { color: #16204a; }
.cmpCol p { margin: 1px 0; font-size: 13px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.cmpCol .cmpOc { font-size: 15px; font-weight: 900; }
.cmpCol .cmpSc { font-weight: 900; color: #16204a; white-space: nowrap; }
.cmpDiff { margin-top: 6px; text-align: center; font-size: 15px; font-weight: 900; color: #16204a; }

/* Batting Challenge end screen */
.screen.chover { justify-content: center; gap: 16px; background: rgba(10, 16, 48, 0.62); }
.chOverP { width: 92%; text-align: center; }
.chOverP .chLbl { margin-top: 8px; font-size: 15px; font-weight: 900; color: #6b4a1e; }
.chOverP .chScore { font-size: 54px; font-weight: 900; color: #ff9a3c; line-height: 1.1; -webkit-text-stroke: 2px #16204a; text-shadow: 0 4px 0 #16204a; animation: popIn 0.4s 0.15s ease-out both; }
.btn.chAgain { width: 78%; min-height: 76px; font-size: 26px; }
