/* ─── Dad Playbook — Stylesheet ───────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }

:root {
  /* ── Design-system palette ── */
  --bg-0: #0a0d12;        /* deep slate — page bg */
  --bg-1: #11161e;        /* app bar / rail bg */
  --bg-2: #161c26;        /* card bg */
  --bg-3: #1d2531;        /* card raised / hover */
  --bg-4: #252e3a;        /* border (quieter than the old #283042) */
  --field: #0e131a;       /* field canvas bg */

  /* Accent: Blaze (redder, hotter sibling of the original brand orange). */
  --accent:      #ff5a3c;
  --accent-hot:  #ff7a5e;
  --accent-ink:  #1a0a06;                 /* dark text/icon on accent fill */
  --accent-soft: rgba(255,90,60,.15);     /* tinted bg (chips, soft buttons) */
  --accent-glow: rgba(255,90,60,.32);     /* accent button drop shadow */
  --accent-blue: #3b82f6;
  --danger:      #ef4444;
  --ok:          #14b8a6;
  --warn:        #eab308;

  --fg-0: #eef2f7;
  --fg-1: #a4aec0;
  --fg-2: #7a8597;
  --fg-3: #6a7585;

  /* Legacy aliases */
  --bg-app:        var(--bg-0);
  --bg-sidebar:    var(--bg-1);
  --bg-panel:      var(--bg-2);
  --bg-card:       var(--bg-3);
  --bg-card-hover: #232c3c;
  --bg-input:      var(--bg-2);
  --bg-field:      var(--field);
  --border:        var(--bg-4);
  --border-light:  #38445b;
  --accent-hover:  var(--accent-hot);
  --accent-red:    var(--danger);
  --accent-amber:  var(--warn);
  --text-primary:   var(--fg-0);
  --text-secondary: var(--fg-1);
  --text-muted:     var(--fg-3);

  /* Density-driven layout tokens (desktop = comfortable; .pmx-compact overrides). */
  --radius-sm: 10px;       /* chips / thumbs */
  --radius:    14px;       /* cards / modals  */
  --radius-lg: 16px;       /* feature cards   */
  --gap:       16px;       /* grid / list gap */
  --pad:       26px;       /* page padding    */
  --grid-min:  230px;      /* card min-width  */
  --fs:        1;          /* type scale mult */

  --topbar-h:    60px;
  --tool-rail-w: 52px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 4px 16px rgba(0,0,0,.35), 0 1px 0 rgba(255,255,255,.04) inset;
  --shadow-lg: 0 18px 48px rgba(0,0,0,.5), 0 1px 0 rgba(255,255,255,.05) inset;

  font-family: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
}

/* ── Outdoor (high-contrast) theme ─────────────────────────────────────────── */
/* Toggled via documentElement.dataset.theme = 'outdoor'. Overrides the design
   tokens above; component CSS keeps using the same var names, so nothing else
   needs to change. The field canvas itself is JS-drawn and stays green. */
:root[data-theme="outdoor"] {
  --bg-0: #f4f1e8;        /* cream page bg */
  --bg-1: #e8e3d2;        /* topbar / rail */
  --bg-2: #ffffff;        /* cards / modals */
  --bg-3: #f7f4ea;        /* raised / hover */
  --bg-4: #c8bea4;        /* border / chip */

  /* Outdoor accent: darker Blaze sibling, readable on cream. */
  --accent:      #c2360e;
  --accent-hot:  #a32c08;
  --accent-ink:  #fff;                    /* white text on accent fill */
  --accent-soft: rgba(194,54,14,.12);
  --accent-glow: rgba(194,54,14,.20);
  --accent-blue: #1d4ed8;
  --danger:      #b91c1c;
  --ok:          #047857;
  --warn:        #a16207;

  --fg-0: #0a0d12;        /* near-black body text */
  --fg-1: #1f2937;
  --fg-2: #4b5563;
  --fg-3: #6b7280;

  --bg-card-hover: #f1ecdc;
  --border-light:  #a89e84;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.15);
  --shadow:    0 4px 16px rgba(0,0,0,.12), 0 1px 0 rgba(0,0,0,.04) inset;
  --shadow-lg: 0 18px 48px rgba(0,0,0,.20), 0 1px 0 rgba(0,0,0,.04) inset;
}

/* Theme toggle: show moon in dark mode, sun in outdoor mode. */
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; padding: 6px 8px; }
.theme-toggle .theme-icon-sun  { display: none; }
.theme-toggle .theme-icon-moon { display: inline-block; }
:root[data-theme="outdoor"] .theme-toggle .theme-icon-sun  { display: inline-block; }
:root[data-theme="outdoor"] .theme-toggle .theme-icon-moon { display: none; }

/* ── Base ──────────────────────────────────────────────────────────────────── */
html, body { height: 100%; overflow: hidden; background: var(--bg-0); color: var(--fg-0); }

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;          /* dynamic viewport — fixes iOS Safari address-bar resize jump */
  overflow: hidden;
}

/* ── Scrollbars ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #344056; }

/* ── Top bar ───────────────────────────────────────────────────────────────── */
#topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 18px;
  background: linear-gradient(180deg, #131923 0%, var(--bg-1) 100%);
  border-bottom: 1px solid var(--bg-4);
  box-shadow: 0 1px 0 rgba(255,255,255,.02) inset;
  z-index: 10;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 6px 8px;
  border-radius: var(--radius);
  transition: background 0.12s;
}
.brand:hover { background: var(--bg-2); }

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #c2540a);
  color: #1a0f04;
  display: grid;
  place-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(249,115,22,.3);
  flex-shrink: 0;
}

.brand-name {
  font-family: 'Hanken Grotesk', sans-serif;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .14em;
  color: var(--fg-0);
  white-space: nowrap;
}

/* Breadcrumbs */
.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  font-size: 13px;
  color: var(--fg-2);
  min-width: 0;
  overflow: hidden;
}
.crumbs .crumb-sep { color: var(--fg-3); flex-shrink: 0; }
.crumbs .crumb-link {
  color: var(--fg-1);
  text-decoration: none;
  padding: 3px 6px;
  border-radius: 5px;
  cursor: pointer;
  transition: background .12s, color .12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.crumbs .crumb-link:hover { background: var(--bg-2); color: var(--fg-0); }
.crumbs .crumb-current {
  color: var(--fg-0);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.spacer { flex: 1; }

/* Save indicator */
.save-indicator {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--fg-3);
  min-width: 70px;
  text-align: right;
  font-weight: 500;
  flex-shrink: 0;
  margin-right: 8px;
}

/* Print menu */
.print-menu-wrap { position: relative; }
.print-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  min-width: 160px;
  overflow: hidden;
}
.print-menu-item {
  display: block;
  padding: 9px 14px;
  color: var(--fg-0);
  text-decoration: none;
  font-size: 13px;
  transition: background 0.1s;
}
.print-menu-item:hover { background: var(--bg-4); }

/* ── Stage ─────────────────────────────────────────────────────────────────── */
#stage {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

/* ── Dynamic View (playbooks list / playbook detail) ───────────────────────── */
#dynamic-view {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  background: var(--bg-0);
  display: flex;
  flex-direction: column;
}

/* ── Playbooks List View ───────────────────────────────────────────────────── */
.view-playbooks {
  flex: 1;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.view-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--fg-0);
  letter-spacing: -.01em;
}

/* Playbook row list */
.pb-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pb-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--bg-4);
  background: var(--bg-2);
  cursor: pointer;
  transition: background .14s, border-color .14s, transform .06s;
}
.pb-row:hover { background: var(--bg-3); border-color: var(--border-light); }
.pb-row:active { transform: translateY(1px); }
.pb-row.dragging { opacity: 0.35; }
.pb-row.drag-over { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(35,134,54,.35); }

/* Drag grip — hidden until row hover */
.pb-grip {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--fg-3);
  cursor: grab;
  margin: -4px 0 -4px -4px;
  padding: 4px;
  border-radius: 4px;
  transition: color .12s;
}
.pb-grip:active { cursor: grabbing; }
.pb-grip:hover  { color: var(--fg-1); }
.pb-row:hover .pb-grip { display: flex; }

.pb-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  min-width: 28px;
  flex-shrink: 0;
}

.pb-row-info { flex: 1; min-width: 0; }
.pb-row-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--fg-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pb-row-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--fg-2);
  margin-top: 3px;
}

.pb-row-actions {
  display: none;
  gap: 4px;
  flex-shrink: 0;
}
.pb-row:hover .pb-row-actions { display: flex; }

.pb-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pb-new-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px dashed var(--bg-4);
  color: var(--fg-3);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.pb-new-row:hover { background: var(--bg-2); border-color: var(--accent); color: var(--accent); }

/* ── Playbook Detail View ──────────────────────────────────────────────────── */
.view-playbook {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.view-subheader {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  height: 56px;
  flex-shrink: 0;
  background: var(--bg-1);
  border-bottom: 1px solid var(--bg-4);
}

.subheader-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--fg-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.subheader-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--fg-2);
  flex-shrink: 0;
}

/* Filter tabs */
.filter-tabs {
  display: flex;
  gap: 2px;
  flex: 1;
  justify-content: center;
}
.filter-tab {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
}
.filter-tab:hover { background: var(--bg-3); color: var(--fg-0); }
.filter-tab.active { background: var(--bg-3); border-color: var(--bg-4); color: var(--fg-0); }

/* Play card grid body */
.view-playbook-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.play-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

/* Empty grid state */
.play-card-empty {
  grid-column: 1 / -1;
}

/* Individual play card */
.play-card {
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .14s, background .14s, transform .06s;
  position: relative;
}
.play-card:hover { border-color: var(--border-light); background: var(--bg-3); transform: translateY(-1px); }

.play-card-thumb {
  width: 100%;
  aspect-ratio: 3/2;
  background: var(--field);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--bg-4);
}
.play-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.play-card-thumb canvas.play-card-canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #ffffff;
}
.play-card-thumb-placeholder {
  font-size: 2rem;
  opacity: 0.3;
}

.play-card-body {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.play-card-idx {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-3);
  flex-shrink: 0;
  min-width: 20px;
}

.play-card-info { flex: 1; min-width: 0; }
.play-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.play-card-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--fg-2);
  margin-top: 2px;
}
.play-card-edited {
  font-size: 10px;
  color: var(--fg-3);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hover action overlay on card */
.play-card-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: none;
  gap: 3px;
}
.play-card:hover .play-card-actions { display: flex; }

.play-card.archived { opacity: 0.5; }
.play-card.archived:hover { opacity: 0.75; }

/* Drag-to-reorder states */
.play-card.dragging { opacity: 0.35; }
.play-card.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(35,134,54,.35);
  transform: translateY(-2px);
}

/* Grip handle — hidden until hover */
.play-card-grip {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--fg-3);
  cursor: grab;
  padding: 2px 4px 2px 0;
  margin-right: 2px;
  border-radius: 4px;
  transition: color .12s;
}
.play-card-grip:active { cursor: grabbing; }
.play-card-grip:hover  { color: var(--fg-1); }
.play-card:hover .play-card-grip { display: flex; }

/* ── Editor View ───────────────────────────────────────────────────────────── */
#view-editor {
  position: absolute;
  inset: 0;
  display: none;  /* JS sets to "flex" when showing */
  flex-direction: row;
}

/* Left tool rail */
#tool-rail {
  width: var(--tool-rail-w);
  flex-shrink: 0;
  background: var(--bg-1);
  border-right: 1px solid var(--bg-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  gap: 2px;
  overflow-y: auto;
}

.tr-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  padding: 0 6px;
}

.tr-sep {
  width: 28px;
  height: 1px;
  background: var(--bg-4);
  margin: 5px 0;
  flex-shrink: 0;
}

.tr-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, color .12s, border-color .12s;
}
.tr-btn:hover  { background: var(--bg-3); color: var(--fg-0); border-color: var(--bg-4); }
.tr-btn.active { background: var(--bg-3); color: var(--fg-0); border-color: var(--bg-4); }
.tr-btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* ── Floating player inspector ──────────────────────────────────────────── */
.player-inspector {
  position: fixed;
  z-index: 900;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 144px;
  user-select: none;
}
.pi-handle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 6px 5px 10px;
  background: var(--bg-3);
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: move;
  border-bottom: 1px solid var(--bg-4);
  touch-action: none;   /* let the pointer-drag handler own touch gestures */
}
.pi-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--fg-2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pi-handle-btns {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.pi-icon-btn {
  background: none;
  border: none;
  color: var(--fg-3);
  cursor: pointer;
  font-size: 13px;
  line-height: 0;
  padding: 3px 5px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pi-icon-btn:hover { color: var(--fg-1); background: var(--bg-4); }
.pi-collapse svg { transition: transform .15s ease; }
/* Collapsed state — body hidden, handle becomes the whole pill */
.player-inspector.pi-collapsed .pi-body { display: none; }
.player-inspector.pi-collapsed .pi-handle {
  border-radius: var(--radius);
  border-bottom: none;
}
.player-inspector.pi-collapsed .pi-collapse svg { transform: rotate(-90deg); }
.pi-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pi-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pi-row {
  display: flex;
  gap: 4px;
  align-items: center;
}
.pi-sep {
  height: 1px;
  background: var(--bg-4);
  margin: 2px 0;
}
.pi-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--fg-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pi-zone-shapes { flex-wrap: wrap; gap: 3px; }
.pi-zone-scale  { justify-content: center; gap: 8px; }
.pi-scale-val {
  font-size: 11px;
  color: var(--fg-2);
  min-width: 34px;
  text-align: center;
}

/* ── Collapsible "Color & Label" sub-section header (inside inspector) ───── */
.pi-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 2px;
  border-radius: 4px;
  font-family: inherit;
}
.pi-subhead:hover { background: var(--bg-3); }
.pi-subhead .pi-label { cursor: pointer; }
.pi-subhead-chev {
  color: var(--fg-3);
  transition: transform .15s ease;
  flex-shrink: 0;
}
.pi-subhead.collapsed .pi-subhead-chev { transform: rotate(-90deg); }
.pi-collapsible {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pi-collapsible.hidden { display: none; }

/* ── Ball selected: hide inspector controls that don't apply to the ball ─
   Ball routes are straight-only, fully dashed end-to-end, with a fixed color
   and no label. So motion/pass tools, dashed toggle, ball-carrier marker,
   color/label editor, and route presets are all hidden while the ball is
   the selected entity. Curved, end-cap, and mirror remain useful. */
body.pmx-ball-selected [data-tool="route-motion"],
body.pmx-ball-selected [data-tool="route-pass"],
body.pmx-ball-selected [data-tool="dashed"],
body.pmx-ball-selected [data-tool="ball-carrier"],
body.pmx-ball-selected [data-tool="route-tree"],
body.pmx-ball-selected #btn-save-route,
body.pmx-ball-selected #btn-manage-routes,
body.pmx-ball-selected #pi-colorlabel-head,
body.pmx-ball-selected #pi-colorlabel-body { display: none !important; }

/* ── Per-play player colour / label editor (inside inspector) ────────────── */
.pi-player-swatches {
  display: grid;
  grid-template-columns: repeat(9, 20px);
  gap: 2px;
  padding: 2px 0;
}
.pi-swatch {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform .1s, border-color .1s;
  flex-shrink: 0;
}
.pi-swatch:hover  { transform: scale(1.15); }
.pi-swatch.active { border-color: #ffffff; transform: scale(1.1); }
.pi-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}
.pi-label-input {
  width: 44px !important;
  padding: 3px 6px !important;
  font-size: 12px !important;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Floating restore button (shown when the tools panel is hidden) ──────── */
.pi-restore {
  position: fixed;
  z-index: 900;
  left: 74px;
  bottom: 24px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: 999px;
  color: var(--fg-1);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: background .12s, color .12s, border-color .12s;
}
.pi-restore:hover { background: var(--bg-3); color: var(--fg-0); border-color: var(--accent); }
.pi-restore svg { color: var(--accent); }
.pi-restore.hidden { display: none; }

/* ── Filter tab info button ──────────────────────────────────────────────── */
.filter-tab-wrap {
  display: flex;
  align-items: center;
  gap: 1px;
}
.filter-tab-info {
  width: 20px; height: 20px;
  border: none;
  background: none;
  color: var(--fg-3);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  transition: color .12s, background .12s;
  flex-shrink: 0;
}
.filter-tab-info:hover { color: var(--fg-1); background: var(--bg-3); }

/* ── Formation-info modal ────────────────────────────────────────────────── */
.modal-formation-info {
  width: 520px;
  max-width: 96vw;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 92vh;
}
.fi-modal-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px 0;
}
.fi-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--fg-0);
  white-space: nowrap;
}
.fi-tabs {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.fi-tab {
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.fi-tab:hover  { background: var(--bg-3); color: var(--fg-0); }
.fi-tab.active { background: var(--bg-3); border-color: var(--bg-4); color: var(--fg-0); }
.fi-tab-pane {
  padding: 14px 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.fi-canvas-wrap {
  background: #0f1f12;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  line-height: 0;
  margin-bottom: 10px;
  border: 1px solid var(--bg-4);
}
.fi-canvas-wrap canvas { display: block; }
.fi-canvas-hint {
  font-size: 11px;
  color: var(--fg-3);
  text-align: center;
  padding: 5px 0 2px;
  line-height: 1;
}
.fi-player-editor {
  background: var(--bg-3);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fi-pe-hd {
  display: flex;
  align-items: center;
  gap: 6px;
}
.fi-pe-badge {
  font-size: 13px;
  font-weight: 800;
  min-width: 28px;
  height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-4);
  border-radius: var(--radius-sm);
  color: var(--fg-0);
  letter-spacing: 0.02em;
}
.fi-pe-label {
  width: 52px !important;
  padding: 3px 7px !important;
  font-size: 13px !important;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fi-reset-btn {
  margin-left: auto;
  font-size: 14px;
  padding: 2px 8px !important;
  color: var(--fg-2) !important;
}
.fi-pe-palette {
  display: grid;
  grid-template-columns: repeat(9, 24px);
  gap: 3px;
}
.fi-swatch {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform .1s, border-color .1s;
}
.fi-swatch:hover  { transform: scale(1.12); }
.fi-swatch.active { border-color: #ffffff; }
.fi-formation-hint {
  font-size: 11px;
  color: var(--fg-3);
  margin-top: 2px;
}
.fi-modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--bg-4);
  flex-shrink: 0;
}
.fi-reset-all-btn {
  margin-right: auto;
  color: var(--fg-2) !important;
}
.fi-reset-all-btn:hover { color: var(--danger) !important; }

/* Center canvas area */
#editor-center {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-0);
  position: relative;        /* anchor for the absolutely positioned #play-nav */
}

#canvas-wrap {
  flex: 1;
  min-height: 0;    /* allow flex shrink below canvas content (fabric inits at 540h) */
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 20px;
  position: relative;   /* anchor for the on-field SELECTED pill */
  background-image: radial-gradient(circle, #1f2937 1px, transparent 1.2px);
  background-size: 18px 18px;
  background-color: var(--bg-0);
}

#field-canvas-container {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--bg-4);
  box-shadow: var(--shadow-lg);
  background: var(--field);
  touch-action: none;       /* let Fabric.js + pinch-zoom handler own gestures; stops Safari pinch / pan */
}

/* ── Info overlay ──────────────────────────────────────────────────────────── */
.info-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.info-overlay.hidden { display: none !important; }

.info-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5,8,12,0.65);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  pointer-events: all;
  /* clicking backdrop intentionally does NOT close the overlay */
}

.info-overlay-panel {
  position: relative;
  z-index: 1;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-lg);
  padding: 18px 18px 14px;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 80px);
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
}

.info-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.info-overlay-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--fg-0);
}

/* ── Play navigation arrows (prev / next play in editor) ─────────────────── */
#play-nav {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 14px;
  z-index: 20;
  pointer-events: none;
}
.play-nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(17, 22, 30, 0.86);
  border: 1px solid var(--bg-4);
  color: var(--fg-1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: all;
  transition: background .14s, color .14s, transform .06s;
  box-shadow: var(--shadow);
  -webkit-tap-highlight-color: transparent;
}
.play-nav-btn:hover:not(:disabled) {
  background: var(--bg-3);
  color: var(--fg-0);
  border-color: var(--border-light);
}
.play-nav-btn:active:not(:disabled) { transform: translateY(1px); }
.play-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Animation toolbar (Play / Pause / Reset / scrub / runtime) ──────────── */
.anim-enable {
  display: flex;
  justify-content: flex-start;
  padding: 6px 16px;
  background: var(--bg-1);
  border-top: 1px solid var(--bg-4);
  flex-shrink: 0;
}
.anim-enable.hidden { display: none; }
.anim-enable-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  color: var(--fg-1);
  font-size: 12px;
  cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
}
.anim-enable-btn:hover { background: var(--bg-3); color: var(--fg-0); border-color: var(--accent); }
.anim-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--bg-1);
  border-top: 1px solid var(--bg-4);
  flex-shrink: 0;
}
.anim-bar.hidden { display: none; }
.anim-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  color: var(--fg-1);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .14s, color .14s, border-color .14s;
}
.anim-btn:hover:not(:disabled) { background: var(--bg-3); color: var(--fg-0); border-color: var(--accent); }
.anim-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.anim-btn.hidden { display: none; }
.anim-scrub {
  flex: 1;
  min-width: 100px;
  height: 4px;
  appearance: none;
  background: var(--bg-3);
  border-radius: 2px;
  cursor: pointer;
}
.anim-scrub::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 0;
}
.anim-scrub::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 0;
}
.anim-scrub:disabled { opacity: 0.4; cursor: not-allowed; }
.anim-time {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--fg-2);
  min-width: 78px;
  text-align: right;
}

/* ── Route Inspector (right-docked panel for per-segment timing) ─────────── */
.route-inspector {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-1);
  border-left: 1px solid var(--bg-4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.route-inspector.hidden { display: none; }
.ri-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--bg-4);
}
.ri-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-1);
}
.ri-close {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: transparent;
  border: 0;
  color: var(--fg-2);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.ri-close:hover { background: var(--bg-3); color: var(--fg-0); }
.ri-body {
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ri-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--fg-1);
}
.ri-row label { font-weight: 500; }
.ri-select {
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  color: var(--fg-0);
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  min-width: 80px;
}
.ri-segments {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ri-segments:empty { display: none; }
.ri-seg {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: 6px;
  font-size: 12px;
  color: var(--fg-1);
}
.ri-seg-head {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-0);
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.ri-seg-type {
  font-size: 11px;
  font-weight: 400;
  text-transform: lowercase;
  color: var(--fg-3);
}
.ri-seg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ri-seg-row label { font-weight: 500; color: var(--fg-2); }
.ri-seg-check label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.ri-seg-check input[type="checkbox"] { cursor: pointer; }
.ri-empty {
  font-size: 12px;
  color: var(--fg-3);
  font-style: italic;
  padding-top: 8px;
  border-top: 1px solid var(--bg-4);
}

/* ── Type checkbox list (multi-select in Play Info) ──────────────────────── */
.type-checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: var(--bg-2);
}
.type-cb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 5px;
  background: var(--bg-3);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 12px;
  color: var(--fg-1);
  transition: background .12s, border-color .12s, color .12s;
  user-select: none;
}
.type-cb:hover { background: #232c3c; }
.type-cb input { margin: 0; cursor: pointer; accent-color: var(--accent); }
.type-cb-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.15);
}
.type-cb:has(input:checked) {
  background: var(--bg-4);
  border-color: var(--accent);
  color: var(--fg-0);
}

/* ── Play-card "+" add tile ───────────────────────────────────────────────── */
.play-card-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 120px;
  border: 2px dashed var(--bg-4);
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  transition: border-color .14s, background .14s;
  color: var(--fg-3);
}
.play-card-add:hover {
  border-color: var(--accent);
  background: rgba(249,115,22,0.05);
  color: var(--accent);
}
.play-card-add-icon { line-height: 0; }
.play-card-add-label { font-size: 12px; font-weight: 600; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .14s, border-color .14s, transform .06s;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translateY(1px); }

.btn-primary   { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 800; box-shadow: 0 6px 20px var(--accent-glow); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hot); border-color: var(--accent-hot); }
.btn-secondary { background: var(--bg-3); border-color: var(--bg-4); color: var(--fg-0); }
.btn-secondary:hover:not(:disabled) { background: #232c3c; border-color: var(--border-light); }
.btn-ghost     { background: transparent; border-color: transparent; color: var(--fg-1); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-2); color: var(--fg-0); }
.btn-danger    { background: transparent; border-color: transparent; color: var(--danger); }
.btn-danger:hover:not(:disabled) { color: #fff; background: #3a1d1f; border-color: #6b2a2d; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: 8px; }
.btn-sm   { padding: 4px 9px; font-size: 12px; }
.btn-lg   { padding: 9px 18px; font-size: 14px; }

/* ── Badges / chips ────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-3);
  border: 1px solid var(--bg-4);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--fg-1);
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-offense { background: rgba(20,184,166,0.12); color: var(--ok); border-color: rgba(20,184,166,0.2); }
.badge-defense { background: rgba(239,68,68,0.12);  color: var(--danger); border-color: rgba(239,68,68,0.2); }
.badge-special { background: rgba(234,179,8,0.12);  color: var(--warn); border-color: rgba(234,179,8,0.2); }
/* Dynamic play type badge — colors applied inline by JS */
.badge-type { font-size: 10px; padding: 1px 5px; border-radius: 3px; border: 1px solid; white-space: nowrap; }

/* ── Form elements ─────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-2);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.form-input, .form-select {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--bg-4);
  background: var(--bg-2);
  color: var(--fg-0);
  font-family: inherit;
  font-size: 13px;
  transition: border-color .12s, background .12s;
  outline: none;
}
.form-input:focus, .form-select:focus { border-color: var(--accent); background: var(--bg-3); }
.form-select option { background: var(--bg-2); }
textarea.form-input { resize: vertical; }

/* Player count selector */
.player-count-grid { display: flex; gap: 6px; }
.pc-btn {
  flex: 1;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--bg-4);
  background: var(--bg-2);
  color: var(--fg-2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all .12s;
}
.pc-btn:hover  { border-color: var(--border-light); color: var(--fg-0); background: var(--bg-3); }
.pc-btn.active { border-color: var(--accent); background: rgba(249,115,22,0.12); color: var(--accent); }

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5,8,12,.68);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-lg);
  padding: 22px;
  width: 440px;
  max-width: 94vw;
  box-shadow: var(--shadow-lg);
}
.modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 18px; color: var(--fg-0); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--bg-4);
}

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--fg-3);
  border: 1px dashed var(--bg-4);
  border-radius: var(--radius-lg);
  background: radial-gradient(circle at top, rgba(249,115,22,.04), transparent 60%), var(--bg-1);
}
.empty-state .es-icon  { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state .es-title { font-size: 14px; font-weight: 700; color: var(--fg-0); margin-bottom: 6px; }
.empty-state .es-sub   { font-size: 13px; margin-bottom: 16px; line-height: 1.5; color: var(--fg-2); }
.empty-state > div:last-child { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ── PWA — install banner & offline banner ─────────────────────────────── */
.pmx-install-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 240;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
  font-size: 13px;
  color: var(--fg-0);
}
.pmx-install-banner .pmx-install-text { flex: 1; min-width: 0; }
@media (min-width: 720px) {
  .pmx-install-banner { left: auto; right: 16px; bottom: 16px; max-width: 420px; }
}

.pmx-offline-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 260;
  background: var(--warn);
  color: #1a0f04;
  font-weight: 600;
  font-size: 13px;
  padding: 6px 12px;
  text-align: center;
  letter-spacing: .02em;
}
body.pmx-offline #app { padding-top: 26px; }

/* When offline, hide every write-affordance so the read-only contract holds
   even if the user finds an entry point we didn't explicitly disable. */
body.pmx-offline .btn-primary,
body.pmx-offline #btn-save,
body.pmx-offline .user-chip .btn-ghost.btn-sm[onclick*="showInviteModal"] {
  display: none !important;
}

/* ── Toast ─────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 250;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  align-items: center;
}
.toast {
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--bg-3);
  border: 1px solid var(--bg-4);
  color: var(--fg-0);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: toastIn .22s ease both;
  pointer-events: all;
}
.toast.success { border-color: var(--ok); color: var(--ok); }
.toast.error   { border-color: var(--danger); color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── Color swatch picker ────────────────────────────────────────────────────── */
.color-swatch-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.color-swatch {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform .1s, box-shadow .1s;
  position: relative;
}
.color-swatch:hover { transform: scale(1.12); }
.color-swatch.active { box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 4px #fff; }
.color-swatch.active::after {
  content: '✓';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: #fff; font-size: .85rem; font-weight: 900;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}

/* ── Misc ──────────────────────────────────────────────────────────────────── */
.play-num {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-3);
  margin-right: 4px;
}

/* Print */
@media print {
  html, body, #root { overflow: visible; height: auto; }
  .no-print { display: none !important; }
  body { background: white !important; color: black !important; }
}

/* ── Auth pages ─────────────────────────────────────────────────────────────── */
.auth-body { background: var(--bg-0); }
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}
.auth-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--fg-0);
  margin-bottom: 20px;
}
.auth-sub {
  font-size: 13px;
  color: var(--fg-2);
  margin-top: -14px;
  margin-bottom: 18px;
}
.auth-error {
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.3);
  color: #fca5a5;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}
.form-hint {
  font-size: 12px;
  color: var(--fg-3);
  margin-top: 6px;
}

/* ── User chip (topbar) ────────────────────────────────────────────────────── */
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--bg-4);
}
.user-email {
  font-size: 12px;
  color: var(--fg-2);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Playbook shared / collaborative badges ──────────────────────────────── */
.pb-collab-badge {
  margin-right: 5px;
  font-size: 13px;
}
.pb-shared-by {
  font-size: 11px;
  color: var(--fg-3);
  margin-left: 6px;
}

/* ── Visibility toggle ───────────────────────────────────────────────────── */
.vis-toggle {
  display: flex;
  gap: 6px;
}
.vis-btn {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-3);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-sm);
  color: var(--fg-1);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.vis-btn:hover { background: var(--bg-4); }
.vis-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a0f04;
  font-weight: 700;
}

/* ─── Mobile editor: stacked bottom bands ─────────────────────────────────
   On phones (portrait and landscape) the editor bottom collapses to three
   slim, separated bands stacked under the field: a single-row, horizontally
   scrollable TOOL STRIP (collapsible to its handle), the PLAY-NAV arrow row
   above it, and — only while animating — the ANIMATION scrubber band. The
   canvas reserves the visible bands so nothing covers the field.
   No inspector sheet — the info overlay replaces it.
*/
:root {
  --mobile-topbar-h:  48px;
  /* Mobile editor bottom bands — a slim, collapsible single-row tool strip,
     the play-nav row above it, and (only while animating) a scrubber band.
     The canvas reserves the visible bands' height so nothing covers the field. */
  --m-tools-h:  52px;   /* single-row tool strip */
  --m-nav-h:    44px;   /* play-nav arrows row */
  --m-anim-h:   46px;   /* animation scrubber band (reserved only when open) */
  --m-band-gap:  6px;
  --mobile-dock-mg:   8px;
}
/* Tool strip tucked away to just its handle — drives both the strip height
   and the canvas reserve (the var cascades to every band + the padding calc). */
body.pmx-tools-collapsed { --m-tools-h: 34px; }

@media (max-width: 768px), (max-height: 500px) {

  /* ── Topbar: shrink universally; aggressively strip in editor mode ── */
  #topbar {
    height: calc(var(--mobile-topbar-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 8px 0;
  }
  .brand-name { display: none; }
  .user-email { max-width: 110px; font-size: 11px; }

  /* In-editor on mobile: search/section-tabs/crumbs are already hidden by the
     facelift rules; the editor chrome row carries title + actions. */
  body.in-editor #topbar .crumbs { display: none !important; }

  /* ── Editor stage layout ─────────────────────────────────────── */
  #view-editor  { position: absolute; inset: 0; }
  #editor-center { position: relative; }

  /* Canvas reserves the visible bottom bands (tool strip + nav row). The
     animation scrubber only reserves extra room while it's open. */
  #editor-center {
    padding-bottom: calc(var(--m-tools-h) + var(--m-nav-h)
                         + (2 * var(--m-band-gap)) + env(safe-area-inset-bottom));
  }
  #editor-center:has(#anim-bar:not(.hidden)) {
    padding-bottom: calc(var(--m-tools-h) + var(--m-nav-h) + var(--m-anim-h)
                         + (3 * var(--m-band-gap)) + env(safe-area-inset-bottom));
  }
  #canvas-wrap { padding: 4px; }

  /* ── Tool strip (bottom band): single horizontal scrollable row ──── */
  #tool-rail {
    position: absolute;
    left: 0; right: 0; bottom: 0; top: auto;
    width: auto; height: auto;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    padding: 6px 8px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
    border: none;
    border-top: 1px solid var(--bg-4);
    border-radius: 0;
    background: var(--bg-1);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 -6px 20px rgba(0,0,0,0.4);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    z-index: 30;
  }
  #tool-rail::-webkit-scrollbar { display: none; }

  /* Collapse handle: sticky at the start so it stays put while the strip
     scrolls; tucks the whole strip away to reclaim the field. */
  .tool-collapse {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    height: 40px;
    padding: 0 11px;
    border: 1px solid var(--bg-4);
    border-radius: 10px;
    background: var(--bg-2);
    color: var(--fg-1);
    font: inherit; font-size: 12px; font-weight: 700;
    cursor: pointer;
    position: sticky;
    left: 0;
    z-index: 1;
    -webkit-tap-highlight-color: transparent;
  }
  .tool-collapse-chev { transition: transform .15s ease; flex-shrink: 0; }

  /* Collapsed: hide the tool groups + separators, leaving just the handle,
     and shrink the strip to ~34px so it matches the reduced canvas reserve
     (--m-tools-h) and the field actually reclaims the space. */
  body.pmx-tools-collapsed #tool-rail .tr-group,
  body.pmx-tools-collapsed #tool-rail .tr-sep { display: none; }
  body.pmx-tools-collapsed #tool-rail {
    padding-top: 3px;
    padding-bottom: calc(3px + env(safe-area-inset-bottom));
  }
  body.pmx-tools-collapsed .tool-collapse { height: 28px; }
  body.pmx-tools-collapsed .tool-collapse-chev { transform: rotate(180deg); }

  .tr-sep {
    display: block;
    width: 1px; height: 26px;
    margin: 0 4px;
    background: var(--bg-4);
    flex-shrink: 0;
  }
  .tr-group {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 4px;
    width: auto;
    padding: 0;
    flex-shrink: 0;
  }
  .tr-btn {
    width: 44px; height: 44px;
    flex-shrink: 0;
    border-radius: 10px;
  }
  .tr-btn svg { width: 18px; height: 18px; }

  /* ── Play-nav row: centered arrows directly above the tool strip ──── */
  #play-nav {
    bottom: calc(var(--m-tools-h) + var(--m-band-gap) + env(safe-area-inset-bottom));
    z-index: 26;
  }

  /* ── Animation: "Animate" pill rides the right end of the nav row (no
     canvas reserve); opening it reveals a full-width scrubber band that
     sits above the nav row and reserves room via the :has() rule above. */
  #anim-enable {
    position: absolute;
    right: calc(env(safe-area-inset-right) + 10px);
    bottom: calc(var(--m-tools-h) + var(--m-band-gap) + env(safe-area-inset-bottom));
    left: auto; top: auto;
    padding: 0;
    background: none;
    border-top: none;
    z-index: 27;
  }
  #anim-bar {
    position: absolute;
    left: 0; right: 0;
    bottom: calc(var(--m-tools-h) + var(--m-nav-h)
                 + (2 * var(--m-band-gap)) + env(safe-area-inset-bottom));
    padding: 7px 12px;
    border-top: 1px solid var(--bg-4);
    border-bottom: 1px solid var(--bg-4);
    z-index: 27;
  }

  /* Info overlay: full-sheet on mobile */
  .info-overlay-panel {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 82dvh;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  /* Modals: respect safe areas */
  .modal {
    width: 94vw;
    max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  /* Playbook list view */
  .view-playbooks { padding: 18px 14px 28px; gap: 18px; }
  .view-title     { font-size: 19px; }

  /* (#play-nav position is handled in the bottom-bands block above.) */

  /* ── Non-editor topbar: allow wrap to a 2nd row so Film Room, the user
        email, Invite and Sign out don't get clipped off the right edge in
        portrait. The .spacer becomes a forced line-break; the user chip
        drops below the brand/tabs and right-aligns. */
  body:not(.in-editor) #topbar {
    flex-wrap: wrap;
    height: auto;
    min-height: calc(var(--mobile-topbar-h) + env(safe-area-inset-top));
    padding-bottom: 6px;
    row-gap: 6px;
  }
  body:not(.in-editor) #topbar .spacer {
    flex-basis: 100%;
    height: 0;
    margin: 0;
  }
  body:not(.in-editor) #topbar .user-chip {
    margin-left: auto;
    padding-left: 0;
    border-left: 0;
  }
  body:not(.in-editor) #topbar .filmroom-link { padding: 4px 8px; }

  /* ── View subheader (playbook detail + scouting team): let action buttons
        wrap to a 2nd row instead of being pushed off-screen. Filter tabs claim
        their own row via `order`; title/meta/Share/Select/Print share row 1. */
  .view-subheader {
    flex-wrap: wrap;
    height: auto;
    min-height: 56px;
    padding: 10px 14px;
    row-gap: 8px;
    column-gap: 10px;
  }
  .view-subheader .subheader-title { max-width: none; min-width: 0; flex-shrink: 1; }
  .view-subheader .filter-tabs {
    order: 5;
    flex: 1 1 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }
}

/* ─── Landscape phone: same stacked bottom bands, tightened ──────────────
   Landscape phones already inherit the portrait bottom-bands layout above
   (they match via max-height: 500px). We only shrink the band heights and
   touch targets so the slim strip + nav row leave more of the short canvas
   visible. The collapse handle reclaims the rest on demand. (This replaces
   the old right-edge vertical rail, which fell over on phones taller than
   500px in landscape and could swallow the whole screen.) */
@media (max-height: 500px) and (orientation: landscape) {
  :root {
    --m-tools-h: 46px;
    --m-nav-h:   38px;
    --m-anim-h:  42px;
  }
  #tool-rail .tr-btn { width: 40px; height: 40px; }
  .tool-collapse     { height: 36px; }
}

/* ── Manage Play Types modal ──────────────────────────────────────────────── */
.type-list { display: flex; flex-direction: column; gap: 6px; }
.type-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 4px;
}
.type-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-3);
  border-radius: 6px;
  padding: 6px 10px;
}
.type-color-swatch {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,.12);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  font-size: 0;            /* kill the inherited line-height baseline */
  transition: transform .1s, box-shadow .1s;
}
.type-color-swatch:hover { transform: scale(1.1); }
.type-color-swatch:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Popover that floats below a swatch and shows the curated palette. */
.type-color-popover {
  z-index: 9999;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.color-swatch-grid--sm { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; max-width: 168px; }
.color-swatch-grid--sm .color-swatch { width: 24px; height: 24px; }
.type-name {
  flex: 1;
  font-size: 13px;
  color: var(--fg-0);
}
.type-name-input {
  flex: 1;
  font-size: 13px;
  padding: 4px 8px;
  height: 28px;
}
.type-empty {
  font-size: 13px;
  color: var(--fg-3);
  padding: 8px 0;
}

/* ── Defense-only tool rail items ─────────────────────────────────────────── */
/* Hidden by default; shown only when body has .defense-play */
.tr-defense-only { display: none; }
body.defense-play .tr-group.tr-defense-only { display: flex; }
body.defense-play .tr-sep.tr-defense-only   { display: block; }
/* Mobile wrap-dock: seps always hidden */
@media (max-width: 768px), (max-height: 500px) {
  body.defense-play .tr-sep.tr-defense-only { display: none; }
}
/* Landscape phone vertical rail: re-show sep */
@media (max-height: 500px) and (orientation: landscape) {
  body.defense-play .tr-sep.tr-defense-only { display: block; }
}

/* ── Zone shape buttons (info overlay) ───────────────────────────────────── */
.zone-shape-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.zone-shape-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  background: var(--bg-3);
  border: 1px solid var(--bg-4);
  border-radius: 7px;
  color: var(--fg-2);
  cursor: pointer;
  font-size: 10px;
  font-family: inherit;
  transition: background .12s, border-color .12s, color .12s;
}
.zone-shape-btn:hover {
  background: var(--bg-4);
  color: var(--fg-0);
  border-color: var(--fg-3);
}
.zone-shape-btn.active {
  background: rgba(249,115,22,.15);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Zone scale slider ───────────────────────────────────────────────────── */
.zone-scale-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-4);
  outline: none;
  cursor: pointer;
}
.zone-scale-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg-1);
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.zone-scale-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg-1);
}

/* ── Info overlay category badge (read-only, slightly larger than card badges) */
#info-play-category-badge {
  font-size: 12px;
  padding: 3px 12px;
}

/* ── Active / Archived segmented control ──────────────────────────────────
   Single-row tabs above the playbook grid. Visually similar to .vis-toggle
   but lighter, since this is a permanent navigation control, not a form. */
.pb-state-tabs {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: 8px;
  padding: 3px;
  margin: 6px 0 14px;
}
.pb-state-btn {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--fg-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.pb-state-btn:hover { color: var(--fg-0); }
.pb-state-btn.active {
  background: var(--bg-3);
  color: var(--fg-0);
}

/* ── Archived playbook row + pill ────────────────────────────────────────
   Dim the entire row so it visually recedes; the pill is a small chip next
   to the name making the state explicit. */
.pb-row.archived {
  opacity: 0.55;
  filter: grayscale(0.3);
}
.pb-row.archived:hover { opacity: 0.85; }
.pill-archived {
  display: inline-block;
  background: var(--bg-4);
  color: var(--fg-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
  vertical-align: 1px;
}

/* ── Share-modal collaborator chips ──────────────────────────────────────
   Each share is a removable pill: email text + an × hover target. */
.share-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 4px;
}
.share-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-3);
  border: 1px solid var(--bg-4);
  padding: 4px 4px 4px 10px;
  border-radius: 14px;
  font-size: 12px;
  color: var(--fg-0);
}
.share-chip-email { line-height: 1; }
.share-chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--fg-2);
  font-size: 14px;
  line-height: 1;
}
.share-chip-x:hover {
  background: var(--danger);
  color: #fff;
}

/* Inline "Revoke all" link beside the "Shared with" label. Styled as a
   subdued text link rather than a button — it's a destructive action, but
   the destination is a confirm dialog, so the chip doesn't need urgency. */
.share-revoke-all {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--danger);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 2px 4px;
  margin-left: 8px;
  border-radius: 4px;
}
.share-revoke-all:hover { background: rgba(239, 68, 68, 0.12); }

/* Hint colour variants for inline form feedback under the share inputs. */
.hint-error   { color: var(--danger); }
.hint-success { color: var(--ok); }
.hint-info    { color: var(--fg-2); }

/* ── Top-level section tabs (Playbooks / Scouting) ─────────────────────── */
.section-tabs {
  display: inline-flex;
  gap: 2px;
  margin-left: 12px;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: 8px;
  padding: 3px;
  flex-shrink: 0;
}
.section-tab {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--fg-2);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.section-tab:hover { color: var(--fg-0); }
.section-tab.active {
  background: var(--bg-3);
  color: var(--fg-0);
}
/* Section tabs remain visible in the editor — the design keeps them so the
   coach can hop to Teams / Scouting without backing out of the play. */

/* ── Scouting views ───────────────────────────────────────────────────── */
/* Coach + team rows reuse the playbook row visual treatment for
   consistency. A small "Coach" / "Team" sub-label helps distinguish them. */
.view-scouting,
.view-coach {
  display: flex;
  flex-direction: column;
  padding: 22px clamp(14px, 4vw, 28px) 28px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  box-sizing: border-box;
}
.coach-notes-panel {
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  color: var(--fg-1);
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.coach-notes-panel.empty { color: var(--fg-3); font-style: italic; }

/* Team grid cards: same row treatment as playbooks, but the meta line
   highlights player_count and play_count instead of team_name. */

/* ── Bulk-select mode (Phase 4 copy-to-team flow) ───────────────────────── */
.view-playbook.select-mode .play-card:not(.play-card-add) {
  outline: 2px dashed transparent;
  outline-offset: -3px;
  transition: outline-color .12s;
}
.view-playbook.select-mode .play-card:not(.play-card-add):hover {
  outline-color: var(--accent);
}
.view-playbook.select-mode .play-card.selected {
  outline: 2px solid var(--accent);
  background: rgba(249, 115, 22, 0.08);
}
.view-playbook.select-mode .play-card.selected::before {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #1a0f04;
  font-weight: 800;
  display: grid;
  place-items: center;
  font-size: 13px;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.view-playbook.select-mode .play-card { position: relative; }

/* Floating action bar pinned to the bottom of the view while select mode
   is active. Sits above the play grid so the user can scroll behind it. */
.select-action-bar {
  position: sticky;
  bottom: 16px;
  margin: 16px auto 0;
  width: fit-content;
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: 999px;
  padding: 8px 12px 8px 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  z-index: 5;
}
.select-action-bar .sab-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-1);
  white-space: nowrap;
}

/* ── Tendencies panel (scouting team detail view) ──────────────────────────
   Sits between the subheader and the play grid. Coach jots notes about the
   opposing team here; collaborators see them read-only. */
.tendencies-panel {
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius);
  padding: 10px 12px 12px;
  margin: 0 0 14px;
}
.tendencies-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.tendencies-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
  color: var(--fg-2);
  text-transform: uppercase;
}
.tendencies-status {
  font-size: 11px;
  color: var(--ok);
  min-height: 14px;
}
.tendencies-input {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-sm);
  color: var(--fg-0);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 10px;
  resize: vertical;
  min-height: 60px;
}
.tendencies-input:focus {
  outline: none;
  border-color: var(--accent);
}
.tendencies-input[readonly] {
  background: var(--bg-3);
  cursor: default;
}

/* ── Per-play notes popover (floating, reused across grids) ──────────────── */
.play-notes-btn { /* matches existing icon buttons; no special styling needed */ }
.play-notes-popover {
  position: fixed;
  z-index: 200;
  max-width: 320px;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 8px 12px 10px;
  color: var(--fg-0);
}
.play-notes-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.play-notes-popover-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-2);
  text-transform: uppercase;
  letter-spacing: .04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.play-notes-popover-close {
  background: transparent;
  border: 0;
  color: var(--fg-2);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.play-notes-popover-close:hover { color: var(--fg-0); }
.play-notes-popover-body {
  font-size: 13px;
  line-height: 1.45;
  color: var(--fg-1);
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ── Manage Routes modal ───────────────────────────────────────────────────
   Per-user route library: rename inline, delete, view leg counts. Sort
   order is implicit (matches storage order); drag-to-reorder is deferred. */
.manage-routes-list {
  display: flex; flex-direction: column;
  gap: 6px;
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 12px;
}
.route-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  background: var(--bg-1);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-sm);
}
.route-row-name {
  flex: 1; min-width: 0;
  font-size: 13px;
  padding: 6px 8px;
}
.route-row-legs {
  font-size: 11px;
  color: var(--fg-2);
  white-space: nowrap;
}

/* ── Play Edit History modal ───────────────────────────────────────────────
   Two-pane: version list on left, preview canvas + restore action on right.
   The .modal-wide variant gives this modal a bigger default width than the
   existing form modals so a 600×400 preview canvas fits comfortably. */
.modal-wide {
  max-width: 880px;
  width: calc(100vw - 32px);
}
.history-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 14px;
  margin-bottom: 12px;
}
.history-list {
  display: flex; flex-direction: column;
  gap: 4px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}
.history-row {
  padding: 8px 10px;
  background: var(--bg-1);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.history-row:hover { background: var(--bg-3); }
.history-row.selected {
  background: var(--bg-3);
  border-color: var(--accent);
}
.history-row-when {
  font-size: 13px; font-weight: 600;
  color: var(--fg-0);
}
.history-row-who {
  font-size: 11px;
  color: var(--fg-2);
  margin-top: 2px;
}
.history-preview {
  display: flex; flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.history-preview-canvas {
  width: 100%;
  aspect-ratio: 800 / 540;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-sm);
}
.history-preview-meta {
  font-size: 12px;
  color: var(--fg-2);
  text-align: center;
}

/* ── My Teams (Phase 1) ──────────────────────────────────────────────── */
.view-myteams, .view-myteam {
  padding: 20px 24px;
  max-width: 980px;
  margin: 0 auto;
  width: 100%;
}
.view-myteam .subheader {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--bg-4);
}
.view-myteam .subheader-color-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.view-myteam .subheader-title {
  font-size: 18px; font-weight: 700;
  color: var(--fg-0);
}
.view-myteam .subheader-sub {
  font-size: 13px;
  color: var(--fg-2);
  margin-left: 6px;
}

/* Tabs inside a team detail */
.myteam-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--bg-4);
  margin-bottom: 14px;
}
.myteam-tab {
  background: none;
  border: none;
  color: var(--fg-2);
  font: inherit;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .12s, border-color .12s;
}
.myteam-tab:hover { color: var(--fg-0); }
.myteam-tab.active {
  color: var(--fg-0);
  border-bottom-color: var(--accent);
}
.myteam-tab-count {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 7px;
  background: var(--bg-3);
  color: var(--fg-2);
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
}
.myteam-tab.active .myteam-tab-count {
  background: var(--accent);
  color: #fff;
}
.myteam-body { min-height: 200px; }

/* Roster list */
.roster-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}
.roster-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.roster-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-sm);
}
.roster-num {
  display: inline-block;
  min-width: 36px;
  padding: 2px 8px;
  background: var(--bg-3);
  color: var(--fg-0);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 12px;
  border-radius: 4px;
  text-align: center;
}
.roster-name {
  flex: 1;
  color: var(--fg-0);
  font-weight: 500;
}

/* Linked playbooks list */
.myteam-pb-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.myteam-pb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-sm);
}
.myteam-pb-info { flex: 1; }
.myteam-pb-name { font-weight: 600; color: var(--fg-0); }
.myteam-pb-meta { font-size: 12px; color: var(--fg-2); margin-top: 2px; }

/* Lineup tab — base lineup + sub packages */
.ls-tab { display: flex; flex-direction: column; gap: 16px; }
/* Unit switcher (Offense / Defense / Special Teams) above the lineup grids. */
.ls-unit-tabs { align-self: flex-start; }
.ls-tab-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ls-tab-toolbar .ls-spacer { flex: 1; }
.ls-pc-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fg-2);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.ls-select {
  font: inherit;
  background: var(--bg-3);
  color: var(--fg-0);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
}
.ls-select:focus { outline: none; border-color: var(--accent); }
.ls-block, .ls-package {
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.ls-block-head {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--fg-2);
  margin-bottom: 10px;
}
.ls-package-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.ls-package-name { font-weight: 700; color: var(--fg-0); flex: 1; }
.ls-package-actions { display: flex; gap: 2px; }
/* Packages reorder by dragging the ⋮⋮ grip. The wrapper reproduces the 16px
   gap they had as direct .ls-tab children, so nothing shifts. */
.ls-package-list { display: flex; flex-direction: column; gap: 16px; }
.ls-package { transition: border-color .12s, opacity .12s; }
.ls-package.dragging { opacity: 0.4; }
/* Border grows 1px -> 2px, so drop a padding px to hold the box height. */
.ls-package.drag-over { border-top: 2px solid var(--accent); padding-top: 11px; }
.ls-pkg-drag {
  flex-shrink: 0;
  cursor: grab;
  color: var(--fg-3);
  font-size: 14px;
  line-height: 1;
  padding: 4px 2px;
  user-select: none;
  display: flex;
  align-items: center;
}
.ls-pkg-drag:active { cursor: grabbing; }
.ls-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
}
.ls-edit-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg-1);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-sm);
}
.ls-edit-slot-sub { border-color: var(--accent); }
.ls-edit-slot .ls-select { flex: 1; min-width: 0; }
.ls-pos {
  flex: 0 0 auto;
  /* Pill, not a circle: defensive labels run to three characters (MLB, OLB). */
  min-width: 26px; height: 26px; padding: 0 7px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 13px;
  font-size: 12px; font-weight: 800; color: #fff;
}
/* On the Lineup tab the chip doubles as the rename control, so it renders as a
   <button> and has to shed the UA button styling. */
button.ls-pos {
  font-family: inherit;
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
}
button.ls-pos:hover,
button.ls-pos:focus-visible { border-color: var(--fg-0); outline: none; }
/* A slot this lineup labels itself rather than inheriting from base/default. */
.ls-pos-custom { box-shadow: inset 0 -2px 0 rgba(255, 255, 255, .55); }
/* Depth affordance on a slot: '+' with nothing benched, '+3' with three. Sits
   at the end of the row so the starter's select stays the row's main event. */
.ls-subs-btn {
  flex: 0 0 auto;
  min-width: 26px; height: 26px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-size: 11px; font-weight: 700; line-height: 1;
  background: var(--bg-3);
  color: var(--fg-3);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.ls-subs-btn:hover,
.ls-subs-btn:focus-visible { border-color: var(--accent); color: var(--fg-0); outline: none; }
.ls-subs-has { color: var(--fg-0); border-color: var(--fg-3); }
/* Benched by the base rather than by this package — dimmer, so a coach can see
   at a glance which lists a package actually owns. */
.ls-subs-inherited { color: var(--fg-2); border-color: var(--bg-4); font-weight: 600; }

/* Potential-subs picker (modal-lineup-subs). */
.subs-list {
  max-height: 46vh;
  overflow-y: auto;
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-sm);
}
.subs-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
}
.subs-row + .subs-row { border-top: 1px solid var(--bg-4); }
.subs-row:hover { background: var(--bg-3); }
.subs-row-on { background: var(--bg-3); }
.subs-row-starter { cursor: default; opacity: .55; }
.subs-row-starter:hover { background: none; }
/* Depth number — the order the coach ticked them in. */
.subs-depth {
  flex: 0 0 auto;
  min-width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px;
  font-size: 10px; font-weight: 800;
  background: var(--bg-4); color: var(--fg-0);
}
.subs-row:not(.subs-row-on) .subs-depth { background: none; }
.subs-name { flex: 1; min-width: 0; }
.subs-tag {
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--fg-2);
}
.ls-label-hint { margin: -4px 0 10px; }

/* Position-check result panel (Lineup tab). */
.ls-check {
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.ls-check-ok   { border-left-color: var(--ok); }
.ls-check-warn { border-left-color: var(--warn); }
.ls-check-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ls-check-title { font-weight: 700; flex: 1; }
.ls-check-sub {
  font-size: 12px;
  color: var(--fg-2);
  margin-top: 2px;
}
.ls-check-list {
  margin: 8px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Attendance report tab — per-calendar-week percentages.
   Prefixed .ar- rather than .att-, which the practice editor's attendance
   checkbox list already owns (.att-row is a flex row there). */
.ar-tab { display: flex; flex-direction: column; gap: 14px; }
.ar-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.ar-toolbar .ls-spacer { flex: 1; }
.ar-kpi {
  display: flex;
  flex-direction: column;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--bg-4);
  border-left-width: 3px;
  background: var(--bg-2);
}
.ar-kpi-pct { font-size: 24px; font-weight: 800; line-height: 1.1; color: var(--fg-0); }
.ar-kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--fg-2);
  margin-top: 2px;
}
.ar-kpi-meta { font-size: 13px; color: var(--fg-1); display: flex; flex-direction: column; }
.ar-sub { font-size: 11px; color: var(--fg-2); }
.ar-note {
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--fg-1);
}

/* The grid scrolls sideways on its own so a long season never forces the
   page to scroll; the player column stays pinned while it does. */
.ar-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}
.ar-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 13px;
}
.ar-table th, .ar-table td { padding: 8px 10px; text-align: center; }
.ar-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-3);
  border-bottom: 1px solid var(--bg-4);
  font-weight: 700;
  vertical-align: bottom;
}
.ar-wk { min-width: 96px; }
.ar-wk-n      { display: block; font-size: 12.5px; color: var(--fg-0); }
.ar-wk-dates  { display: block; font-size: 11px; color: var(--fg-2); font-weight: 500; margin-top: 2px; }
.ar-wk-count  { display: block; font-size: 10.5px; color: var(--fg-3); font-weight: 500; }

/* Sticky player column. */
.ar-player {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--bg-2);
  text-align: left;
  min-width: 168px;
  border-right: 1px solid var(--bg-4);
  font-weight: 600;
}
.ar-table thead .ar-corner { z-index: 3; background: var(--bg-3); }
.ar-num {
  font-family: 'JetBrains Mono', monospace;
  color: var(--fg-2);
  font-size: 12px;
  margin-right: 7px;
}
.ar-name { color: var(--fg-0); }
/* Secondary line under the player name ("off roster", the Team row's count). */
.ar-player .ar-sub { display: block; margin-top: 1px; }
.ar-row + .ar-row .ar-player,
.ar-row + .ar-row .ar-cell { border-top: 1px solid var(--bg-4); }
.ar-row-team .ar-player, .ar-row-team .ar-cell { background: var(--bg-3); font-weight: 700; }
.ar-row-off .ar-name { color: var(--fg-2); }
.ar-cell { white-space: nowrap; }
.ar-pct  { display: block; font-weight: 700; font-size: 14px; }
.ar-frac { display: block; font-size: 10.5px; color: var(--fg-3); margin-top: 1px; }
.ar-total { border-left: 1px solid var(--bg-4); }
.ar-table .ar-total { background: rgba(255,255,255,.03); }

/* Tiers — attendance is the problem being managed, so the bar is high:
   red under 60%, amber to 84%, green at 85%+. */
.ar-good .ar-pct { color: var(--ok); }
.ar-warn .ar-pct { color: var(--warn); }
.ar-bad  .ar-pct { color: var(--danger); }
.ar-none .ar-pct { color: var(--fg-3); font-weight: 600; }
.ar-kpi.ar-good { border-left-color: var(--ok); }
.ar-kpi.ar-warn { border-left-color: var(--warn); }
.ar-kpi.ar-bad  { border-left-color: var(--danger); }
.ar-kpi.ar-none { border-left-color: var(--bg-4); }

@media (max-width: 720px) {
  .ar-player { min-width: 132px; }
  .ar-wk     { min-width: 78px; }
  .ar-table th, .ar-table td { padding: 7px 6px; }
}
/* Practices list */
.practice-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.practice-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.practice-row:hover {
  background: var(--bg-3);
  border-color: var(--accent);
}
.practice-date {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 13px;
  color: var(--fg-0);
  min-width: 100px;
}
.practice-info { flex: 1; }
.practice-name { font-weight: 600; color: var(--fg-0); }
.practice-meta { font-size: 12px; color: var(--fg-2); margin-top: 2px; }

/* Drills library list (modal) */
.drills-library-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}

/* Drill cards (in library modal) */
.drill-card {
  padding: 12px;
  background: var(--bg-1);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-sm);
}
.drill-card-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.drill-card-name {
  flex: 1;
  font-weight: 700;
  color: var(--fg-0);
}
.drill-card-actions { display: flex; gap: 4px; }
.drill-desc {
  font-size: 13px;
  color: var(--fg-1);
  white-space: pre-wrap;
  margin-bottom: 8px;
}
.drill-video {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 6px;
}
.drill-video iframe,
.drill-video video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  border: 0;
}
.drill-video-link {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 8px;
  background: var(--bg-3);
  color: var(--accent);
  border-radius: 4px;
  font-size: 13px;
  text-decoration: none;
}
.drill-video-link:hover { background: var(--bg-4); }

/* ── Play tags + search (playbook view) + info-overlay video ─────────────── */
.pb-search-wrap { display: flex; align-items: center; }
.pb-search {
  width: 160px;
  max-width: 40vw;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--bg-4);
  background: var(--bg-1);
  color: var(--fg-0);
  font-family: inherit;
  font-size: 12px;
}
.pb-search::placeholder { color: var(--fg-3); }
.pb-search:focus { outline: none; border-color: var(--accent); }
.play-card.search-hidden { display: none !important; }

/* ── Category bar (playbook grid) ──────────────────────────────────────────
   Surfaces the per-playbook play_type list ("categories") on the grid itself:
   each chip filters the cards, and the owner gets an inline creator. The only
   hard-coded color is the category's own, passed in as --cat-color; everything
   else is a theme token, so the outdoor theme swaps for free. */
.cat-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  flex-shrink: 0;
  background: var(--bg-1);
  border-bottom: 1px solid var(--bg-4);
  overflow-x: auto;
}
.cat-bar-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--fg-3);
  flex-shrink: 0;
}
.cat-bar-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--bg-4);
  background: var(--bg-2);
  color: var(--fg-1);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.cat-chip:hover { background: var(--bg-3); color: var(--fg-0); }
.cat-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cat-color, var(--fg-3));
  border: 1px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
}
.cat-chip-n {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--fg-3);
}
.cat-chip.active {
  border-color: var(--cat-color, var(--accent));
  background: var(--bg-4);
  color: var(--fg-0);
}
.cat-chip.active .cat-chip-n { color: var(--fg-1); }
.cat-chip-add { border-style: dashed; color: var(--fg-2); }
.cat-chip-add:hover { border-color: var(--accent); color: var(--accent); }
.cat-chip-clear { border-color: var(--accent); color: var(--accent); }

.cat-new-wrap { display: inline-flex; }
.cat-new-input {
  width: 150px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--bg-1);
  color: var(--fg-0);
  font-family: inherit;
  font-size: 11px;
}
.cat-new-input:focus { outline: none; }

/* ── Quick-tag popover (play card tag button / bulk "Tag as…") ────────────
   position:fixed is set inline by _positionPopover so the grid's overflow
   can't clip it. Reuses .type-checkbox-list / .type-cb from the play info
   window so a category reads the same wherever it is toggled. */
.qt-pop {
  z-index: 60;
  min-width: 190px;
  max-width: 280px;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--bg-4);
  background: var(--bg-2);
  box-shadow: 0 12px 34px rgba(0,0,0,0.5);
}
.qt-head {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--fg-3);
  padding: 0 2px 6px;
}
.qt-list { max-height: 260px; overflow-y: auto; }
.qt-empty { font-size: 11px; color: var(--fg-2); padding: 4px 2px 2px; }
.qt-bulk { font-family: inherit; }
.qt-bulk .qt-op { font-size: 10px; color: var(--fg-3); margin-left: 2px; }
.qt-bulk.on { background: var(--bg-4); border-color: var(--accent); color: var(--fg-0); }
.qt-bulk.on .qt-op { color: var(--accent); }

/* Phone: keep the chip row to a single scrollable line (it wraps to 3 rows and
   eats ~110px of an iPhone otherwise). Matches how .filter-tabs behaves here.
   This block must stay AFTER the base rules above — the shared phone media
   query earlier in the file loses the cascade to them. */
@media (max-width: 768px), (max-height: 500px) {
  .cat-bar { padding: 6px 14px; gap: 8px; }
  .cat-bar-chips { flex-wrap: nowrap; }
}

.play-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}
.pc-tag-chip {
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--bg-4);
  background: var(--bg-3);
  color: var(--fg-1);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.6;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s;
}
.pc-tag-chip:hover { background: var(--bg-4); color: var(--fg-0); border-color: var(--accent); }

/* Film-clip preview inside the play info overlay (mirrors .drill-video). */
.info-video {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 8px;
}
.info-video iframe,
.info-video video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  border: 0;
}
.info-video-link {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 8px;
  background: var(--bg-3);
  color: var(--accent);
  border-radius: 4px;
  font-size: 13px;
  text-decoration: none;
}
.info-video-link:hover { background: var(--bg-4); }
.drill-images {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.drill-img {
  height: 100px;
  max-width: 100%;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg-3);
}

/* Roster — add-player picker */
.add-player-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 4px;
}
.add-player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: var(--bg-1);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-sm);
}
.add-player-row.rostered { opacity: 0.55; }
.add-player-on-roster {
  font-size: 11px;
  font-weight: 600;
  color: var(--ok);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.roster-num-blank { color: var(--fg-3); }

/* Practice editor */
.practice-col-count {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  background: var(--bg-3);
  color: var(--fg-1);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 400;
}

/* ─── Workspace (Practices list + Editor + Library) ─────────────────────── */
.myteam-body-flush { padding: 0; }
.workspace-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 280px;
  gap: 12px;
  padding: 12px 16px 24px;
  align-items: start;
}
.ws-region {
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-sm);
  padding: 10px;
  min-height: 200px;
}
.ws-region-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 4px 8px;
  border-bottom: 1px solid var(--bg-4);
  margin-bottom: 8px;
}
.ws-region-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-2);
}
.ws-editor-hd { align-items: baseline; }
.ws-editor-title { display: flex; align-items: baseline; gap: 8px; flex: 1; min-width: 0; }
.ws-editor-title .ws-region-title {
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--fg-0);
  font-weight: 600;
}
.ws-editor-date { font-size: 12px; color: var(--fg-2); }
.ws-editor-actions { display: flex; gap: 4px; flex: 0 0 auto; }

/* Left rail — practices list */
.ws-prac-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 60vh;
  overflow-y: auto;
}
.ws-prac-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg-1);
  border: 1px solid var(--bg-4);
  border-radius: 4px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.ws-prac-row:hover { background: var(--bg-3); }
.ws-prac-row.active {
  border-color: var(--accent);
  background: var(--bg-3);
}
.ws-prac-row-main { flex: 1; min-width: 0; }
.ws-prac-row-date { font-size: 11px; color: var(--fg-2); text-transform: uppercase; letter-spacing: 0.04em; }
.ws-prac-row-name { font-size: 13px; color: var(--fg-0); font-weight: 500; }
.ws-prac-row-meta { font-size: 11px; color: var(--fg-2); margin-top: 2px; }

/* Center — editor sections */
.ws-editor-section { margin-bottom: 14px; }
.ws-editor-section-hd {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-2);
  margin-bottom: 6px;
}
.ws-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--fg-2);
}
.ws-empty .es-icon { font-size: 28px; margin-bottom: 8px; }
.ws-empty .es-title { font-size: 14px; color: var(--fg-0); margin-bottom: 4px; font-weight: 500; }
.ws-empty .es-sub { font-size: 12px; margin-bottom: 12px; }

/* Right rail — library */
.ws-lib-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-1);
  padding: 3px;
  border-radius: 6px;
  margin-bottom: 8px;
}
.ws-lib-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--fg-2);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.ws-lib-tab.active { background: var(--bg-3); color: var(--fg-0); }
.ws-lib-search { width: 100%; margin-bottom: 8px; font-size: 13px; }
.ws-library-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 60vh;
  overflow-y: auto;
}
.ws-lib-section + .ws-lib-section { margin-top: 8px; }
.ws-lib-section-hd {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-2);
  padding: 4px 6px;
}
.ws-lib-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--bg-1);
  border-radius: 4px;
  cursor: pointer;
  transition: background .12s;
}
.ws-lib-row:hover { background: var(--bg-3); }
.ws-lib-row.disabled { opacity: 0.5; cursor: not-allowed; }
.ws-lib-row.disabled:hover { background: var(--bg-1); }
.ws-lib-row-name { flex: 1; min-width: 0; font-size: 13px; color: var(--fg-0); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-lib-row-add { color: var(--accent); font-size: 16px; line-height: 1; }
.ws-lib-row-edit { opacity: 0.5; transition: opacity .12s; }
.ws-lib-row:hover .ws-lib-row-edit { opacity: 1; }
.ws-lib-row-meta {
  font-size: 11px;
  color: var(--fg-2);
  background: var(--bg-3);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: monospace;
}
.ws-lib-new { width: 100%; margin-top: 10px; }

/* Mobile sub-tabs — only render below 1100px */
.ws-mobile-tabs { display: none; }
@media (max-width: 1100px) {
  .workspace-grid {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 12px 16px;
  }
  .ws-mobile-tabs {
    display: flex;
    gap: 2px;
    background: var(--bg-1);
    padding: 3px;
    margin: 8px 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--bg-4);
  }
  .ws-mtab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--fg-2);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
  }
  .ws-mtab.active { background: var(--bg-3); color: var(--fg-0); }
  .ws-region { display: none; }
  .ws-region.ws-mobile-active { display: block; }
  .ws-prac-list, .ws-library-list { max-height: none; }
}
.prac-item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 40px;
  margin-bottom: 10px;
}
.prac-item {
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg-1);
  border: 1px solid var(--bg-4);
  border-left: 3px solid var(--bg-4);
  border-radius: 4px;
  transition: border-color .12s, background .12s, opacity .12s;
}
.prac-item.dragging { opacity: 0.4; }
.prac-item.drag-over {
  border-top: 2px solid var(--accent);
  padding-top: 7px;
}
.prac-item-play  { border-left-color: #34d399; }
.prac-item-drill { border-left-color: #60a5fa; }
.prac-item-goal  { border-left-color: #fbbf24; }

.prac-drag {
  flex-shrink: 0;
  cursor: grab;
  color: var(--fg-3);
  font-size: 14px;
  line-height: 1;
  padding: 4px 2px;
  user-select: none;
  display: flex;
  align-items: center;
}
.prac-drag:active { cursor: grabbing; }

.prac-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.prac-item-hd {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.prac-idx {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--fg-1);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.prac-kind {
  flex-shrink: 0;
  font-size: 14px;
  line-height: 1;
}
.prac-item-num {
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-2);
}
.prac-item-name {
  flex: 1;
  min-width: 80px;
  color: var(--fg-0);
  font-size: 13px;
  font-weight: 600;
}
.prac-item-meta {
  font-size: 11px;
  color: var(--fg-2);
}
.prac-spacer { flex: 1; }

.prac-title-input {
  flex: 1;
  min-width: 100px;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
}
.prac-time {
  font-size: 11px;
  color: var(--fg-2);
  font-family: monospace;
  white-space: nowrap;
}
.prac-duration {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--fg-2);
}
.prac-duration-input {
  width: 56px;
  padding: 3px 6px;
  font-size: 12px;
  text-align: right;
}
.prac-remove { color: var(--fg-2); }
.prac-remove:hover { color: var(--danger); }

.prac-textarea {
  font-size: 12px;
  padding: 6px 8px;
  resize: vertical;
}
.prac-field-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-2);
  margin-bottom: -3px;
}

/* Schedule header (start time + total) */
.ws-editor-schedhd {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--bg-4);
}
.ws-sched-time {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-2);
}
.ws-sched-time-input {
  width: auto;
  padding: 4px 8px;
  font-size: 12px;
}
.ws-sched-total {
  flex: 1;
  font-size: 13px;
  color: var(--fg-1);
}
.ws-sched-total strong { color: var(--fg-0); }
.prac-picker > summary {
  cursor: pointer;
  padding: 6px 10px;
  background: var(--bg-1);
  border: 1px dashed var(--bg-4);
  border-radius: 4px;
  color: var(--fg-2);
  font-size: 13px;
  font-weight: 600;
  user-select: none;
}
.prac-picker[open] > summary { border-style: solid; }
.prac-picker-body {
  margin-top: 6px;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--bg-4);
  border-radius: 4px;
  background: var(--bg-1);
}
.picker-section + .picker-section { border-top: 1px solid var(--bg-4); }
.picker-section-hd {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-2);
  background: var(--bg-2);
}
.picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: background .12s;
}
.picker-row:hover { background: var(--bg-3); }
.picker-row-name {
  flex: 1;
  color: var(--fg-0);
  font-size: 13px;
}
.picker-row-add {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

/* Attendance list */
.att-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 360px;
  overflow-y: auto;
  margin-bottom: 10px;
}
.att-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  background: var(--bg-1);
  border: 1px solid var(--bg-4);
  border-radius: 4px;
  cursor: pointer;
  transition: background .12s;
}
.att-row:hover { background: var(--bg-3); }
.att-check { margin: 0; }

/* Practice notes block */
.practice-notes { margin-top: 14px; }


/* ═══════════════════════════════════════════════════════════════════════════
   FACELIFT — 2026-06 UI redesign
   Density-driven layout: desktop = comfortable; .pmx-compact (added on
   narrow viewports by app.js) drops --gap / --pad / --grid-min / --radius
   to compact values. Entrance keyframes used by section/modal transitions.
   ─────────────────────────────────────────────────────────────────────── */
@keyframes pmxFade  { from { opacity: 0; transform: translateY(7px);  } to { opacity: 1; transform: none; } }
@keyframes pmxSheet { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* Compact density: viewport-driven (no JS toggle). The class form is kept
   as an escape hatch in case we ever need to force compact on a specific
   page. Below 720px the tokens drop automatically. */
@media (max-width: 720px) {
  body {
    --gap: 9px;
    --pad: 15px;
    --grid-min: 168px;
    --radius: 11px;
    --radius-sm: 8px;
    --fs: .92;
  }
}
body.pmx-compact {
  --gap: 9px;
  --pad: 15px;
  --grid-min: 168px;
  --radius: 11px;
  --radius-sm: 8px;
  --fs: .92;
}

/* ── Top bar (facelift) ──────────────────────────────────────────────────── */
#topbar {
  height: var(--topbar-h);
  padding: 0 18px;
  gap: 14px;
  background: color-mix(in srgb, var(--bg-1) 92%, transparent);
  border-bottom: 1px solid var(--bg-4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: none;
  position: sticky;
  top: 0;
  /* Stay above the sub-header (z:10) and its accent button glow so the
     avatar dropdown can spill below the bar without anything overlapping. */
  z-index: 30;
}

.brand { gap: 11px; padding: 4px; border-radius: 10px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 17px; font-weight: 900;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.brand-name {
  display: flex; flex-direction: column; line-height: 1; gap: 3px;
}
.brand-name::before {
  content: "DC DAD FLAG";
  font-weight: 900; font-size: 13px; letter-spacing: .16em; color: var(--fg-0);
}
.brand-name::after {
  content: "COACHING";
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px; letter-spacing: .22em; color: var(--fg-3); font-weight: 500;
}
/* hide the literal text node so only the pseudo-el wordmark renders. */
.brand-name { font-size: 0; }
/* The mark holds two characters now ("DC") — shrink the font so it fits. */
.brand-mark { font-size: 14px; }

/* Section switcher pill */
.section-tabs {
  display: flex; align-items: center; gap: 3px;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: 12px;
  padding: 4px;
  margin: 0 6px;
}
.section-tab {
  height: 32px;
  padding: 0 14px;
  border-radius: 8px;
  border: none; background: transparent;
  color: var(--fg-1); font-family: inherit;
  font-weight: 600; font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer; white-space: nowrap;
  transition: background .12s, color .12s;
}
.section-tab:hover { color: var(--fg-0); }
.section-tab.active {
  background: var(--accent); color: var(--accent-ink); font-weight: 800;
  box-shadow: 0 4px 14px var(--accent-glow);
}

/* Search field (desktop) — non-functional placeholder for now */
.tb-search {
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 12px;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: 10px;
  width: 200px; color: var(--fg-3); font-size: 13px;
  flex-shrink: 0;
}
.tb-search .kbd {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  border: 1px solid var(--border-light);
  border-radius: 5px; padding: 1px 5px; color: var(--fg-2);
}

/* User-chip & theme-toggle: keep wiring, tighten visuals */
.theme-toggle {
  width: 38px; height: 38px;
  padding: 0 !important;
  border-radius: 10px;
  border: 1px solid var(--bg-4) !important;
  background: var(--bg-2);
  color: var(--fg-1);
}

/* The redesign drops the breadcrumbs row and the misc top-bar text links —
   the sub-header carries page context, and the avatar menu surfaces the
   utility actions (Drills / Film Room / Invite / Sign out). Save indicator
   + History/Save only matter in the editor; CSS shows them only there. */
#topbar #breadcrumbs,
#topbar .topbar-legacy,
#topbar .drills-link,
#topbar .filmroom-link { display: none !important; }

.user-chip { display: flex; align-items: center; gap: 8px; }
.user-chip .user-email { display: none; }      /* email lives in the avatar tooltip now */
.user-avatar-wrap { position: relative; flex-shrink: 0; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-3); border: 1px solid var(--border-light);
  display: grid; place-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800; font-size: 12px; color: var(--fg-0);
  flex-shrink: 0; cursor: pointer; padding: 0;
}
.user-avatar:hover { border-color: var(--accent); }

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--bg-2);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0,0,0,.55);
  padding: 6px;
  z-index: 200;
  animation: pmxFade .15s ease;
}
.user-menu-email {
  padding: 8px 12px 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--fg-3);
  letter-spacing: .04em;
  word-break: break-all;
}
.user-menu-sep { height: 1px; background: var(--bg-4); margin: 4px 0; }
.user-menu-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  padding: 9px 12px;
  background: none; border: none;
  color: var(--fg-0);
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; border-radius: 8px;
  text-decoration: none;
}
.user-menu-item:hover { background: var(--bg-3); }
.user-menu-item-danger { color: var(--danger); }
.user-menu-item-danger:hover { background: rgba(239,68,68,.1); }
/* Brand text becomes mark-only below 720px */
@media (max-width: 720px) {
  .brand-name { display: none; }
  .tb-search, .drills-link, .filmroom-link { display: none; }
  .section-tabs { display: none; }            /* bottom nav takes over (future) */
}

/* ── Playbooks list (facelift) ──────────────────────────────────────────── */
.view-playbooks {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--pad);
  gap: calc(var(--gap) + 6px);
  animation: pmxFade .25s ease;
}
.view-playbooks .view-header {
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
}
.view-playbooks .view-header::before {
  content: "YOUR PLAYBOOKS";
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: .2em;
  color: var(--accent); font-weight: 600;
  margin-bottom: 8px;
}
/* re-stack the eyebrow above the title without changing markup */
.view-playbooks .view-header { display: grid; grid-template-columns: 1fr auto; align-items: end; }
.view-playbooks .view-header::before { grid-column: 1; }
.view-playbooks .view-header .view-title { grid-column: 1; }
.view-playbooks .view-header > .btn,
.view-playbooks .view-header > button:not(.section-tab) { grid-column: 2; grid-row: 1 / span 2; align-self: end; }
.view-title {
  font-size: calc(30px * var(--fs));
  font-weight: 900;
  letter-spacing: -.02em;
}
.view-playbooks .btn-primary {
  height: 42px; padding: 0 18px; border-radius: 11px;
  font-size: 14px;
}

/* State tabs (Active / Archived) — keep wiring, restyle as small pills */
.pb-state-tabs { display: flex; gap: 4px; }
.pb-state-btn {
  height: 32px; padding: 0 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--fg-2); font-family: inherit;
  font-weight: 600; font-size: 12.5px; cursor: pointer;
}
.pb-state-btn:hover { color: var(--fg-0); background: var(--bg-2); }
.pb-state-btn.active {
  background: var(--bg-2);
  border-color: var(--bg-4);
  color: var(--fg-0);
}

/* Card grid replaces the old row list. .pb-list becomes a grid. */
.pb-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: var(--gap);
}

/* New playbook card. Markup emitted by _renderPlaybooksView keeps using
   .pb-row as the container for back-compat; we make it card-shaped here. */
.pb-row {
  position: relative;
  display: block;                          /* override the old flex row */
  padding: 18px 20px 18px 26px;
  border-radius: var(--radius);
  border: 1px solid var(--bg-4);
  background: var(--bg-2);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
  overflow: hidden;
}
.pb-row:hover {
  background: var(--bg-3);
  border-color: var(--border-light);
  transform: translateY(-2px);
}
.pb-row .pb-color-dot {                    /* repurpose dot as 4px left stripe */
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  border-radius: 0;
}
.pb-row .pb-num { display: none; }         /* card design replaces the row index */

.pb-row .pb-row-info {
  display: block;
  margin-top: 14px;                        /* room for the meta row above */
}
.pb-row .pb-row-name {
  font-size: 18px; font-weight: 800;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pb-row .pb-row-meta {
  font-family: inherit;                    /* the card uses sans, not mono */
  font-size: 13px; color: var(--fg-1);
}

.pb-card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.pb-row .pb-pill-7v7 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: .14em;
  color: var(--fg-2);
  padding: 4px 9px;
  border: 1px solid var(--bg-4);
  border-radius: 20px;
  text-transform: uppercase;
}

/* Tag pill — free-form label (coach tier, team tendency) rendered with a
   hash-derived accent supplied via inline style: color, background,
   border-color. Visual treatment matches the design's RUN-HEAVY / AIR-RAID
   style chips. */
.pb-row .tag-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: .12em;
  padding: 4px 10px;
  border: 1px solid currentColor;
  border-radius: 6px;
  text-transform: uppercase;
  font-weight: 800;
  background: transparent;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pb-row .pb-plays-count {
  font-size: 12px; color: var(--fg-2);
  /* Reserve room for the absolutely-positioned grip handle (top-right,
     12px from the edge) so it doesn't run over the play-count text on
     hover. */
  margin-right: 22px;
}

/* Owner action row — bottom-right, level with the "updated …" meta so it
   doesn't crash into the grip / play-count at the top of the card. */
.pb-row .pb-row-actions {
  position: absolute;
  bottom: 12px; right: 12px;
  display: none;
  gap: 2px;
}
.pb-row:hover .pb-row-actions { display: flex; }
.pb-row .pb-grip {
  position: absolute;
  top: 12px; right: 12px;                  /* grip stays at the top corner */
  margin: 0;
}

/* Dashed "+ New playbook" tile */
.pb-new-row {
  border: 1.5px dashed var(--border-light);
  border-radius: var(--radius);
  min-height: 128px;
  font-weight: 700; font-size: 14px;
  color: var(--fg-2);
  background: transparent;
}
.pb-new-row:hover { border-color: var(--accent); color: var(--accent); background: transparent; }

/* ── Playbook detail (facelift) ─────────────────────────────────────────── */
.view-subheader {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg-1) 94%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--bg-4);
  padding: 14px var(--pad);
  height: auto;
  min-height: 56px;
  flex-wrap: wrap;
  row-gap: 12px;
}
.view-subheader::after {
  /* divider | between back and title is rendered by the subheader children */
  content: "";
}
.subheader-title {
  font-size: 17px;
  font-weight: 800;
  max-width: 360px;
}
.subheader-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.view-subheader .filter-tabs {
  flex: 0 0 100%;
  justify-content: flex-start;
  gap: 4px;
  margin-top: 4px;
}

.vs-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--fg-1);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  flex-shrink: 0;
}
.vs-back:hover { color: var(--fg-0); background: var(--bg-2); }
.vs-divider { width: 1px; height: 22px; background: var(--bg-4); flex-shrink: 0; }
.vs-color-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.vs-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.vs-actions .btn-sm { height: 36px; padding: 0 14px; font-size: 13px; }
.vs-actions .btn-primary { font-weight: 800; }
.filter-tab {
  height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  font-size: 13px;
}
.filter-tab.active {
  background: var(--bg-3);
  border-color: var(--border-light);
  color: var(--fg-0);
}

/* Play card thumb gets the overlay number + tag */
.play-card { border-radius: var(--radius-sm); }
.play-card-thumb {
  background: #0d1f17;                     /* darker green, per design */
  position: relative;
  border-bottom: 1px solid var(--bg-4);
}
.play-card-thumb .pc-num {
  position: absolute;
  top: 8px; left: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 700;
  color: #fff;
  background: rgba(0,0,0,.55);
  padding: 2px 7px;
  border-radius: 6px;
}
.play-card-thumb .pc-tag {
  position: absolute;
  top: 8px; right: 8px;
  font-size: 9px; font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: rgba(0,0,0,.55);
  padding: 3px 7px;
  border-radius: 6px;
}
.play-card-thumb .pc-tag.t-pass { color: #86efac; }
.play-card-thumb .pc-tag.t-run  { color: #fdba74; }
.play-card-thumb .pc-tag.t-nip  { color: #cbd5e1; }

.play-card-body {
  padding: 11px 13px;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
}
.play-card-idx { display: none; }          /* number now lives over the thumb */
.play-card-name { font-size: 14px; }
.play-card-meta { font-size: 10.5px; }

.play-card-grip {
  position: absolute;
  top: 6px; left: 6px;                     /* live over the thumb */
  background: rgba(0,0,0,.4);
  border-radius: 4px;
  z-index: 2;
}

/* New-play tile in the grid */
.play-card-add {
  border: 1.5px dashed var(--border-light);
  background: transparent;
  border-radius: var(--radius-sm);
}
.play-card-add:hover { border-color: var(--accent); color: var(--accent); }

/* ── Editor (facelift) ──────────────────────────────────────────────────── */
#view-editor { background: var(--bg-0); }

/* Tool rail becomes a floating bottom-center pill. The existing markup
   (#tool-rail > .tr-group/.tr-sep/.tr-btn) is preserved — only the
   container orientation + position change.
   SCOPED to desktop: the mobile editor (the complementary
   max-width:768px / max-height:500px query) lays the dock out as stacked
   bottom bands, and these unconditional #tool-rail rules would otherwise
   leak in and override it (equal specificity, later source order). */
@media (min-width: 769px) and (min-height: 501px) {
#tool-rail {
  position: absolute;
  /* Sit above the prev/next play-nav arrows (bottom 14px + 44px button +
     ~14px gap) so the two floating clusters don't collide. */
  bottom: 76px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  max-width: calc(100% - 32px);
  flex-direction: row;
  align-items: center;
  gap: 4px;
  background: color-mix(in srgb, var(--bg-2) 96%, transparent);
  border: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  z-index: 20;
  box-shadow: 0 14px 40px rgba(0,0,0,.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
#tool-rail .tr-group {
  flex-direction: row;
  width: auto;
  padding: 0;
  gap: 2px;
}
/* The collapse handle is a mobile-only affordance — the desktop dock is a
   floating pill that never needs tucking away. */
.tool-collapse { display: none; }
#tool-rail .tr-sep {
  width: 1px; height: 24px;
  margin: 0 4px;
  background: var(--border-light);
}
#tool-rail .tr-btn {
  width: 38px; height: 38px;
  border-radius: 9px;
}
#tool-rail .tr-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 4px 14px var(--accent-glow);
}

/* Secondary dock group — less-frequent tools rendered slightly muted so
   the primary mode row reads as the main affordance. */
#tool-rail .tr-group-secondary .tr-btn {
  width: 32px; height: 32px;
  border-radius: 7px;
  color: var(--fg-2);
}
#tool-rail .tr-group-secondary .tr-btn svg { width: 14px; height: 14px; }
#tool-rail .tr-group-secondary .tr-btn:hover { color: var(--fg-0); }
}  /* end desktop-only #tool-rail block */

/* ── On-field SELECTED pill ───────────────────────────────────────────────
   Sits over the top-left corner of the field whenever a player is picked,
   echoing their color/label so the coach knows what they're editing even
   when the inspector is off-screen or collapsed. */
.field-selected-pill {
  position: absolute;
  top: 12px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid #34d399;
  background: rgba(52, 211, 153, 0.14);
  color: #34d399;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  z-index: 25;
  pointer-events: none;
  animation: pmxFade .16s ease;
}
.field-selected-pill.hidden { display: none; }
.field-selected-pill .fsp-label { color: var(--fg-0); font-weight: 800; }
.field-selected-pill .fsp-sep   { opacity: .55; }

/* ── Player inspector identity header ─────────────────────────────────────
   Replaces the old "Tools" handle's mode-button row with a clean header
   echoing the design: ringed avatar + position name + meta. */
.pi-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px 8px;
}
.pi-identity.hidden { display: none; }
.pi-identity-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--bg-4);
  display: grid;
  place-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
  background: var(--bg-1);
  letter-spacing: -.02em;
}
.pi-identity-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.pi-identity-name {
  font-family: 'Hanken Grotesk', sans-serif;
  font-weight: 800;
  font-size: 14px;
  color: var(--fg-0);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pi-identity-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--fg-3);
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* ── Route preset grid ───────────────────────────────────────────────────
   Visible 3-col grid of named preset buttons. Mirrors the design's "ROUTE
   PRESET" row. Active preset gets the accent treatment. */
.pi-preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-top: 4px;
}
.pi-preset-btn {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--bg-4);
  border-radius: 8px;
  background: var(--bg-1);
  color: var(--fg-1);
  font-family: 'Hanken Grotesk', sans-serif;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .12s, border-color .12s, color .12s;
}
.pi-preset-btn:hover {
  border-color: var(--accent);
  color: var(--fg-0);
}
.pi-preset-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.pi-preset-empty {
  font-size: 11px;
  color: var(--fg-3);
  padding: 6px 2px;
  font-style: italic;
}

/* Curved-route checkbox lives inline with the Label input — small + tidy. */
.pi-curved-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--fg-1);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.pi-curved-toggle input[type="checkbox"] {
  width: 13px; height: 13px;
  accent-color: var(--accent);
  cursor: pointer;
}
.pi-label-input { flex: 1 1 auto; min-width: 0; }
.pi-row-wrap { flex-wrap: wrap; }

/* Empty state — shown when no player is selected. */
.pi-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 12px 14px;
  color: var(--fg-3);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.pi-empty.hidden { display: none; }
.pi-empty svg { color: var(--bg-4); }

/* Light-touch editor restyle — the field canvas geometry is owned by
   Fabric.js and assets/js/designer.js. Don't force aspect-ratio or
   max-width here or the canvas will end up the wrong size. */
#editor-center {
  background: radial-gradient(circle at 50% 40%, #0c1219, #080b0f);
}
#editor-center #canvas-wrap { padding-bottom: 144px; } /* room for floating toolbar + play-nav arrows */

/* ── Editor chrome row ─────────────────────────────────────────────────────
   Sits directly under the global topbar in the editor view only. Carries
   back arrow / play# / title+subtitle / category·type pill / Saved /
   History / Save. Outside the editor it is collapsed to display:none. */
.editor-chrome { display: none; }
body.in-editor .editor-chrome {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px clamp(14px, 3vw, 24px);
  background: var(--bg-1);
  border-bottom: 1px solid var(--bg-4);
  flex: 0 0 auto;
  animation: pmxFade .18s ease;
  position: relative;
  z-index: 5;
}
.editor-chrome .ec-back {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid var(--bg-4);
  border-radius: 9px;
  background: var(--bg-2);
  color: var(--fg-1);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .12s, color .12s, border-color .12s;
}
.editor-chrome .ec-back:hover {
  background: var(--bg-3);
  color: var(--fg-0);
  border-color: var(--accent);
}
.editor-chrome .ec-number {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 18px;
  color: var(--accent);
  letter-spacing: .02em;
  flex-shrink: 0;
  min-width: 24px;
}
.editor-chrome .ec-title-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
  gap: 2px;
}
.editor-chrome .ec-title {
  margin: 0;
  font-family: 'Hanken Grotesk', sans-serif;
  font-weight: 800;
  font-size: 18px;
  color: var(--fg-0);
  letter-spacing: -.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.15;
}
.editor-chrome .ec-subtitle {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: .03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.editor-chrome .ec-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 7px;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .06em;
  flex-shrink: 0;
  line-height: 1.2;
}
.editor-chrome .ec-meta-pill .ec-pill-cat { color: #34d399; }
.editor-chrome .ec-meta-pill.cat-defense .ec-pill-cat { color: #f87171; }
.editor-chrome .ec-meta-pill.cat-special .ec-pill-cat { color: #fcd34d; }
.editor-chrome .ec-meta-pill .ec-pill-sep { color: var(--fg-3); }
.editor-chrome .ec-meta-pill .ec-pill-type { color: var(--fg-1); }
.editor-chrome .ec-spacer { flex: 1 1 auto; min-width: 8px; }
.editor-chrome #save-indicator {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--fg-3);
  flex-shrink: 0;
  min-width: 64px;
  text-align: right;
  margin-right: 0;
}
.editor-chrome .ec-history,
.editor-chrome .ec-save {
  height: 36px;
  border-radius: 9px;
  font-weight: 700;
  padding: 0 14px;
  flex-shrink: 0;
}

/* Mobile: tighter spacing, drop the History button (less critical on a
   small screen — coach can use the avatar menu later if we expose it). */
@media (max-width: 720px) {
  body.in-editor .editor-chrome {
    gap: 8px;
    padding: 8px 12px;
  }
  body.in-editor .editor-chrome .ec-history { display: none; }
  body.in-editor .editor-chrome .ec-number { font-size: 16px; min-width: 20px; }
  body.in-editor .editor-chrome .ec-title { font-size: 15px; }
  body.in-editor .editor-chrome .ec-subtitle { font-size: 10px; }
  body.in-editor .editor-chrome .ec-meta-pill { font-size: 9px; padding: 4px 8px; }
  body.in-editor .editor-chrome #save-indicator { display: none; }
}

/* Route inspector — repurpose the route-segment panel as a right-side
   "inspector" on desktop. (It's still hidden by default until a route is
   selected; we just give it a more deliberate panel look when shown.) */
.route-inspector {
  width: 290px;
  background: var(--bg-1);
  border-left: 1px solid var(--bg-4);
  border-right: none;
  border-top: none;
  border-bottom: none;
  border-radius: 0;
  padding: 18px;
}
@media (max-width: 720px) {
  .route-inspector {
    width: 100%;
    max-height: 46%;
    border-left: none;
    border-top: 1px solid var(--bg-4);
  }
  /* Only lift the dock above the route (segment-timing) inspector while it's
     actually open as a bottom sheet — otherwise the tool strip stays pinned
     to the field bottom. The nav/anim bands hide to keep the sheet clear. */
  #view-editor:has(.route-inspector:not(.hidden)) #tool-rail {
    bottom: calc(46% + 12px);
  }
  #view-editor:has(.route-inspector:not(.hidden)) #play-nav,
  #view-editor:has(.route-inspector:not(.hidden)) #anim-enable {
    display: none;
  }
}


/* ═══════════════════════════════════════════════════════════════════════════
   FACELIFT — Teams workspace
   ─────────────────────────────────────────────────────────────────────── */

/* Team detail container — stretch to full width, use the page padding token. */
.view-myteam {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0;                                   /* sub-header is sticky; body owns its padding */
  width: 100%;
  animation: pmxFade .25s ease;
}

/* Team sub-header — same sticky-blur treatment as the playbook detail. */
.view-myteam .subheader {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg-1) 94%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--bg-4);
  padding: 14px var(--pad);
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.view-myteam .subheader-color-dot {
  width: 9px; height: 9px; border-radius: 50%;
  flex-shrink: 0;
}
.view-myteam .subheader-title {
  font-size: 17px;
  font-weight: 800;
  max-width: 360px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.view-myteam .subheader-sub {
  font-size: 12px;
  color: var(--fg-3);
  margin-left: 0;
}

/* Segmented "Practices / Roster / Playbooks" pill — replaces the old myteam-tabs row. */
.myteam-segmented {
  display: inline-flex;
  gap: 3px;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: 10px;
  padding: 3px;
}
.myteam-seg {
  padding: 6px 13px;
  border: none;
  background: transparent;
  color: var(--fg-2);
  font-family: inherit;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  border-radius: 7px;
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.myteam-seg:hover { color: var(--fg-0); }
.myteam-seg.active {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  box-shadow: 0 4px 14px var(--accent-glow);
}
/* Hide the old myteam-tabs row — segmented pill lives in the sub-header now. */
.view-myteam .myteam-tabs { display: none; }

/* Mobile: as a single nowrap pill the (now 4-tab) control is wider than the
   viewport and forces horizontal page scroll. Give it its own full-width row
   with equal-width segments so every tab fits without scrolling. */
@media (max-width: 720px) {
  .view-myteam .subheader .vs-actions { width: 100%; margin-left: 0; flex-wrap: wrap; }
  .view-myteam .myteam-segmented { flex: 1 1 100%; width: 100%; }
  .view-myteam .myteam-seg {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    padding: 7px 2px;
    /* Five tabs now; "Attendance" is the widest label and only fits a 375px
       viewport in one row at this size. */
    font-size: 11px;
  }
}

/* Workspace grid — match the design (240 / 1fr / 280). */
.view-myteam .myteam-body { padding: var(--pad); }
.view-myteam .myteam-body-flush { padding: 0; }
.workspace-grid {
  grid-template-columns: 240px minmax(0, 1fr) 280px;
  gap: var(--gap);
  padding: var(--pad);
  align-items: start;
  max-width: 1280px;
  margin: 0 auto;
}

/* The three workspace columns are bare regions (no card wrapper) — the
   editor pane wraps itself in .ws-editor-card; the left/right rails are
   un-bordered groups of cards. */
.workspace-grid .ws-region {
  background: transparent;
  border: none;
  padding: 0;
  min-height: 0;
}

/* Left rail label + practice cards */
.ws-region-hd {
  border-bottom: none;
  padding: 0 2px 8px;
  margin-bottom: 6px;
}
.ws-region-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: .14em;
  color: var(--fg-3);
  text-transform: uppercase;
  font-weight: 600;
}
.ws-prac-list { gap: 8px; }
.ws-prac-row {
  display: block;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: 11px;
  transition: background .12s, border-color .12s, transform .12s;
}
.ws-prac-row:hover {
  background: var(--bg-3);
  border-color: var(--border-light);
  transform: translateY(-1px);
}
.ws-prac-row.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.ws-prac-row .ws-prac-row-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ws-prac-row-date {
  font-size: 14px;
  font-weight: 800;
  color: var(--fg-0);
  text-transform: none;
  letter-spacing: 0;
}
.ws-prac-row-name {
  font-size: 12px;
  color: var(--fg-2);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-prac-row.active .ws-prac-row-name { color: var(--fg-1); }
.ws-prac-row-meta {
  font-size: 11.5px;
  color: var(--fg-3);
  margin-top: 4px;
}
.ws-prac-row .btn-icon { opacity: 0; transition: opacity .12s; }
.ws-prac-row:hover .btn-icon { opacity: 1; }

/* "+ New practice" tile */
.ws-region .btn-primary.btn-sm,
.ws-region .ws-region-hd .btn-primary {
  /* Keep the "+ New" trigger compact in the rail header */
}

/* ── Editor pane wrapped as a single bordered card ────────────────────── */
.ws-editor-card {
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius);
  overflow: hidden;
}
.ws-editor-card-hd {
  padding: 16px 18px;
  border-bottom: 1px solid var(--bg-4);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.ws-editor-title-block {
  display: flex; flex-direction: column; gap: 2px;
}
.ws-editor-date-title {
  font-size: 17px; font-weight: 800;
  white-space: nowrap; color: var(--fg-0);
}
.ws-editor-subtitle { font-size: 12.5px; color: var(--fg-3); }
.ws-editor-clock {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; color: var(--fg-2);
}
.ws-clock-label { color: var(--fg-3); letter-spacing: .04em; }
.ws-clock-sep { width: 1px; height: 16px; background: var(--bg-4); }
.ws-clock-total { color: var(--accent); font-weight: 700; }
.ws-clock-end { color: var(--fg-2); }
.ws-sched-time {
  display: inline-flex; align-items: center; gap: 6px;
}
.ws-sched-time-input {
  width: 96px;
  padding: 4px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  background: var(--bg-1);
  border: 1px solid var(--bg-4);
  color: var(--fg-0);
}
.ws-editor-actions { display: flex; gap: 4px; flex-shrink: 0; }
.ws-editor-card-body {
  padding: 14px 18px;
  display: flex; flex-direction: column; gap: 14px;
}

/* Add-block dashed footer */
.ws-editor-add-row { display: flex; gap: 8px; }
.ws-add-tile {
  flex: 1;
  padding: 11px;
  border-radius: 10px;
  border: 1.5px dashed var(--border-light);
  background: none;
  color: var(--fg-3);
  font-family: inherit; font-weight: 700; font-size: 13px;
  cursor: pointer;
  transition: border-color .12s, color .12s;
}
.ws-add-tile:hover { border-color: var(--accent); color: var(--accent); }

/* Schedule rows — single visible row, body collapses by default */
.prac-item-list { gap: 8px; }
.prac-item {
  display: block;                          /* override the old flex layout */
  padding: 0;
  background: transparent;
  border: none;
  border-left: none;
  border-radius: 0;
}
.prac-item-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  background: var(--bg-1);
  border: 1px solid var(--bg-4);
  border-radius: 11px;
  cursor: pointer;
  user-select: none;
  width: 100%; text-align: left;
  transition: border-color .12s, background .12s;
}
.prac-item-toggle:hover { border-color: var(--border-light); background: var(--bg-3); }
.prac-item.prac-item-expanded .prac-item-toggle {
  border-color: var(--accent);
  background: var(--bg-1);
  box-shadow: 0 0 0 1px var(--accent-soft);
}
.prac-item-toggle .prac-drag {
  flex-shrink: 0;
  color: var(--fg-3); font-size: 14px;
  padding: 0;
}
.prac-item-toggle .prac-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--fg-3);
  width: 78px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Kind pill (Play / Drill / Goal) */
.prac-kind-pill {
  flex-shrink: 0;
  font-size: 9px; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
}
.prac-kind-pill-play  { color: #86efac; background: rgba(134,239,172,.12); }
.prac-kind-pill-drill { color: #7dd3fc; background: rgba(125,211,252,.12); }
.prac-kind-pill-goal  { color: #fbbf24; background: rgba(251,191,36,.12); }

.prac-item-toggle .prac-item-main {
  flex: 1; min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
  color: var(--fg-0);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.prac-item-toggle .prac-item-hd {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.prac-item-toggle .prac-item-name {
  flex: 0 1 auto;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.prac-item-toggle .prac-title-input {
  flex: 1; min-width: 80px;
  background: transparent;
  border: 1px solid transparent;
  padding: 2px 6px;
  font-size: 14px;
  font-weight: 600;
}
.prac-item-toggle .prac-title-input:hover,
.prac-item-toggle .prac-title-input:focus {
  background: var(--bg-2);
  border-color: var(--bg-4);
}
.prac-item-toggle .prac-duration {
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; color: var(--fg-2);
  gap: 2px;
}
.prac-item-toggle .prac-duration-input {
  width: 40px;
  padding: 2px 4px;
  font-size: 12px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-2);
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
}
.prac-item-toggle .prac-duration-input:hover,
.prac-item-toggle .prac-duration-input:focus {
  background: var(--bg-2);
  border-color: var(--bg-4);
  color: var(--fg-0);
}
.prac-item-chev {
  font-size: 10px;
  color: var(--fg-3);
  transition: transform .15s ease;
  margin-left: 2px;
}
.prac-item.prac-item-expanded .prac-item-chev { transform: rotate(-180deg); }

.prac-item-body {
  display: none;
  padding: 12px 14px 14px;
  margin-top: 0;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-top: none;
  border-bottom-left-radius: 11px;
  border-bottom-right-radius: 11px;
  margin-left: 4px; margin-right: 4px;
}
.prac-item.prac-item-expanded .prac-item-body { display: block; }
.prac-item-body .prac-field-label { display: block; margin: 6px 0 4px; }
.prac-item-body .prac-textarea { width: 100%; }

/* ── Right rail — library card ──────────────────────────────────────────── */
.workspace-grid .ws-region.ws-library {
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
}
.workspace-grid .ws-library .ws-region-hd {
  padding: 12px 14px;
  border-bottom: 1px solid var(--bg-4);
  margin-bottom: 0;
}
.workspace-grid .ws-library .ws-region-title {
  font-family: inherit;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-0);
}
.workspace-grid .ws-library .ws-lib-tabs {
  display: flex;
  border-bottom: 1px solid var(--bg-4);
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin: 0;
}
.workspace-grid .ws-library .ws-lib-tab {
  flex: 1;
  padding: 11px 0;
  border: none;
  background: none;
  color: var(--fg-3);
  font-family: inherit;
  font-weight: 600;
  font-size: 12.5px;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.workspace-grid .ws-library .ws-lib-tab:hover { color: var(--fg-1); }
.workspace-grid .ws-library .ws-lib-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 700;
}
.workspace-grid .ws-library .ws-lib-search {
  margin: 10px 12px 0;
  width: calc(100% - 24px);
}
.workspace-grid .ws-library .ws-library-list {
  padding: 8px 8px 4px;
  max-height: 56vh;
}
.workspace-grid .ws-library .ws-lib-new {
  margin: 8px 12px 12px;
  width: calc(100% - 24px);
}

@media (max-width: 1100px) {
  /* minmax(0, ...), not plain 1fr: a bare `1fr` track floors at min-content,
     so the schedule rows (fixed-width time / pill / duration children) pushed
     the column to ~478px inside a 367px viewport and the whole workspace
     scrolled sideways with the notes clipped off the edge. */
  .workspace-grid {
    grid-template-columns: minmax(0, 1fr);
    padding: var(--pad);
  }

  /* The attendance roster kept its 360px inner scroller on phones (the other
     two rails are reset above; this one was missed). A nested scroll region
     sitting directly above "Overall notes" swallows the page-scroll gesture,
     which made the notes very hard to reach. Let it grow and scroll the page. */
  .att-list { max-height: none; }

  /* Let a schedule row wrap: the play/goal title moves to its own full-width
     line instead of being squeezed to ~80px between the fixed-width chips. */
  .prac-item-toggle { flex-wrap: wrap; gap: 8px; }
  .prac-item-toggle .prac-item-main {
    order: 10;
    flex: 1 0 100%;
    white-space: normal;
    overflow: visible;
  }
  .prac-item-toggle .prac-item-hd { width: 100%; }
  .prac-item-toggle .prac-title-input { width: 100%; }
  .prac-item-toggle .prac-item-name { white-space: normal; }
}


/* ═══════════════════════════════════════════════════════════════════════════
   FACELIFT — Share + Invite modals
   ─────────────────────────────────────────────────────────────────────── */

/* Backdrop: deeper scrim + blur. */
.modal-backdrop {
  background: rgba(4, 7, 11, .66);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Generic .modal restyle (applies to all modals — most existing modals had
   16px padding + 8px radius; bump to roomier 18px radius + slide-up entrance). */
.modal {
  border-radius: 18px;
  box-shadow: 0 36px 90px rgba(0,0,0,.62);
  border: 1px solid var(--border-light);
  background: var(--bg-2);
  padding: 0;                                /* sections own their padding now */
  animation: pmxSheet .22s ease;
}
.modal-share  { max-width: 466px; }
.modal-invite { max-width: 420px; }

/* Plain modals (New Playbook, New Coach, team / drill / goal editors, wide
   list modals, …) predate the section-based Share/Invite layout: their <h3>
   and .form-group children sit directly inside .modal with no .modal-body
   wrapper. The padding:0 above is meant for the section modals only — without
   this, plain modals jam their title and fields against the edges. Restore the
   classic inner padding + footer for any modal that doesn't use the new
   .modal-header structure. */
.modal:not(:has(.modal-header)) { padding: 22px; }
.modal:not(:has(.modal-header)) > .modal-footer {
  padding: 16px 0 0;
  margin-top: 22px;
  justify-content: flex-end;
}

/* Modal header — icon tile + title + subtitle + close button */
.modal-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--bg-4);
}
.modal-header-icon {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid; place-items: center;
}
.modal-header-text { flex: 1; min-width: 0; }
.modal-header-text h3 {
  font-size: 17px;
  font-weight: 800;
  color: var(--fg-0);
  margin: 0;
  line-height: 1.25;
}
.modal-header-sub {
  font-size: 13px;
  color: var(--fg-2);
  margin: 4px 0 0;
  line-height: 1.4;
}
.modal-close {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--bg-4);
  background: var(--bg-3);
  color: var(--fg-2);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
}
.modal-close:hover { color: var(--fg-0); background: var(--bg-4); }

.modal-body { padding: 16px 18px; }

.modal-section-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 600;
  margin-bottom: 10px;
}
.modal-section-count {
  margin-left: auto;
  background: var(--bg-3);
  border: 1px solid var(--bg-4);
  border-radius: 20px;
  padding: 2px 9px;
  font-size: 11px;
  color: var(--fg-2);
  letter-spacing: 0;
}
.modal-section-sub {
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0;
  color: var(--fg-3);
  text-transform: none;
  font-weight: 500;
  margin-left: 4px;
}

/* Footer with separator */
.modal .modal-footer {
  padding: 12px 18px 14px;
  border-top: 1px solid var(--bg-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 0;
}
.modal-footer-link {
  background: none;
  border: none;
  color: var(--accent);
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  padding: 8px 0;
}
.modal-footer-link:hover { text-decoration: underline; }

/* People-with-access list */
.share-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.share-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-1);
  border: 1px solid var(--bg-4);
  border-radius: 12px;
  transition: border-color .12s;
}
.share-row:hover { border-color: var(--border-light); }
.share-row-owner { border-color: var(--bg-4); }
.share-avatar {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--bg-3);
  color: #fff;
  display: grid; place-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 12px;
}
.share-avatar-owner {
  background: var(--bg-3);
  border: 2px solid var(--accent);
  color: var(--fg-0);
}
.share-row-info { flex: 1; min-width: 0; }
.share-row-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--fg-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.share-row-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--fg-3);
  margin-top: 2px;
}
.share-pill {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
}
.share-pill-owner {
  color: var(--accent);
  background: var(--accent-soft);
}
.share-pill-pending {
  color: var(--warn);
  background: rgba(251, 191, 36, .14);
}
.share-row-remove {
  flex-shrink: 0;
  width: 32px; height: 32px;
  background: var(--bg-3);
  border: 1px solid var(--bg-4);
  color: var(--fg-3);
  border-radius: 8px;
  display: grid; place-items: center;
  cursor: pointer;
}
.share-row-remove:hover { color: var(--danger); border-color: var(--danger); background: rgba(239,68,68,.08); }

.share-add-row {
  display: flex; gap: 8px;
  margin-top: 10px;
}
.share-add-row .form-input { flex: 1; }
.share-add-row .btn { flex-shrink: 0; }

/* "Send an independent copy instead" collapsible */
.share-copy-disclosure {
  border-top: 1px solid var(--bg-4);
  margin-top: 16px;
  padding-top: 14px;
}
.share-copy-disclosure summary {
  list-style: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--fg-1);
  display: flex; align-items: center; gap: 8px;
}
.share-copy-disclosure summary::-webkit-details-marker { display: none; }
.share-copy-disclosure summary:hover { color: var(--fg-0); }
.share-copy-chev {
  transition: transform .15s ease;
  color: var(--fg-3);
}
.share-copy-disclosure[open] .share-copy-chev { transform: rotate(180deg); }

/* Invite modal */
.invite-link-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.invite-link-row .form-input {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--fg-1);
}
.invite-link-row .btn { flex-shrink: 0; min-width: 100px; }
.invite-link-foot {
  display: flex; align-items: center; gap: 6px;
  margin-top: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--fg-3);
}
.btn-copied {
  background: var(--ok) !important;
  border-color: var(--ok) !important;
  color: #04201c !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Scouting tier chips + mobile bottom nav
   ─────────────────────────────────────────────────────────────────────── */

/* Filter chip row above the coach grid. "All coaches" + one per distinct
   coach.tier value. Sits below the sticky sub-header. */
.tier-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px clamp(14px, 4vw, 28px) 0;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}
.tier-chip {
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-2);
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: 18px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}
.tier-chip:hover {
  color: var(--fg-0);
  border-color: var(--accent);
}
.tier-chip.active {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

/* ── Mobile bottom nav ───────────────────────────────────────────────────
   Section switcher for ≤720px. Hidden by default on desktop and in the
   editor; shown only at the breakpoint where the desktop pill collapses. */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 40;
  background: var(--bg-1);
  border-top: 1px solid var(--bg-4);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  justify-content: space-around;
  align-items: stretch;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, .45);
}
.mbn-btn {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  background: none;
  border: none;
  color: var(--fg-2);
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  border-radius: 10px;
  transition: color .12s, background .12s;
  -webkit-tap-highlight-color: transparent;
}
.mbn-btn:hover { color: var(--fg-1); }
.mbn-btn.active {
  color: var(--accent);
}
.mbn-btn.active svg { stroke: var(--accent); }

@media (max-width: 720px) {
  body:not(.in-editor) .mobile-bottom-nav { display: flex; }

  /* Clearance has to sit on the SCROLLING element, not on #stage. Both views
     below are `position: absolute; inset: 0`, so their containing block is
     #stage's PADDING box — padding on #stage neither shrinks them nor adds
     scrollable space, and the last thing in a view (the practice editor's
     "Overall notes" box) ended up underneath the fixed bar with no way to
     scroll it clear. On a phone with a home indicator the bar is roughly
     twice as tall as env(safe-area-inset-bottom) suggests on desktop, so the
     inset stays in the calc. */
  body:not(.in-editor) #dynamic-view,
  body:not(.in-editor) #view-filmroom {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Film Room (SPA view) — pickers + side-by-side / overlay stage + coaching
   point note. Reuses .view-subheader for the top chrome row so the back
   button / title / meta / right-cluster look identical to playbook detail.
   ─────────────────────────────────────────────────────────────────────── */

#view-filmroom {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  background: var(--bg-0);
}

.view-filmroom {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 clamp(14px, 4vw, 28px) 28px;
  box-sizing: border-box;
  flex: 1;
  min-height: 0;
  animation: pmxFade .2s ease;
}
.view-filmroom .view-subheader { padding-left: 0; padding-right: 0; }

/* Mode pill — mirrors the segmented Side-by-side / Overlay control from
   the standalone print page so the affordance reads the same in both. */
.fr-mode-pill {
  display: inline-flex;
  gap: 3px;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: 10px;
  padding: 3px;
}
.fr-mode-pill button {
  border: 0;
  height: 28px;
  padding: 0 12px;
  background: transparent;
  color: var(--fg-1);
  border-radius: 7px;
  font: inherit;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.fr-mode-pill button:hover { color: var(--fg-0); }
.fr-mode-pill button.active {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 4px 14px var(--accent-glow);
}

/* Stage — side-by-side defaults to 2 columns; overlay mode collapses to 1. */
.fr-stage {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr 1fr;
  margin-top: 18px;
  flex: 1;
  min-height: 0;
}
.fr-stage[data-mode="overlay"] {
  grid-template-columns: 1fr;
}
.fr-stage[data-mode="overlay"] .fr-pane-ours .fr-canvas-wrap { display: none; }
.fr-stage[data-mode="overlay"] .fr-pane-ours .fr-pane-eyebrow { color: var(--accent); }
.fr-stage.fr-swapped { direction: rtl; }
.fr-stage.fr-swapped > .fr-pane { direction: ltr; }

.fr-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.fr-pane-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.fr-pane-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: .14em;
  font-weight: 700;
  text-transform: uppercase;
}
.fr-eyebrow-their { color: #f97316; }
.fr-eyebrow-ours  { color: var(--accent); }

.fr-pane-pickers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.fr-pane-pickers select {
  height: 34px;
  padding: 0 10px;
  background: var(--bg-1);
  color: var(--fg-0);
  border: 1px solid var(--bg-4);
  border-radius: 9px;
  font: inherit;
  font-weight: 500;
  font-size: 13px;
  min-width: 0;
}
.fr-pane-pickers select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.fr-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 800 / 540;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.fr-canvas-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}
.fr-overlay-canvas { opacity: .58; }
.fr-stage[data-mode="side"] .fr-overlay-canvas { display: none; }
.fr-canvas-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--fg-2);
  font-style: italic;
  pointer-events: none;
}
.fr-canvas-empty.hidden { display: none; }

/* Coaching-point card — pinned beneath the stage, autosaves on input. */
.fr-coaching {
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fr-coaching-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.fr-coaching-icon {
  width: 26px; height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--accent-ink);
  background: var(--accent);
  box-shadow: 0 4px 12px var(--accent-glow);
}
.fr-coaching-title {
  font-family: 'Hanken Grotesk', sans-serif;
  font-weight: 800;
  font-size: 14px;
  color: var(--fg-0);
}
.fr-coaching-meta {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--fg-3);
}
.fr-note-input {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  background: var(--bg-1);
  border: 1px solid var(--bg-4);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--fg-0);
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  box-sizing: border-box;
}
.fr-note-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

@media (max-width: 720px) {
  .fr-stage { grid-template-columns: 1fr; }
  .fr-pane-pickers { grid-template-columns: 1fr 1fr; }
}

