/* Boundary Park: floodlit club-cricket presentation on the shared library theme. */
body.bp { --bp-grass: #347557; --bp-cream: #f4e7bd; background: #101522; }
body.bp button { min-height: 44px; touch-action: manipulation; }
body.bp kbd { font: inherit; font-size: 10px; background: rgba(0,0,0,.25); border: 1px solid currentColor; border-radius: 2px; padding: 1px 4px; opacity: .8; }
#bp-main { flex: 1; width: min(1180px, 100%); margin: 0 auto; padding: 10px max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
.bp-score { min-height: 68px; display: grid; grid-template-columns: 1.25fr 1fr 1.25fr 1.1fr .9fr; align-items: center; gap: 10px; background: #0c0e14; border: 2px solid var(--line); border-bottom: 3px solid #080b11; border-radius: 5px; padding: 7px 12px; font-variant-numeric: tabular-nums; }
.bp-score-main { display: flex; align-items: baseline; gap: 9px; white-space: nowrap; }
.bp-score-main > span:first-child { font-size: 12px; font-weight: 800; letter-spacing: .6px; }
#bp-score { color: var(--ink); font-size: 27px; line-height: 1; }
#bp-overs { color: var(--muted); font-size: 14px; }
.bp-score-stat, .bp-this-over { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.bp-score small { color: var(--muted); font-size: 10px; letter-spacing: .7px; }
.bp-score-stat b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
#bp-target { color: var(--gold); }
#bp-over-balls { height: 20px; color: var(--bp-cream); font-size: 12px; white-space: nowrap; overflow: hidden; }
.bp-play-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 10px; margin-top: 10px; align-items: start; }
.bp-stage { min-width: 0; }
#canvas-wrap { width: 100%; overflow: hidden; border-color: #080b11; border-radius: 4px; background: #101522; }
#ground { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; image-rendering: pixelated; image-rendering: crisp-edges; }
#bp-event { position: absolute; left: 8px; top: 8px; width: max-content; max-width: 42%; padding: 5px 8px; text-align: left; line-height: 1.15; pointer-events: none; background: rgba(12,14,20,.9); border: 2px solid var(--gold); box-shadow: 3px 3px 0 rgba(0,0,0,.45); }
#bp-event strong { display: block; color: var(--gold); font-size: clamp(13px, 2vw, 20px); letter-spacing: 1px; text-shadow: 2px 2px 0 #6b4f12; }
#bp-event span { display: block; margin-top: 3px; font-size: 9px; color: var(--ink); }
#bp-event.good { border-color: var(--good); } #bp-event.good strong { color: var(--good); text-shadow: 3px 3px 0 #214c3a; }
#bp-event.bad { border-color: var(--bad); } #bp-event.bad strong { color: var(--bad); text-shadow: 3px 3px 0 #692d2a; }
.bp-commentary { height: 52px; display: grid; grid-template-columns: 140px minmax(0, 1fr); align-items: center; gap: 10px; background: #0c0e14; border: 2px solid var(--line); border-top: 0; padding: 6px 12px; }
.bp-commentary > span { color: var(--accent); font-size: 10px; letter-spacing: .5px; }
.bp-commentary p { margin: 0; font-size: 12px; line-height: 1.4; }
.bp-controls { min-height: 487px; display: flex; flex-direction: column; gap: 8px; background: var(--panel); border: 3px solid var(--line); border-radius: 5px; padding: 10px; }
.bp-control-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; border-bottom: 1px solid var(--line); padding-bottom: 7px; }
#bp-role { color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: .6px; }
#bp-format { color: var(--muted); font-size: 9px; white-space: nowrap; }
.bp-controls fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.bp-controls legend { width: 100%; margin-bottom: 4px; color: var(--muted); font-size: 10px; letter-spacing: .7px; }
.bp-controls legend small { float: right; font-size: 9px; }
.bp-segment { display: grid; gap: 4px; }
.bp-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bp-segment button { min-width: 0; min-height: 44px; padding: 4px 3px; font-size: 12px; line-height: 1.2; }
.bp-segment button b, .bp-segment button small { display: block; overflow: hidden; text-overflow: ellipsis; }
.bp-segment button small { margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 400; }
.bp-segment button[aria-pressed="true"] { color: var(--gold); border-color: var(--gold); background: #3a3320; box-shadow: inset 0 0 0 1px #6b4f12; }
.bp-segment button[aria-pressed="true"] small { color: var(--bp-cream); }
#bp-action { width: 100%; min-height: 54px; margin-top: auto; font-size: 15px; font-weight: 800; }
#bp-hint { min-height: 34px; margin: 0; text-align: center; color: var(--muted); font-size: 11px; line-height: 1.45; }
.bp-tip { min-height: 49px; display: grid; grid-template-columns: 45px 1fr; gap: 7px; padding: 6px; background: #0f1420; border-left: 3px solid var(--accent); font-size: 10px; line-height: 1.35; }
.bp-tip b { color: var(--accent); font-size: 9px; }
.bp-timing { padding: 3px 0; }
.bp-timing-label { display: flex; justify-content: space-between; gap: 6px; margin-bottom: 5px; font-size: 9px; color: var(--muted); }
#bp-timing-value { color: var(--gold); font-size: 9px; }
.bp-meter { position: relative; height: 18px; background: #0c0e14; border: 2px solid var(--line); overflow: hidden; }
.bp-meter-zone { position: absolute; left: 45%; top: 0; width: 20%; height: 100%; background: #8a6a1c; }
#bp-meter-marker { position: absolute; left: 0; top: 0; width: 4px; height: 100%; margin-left: -2px; background: #fff; box-shadow: 0 0 5px #fff; }

/* Menus */
#panel.bp-panel { width: min(650px, 100%); border-color: #4a526b; background: #181e2c; }
#panel.bp-panel h2 { font-size: clamp(24px, 5vw, 36px); text-shadow: 3px 3px 0 #6b4f12; }
.bp-kicker { color: var(--accent); font-size: 11px; letter-spacing: 1px; }
.bp-title-art { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; margin: 10px 0; border: 3px solid #080b11; image-rendering: pixelated; }
.bp-lead { color: var(--bp-cream); font-weight: 800; font-size: 17px; }
.bp-menu { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.bp-menu button { min-width: 130px; }
.bp-save-line { display: inline-block; margin: 0 8px; color: var(--good); font-size: 12px; }
.bp-mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.bp-mode { min-height: 205px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; padding: 14px; text-align: center; }
.bp-mode b { color: var(--gold); font-size: 20px; }
.bp-mode strong { color: var(--ink); font-size: 12px; }
.bp-mode > span:last-child { color: var(--muted); font-size: 12px; line-height: 1.5; }
.bp-mode-icon { display: grid; place-items: center; width: 52px; height: 52px; color: #101522; background: var(--gold); border: 3px solid #fbe293; box-shadow: 4px 4px 0 #6b4f12; font-size: 22px; font-weight: 900; }
.bp-coin { display: grid; place-items: center; width: 80px; height: 80px; margin: 16px auto; color: #6b4f12; background: var(--gold); border: 6px double #6b4f12; border-radius: 50%; box-shadow: 5px 5px 0 #080b11; font-size: 38px; font-weight: 900; }
.bp-coin.flipping { animation: bp-flip .22s linear 4; }
@keyframes bp-flip { 50% { transform: scaleX(.08) translateY(-12px); } }
.bp-toss-buttons { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.bp-toss-buttons button { min-width: 140px; min-height: 52px; }
.bp-centre { text-align: center; }
.bp-break-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 18px; margin: 12px 0; background: #0c0e14; border: 2px solid var(--line); }
.bp-break-score b { color: var(--gold); font-size: 32px; }
.bp-break-score span:last-child { text-align: right; color: var(--muted); }
.bp-result-badge { display: inline-block; padding: 6px 10px; margin: 7px 0 12px; border: 2px solid var(--gold); color: var(--gold); font-weight: 800; }
.bp-result-badge.good { color: var(--good); border-color: var(--good); }
.bp-result-badge.bad { color: var(--bad); border-color: var(--bad); }
.bp-result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bp-result-inn { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 12px; background: #0c0e14; border-left: 4px solid var(--accent); }
.bp-result-inn b { grid-row: span 2; color: var(--gold); font-size: 24px; }
.bp-result-inn small { color: var(--muted); }

@media (max-width: 850px) {
  #bp-main { padding-top: 6px; }
  .bp-score { grid-template-columns: 1.1fr 1fr 1fr; gap: 6px 10px; padding: 6px 9px; }
  .bp-score-main { grid-row: span 2; flex-wrap: wrap; gap: 4px 8px; }
  .bp-score-stat:nth-of-type(4) { display: none; }
  .bp-this-over { grid-column: 2 / 4; flex-direction: row; align-items: center; }
  .bp-play-layout { grid-template-columns: minmax(0, 1fr); margin-top: 6px; }
  .bp-controls { min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 9px; }
  .bp-control-head { grid-column: 1 / -1; }
  #bp-bat-controls, #bp-bowl-controls { display: contents; }
  #bp-bat-controls[hidden], #bp-bowl-controls[hidden] { display: none; }
  .bp-controls fieldset { min-width: 0; }
  #bp-bowl-controls fieldset:last-child { grid-column: 1 / -1; }
  #bp-action { margin-top: 0; }
  #bp-hint { align-self: center; }
  .bp-tip { grid-column: 1 / -1; min-height: 0; }
  .bp-timing { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  body.bp #hud { gap: 6px; padding: max(6px, env(safe-area-inset-top)) 8px 6px; }
  body.bp #hud .brand { width: 100%; text-align: center; font-size: 13px; }
  body.bp .hud-buttons { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  body.bp .hud-buttons button { min-width: 0; padding: 4px 2px; font-size: 11px; }
  body.bp .hud-buttons kbd { display: none; }
  #b-stop { grid-column: auto; }
  .bp-score { font-size: 12px; }
  #bp-score { font-size: 24px; }
  .bp-score-stat b { font-size: 11px; }
  .bp-commentary { height: 48px; grid-template-columns: 1fr; gap: 1px; padding: 4px 8px; }
  .bp-commentary > span { font-size: 8px; }
  .bp-commentary p { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #bp-event { left: 5px; top: 5px; max-width: 55%; padding: 4px 6px; }
  #bp-event strong { font-size: 14px; }
  #bp-event span { font-size: 8px; }
  .bp-controls { grid-template-columns: 1fr; }
  .bp-control-head, .bp-tip, .bp-timing, #bp-bowl-controls fieldset:last-child { grid-column: 1; }
  .bp-segment button { min-height: 46px; }
  #bp-action { min-height: 54px; }
  #bp-hint { min-height: 0; }
  .bp-tip { display: none; }
  .bp-mode-grid { grid-template-columns: 1fr; }
  .bp-mode { min-height: 145px; }
  .bp-title-art { max-height: 175px; }
  #panel.bp-panel { padding: 14px; }
  .bp-result-grid { grid-template-columns: 1fr; }
}
@media (max-height: 500px) and (orientation: landscape) {
  body.bp #hud { padding: 4px 8px; flex-wrap: nowrap; }
  body.bp #hud .brand { width: auto; }
  body.bp .hud-buttons { display: flex; width: auto; margin-left: auto; }
  body.bp .hud-buttons button { min-height: 44px; }
  #bp-main { padding: 4px 8px; }
  .bp-score { min-height: 48px; grid-template-columns: 1.2fr 1fr 1fr .8fr; padding: 3px 8px; }
  .bp-score-main { grid-row: auto; flex-wrap: nowrap; }
  .bp-score-stat:nth-of-type(4) { display: flex; }
  .bp-this-over { display: none; }
  #bp-score { font-size: 21px; }
  .bp-play-layout { grid-template-columns: minmax(0, 1.2fr) minmax(280px, 1fr); gap: 6px; margin-top: 4px; }
  .bp-commentary { height: 34px; grid-template-columns: 100px 1fr; }
  .bp-controls { max-height: calc(100vh - 120px); overflow-y: auto; display: flex; min-height: 0; padding: 6px; gap: 5px; }
  .bp-control-head { padding-bottom: 3px; }
  .bp-segment button { min-height: 40px; }
  #bp-action { min-height: 44px; }
  .bp-tip { display: none; }
  #bp-hint { min-height: 0; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) { .bp-coin.flipping { animation: none; } }
