/* Pocket Target. Surfaces white / light gray, slate borders, one primary color for controls. Change --pt-primary to restyle. */
.pt { --pt-primary: #102a56; --pt-surface: #ffffff; --pt-bg: #f5f7f6; --pt-line: #d6ddd9; --pt-ink: #111a16; --pt-muted: #56635c;
  --pt-p0: #e8590c; --pt-p1: #1c64d1; --pt-good: #1f7a4d; --pt-bad: #b3261e; --pt-target: #f2b600;
  display: grid; gap: 8px; padding-block: 8px 16px; max-width: 520px !important; color: var(--pt-ink); font-variant-numeric: tabular-nums; }
body { background: var(--pt-bg, #f5f7f6); }
.pt-card { background: var(--pt-surface); border: 1px solid var(--pt-line); border-radius: 12px; padding: 8px 10px; }
.pt-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pt-top h1 { margin: 0; font-size: var(--fs-card); } .pt-top .pt-btn { min-height: 38px; padding: 4px 12px; font-size: var(--fs-small); }
.pt-btn { min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--pt-line); background: var(--pt-surface); color: var(--pt-ink); font-family: inherit; font-weight: 700; font-size: var(--fs-body); line-height: 1.15; cursor: pointer; }
.pt-btn.primary { background: var(--pt-primary); border-color: var(--pt-primary); color: #fff; }
.pt-btn:disabled { opacity: .45; cursor: default; }
.pt-seg { display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid var(--pt-line); border-radius: 10px; overflow: hidden; background: var(--pt-surface); }
.pt-seg button { min-height: 42px; padding: 6px 4px; border: 0; border-left: 1px solid var(--pt-line); background: transparent; color: var(--pt-ink); font-family: inherit; font-weight: 700; font-size: var(--fs-small); line-height: 1.15; cursor: pointer; }
.pt-seg button:first-child { border-left: 0; }
.pt-seg button[aria-pressed="true"] { background: var(--pt-primary); color: #fff; }
.pt-main, .pt-play { display: grid; gap: 8px; }
/* Scoreboards */
.pt-sb { display: grid; gap: 8px; }
.pt-sb-row { display: flex; gap: 8px; align-items: stretch; }
.pt-stat { flex: 1; text-align: center; border: 1px solid var(--pt-line); border-radius: 10px; padding: 4px; background: var(--pt-surface); }
.pt-stat b { display: block; font-size: var(--fs-section); line-height: 1.1; }
.pt-stat span { display: block; font-size: var(--fs-small); color: var(--pt-muted); }
.pt-stat.turn { border: 2px solid currentColor; }
.pt-stat.p0 { color: var(--pt-p0); } .pt-stat.p1 { color: var(--pt-p1); }
.pt-stat.p0 span, .pt-stat.p1 span { color: inherit; font-weight: 700; }
.pt-hsb { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.pt-hsb table { border-collapse: collapse; width: 100%; font-size: var(--fs-body); }
.pt-box { border: 2px solid var(--pt-primary); }
.pt-box th, .pt-box td { border: 1px solid var(--pt-line) !important; }
.pt-box th { background: var(--pt-primary); color: #fff !important; text-align: center; }
.pt-box th.half { text-align: left; }
.pt-box th.now { background: var(--pt-target); color: var(--pt-ink) !important; }
.pt-box td.n, .pt-box th.n { width: 2em; text-align: center; padding: 1px 2px; }
.pt-box td.r { font-weight: 800; }
.pt-box tr.bat td.who { box-shadow: inset 4px 0 0 currentColor; }
.pt-box tr.p0 td.who { color: var(--pt-p0); } .pt-box tr.p1 td.who { color: var(--pt-p1); }
.pt-name { width: 100%; min-width: 0; border: 0; border-bottom: 1px dashed currentColor; background: transparent; color: inherit; font: inherit; font-weight: 700; font-size: var(--fs-body); padding: 2px 0; }
.pt-name:focus { outline: 2px solid var(--pt-target); outline-offset: 1px; border-bottom-color: transparent; }
.pt-stat .pt-name { text-align: center; font-size: var(--fs-small); }
.pt-stat .up { font-size: var(--fs-small); font-weight: 700; }
.pt-diamond .fld { fill: #e3efe6; stroke: var(--pt-primary); stroke-width: 2.5; }
.pt-hsb td, .pt-hsb th { padding: 1px 6px; text-align: left; border-bottom: 1px solid var(--pt-line); }
.pt-hsb th { font-size: var(--fs-small); color: var(--pt-muted); font-weight: 600; }
.pt-hsb td.r { text-align: right; font-weight: 800; font-size: var(--fs-card); }

.pt-count { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-small); font-weight: 700; margin-top: 4px; }
.pt-count span { display: inline-flex; align-items: center; gap: 4px; }
.pt-count i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--pt-muted); display: inline-block; }
.pt-count .b i.on { background: var(--pt-good); border-color: var(--pt-good); }
.pt-count .s i.on, .pt-count .o i.on { background: var(--pt-bad); border-color: var(--pt-bad); }
.pt-diamond { width: 76px; height: 76px; }
.pt-diamond .bag { fill: #fff; stroke: var(--pt-muted); stroke-width: 2; }
.pt-diamond .bag.on { fill: var(--pt-p0); stroke: var(--pt-p0); }
/* Call and result */
.pt-call { font-size: var(--fs-section); font-weight: 800; line-height: 1.15; color: var(--pt-primary); }
.pt-sub { font-size: var(--fs-small); color: var(--pt-muted); min-height: 1.3em; }
.pt-last { display: flex; align-items: baseline; gap: 8px; border: 1px solid var(--pt-line); border-left-width: 4px; border-radius: 8px; padding: 4px 8px; background: var(--pt-surface); font-size: var(--fs-small); min-height: 30px; }
.pt-last > span { color: var(--pt-muted); font-weight: 600; white-space: nowrap; }
.pt-result { font-weight: 700; } .pt-last.good { border-left-color: var(--pt-good); } .pt-last.good .pt-result { color: var(--pt-good); }
.pt-last.bad { border-left-color: var(--pt-bad); } .pt-last.bad .pt-result { color: var(--pt-bad); }
.pt-fix { font-size: var(--fs-small); color: var(--pt-muted); text-align: center; margin: -2px 0 0; } .pt-fix:empty { display: none; }
/* The target board */
.pt-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 6px; background: var(--pt-primary); border-radius: 12px; width: 100%; }
/* The scene around the board, drawn like the Baseball IQ players: a catcher crouched behind the target and, when pitching, a
   hitter at the plate. The art is one 390 x 332 picture; the board sits on it at x 24, y 34, 260 wide. */
.pt-scene { position: relative; justify-self: center; width: min(100%, 280px, 36svh); }
.pt-art { display: none; }
.pt-scene.art { width: min(100%, calc(min(240px, 29svh) * 1.5)); aspect-ratio: 390 / 332; }
.pt-scene.art .pt-art { display: block; overflow: visible; position: absolute; inset: 0; width: 100%; height: 100%; }
.pt-scene.art .pt-board { position: absolute; left: 6.154%; top: 10.241%; width: 66.667%; box-shadow: 0 3px 0 rgba(16, 42, 86, .35); }
.pt-scene:not(.bat) .pt-batter { display: none; }
/* No hitter: the picture is cut to 308 wide so the board sits in the middle (pocket-target.js sets the viewBox to match). */
.pt-scene.art:not(.bat) { width: min(100%, calc(min(240px, 29svh) * 308 / 260)); aspect-ratio: 308 / 332; }
.pt-scene.art:not(.bat) .pt-art { overflow: hidden; border-radius: 0 0 10px 10px; }
.pt-scene.art:not(.bat) .pt-board { left: 7.792%; width: 84.416%; }
.pt-art .shirt { fill: var(--pt-shirt, #102a56); } .pt-art .sleeve { stroke: var(--pt-shirt, #102a56); }
/* The catcher's mitt marks the called pocket. */
.pt-board button.target { background: var(--pt-target) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M11 37C6 33 4.5 25 6.5 18.5 7.7 14.6 11.4 14.8 12 18V9.5C12 5.6 16.4 5.6 16.4 9.5V6.5C16.4 2.6 20.8 2.6 20.8 6.5V7.5C20.8 3.6 25.2 3.6 25.2 7.5V10.5C25.2 6.8 29.6 6.8 29.6 10.5V24C31.8 20.6 36.6 21.4 35.4 25.6 33.6 31 30 35 26 37.4Z' fill='%23a0541f' stroke='%235a2d10' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cellipse cx='19.5' cy='25' rx='7.4' ry='6.6' fill='%23c9783f'/%3E%3Cpath d='M16.4 9.5V16M20.8 7.5V15M25.2 10.5V16' stroke='%235a2d10' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E") center 58% / 78% no-repeat; }
.pt-board button.target > span { color: #fff; text-shadow: 0 0 3px #3b1d08, 0 0 6px #3b1d08; }
.pt-board button { aspect-ratio: 1; border: 0; border-radius: 6px; background: var(--pt-surface); color: var(--pt-ink); display: grid; place-items: center; align-content: center; gap: 0; font-family: inherit; font-weight: 800; font-size: var(--fs-section); line-height: 1; cursor: default; position: relative; }
.pt-board.tap button { cursor: pointer; }
.pt-board button:disabled { opacity: 1; color: var(--pt-ink); }
.pt-board button.p0:disabled, .pt-board button.p1:disabled, .pt-board button.hit:disabled, .pt-board button.miss:disabled { color: #fff; }
.pt-board button { -webkit-tap-highlight-color: transparent; }
.pt-board.tap button:active { transform: translateY(1px); }
.pt-board button small { font-size: var(--fs-small); font-weight: 700; color: var(--pt-muted); }
.pt-board button.target { box-shadow: inset 0 0 0 3px #8a6700; }
.pt-board button.p0 { background: var(--pt-p0); color: #fff; } .pt-board button.p1 { background: var(--pt-p1); color: #fff; }
.pt-board button.p0 small, .pt-board button.p1 small, .pt-board button.hit small, .pt-board button.miss small { color: #fff; }
.pt-board button.line { box-shadow: inset 0 0 0 4px #fff, 0 0 0 3px var(--pt-target); }
.pt-board button.hit { background: var(--pt-good); color: #fff; } .pt-board button.miss { background: var(--pt-bad); color: #fff; }
.pt-board button.flash { box-shadow: inset 0 0 0 4px #fff; }
.pt-board button.line.flash { box-shadow: inset 0 0 0 4px #fff, 0 0 0 3px var(--pt-target); }
.pt-board button.h1 { background: #dbe3ef; } .pt-board button.h2 { background: #a9bcd8; } .pt-board button.h3 { background: #6f8dbb; color: #fff; } .pt-board button.h4 { background: #2f5aa0; color: #fff; }
.pt-board button.h3 small, .pt-board button.h4 small { color: #fff; }
.pt-board.miss { background: var(--pt-bad); }
.pt-board button.swing { box-shadow: inset 0 0 0 4px var(--pt-primary); }
.pt-ctl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; } .pt-ctl .pt-btn { min-height: 42px; padding: 4px; font-size: var(--fs-small); }
.pt-toggles { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--fs-small); }
.pt-toggles label { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; }
/* Camera */
.pt-hint { background: var(--pt-primary); color: #fff; border-radius: 10px; padding: 8px 12px; font-size: var(--fs-body); font-weight: 600; }
.pt-stage { position: relative; background: #1b2420; border-radius: 12px; overflow: hidden; min-height: 160px; }
.pt-stage canvas { display: block; width: 100%; height: auto; touch-action: none; cursor: crosshair; }
.pt-cam-main .pt-stage { background: transparent; min-height: 0; display: flex; justify-content: center; }
.pt-cam-main canvas { width: auto; max-width: 100%; max-height: 42svh; border-radius: 12px; }
.pt-off { position: absolute; inset: 0; display: grid; place-content: center; gap: 8px; color: #fff; text-align: center; font-size: var(--fs-body); padding: 12px; }
/* Camera setup drawer */
.pt-setup { border: 0; padding: 0; width: min(560px, 100%); max-height: 92vh; border-radius: 14px; background: var(--pt-surface); color: var(--pt-ink); }
.pt-setup::backdrop { background: rgba(10, 16, 14, .45); }
.pt-setup .in { padding: 0 16px 18px; display: grid; gap: 12px; }
.pt-setup-head { position: sticky; top: 0; z-index: 2; background: var(--pt-surface); padding: 12px 0 10px; border-bottom: 1px solid var(--pt-line); }
.pt-setup h2 { margin: 0; font-size: var(--fs-section); }
.pt-setup .note { font-size: var(--fs-small); color: var(--pt-muted); margin: 0; }
.pt-setup label { font-size: var(--fs-body); }
.pt-setup select { min-height: 40px; font: inherit; font-size: var(--fs-body); }
.pt-howto .pics { display: grid; gap: 10px; } .pt-howto figure { margin: 0; display: grid; gap: 4px; }
.pt-howto svg { width: 100%; height: auto; display: block; background: var(--pt-bg); border-radius: 10px; border: 1px solid var(--pt-line); }
.pt-howto figcaption { font-size: var(--fs-small); }
@media (min-width: 520px) { .pt-howto .pics { grid-template-columns: 1fr 1fr; } }
.pt.board .for-net, .pt:not(.board) .for-board { display: none; }
.pt-steps { margin: 0; padding-left: 1.2em; font-size: var(--fs-body); } .pt-steps li { margin-bottom: 4px; }
.pt-aim { font-weight: 700; } .pt-aim select { flex: 1; min-height: 42px; font: inherit; font-weight: 700; padding: 0 8px; border: 2px solid var(--pt-primary); border-radius: 10px; background: var(--pt-surface); color: var(--pt-ink); }
.pt-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#pt-log { font-size: var(--fs-small); max-height: 140px; overflow: auto; color: var(--pt-muted); }
