/* Youth Baseball Plays — Homerun Baseball Ottawa brand envelope */

:root {
  /* Brand palette */
  --brand-navy: #062448;
  --brand-navy-2: #14294d;
  --brand-red: #a3301f;
  --brand-red-2: #8d2418;
  --brand-cream: #f6f3ec;

  /* Legacy greens kept only where field chrome still needs them */
  --green-deep: #1b5e20;
  --green-mid: #2e7d32;
  --green-soft: #e8f5e9;
  --dirt: #c4a574;
  --dirt-dark: #8d6e4c;
  --sky: #e3f2fd;
  --ink: #062448;
  --ink-muted: #4a5568;
  --surface: #ffffff;
  --surface-2: #f4f1ea;
  --border: rgba(6, 36, 72, 0.12);
  --accent: #e65100;
  --accent-soft: #fff3e0;
  --danger: #c62828;

  /* Teaching colors — DO NOT change (field tokens / roles) */
  --role-ball: #dc2626;
  --role-base: #facc15;
  --role-backup: #16a34a;
  --unit-if: #0d9488;
  --unit-of: #ea580c;
  --unit-battery: #374151;

  --shadow: 0 2px 12px rgba(6, 36, 72, 0.08);
  --radius: 6px;
  --radius-sm: 6px;
  --touch: 44px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Shared typography scale (parity with lineup-app) */
  --text-xs: 0.70rem;
  --text-sm: 0.82rem;
  --text-base: 0.90rem;
  --text-md: 1.00rem;
  --text-lg: 1.10rem;
  --text-xl: 1.40rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--brand-cream);
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* ── Skip link ── */

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--brand-navy);
  color: #fff;
  padding: 0.5rem 1rem;
  font-size: var(--text-base);
  font-weight: 700;
  z-index: 200;
  border-radius: 0 0 var(--radius) 0;
  text-decoration: none;
  transition: top 0.15s;
}

.skip-link:focus {
  top: 0;
}

/* ── Header / app-bar + pill nav ── */

.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  background: var(--brand-navy);
  color: #fff;
  padding: 0.6rem 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.app-logo {
  height: 44px;
  width: 44px;
  display: block;
  background: #fff;
  border-radius: 50%;
  padding: 2px;
  flex: 0 0 auto;
  object-fit: contain;
}

.header-brand {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
  flex: 0 1 auto;
}

.brand {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
}

.tagline {
  margin: 0;
  font-size: var(--text-sm);
  opacity: 0.85;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  line-height: 1.3;
}

.tab-bar {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-left: auto;
  min-width: 0;
}

.tab {
  flex: 0 0 auto;
  min-height: 34px;
  min-width: 0;
  padding: 0.4rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 600;
  font-size: var(--text-base);
  cursor: pointer;
  white-space: nowrap;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* App-bar utility button (Suggestion) — matches lineup-app utility style */
.btn-appbar-util {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 600;
  min-height: 34px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  white-space: nowrap;
}

.btn-appbar-util:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.btn-appbar-util:focus-visible {
  outline: 3px solid rgba(246, 243, 236, 0.85);
  outline-offset: 1px;
}

.tab.active {
  background: #fff;
  color: var(--brand-navy);
  border-color: #fff;
  font-weight: 600;
}

/* Cream Help & Guide pill (mirrors lineup-app .nav-btn-readme) */
.tab.tab-help {
  background: var(--brand-cream);
  border-color: var(--brand-cream);
  color: var(--brand-navy);
}

.tab.tab-help:hover {
  background: #fff;
  color: var(--brand-navy);
}

.tab.tab-help.active {
  background: #fff;
  color: var(--brand-navy);
  border-color: #fff;
}

/* ── Main / panels ── */

.app-main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.panel-inner {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.panel-inner h2 {
  margin: 0 0 0.35rem;
  font-size: var(--text-xl);
  color: var(--brand-navy);
  border-bottom: 2px solid var(--brand-navy);
  padding-bottom: 0.3em;
  line-height: 1.25;
}

.panel-lead {
  margin: 0 0 1rem;
  color: var(--ink-muted);
  font-size: var(--text-base);
  line-height: 1.4;
}

/* ── Help & Guide (readme) ── */

.readme-content {
  max-width: 760px;
}

.readme-section {
  margin-bottom: 2rem;
}

.readme-section h3 {
  font-size: var(--text-lg);
  margin: 0 0 0.4rem;
  color: var(--brand-navy);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.2rem;
}

.readme-section h4 {
  font-size: var(--text-md);
  margin: 1rem 0 0.25rem;
  color: var(--brand-navy);
}

.readme-section p,
.readme-section ul,
.readme-section ol {
  margin: 0.3rem 0 0.5rem;
  line-height: 1.6;
  font-size: var(--text-base);
}

.readme-section ul,
.readme-section ol {
  padding-left: 1.4rem;
}

.readme-section li {
  margin-bottom: 0.3rem;
}

/* ── Field layout ── */

.field-layout {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.field-wrap {
  background: #5a9a5a;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 2px solid #3d7a3d;
  overflow: hidden;
  width: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.field-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1.05;
  max-height: min(62vh, 600px);
  touch-action: none;
  flex: 1 1 auto;
  min-height: 0;
  background: #5a9a5a;
}

.field-svg {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Unit colors (pre-hit) — teaching colors, do not change */
.unit-if .token-circle {
  fill: var(--unit-if);
}
.unit-of .token-circle {
  fill: var(--unit-of);
}
.unit-battery .token-circle {
  fill: var(--unit-battery);
}
.fielder-token .token-label {
  fill: #fff;
}

/* Role colors (post-hit — override unit) — teaching colors, do not change */
.role-ball .token-circle {
  fill: var(--role-ball);
}
.role-ball .token-label {
  fill: #fff;
}
.role-base .token-circle {
  fill: var(--role-base);
}
.role-base .token-label {
  fill: #1f2937;
}
.role-backup .token-circle {
  fill: var(--role-backup);
}
.role-backup .token-label {
  fill: #fff;
}

/* Action bar under the diagram (Hit / Play / Reset) */
.action-bar {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  width: 100%;
  padding: 0.35rem 0.5rem 0.5rem;
  background: var(--brand-navy);
  box-sizing: border-box;
}

.action-bar .btn {
  min-height: 44px;
  /* Unit-bearing min-width: unitless flex-basis 0 + min-width 0 collapses on iOS when label reflows */
  min-width: 5rem;
}

.action-bar #btn-hit {
  flex: 1.2 1 0%;
}

.action-bar #btn-playpause {
  flex: 1 1 0%;
  /* Wider than "▶ Play" / "⏸ Pause" so the toggle never collapses the button */
  min-width: 6.5rem;
}

.action-bar #btn-reset-positions {
  flex: 1 1 0%;
}

@media (max-width: 339px) {
  .action-bar {
    flex-wrap: wrap;
  }
}

/* Player jobs: mobile = full-width card under diagram; desktop = overlay */
.onfield-desc {
  position: static;
  width: 100%;
  max-width: none;
  max-height: 40vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-size: 11px;
  line-height: 1.25;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0;
  margin-top: 8px;
  pointer-events: auto;
  z-index: 5;
  box-shadow: var(--shadow);
  box-sizing: border-box;
}

/* Jobs panel summary — mirrors .play-category > summary */
#jobs-panel > summary {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.45rem 0.55rem;
  list-style: none;
  user-select: none;
  gap: 0.4rem;
  min-height: var(--touch);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--brand-navy);
  flex: 0 0 auto;
}

#jobs-panel > summary::-webkit-details-marker {
  display: none;
}

#jobs-panel > summary::before {
  content: "▶";
  font-size: var(--text-xs);
  color: var(--ink-muted);
  flex: 0 0 auto;
  transition: transform 0.15s ease;
}

#jobs-panel[open] > summary::before {
  transform: rotate(90deg);
}

#jobs-panel > summary:hover {
  background: var(--brand-cream);
}

#jobs-panel[open] > summary {
  border-bottom: 1px solid var(--border);
}

.jobs-summary-label {
  flex: 1 1 auto;
  min-width: 0;
}

.jobs-count {
  display: inline-block;
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(6, 36, 72, 0.08);
  color: var(--brand-navy);
}

#jobs-panel > #onfield-descriptions {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.35rem 0.5rem 0.45rem;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
}

.onfield-desc-placeholder {
  color: var(--ink-muted);
  font-size: inherit;
  margin: 0;
  padding: 0.15rem 0.1rem;
}

.onfield-desc-table {
  width: 100%;
  border-collapse: collapse;
}

.onfield-desc-row {
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
  padding: 0.12rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.onfield-desc-row:last-child {
  border-bottom: none;
}

.onfield-desc-row.role-ball {
  border-left: 3px solid var(--role-ball);
  padding-left: 0.25rem;
}
.onfield-desc-row.role-base {
  border-left: 3px solid var(--role-base);
  padding-left: 0.25rem;
}
.onfield-desc-row.role-backup {
  border-left: 3px solid var(--role-backup);
  padding-left: 0.25rem;
}
.onfield-desc-row.role-none {
  border-left: 3px solid transparent;
  padding-left: 0.25rem;
}

.onfield-desc-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 0.2rem;
  background: #9ca3af;
}
.onfield-desc-dot.role-ball {
  background: var(--role-ball);
}
.onfield-desc-dot.role-base {
  background: var(--role-base);
}
.onfield-desc-dot.role-backup {
  background: var(--role-backup);
}

.onfield-desc-code {
  flex: 0 0 auto;
  font-weight: 800;
  min-width: 1.5em;
  color: var(--ink);
}

.onfield-desc-text {
  flex: 1 1 auto;
  min-width: 0;
  color: #374151;
  word-break: break-word;
}

/* Situation line + legend = field-status strip (navy brand chrome) */
.situation-line {
  flex: 0 0 auto;
  text-align: center;
  font-weight: 600;
  font-size: 0.82rem;
  line-height: 1.3;
  padding: 0.4rem 0.55rem 0.2rem;
  color: #fff;
  background: var(--brand-navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 1.6rem;
}

.field-legend {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.55rem 0.85rem;
  padding: 0.3rem 0.5rem 0.45rem;
  background: var(--brand-navy);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.legend-swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  flex-shrink: 0;
}

/* Legend swatches keep teaching role colors */
.swatch-ball {
  background: var(--role-ball);
}
.swatch-base {
  background: var(--role-base);
}
.swatch-backup {
  background: var(--role-backup);
}

.controls-panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.9rem 1rem 1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.control-block {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.control-label,
.field-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

/* Segmented hit types */

.seg-control {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.seg-btn {
  min-height: var(--touch);
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--surface-2);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.seg-btn:hover {
  border-color: var(--brand-navy-2);
}

.seg-btn.active {
  background: var(--brand-navy);
  border-color: var(--brand-navy);
  color: #fff;
}

/* Compact outs / balls / strikes */
.count-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  align-items: flex-end;
}

.count-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.compact-seg {
  gap: 0.25rem;
}

.seg-btn.compact {
  min-height: 32px;
  min-width: 32px;
  padding: 0.2rem 0.45rem;
  font-size: 0.8rem;
  font-weight: 700;
}

/* Runner chips */

.runner-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.toggle.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: var(--touch);
  padding: 0 0.9rem;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--surface-2);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.toggle.chip input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
}

.toggle.chip:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #bf360c;
}

/* Buttons */

.btn {
  min-height: var(--touch);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s, background 0.15s, opacity 0.15s, border-color 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

/* Hit and other primary actions — brick red */
.btn-primary {
  background: var(--brand-red);
  color: #fff;
  border-color: var(--brand-red);
}

.btn-primary:hover {
  background: var(--brand-red-2);
  border-color: var(--brand-red-2);
}

/* Play / Pause, Reset, and secondary actions — white / navy */
.btn-secondary {
  background: #fff;
  border-color: var(--brand-navy);
  color: var(--brand-navy);
}

.btn-secondary:hover {
  background: var(--brand-cream);
  border-color: var(--brand-navy-2);
  color: var(--brand-navy);
}

.btn-danger {
  background: #ffebee;
  border: 2px solid #ffcdd2;
  color: var(--danger);
}

.btn-small {
  min-height: 36px;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
}

.btn-lg {
  flex: 1;
  font-size: 1.05rem;
}

.actions-row {
  display: flex;
  gap: 0.5rem;
  flex-direction: row;
  flex-wrap: wrap;
}

.actions-row.wrap {
  flex-wrap: wrap;
}

.select,
.input,
.textarea {
  min-height: var(--touch);
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: #fff;
  width: 100%;
}

.textarea {
  min-height: 4rem;
  resize: vertical;
}

.select:focus,
.input:focus,
.textarea:focus,
.btn:focus-visible,
.seg-btn:focus-visible,
.tab:focus-visible,
.play-btn:focus-visible,
.play-category > summary:focus-visible,
#jobs-panel > summary:focus-visible {
  outline: 3px solid rgba(6, 36, 72, 0.45);
  outline-offset: 1px;
}

.tab:focus-visible {
  outline-color: rgba(246, 243, 236, 0.85);
}

/* Cream outline so keyboard focus stays visible on the navy action bar */
.action-bar .btn:focus-visible {
  outline-color: rgba(246, 243, 236, 0.85);
}

.status-msg {
  margin: 0;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  background: rgba(6, 36, 72, 0.06);
  color: var(--brand-navy);
  font-size: 0.9rem;
  line-height: 1.35;
  min-height: 2.4rem;
}

.status-msg.warn {
  background: var(--accent-soft);
  color: #bf360c;
}

.status-msg.error {
  background: #ffebee;
  color: var(--danger);
}

.hint-mini {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-muted);
  line-height: 1.4;
}

/* ── Feedback modal ── */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(6, 36, 72, 0.55);
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  width: 100%;
  max-width: 30rem;
  max-height: min(90vh, 40rem);
  overflow-y: auto;
  padding: 1.15rem 1.25rem 1.25rem;
  background: var(--brand-cream);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(6, 36, 72, 0.28);
  color: var(--ink);
}

.modal #feedback-title,
.modal h2 {
  margin: 0 0 0.45rem;
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--brand-navy);
  letter-spacing: 0.01em;
}

.modal-intro {
  margin: 0 0 0.55rem;
  font-size: var(--text-base);
  line-height: 1.4;
  color: var(--ink);
}

.modal #feedback-context {
  margin-bottom: 0.85rem;
}

#feedback-form,
#suggestion-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#feedback-form[hidden],
#suggestion-form[hidden] {
  display: none;
}

#feedback-form .field-label {
  gap: 0.35rem;
}

#feedback-form .textarea {
  min-height: 4.5rem;
}

#feedback-error {
  min-height: 0;
}

.modal-actions {
  margin-top: 0.15rem;
}

#feedback-thanks,
#suggestion-thanks {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#feedback-thanks[hidden],
#suggestion-thanks[hidden] {
  display: none;
}

.modal-thanks-msg {
  margin: 0;
  font-size: var(--text-base);
  line-height: 1.45;
  color: var(--brand-navy);
  font-weight: 600;
}

/* ── Plays list (collapsible categories) ── */

.plays-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.play-category {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  margin: 0;
}

.play-category > summary {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.55rem 0.85rem;
  list-style: none;
  user-select: none;
  border-radius: var(--radius);
  gap: 0.5rem;
  min-height: var(--touch);
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--brand-navy);
}

.play-category > summary::-webkit-details-marker {
  display: none;
}

.play-category > summary::before {
  content: "▶";
  font-size: var(--text-xs);
  color: var(--ink-muted);
  flex: 0 0 auto;
  transition: transform 0.15s ease;
}

.play-category[open] > summary::before {
  transform: rotate(90deg);
}

.play-category > summary:hover {
  background: var(--brand-cream);
  border-radius: var(--radius);
}

.play-category[open] > summary {
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}

.play-category-name {
  flex: 1 1 auto;
  min-width: 0;
}

.play-count {
  display: inline-block;
  flex: 0 0 auto;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(6, 36, 72, 0.08);
  color: var(--brand-navy);
}

.play-category > .plays-ul {
  padding: 0.55rem 0.65rem 0.65rem;
}

.plays-ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.play-item {
  margin: 0;
}

.play-item.row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.play-item.row .play-btn,
.play-item.row > span {
  flex: 1;
}

.play-btn {
  width: 100%;
  min-height: var(--touch);
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.play-btn:hover {
  border-color: var(--brand-navy-2);
  background: rgba(6, 36, 72, 0.06);
}

.play-title {
  font-weight: 700;
  font-size: var(--text-md);
  color: var(--brand-navy);
}

.play-blurb {
  font-size: var(--text-sm);
  color: var(--ink);
  line-height: 1.35;
  font-weight: 400;
}

.play-meta {
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

/* ── Coach ── */

.coach-grid {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.coach-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.25rem;
  text-align: center;
}

.coach-brand img {
  display: block;
  width: 140px;
  height: auto;
  max-width: 100%;
  background: transparent;
}

.coach-brand span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-variant: small-caps;
  color: var(--brand-navy);
}

.coach-values {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.value-chip {
  background: var(--brand-navy);
  color: var(--brand-cream);
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  font-size: 0.75rem;
}

.coach-motto {
  margin: 0;
  color: var(--brand-navy);
  font-style: italic;
  text-align: center;
  font-size: 0.9rem;
}

.coach-roots {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.75rem;
  text-align: center;
  letter-spacing: 0.02em;
}

.coach-heading {
  margin: 0;
}

.coach-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 0.95rem;
}

.coach-card h3 {
  margin: 0 0 0.55rem;
  font-size: 1rem;
  color: var(--brand-navy);
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.coach-message,
.import-status {
  margin: 0;
  min-height: 1.2rem;
  font-size: 0.9rem;
}

.coach-message.ok,
.import-status.ok {
  color: var(--brand-navy);
}

.coach-message.error,
.import-status.error {
  color: var(--danger);
}

.sub-list {
  margin-top: 0.75rem;
}

.playlist-nav {
  flex-wrap: wrap;
}

.empty-hint {
  color: var(--ink-muted);
  font-size: 0.95rem;
}

/* ── Footer ── */

.app-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.75rem 1rem 1.25rem;
  font-size: 0.75rem;
  color: var(--ink-muted);
  gap: 0.5rem;
}

.footer-motto {
  margin: 0.35rem 0 0;
  color: var(--brand-navy);
  font-weight: 600;
  font-style: italic;
  font-size: 0.85rem;
  text-align: center;
}

.footer-values {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--ink-muted);
  text-align: center;
}

.footer-values span {
  color: var(--brand-navy);
}

.footer-crest {
  display: block;
  width: 90px;
  height: auto;
  margin: 0.35rem auto 0.15rem;
  background: transparent;
}

/* Desktop: descriptions overlay bottom-left of the field diagram */
@media (min-width: 768px) {
  .field-wrap {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto auto auto;
  }

  .field-stage {
    grid-column: 1;
    grid-row: 1;
  }

  .situation-line {
    grid-column: 1;
    grid-row: 2;
  }

  .field-legend {
    grid-column: 1;
    grid-row: 3;
  }

  .action-bar {
    grid-column: 1;
    grid-row: 4;
    margin-top: 0;
  }

  .onfield-desc {
    grid-column: 1;
    grid-row: 1;
    position: relative;
    align-self: end;
    justify-self: start;
    width: auto;
    max-width: 44%;
    max-height: 55%;
    margin: 0 0 0.4rem 0.4rem;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    font-size: 11px;
    padding: 0;
  }

  /* Collapsed overlay shrinks to just the summary pill */
  #jobs-panel:not([open]) {
    max-height: none;
    width: auto;
  }

  #jobs-panel > summary {
    min-height: 34px;
    padding: 0.3rem 0.45rem;
    font-size: 11px;
  }

  #jobs-panel .jobs-count {
    font-size: 10px;
    padding: 0.05rem 0.35rem;
  }

  #jobs-panel > #onfield-descriptions {
    padding: 0.25rem 0.35rem 0.35rem;
  }
}

/* ── Wide layout: field left, controls right ── */

@media (min-width: 820px) {
  .app-main {
    padding: 1rem 1.25rem;
  }

  .field-layout {
    flex-direction: row;
    align-items: stretch;
    min-height: 560px;
  }

  .field-wrap {
    flex: 1 1 58%;
    max-height: min(82vh, 760px);
  }

  .field-stage {
    max-height: none;
    aspect-ratio: auto;
    min-height: 480px;
  }

  .onfield-desc {
    font-size: 12px;
    max-width: 40%;
  }

  .controls-panel {
    flex: 0 0 320px;
    max-width: 340px;
  }

  .actions-row {
    flex-wrap: wrap;
  }
}

@media (min-width: 1100px) {
  .controls-panel {
    flex-basis: 360px;
    max-width: 380px;
  }
}

/* ── Reduced motion ── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Phones — compact app-bar, no horizontal overflow at 375px */
@media (max-width: 480px) {
  .app-header {
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
  }

  .app-logo {
    height: 40px;
    width: 40px;
  }

  .brand {
    font-size: 1.05rem;
  }

  .tagline {
    font-size: 0.72rem;
  }

  .tab-bar {
    width: 100%;
    margin-left: 0;
    flex-wrap: nowrap;
  }

  .tab {
    min-height: 36px;
    padding: 0.35rem 0.65rem;
    font-size: var(--text-sm);
  }

  .btn-appbar-util {
    min-height: 32px;
    padding: 0.3rem 0.55rem;
    font-size: var(--text-xs);
  }
}

@media (max-width: 379px) {
  .app-main {
    padding: 0.5rem;
  }

  .app-header {
    padding: 0.5rem 0.65rem;
  }

  .seg-btn {
    font-size: 0.78rem;
    padding: 0.35rem 0.55rem;
  }

  .seg-btn.compact {
    min-height: 32px;
    min-width: 30px;
    padding: 0.15rem 0.35rem;
  }

  .count-controls {
    gap: 0.4rem;
  }

  .onfield-desc {
    font-size: 10px;
  }

  .situation-line {
    font-size: 0.75rem;
  }

  .field-legend {
    font-size: 0.68rem;
    gap: 0.4rem 0.6rem;
  }

  .action-bar .btn {
    font-size: 0.92rem;
    padding: 0.45rem 0.55rem;
  }

  .coach-brand img {
    width: 120px;
  }

  .footer-crest {
    width: 72px;
  }

  .tab {
    padding: 0.35rem 0.5rem;
  }
}

/* ── Lingo dictionary ── */

.lingo-search-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0 0 1rem;
}

#lingo-search {
  font-size: 16px;
  width: 100%;
}

.lingo-count {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

.lingo-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.lingo-category .lingo-terms {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.65rem 0.7rem 0.75rem;
}

.lingo-term {
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-navy);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.8rem 0.75rem;
  background: var(--surface-2);
}

.lingo-term-name {
  margin: 0 0 0.25rem;
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--brand-navy);
  line-height: 1.3;
}

.lingo-aka {
  margin: 0 0 0.5rem;
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--ink-muted);
}

.lingo-means,
.lingo-why {
  margin: 0 0 0.45rem;
  font-size: var(--text-base);
  line-height: 1.45;
}

.lingo-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.15rem;
}

.lingo-heads-up {
  margin: 0 0 0.5rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: #bf360c;
  font-size: var(--text-sm);
  line-height: 1.4;
  border: 1px solid rgba(230, 81, 0, 0.2);
}

.lingo-heads-up .lingo-label {
  color: #bf360c;
}

.lingo-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.lingo-links a {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-xs);
  font-weight: 700;
  text-decoration: none;
  color: var(--brand-navy);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  min-height: 32px;
}

.lingo-links a:hover {
  border-color: var(--brand-navy);
  background: var(--brand-cream);
}

.lingo-links a:focus-visible {
  outline: 3px solid rgba(6, 36, 72, 0.45);
  outline-offset: 1px;
}
