.plate-console {
  --plate-pine: #163f33;
  --plate-cream: #fffdf2;
  --plate-stroke: #cbd2bd;
  width: 100%;
  color: #17372c;
  background: var(--plate-cream);
  border: 1px solid var(--plate-stroke);
  border-radius: 12px;
  overflow: hidden;
  font-family: Barlow, Arial, sans-serif;
}
.plate-console [hidden] { display: none !important }
/* Player details use the two existing matchup slots above the board. */
.plate-match {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  align-items:stretch;
  gap:10px;
  padding:3px clamp(12px,2.5vw,24px);
  background:#143c32;
  color:#fff5d9;
}
.plate-match:has(>.sound-switch:not([hidden])) {
  grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);
  column-gap:clamp(4px,1vw,10px);
}
.sound-switch {
  align-self:center;min-width:46px;min-height:44px;padding:0 7px;
  border:1px solid #9fb7a2;border-radius:6px;background:#163c31;color:#fff7df;
  font:600 .79rem/1.05 Barlow,Arial,sans-serif;touch-action:manipulation;cursor:pointer;
}
.sound-switch[aria-pressed="false"] {background:#374c44;color:#e2e5dc}
.sound-switch:focus-visible {outline:2px solid #ffe28b;outline-offset:1px}
#field-sound {position:absolute;bottom:7px;right:8px;z-index:1}
.plate-player {
  display:grid; justify-items:start; align-content:center; gap:1px;
  min-width:0; min-height:48px; padding:2px 0; border:0;
  background:transparent; color:inherit; text-align:start;
}
.plate-player:last-child {justify-items:end;text-align:end}
.plate-player-line {display:flex;align-items:baseline;gap:5px;max-width:100%;font-size:.74rem;line-height:1.1;color:#e1eada}
.plate-player-line small {font-size:.68rem;font-weight:600;letter-spacing:.055em;text-transform:uppercase;color:#c7d8b9}
.plate-player-line [data-p$="-stat"] {font-variant-numeric:tabular-nums}
.plate-player strong {
  max-width:100%;font:400 clamp(1rem,2.1vw,1.4rem)/1.08 "DM Serif Text",Georgia,serif;
  overflow-wrap:anywhere;text-decoration:underline;text-decoration-color:#afc4a57d;
  text-decoration-thickness:1px;text-underline-offset:2px;
}
.plate-player:is(:hover,:focus-visible) strong {text-decoration-color:currentColor}
.plate-player-rating {font-size:.74rem;font-weight:600;line-height:1.08;color:#d5e9ad}
.plate-console .plate-player:focus-visible {outline:2px solid #ffe28b;outline-offset:-1px}
dialog.player-card {
  width:min(390px,calc(100vw - 20px));max-height:calc(100dvh - 20px);
  margin:auto;padding:0;color:#183a2d;background:#fffcf1;
  border:1px solid #80957c;border-radius:12px;box-shadow:0 12px 52px #0a251e4d;
  scrollbar-gutter:auto;overscroll-behavior:contain;font-family:Barlow,Arial,sans-serif;
}
.player-card::backdrop {background:#0c231ac9}
.player-card-head {
  position:sticky;z-index:1;top:0;display:flex;align-items:center;justify-content:space-between;
  gap:12px;padding:12px 17px;background:#143c32;color:#fff8dc;
}
.player-card-head.player-card-illustrated {
  display:grid;grid-template-columns:clamp(50px,16vw,66px) minmax(0,1fr) auto;
  column-gap:clamp(6px,2vw,10px);row-gap:0;padding-inline:clamp(10px,3vw,17px);
}
.player-card-illustrated > div {display:contents}
.player-card-portrait {
  grid-column:1;grid-row:1 / 4;align-self:center;width:100%;height:auto;aspect-ratio:1;object-fit:contain;
}
.player-card-portrait.throws-left {transform:scaleX(-1)}
.player-card-illustrated .player-card-role {grid-column:2;grid-row:1}
.player-card-illustrated h2 {grid-column:2;grid-row:2;overflow-wrap:anywhere}
.player-card-illustrated .player-card-identity {grid-column:2 / -1;grid-row:3}
.player-card-illustrated .player-card-close {grid-column:3;grid-row:1 / 3;justify-self:end}
.player-card-role {font-size:.73rem;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:#cbe1b1}
.player-card-head h2 {margin:2px 0;font:400 1.57rem/1.15 "DM Serif Text",Georgia,serif}
.player-card-identity {font-size:.86rem;color:#e1ecda}
.player-card-close {
  flex:none;min-height:44px;padding:0 12px;border:1px solid #839e8d;border-radius:6px;
  background:transparent;color:#fff8dc;font:600 .9rem Barlow,Arial,sans-serif;
}
.player-card-close:focus-visible {outline:2px solid #f5d884;outline-offset:2px}
.player-card-body {display:grid;gap:14px;padding:14px 17px 17px}
.player-card-body h3 {display:flex;align-items:baseline;gap:6px;margin:0 0 6px;font:600 .98rem/1.2 Barlow,Arial,sans-serif}
.player-card-body h3 small {font-size:.74rem;font-weight:400;color:#506253}
.player-card-body dl {margin:0;display:grid;gap:6px 12px}
.player-card-body dt {font-size:.78rem;line-height:1.12;color:#4c6252;overflow-wrap:break-word}
.player-card-body dd {margin:0;font-weight:600;font-variant-numeric:tabular-nums}
.player-card-numbers {grid-template-columns:repeat(auto-fit,minmax(68px,1fr))}
.player-card-numbers div {border-left:2px solid #bdcda7;padding-left:7px}
.player-card-numbers dd {margin-top:2px;font-size:1rem}
.player-card-ratings {grid-template-columns:repeat(2,minmax(0,1fr))}
.player-card-ratings div {display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:baseline;gap:2px 4px}
.player-card-ratings dd {font-size:.86rem}
.player-card-ratings meter {grid-column:1/-1;width:100%;height:6px;appearance:none;border:0;border-radius:4px;background:#dce4ce}
.player-card-ratings meter::-webkit-meter-bar {height:6px;border:0;border-radius:4px;background:#dce4ce}
.player-card-ratings meter::-webkit-meter-optimum-value {border-radius:4px;background:#517a55}
.player-card-ratings meter::-moz-meter-bar {border-radius:4px;background:#517a55}
.player-card-note {margin:0;border-top:1px solid #d3dcc5;padding-top:10px;font-size:.9rem;line-height:1.3}
.plate-window {
  position: relative;
  width: 100%;
  height: clamp(215px, 34vw, 333px);
  overflow: hidden;
  background: #527559;
}
.plate-window canvas {
  position: absolute; inset: 0;
  display: block;
  width: 100%; height: 100%;
  cursor: default;
  touch-action: none;
}
.plate-console[data-role="pitch"] .plate-window canvas,
.plate-console[data-role="bat"][data-automatic="false"] .plate-window canvas { cursor: crosshair; }
.plate-console[data-automatic="true"] .plate-window canvas { touch-action: pan-y pinch-zoom; }
.plate-window canvas:focus-visible { outline: 3px solid #ffe28b; outline-offset: -4px }
.plate-stage {
  position: absolute;
  top: 10px; left: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  background: #18382eea;
  color: #fff6da;
  pointer-events: none;
  font-size: .86rem;
  font-weight: 600;
  line-height: 1.25;
}
.plate-content { display: grid; gap: 10px; padding: 14px clamp(12px, 2.6vw, 22px) }
.plate-repertoire h3 { font: 600 .9rem/1.25 Barlow, Arial, sans-serif; margin: 0 0 6px }
.plate-pitches { display: grid; grid-template-columns: repeat(auto-fit, minmax(81px,1fr)); gap: 5px }
.plate-console button { font-family: inherit; cursor: pointer }
.plate-console button:disabled { cursor: default }
.plate-console :is(button,summary,select) { touch-action: manipulation }
.plate-console :is(button,summary,select):focus-visible { outline: 3px solid #397b86; outline-offset: 2px }
.plate-pitches button {
  padding: 7px 6px; min-height: 44px; background: #f2f1e3; color: #254538;
  border: 1px solid #cdd2bd; border-radius: 6px;
  font-size: .9rem; line-height: 1.1;
}
.plate-pitches b,.plate-pitches span { display: block }
.plate-pitches span { margin-top: 3px; font-size: .78rem }
.plate-pitches button[aria-pressed="true"] { border-color: #2b5b43; background: #d7e7bc; color: #163b2a }
.plate-pitches button:disabled,.plate-speed button:disabled { opacity: .76 }
.plate-repertoire p { margin: 5px 0 0; color: #52634f; font-size: .86rem }
.plate-settings {
  border-top: 1px solid var(--plate-stroke);
}
.plate-settings summary {
  display: flex; align-items: center; gap: 7px 12px; min-height: 44px;
  padding: 5px 1px; cursor: pointer; color: #254538; list-style: none;
}
.plate-settings summary::-webkit-details-marker { display:none; }
.plate-settings summary strong { font-size: .9rem; font-weight: 600; }
.plate-settings summary span { margin-left: auto; color: #526452; font-size: .84rem; text-align:right; }
.plate-settings summary::after {
  content: ""; flex:none; width:8px; height:8px; margin:0 4px 4px 0;
  border:solid #456452; border-width:0 1.5px 1.5px 0; transform:rotate(45deg);
}
.plate-settings[open] summary::after { transform:rotate(225deg); margin:4px 4px 0 0; }
.plate-setup { display: grid; gap: 12px; padding-bottom: 4px; }
.plate-audio-cues {display:flex;flex-wrap:wrap;gap:0 20px;min-width:0;margin:0;padding:0;border:0}
.plate-audio-cues[hidden] {display:none}
.plate-audio-cues legend {padding:0;color:#355442;font-weight:600}
.plate-audio-cues label {display:inline-flex;align-items:center;gap:6px;min-height:44px;cursor:pointer}
.plate-audio-cues input {width:17px;height:17px;margin:0;accent-color:#215847}
.plate-batting-options { display:flex; align-items:end; gap:8px 16px; flex-wrap:wrap; }
.plate-scouting { display:grid; grid-template-columns:auto minmax(0,1fr); align-items:center; gap:4px 14px; max-width:100%; }
.plate-scouting .plate-guess-name,.plate-scouting small { grid-column:2; max-width:15em; }
.plate-scouting .plate-guess-name { align-self:end; }
.plate-scouting small { align-self:start; color:#526452; font-size:.79rem; line-height:1.25; }
.plate-scouting .plate-guess-grid { grid-row:1/3; grid-column:1; }
.plate-guess-name { margin:0; color:#214736; font-size:.99rem; font-weight:600; }
.plate-guess-grid { display:grid; grid-template-columns:repeat(3,44px); grid-template-rows:repeat(3,44px);
  overflow:hidden; border:1px solid #738677; border-radius:5px; background:#738677; }
.plate-guess-grid button { font:600 .86rem Barlow,Arial,sans-serif; color:#294a39; font-variant-numeric:tabular-nums; border:none; box-shadow:inset 0 0 0 .55px #a7b7a8; background:#f0f2e6; padding:0; }
.plate-guess-grid button:hover:enabled { background:#cedfd8; }
.plate-guess-grid button[aria-pressed="true"] { background:#87b9c1; box-shadow:inset 0 0 0 2px #2e6168; }
.plate-guess-grid button:focus-visible { outline:3px solid #253a32; outline-offset:-4px; }
.plate-guess-grid button:disabled { opacity:.72; }
.plate-console[data-stage="flight"] .plate-guess-grid { pointer-events:none; }
.plate-batting-options label { display:grid; gap:3px; color:#526452; font-size:.84rem; font-weight:600; }
.plate-batting-options select { font:600 .94rem Barlow,Arial,sans-serif; color:#1d4133; background:#fcfcf4;
  border:1px solid #9eae9a; border-radius:5px; min-height:44px; max-width:100%; padding:4px 8px; }
.plate-batting-options .plate-guide-option { display:flex; gap:6px; align-items:center; min-height:44px; cursor:pointer; }
.plate-guide-option input { accent-color:#24543e; width:17px; height:17px; }
.plate-release-option {display:inline-flex;align-items:center;gap:6px;min-height:44px;cursor:pointer}
.plate-actions { display: flex; gap: 8px }
.plate-actions button {
  border: 1px solid transparent;
  min-height: 48px; padding: 8px 14px;
  font-size: 1rem; font-weight: 600; line-height: 1.15; border-radius: 7px;
}
.plate-actions .plate-action { flex: 1; background: var(--plate-pine); color: #fff8df }
.plate-actions .plate-action:hover:enabled { background: #22563e }
.plate-actions .plate-alt { flex: .6; border-color: #b6c3aa; color: #254b35; background: #f2f3e6 }
.plate-actions button:disabled { opacity: .58 }
.plate-status { margin: 0; font-size: 1rem; line-height: 1.35 }
.plate-status:empty { display: none }
.plate-console[data-stage="feedback"] .plate-status { border-left: 3px solid #bf944d; padding-left: 9px }
.plate-speed { display: inline-flex; align-items: center; gap: 3px; flex-wrap: nowrap }
.plate-speed span { margin-right: 4px; font-size: .85rem; color: #526452; font-weight: 600 }
.plate-speed button {
  padding: 6px 9px; min-height: 44px; min-width: 52px;
  border: 1px solid #c5ceba; border-radius: 5px; background: #f8f7ed;
  color: #3c5644; font-size: .88rem; font-weight: 600; white-space: nowrap;
}
.plate-speed small { display: block; margin-top: 1px; font-size: .71rem; font-weight: 500 }
.plate-speed button[aria-pressed="true"] { background: #e1e9d2; border-color: #879e7d; color: #284a33 }
.plate-hint { margin: 0; max-width: 65ch; color: #52634f; font-size: .87rem; line-height: 1.28 }
@media(max-width:540px) {
  .plate-window { height: clamp(207px, 63vw, 276px) }
  .plate-content { padding: 11px 12px; gap: 8px }
  .plate-match { padding: 1px 12px }
  .plate-pitches { grid-template-columns: repeat(auto-fit, minmax(68px,1fr)); gap: 4px }
  .plate-pitches button { font-size: .84rem; padding: 6px 3px }
  .plate-batting-options { gap:8px; }
  .plate-batting-options > label:not(.plate-guide-option) { flex:1 1 112px; min-width:0; }
  .plate-batting-options select,.plate-batting-options .plate-guide-option { min-height:44px }
}

/* Give the close plate camera room for both the mound and a thumb-sized grid. */
@media (max-width: 600px) and (orientation: portrait) {
  :where(.plate-console) :is(.plate-window, .contact-field canvas) {
    height: clamp(255px, 76vw, 340px);
  }
  .mode-card > [data-duel-plate] {
    margin-inline: -15px;
  }
  #series-plate { padding-inline: 0 }
}
@media (orientation: landscape) and (max-height: 500px) and (max-width: 1000px) {
  :where(.plate-console) :is(.plate-window, .contact-field canvas) {
    height: clamp(208px, 66svh, 280px);
  }
}

.plate-arm-row {
  display: flex; align-items: center; justify-content: space-between; gap: 9px 18px; flex-wrap: wrap;
}
.plate-arm-row label {
  display: inline-flex; align-items: center; gap: 8px; color: #385448; font-size: .94rem;
  font-weight: 600;
}
.plate-arm-row select {
  font: inherit; max-width: 100%; color: #1d4133; border: 1px solid #9eae9a;
  border-radius: 5px; background: #fcfcf4; min-height: 44px; padding: 3px 7px;
}
.plate-arm-row button { min-height:44px; }
.plate-field { width: 100%; }
.plate-console[data-field="true"] .plate-window,
.plate-console:is([data-stage="contact"],[data-stage="feedback"],[data-stage="replay"],[data-stage="waiting"]) .plate-repertoire,
.plate-console[data-stage="field"] .plate-content,
.plate-console[data-stage="replay"] .plate-status { display: none; }
.plate-console[data-stage="contact"] .plate-stage { background: #71481d; }


.plate-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.plate-console[data-role="watch"] .contact-booth button:not([data-skip-trot]),
.plate-console[data-role="watch"]:not([data-stage="feedback"]):not([data-stage="retry"]) .plate-content { display: none; }
.plate-console[data-role="watch"] canvas { cursor: default; touch-action: auto; }

.plate-quick,.plate-tools-open,.plate-dock-note {display:none}
.plate-aim-pad {
  position:relative;flex:0 0 112px;min-width:0;min-height:70px;overflow:hidden;
  border:1px solid #789179;border-radius:9px;box-sizing:border-box;
  background:#e7eddb;touch-action:none;cursor:crosshair;user-select:none;-webkit-user-select:none;
}
.plate-aim-pad:focus-visible {outline:3px solid #397b86;outline-offset:-3px}
.plate-aim-pad > span {position:absolute;pointer-events:none}
.plate-pad-zone {
  inset:16.667%;border:1px solid #81997f;border-radius:2px;
  background:linear-gradient(to right, transparent calc(50% - .5px),#a4b59b 50%,transparent calc(50% + .5px)),
    linear-gradient(to bottom, transparent calc(50% - .5px),#a4b59b 50%,transparent calc(50% + .5px));
}
.plate-pad-label {
  top:2px;left:5px;padding-inline:2px;background:#e7eddb;color:#385640;
  font:700 .69rem/1 Barlow,Arial,sans-serif;
}
.plate-pad-grip {
  top:50%;left:50%;width:13px;height:13px;box-sizing:border-box;transform:translate(-50%,-50%);
  border:2px solid #245b54;border-radius:50%;background:#b5e5d6;box-shadow:0 0 0 2px #fbfff5;
}
.plate-actions:has(.plate-aim-pad:not([hidden])) .plate-action {touch-action:manipulation}
.plate-tools-sheet {
  box-sizing:border-box;width:min(420px,calc(100vw - 16px));max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);
  margin:auto;padding:0;color:#173b30;background:#fffcf1;border:1px solid #789579;border-radius:14px;
  overscroll-behavior:contain;box-shadow:0 14px 46px #10372b55;
}
.plate-tools-sheet::backdrop {background:#092319b8}
.plate-tools-sheet header {
  position:sticky;z-index:1;top:0;display:flex;align-items:center;justify-content:space-between;
  gap:12px;padding:6px 14px;background:#163c30;color:#fff9e6;
}
.plate-tools-sheet h2 {margin:0;color:inherit;font:400 1.32rem/1.15 "DM Serif Text",Georgia,serif}
.plate-tools-sheet header button {
  min-height:44px;padding:0 14px;border:1px solid #9cb393;border-radius:7px;
  background:transparent;color:inherit;font:600 .95rem Barlow,Arial,sans-serif;
}
.plate-tools-sheet header button:focus-visible {outline:2px solid #ffe391;outline-offset:-3px}
/* Native selects have an intrinsic width based on their longest option. The
   sheet tracks must be allowed to shrink independently of those labels. */
.plate-tools-body,.plate-tools-sheet .plate-setup {display:grid;grid-template-columns:minmax(0,1fr);min-width:0}
.plate-tools-body {gap:16px;padding:14px}
.plate-tools-sheet .plate-setup {gap:14px}
.plate-tools-sheet .plate-batting-options {
  display:grid;grid-template-columns:repeat(auto-fit,minmax(min(158px,100%),1fr));gap:8px;
}
.plate-tools-sheet .plate-batting-options label,.plate-tools-sheet select {min-width:0;width:100%;max-width:100%;box-sizing:border-box}
.plate-tools-sheet .plate-speed {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}
.plate-tools-sheet .plate-speed > span {grid-column:1/-1;margin:0}
.plate-tools-sheet .plate-speed button {min-width:0;padding-inline:4px}
.plate-tools-sheet .plate-arm-row label {display:grid;gap:3px;flex:1 1 162px;min-width:0}
.plate-tools-sheet .plate-hint {min-width:0;overflow-wrap:anywhere}
.plate-sheet-zones {margin:0 14px 12px;border-top:1px solid #ced9c1}
.plate-sheet-zones summary {min-height:44px;align-content:center;cursor:pointer;font-weight:600}
.plate-sheet-zones .plate-scouting {margin:0 0 8px}
@media (max-width:600px), (orientation:landscape) and (max-height:500px) and (max-width:1000px) {
  .plate-console:not([data-role="watch"]) .plate-content {
    container:plate-dock / inline-size;
    padding:6px max(8px,env(safe-area-inset-right)) 7px max(8px,env(safe-area-inset-left));
    gap:4px;background:var(--plate-cream);border-top:1px solid var(--plate-stroke);
  }
  .plate-content > :is(.plate-scouting,.plate-repertoire,.plate-settings) {display:none}
  .plate-console:not([data-role="watch"]) .plate-actions {
    display:grid;grid-template-columns:minmax(69px,1.3fr) minmax(44px,.65fr) minmax(66px,1.05fr) 56px;gap:4px;
  }
  .plate-console:not([data-role="watch"]) .plate-actions:has(.plate-alt[hidden]) {
    grid-template-columns:minmax(76px,1.3fr) minmax(70px,1fr) 58px;
  }
  .plate-actions :is(.plate-action,.plate-alt,.plate-tools-open) {
    box-sizing:border-box;min-height:46px;min-width:0;padding:4px;
    font:600 .9rem/1.04 Barlow,Arial,sans-serif;
  }
  .plate-quick,.plate-tools-open {
    color:#204835;border:1px solid #9eaf94;border-radius:7px;background:#f2f4e6;
  }
  .plate-quick {
    position:relative;display:grid;align-content:center;gap:2px;min-width:0;min-height:46px;
    padding:2px 14px 2px 7px;cursor:pointer;
  }
  .plate-quick::after {
    content:"";position:absolute;right:5px;top:43%;width:5px;height:5px;
    border:solid #49644e;border-width:0 1.5px 1.5px 0;transform:rotate(45deg);pointer-events:none;
  }
  .plate-quick > span {font:600 .65rem/1 Barlow,Arial,sans-serif;letter-spacing:.04em;text-transform:uppercase;color:#526952}
  .plate-quick > strong {overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:600 .87rem/1.05 Barlow,Arial,sans-serif}
  .plate-quick > select {position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer;font-size:16px}
  .plate-quick:focus-within {outline:2px solid #397b86;outline-offset:-3px}
  .plate-quick:has(select:disabled) {opacity:.64;cursor:default}
  .plate-actions .plate-tools-open {display:block;border-color:#a8b89d;font-size:.84rem}
  .plate-content .plate-dock-note {
    display:block;margin:0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
    font:600 .79rem/16px Barlow,Arial,sans-serif;color:#405d45;
  }
  /* Keep the bullpen camera at its flight dimensions until the high wrap has been shown. */
  :is(.plate-console:is([data-stage="feedback"],[data-stage="retry"],[data-stage="waiting"]),.plate-console:not([data-role="pitch"]):is([data-stage="contact"],[data-stage="replay"])) :is(.plate-quick,.plate-tools-open,.plate-dock-note) {display:none}
  :is(.plate-console:is([data-stage="feedback"],[data-stage="retry"],[data-stage="waiting"]),.plate-console:not([data-role="pitch"]):is([data-stage="contact"],[data-stage="replay"])) .plate-actions :is(.plate-action,.plate-alt) {grid-column:1/-1}
  .plate-console .contact-booth button {min-height:44px}
  .plate-tools-sheet select {font-size:16px}
  @container plate-dock (max-width:250px) {
    .plate-console:not([data-role="watch"]) .plate-actions,
    .plate-console:not([data-role="watch"]) .plate-actions:has(.plate-alt[hidden]) {grid-template-columns:minmax(0,1fr) minmax(60px,.68fr)}
    .plate-actions:has(.plate-alt[hidden]) .plate-action {grid-column:1/-1}
  }
  .plate-console[data-role="bat"] .plate-actions:has(.plate-aim-pad:not([hidden])) {
    grid-template-columns:minmax(72px,1.23fr) minmax(44px,.65fr) minmax(65px,.97fr) minmax(49px,.72fr) minmax(66px,1.1fr);
    grid-template-areas:"aim take mode settings swing";
  }
  .plate-aim-pad {grid-area:aim;min-height:64px}
  .plate-actions:has(.plate-aim-pad:not([hidden])) .plate-action {grid-area:swing}
  .plate-actions:has(.plate-aim-pad:not([hidden])) .plate-alt {grid-area:take}
  .plate-actions:has(.plate-aim-pad:not([hidden])) .plate-quick {grid-area:mode;padding-inline:5px 11px}
  .plate-actions:has(.plate-aim-pad:not([hidden])) .plate-tools-open {grid-area:settings}
  @container plate-dock (max-width:325px) {
    .plate-console[data-role="bat"] .plate-actions:has(.plate-aim-pad:not([hidden])) {
      grid-template-columns:minmax(68px,1.2fr) minmax(58px,1fr) minmax(49px,.85fr);
      grid-template-areas:"aim take swing" "aim mode settings";
    }
  }
}

.plate-console[data-release-control="true"] .plate-window canvas,
.plate-console[data-release-control="true"] .plate-action {touch-action:none}
.plate-console[data-release-control="true"][data-armed="true"] .plate-aim-pad {
  border-color:#245b54;box-shadow:inset 0 0 0 2px #64a895;
}
@media (max-width:600px), (orientation:landscape) and (max-height:500px) and (max-width:1000px) {
  .plate-console[data-role="bat"][data-release-control="true"]:is([data-stage="windup"],[data-stage="flight"]) .plate-actions {
    grid-template-columns:minmax(85px,1.7fr) minmax(50px,.7fr) minmax(66px,.9fr);
    grid-template-areas:"aim take swing";
  }
  .plate-console[data-release-control="true"]:is([data-stage="windup"],[data-stage="flight"]) :is(.plate-tools-open,.plate-quick) {display:none}
}

/* Plate-crossing review sits inside the picture. The dock keeps its play controls. */
.swing-review {
  position:absolute; bottom:6px; left:50%; transform:translateX(-50%);
  width:min(410px,calc(100% - 12px)); box-sizing:border-box; z-index:2;
  display:grid; grid-template-columns:minmax(50px,24%) 1fr auto; align-items:center; gap:7px;
  padding:5px 8px; border-radius:7px; background:#14352ff2; color:#fff5da;
  line-height:1.2; box-shadow:0 1px 6px #12271e55;
}
.swing-review svg {display:block;width:100%;height:65px}
.swing-review strong,.swing-review small,.swing-review span {display:block}
.swing-review strong {font-size:.85rem}
.swing-review small,.swing-review span {font-size:.76rem;margin-top:3px}
.swing-review span {color:#dcebdd}
.swing-review i {display:inline-block;vertical-align:middle}
.review-ball {width:7px;height:7px;border-radius:50%;background:#fff2c7}
.review-bat {height:3px;width:14px;background:#e3b582;margin-left:5px}
.review-aim {width:9px;height:9px;border-radius:50%;border:1.3px solid #7ee0cd;margin-left:5px;box-sizing:border-box}
.swing-review button {min-height:44px;padding:4px 8px;background:#f6e8bb;color:#163c31;border:0;border-radius:5px;font:inherit;font-size:.83rem;font-weight:bold}

/* The direction is drawn in field coordinates with home at the bottom. */
.swing-timing-result {
  display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);align-items:center;
  gap:12px;padding:6px 10px;background:#193b32;color:#fff5df;border-radius:7px;
  font:600 .87rem/1.12 Barlow,Arial,sans-serif;
}
.plate-console:not([data-stage="feedback"]) .swing-timing-result,.swing-timing-result[hidden] {display:none}
.contact-field > .swing-timing-result {flex:none;border-top:1px solid #56745f;border-radius:0}
.swing-timing-result span {color:#cfdecd;font-size:.75rem;font-weight:500}
.swing-timing-result strong {font-weight:650}
.swing-timing-reading {display:grid;grid-template-columns:auto 1fr;align-items:baseline;gap:4px 6px}
.swing-timing-reading strong {text-align:right}
.swing-timing-scale {grid-column:1/-1;position:relative;height:8px;margin-block:1px}
.swing-timing-scale svg {display:block;width:100%;height:100%;border-radius:3px;overflow:hidden}
.swing-timing-scale i {
  position:absolute;bottom:-2px;top:-2px;width:3px;transform:translateX(-50%);
  background:#fffdf4;border-radius:2px;box-shadow:0 0 0 1.5px #16352d;
}
.swing-flight-reading {display:flex;align-items:center;gap:5px;border-left:1px solid #64806c;padding-left:7px}
.swing-flight-reading svg {display:block;width:50px;height:33px;flex:none}
.swing-flight-reading span,.swing-flight-reading strong {display:block}
@container plate-dock (max-width:330px) {
  .swing-timing-result {gap:7px;padding:5px 7px}
  .swing-flight-reading {padding-left:4px;gap:2px}
  .swing-flight-reading svg {width:37px}
}

@media (max-width:600px) and (orientation:portrait) {
  /* Let the completed-pitch summary borrow camera height on short phones. */
  :is(.phone-play-frame,#series-plate:not([data-inning-plate])) .plate-console[data-stage="feedback"]:has(.swing-timing-result:not([hidden])) .plate-content {
    max-height:49dvh;
  }
}

.swing-spin {grid-column:1/-1;padding-top:4px;border-top:1px solid #597768;font-size:.77rem;line-height:1.2;color:#e3ecdc}
.swing-timing-result:has(.swing-spin:not([hidden])) {row-gap:3px}
.swing-timing-result [hidden] {display:none!important}

.field-pitch-details { display:none }
@media (max-width:600px) and (orientation:portrait) {
  /* Keep the live contact readings and the completed play in the same rows.
     The pitch notes open above the dock without moving the field. */
  :is(.phone-play-frame,#series-plate:not([data-inning-plate])) > .plate-console[data-field="true"]:not([data-role="watch"]) .plate-content {
    display:grid; grid-template-columns:minmax(0,1fr) auto;
    grid-template-areas:"timing timing" "details actions";
    align-items:center; gap:3px 6px; max-height:none; overflow:visible;
  }
  .plate-console[data-field="true"]:not([data-role="watch"]) .plate-content > .swing-timing-result:not([hidden]) {
    display:grid; grid-area:timing;
  }
  .plate-console[data-field="true"]:not([data-role="watch"]) .plate-content > :is(.plate-dock-note,.plate-status),
  .plate-console[data-field="true"]:not([data-role="watch"]) .plate-actions > :not(.plate-action) {display:none}
  .plate-console[data-field="true"]:not([data-role="watch"]) .plate-content > .plate-actions {
    display:block;grid-area:actions;min-width:0;
  }
  .plate-console[data-field="true"]:not([data-role="watch"]) .plate-action {min-width:82px}
  .plate-console[data-field="true"][data-stage="field"] .plate-actions {visibility:hidden}
  .plate-console[data-field="true"] .field-pitch-details {
    display:block;grid-area:details;position:relative;min-width:0;
  }
  .field-pitch-details summary {
    display:flex;flex-direction:column;justify-content:center;gap:1px;
    min-height:46px;line-height:1.1;padding:3px 8px;
    border:1px solid #b3c2aa;border-radius:6px;background:#f1f3e9;
    color:#244434;font-size:.84rem;font-weight:600;cursor:pointer;
  }
  .field-pitch-details summary::after {content:'⌄';position:absolute;right:8px;top:13px}
  .field-pitch-details[open] summary::after {content:'⌃'}
  .field-pitch-details summary span {
    padding-right:12px;font-size:.77rem;font-weight:500;white-space:nowrap;
    overflow:hidden;text-overflow:ellipsis;
  }
  .field-pitch-details p {
    position:absolute;z-index:4;bottom:100%;left:0;margin:0 0 4px;
    width:min(335px,calc(100vw - 24px));padding:9px 12px;box-sizing:border-box;
    max-height:33dvh;overflow:auto;box-shadow:0 2px 8px #16372555;
    border:1px solid #8ca284;border-radius:7px;background:#fffdf2;
    font:.93rem/1.32 Barlow,Arial,sans-serif;
  }
  .plate-console[data-field="true"] .contact-booth {
    flex:0 0 54px;box-sizing:border-box;height:54px;min-height:54px;
    gap:5px;padding:4px 8px;
  }
  .plate-console[data-field="true"] .contact-booth [data-call] {
    display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
    line-height:1.15;
  }
}
