:root {
  --navy: #1a2744;
  --rail: #141e36;
  --chalk: #f3efe2;
  --chalk-dim: #c9c0ae;
  --amber: #e0a106;
  --ink: #142033;
  --turf-a: #237844;
  --turf-b: #1c693b;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--navy);
  color: var(--chalk);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

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

button {
  background: transparent;
  border: 1px solid rgba(243, 239, 226, 0.35);
  border-radius: 2px;
  padding: 8px 12px;
  cursor: pointer;
}

button:hover { border-color: var(--chalk); }

button:disabled {
  opacity: 0.4;
  cursor: default;
}

button:focus-visible, input:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100%;
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--rail);
  border-right: 1px solid rgba(243, 239, 226, 0.12);
  padding: 18px 14px 14px;
}

.rail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.brand {
  margin: 0;
  font-family: "Avenir Next Condensed", "Avenir Next", sans-serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
}

.rail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.pick-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  position: sticky;
  bottom: 0;
  z-index: 2;
  flex: 0 0 auto;
  background: var(--rail);
}

.pick-bar[hidden] { display: none; }

#pick-edit-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  align-items: center;
}

#pick-edit-panel[hidden] { display: none; }

#pick-edit-cats { display: flex; flex-wrap: wrap; gap: 6px; }

.pick-bar button { padding: 4px 8px; font-size: 13px; }

.pick-cat {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--chalk-dim);
  font-size: 13px;
}

.pick-cat input {
  width: 72px;
  background: var(--navy);
  color: var(--chalk);
  border: 1px solid rgba(243, 239, 226, 0.35);
  border-radius: 2px;
  padding: 4px 6px;
}

.team-box {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(243, 239, 226, 0.12);
}

.practice-add { width: 100%; margin: 8px 0; }

.practice-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 2px;
  font-size: 14px;
}

.practice-row button {
  border: 0;
  background: transparent;
  color: var(--chalk-dim);
  padding: 4px 6px;
}

.team-box summary {
  cursor: pointer;
  color: var(--chalk-dim);
  font-size: 14px;
}

.team-box .logo-row,
.team-box .save-note,
.team-box .file-actions { margin-left: 0; margin-right: 0; }

#side-select {
  width: 100%;
  margin: 0 0 10px;
  background: var(--navy);
  border: 1px solid rgba(243, 239, 226, 0.35);
  border-radius: 2px;
  padding: 8px;
}

.team-label {
  display: block;
  margin: 0 0 6px;
  color: var(--chalk-dim);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.team-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 12px;
}

#team-select {
  width: 100%;
  background: var(--navy);
  border: 1px solid rgba(243, 239, 226, 0.35);
  border-radius: 2px;
  padding: 8px;
}

.team-row #team-select { flex: 1; width: auto; }

#team-name-field { margin-bottom: 12px; }

.new-team {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.new-team .team-label,
.new-team .print-label,
.new-team .tools { flex: 1 0 100%; }

.new-team[hidden] { display: none; }

.new-team input {
  flex: 1;
  min-width: 0;
  background: var(--navy);
  border: 1px solid rgba(243, 239, 226, 0.35);
  border-radius: 2px;
  padding: 8px;
}

.roster { margin: 4px 0 12px; }

.roster-form {
  display: flex;
  gap: 6px;
}

.roster-form input {
  flex: 1;
  min-width: 0;
  background: var(--navy);
  border: 1px solid rgba(243, 239, 226, 0.35);
  border-radius: 2px;
  padding: 8px;
}

.roster-hint {
  margin: 6px 0;
  color: var(--chalk-dim);
  font-size: 12px;
}

.roster-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.roster-chip {
  display: inline-flex;
  align-items: center;
  background: var(--navy);
  border: 1px solid rgba(243, 239, 226, 0.35);
  border-radius: 2px;
}

.roster-drag {
  padding: 4px 2px 4px 8px;
  cursor: grab;
  touch-action: none;
}

.roster-chip [data-roster-remove] {
  width: 22px;
  height: 22px;
  color: var(--chalk-dim);
}

.roster-ghost {
  position: fixed;
  z-index: 30;
  pointer-events: none;
  background: var(--amber);
  color: #1a1404;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 2px;
}

.roster-ghost[hidden] { display: none; }

.player.is-drop circle { stroke: #e0a106; }

.book-switch {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin: 4px 0 12px;
}

.book-switch button { padding: 8px 2px; font-size: 13px; line-height: 1.15; white-space: normal; }

#book-offense,
#book-defense { font-size: 18px; font-weight: 700; }

.book-switch button[aria-pressed="true"] {
  background: var(--amber);
  border-color: var(--amber);
  color: #1a1403;
  font-weight: 700;
}

#new-team { width: 100%; margin-bottom: 8px; }

#account-open {
  width: auto;
  margin: 0;
  padding: 4px 8px;
  font-size: 13px;
}

.account-line {
  margin: -2px 0 10px;
  color: var(--amber);
  font-size: 13px;
  word-break: break-all;
}

.account-line[hidden] { display: none; }

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.category-filters[hidden] { display: none; }

.category-colors {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 14px 0;
}

.category-colors[hidden],
#print-coding[hidden],
#print-tree-options[hidden] { display: none; }

.tree-cover ul {
  margin: 0.35in 0 0;
  padding: 0;
  list-style: none;
}

.tree-cover li {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
}

#category-color-row,
#group-color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

#category-color-row button[data-cat-color="auto"],
#group-color-row button[data-cat-color="auto"] {
  padding: 4px 8px;
  font-size: 13px;
}

#category-color-row button:not([data-cat-color="auto"]),
#group-color-row button:not([data-cat-color="auto"]) {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
}

#category-color-row button[aria-pressed="true"],
#group-color-row button[aria-pressed="true"] {
  border-color: var(--chalk);
}

.category-filters button {
  padding: 4px 8px;
  font-size: 14px;
}

.category-filters button[aria-pressed="true"] {
  background: var(--amber);
  border-color: var(--amber);
  color: #1a1403;
  font-weight: 700;
}

.category-editor {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.category-editor[hidden] { display: none; }

.cat-line {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cat-line input {
  flex: 1;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid rgba(243, 239, 226, 0.28);
  background: transparent;
  color: var(--chalk);
  font-size: 14px;
  padding: 2px 0;
}

.cat-label { flex: 1; min-width: 0; }

.cat-grip, .cat-info, .cat-delete {
  border: 0;
  background: transparent;
  color: var(--chalk);
  padding: 2px 6px;
}

.playbook-switch, .playbook-new, .invite-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
}

.playbook-switch select,
.playbook-new input,
.invite-form input,
.invite-form select {
  flex: 1;
  min-width: 7rem;
  background: var(--navy);
  color: var(--chalk);
  border: 1px solid rgba(243, 239, 226, 0.35);
  border-radius: 2px;
  padding: 6px 8px;
}

.shelf-label {
  margin: 12px 0 0;
  color: var(--chalk-dim);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.play-list {
  overflow: auto;
  flex: 1;
  margin-top: 6px;
  min-height: 0;
}

.playbook-list {
  flex: 0 1 42%;
  min-height: 72px;
  border: 1px dashed rgba(243, 239, 226, 0.28);
  border-radius: 4px;
  padding: 4px;
}

.playbook-list.is-drop { border-color: var(--amber); }

.shelf-empty {
  margin: 8px 4px;
  color: var(--chalk-dim);
  font-size: 13px;
}

#play-list .play-row { grid-template-columns: 28px 28px minmax(0, 1fr) auto auto auto; }

#play-gallery {
  width: 100%;
  margin-top: 8px;
}

.play-list.is-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-content: start;
}

.play-list.is-gallery .play-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border: 1px solid rgba(243, 239, 226, 0.16);
}

.play-list.is-gallery .play-open {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  white-space: normal;
  text-align: left;
}

.play-list.is-gallery .print-field {
  width: 100%;
  height: auto;
}

.play-list.is-gallery .play-pick {
  align-self: flex-start;
  margin: 6px 6px 0;
}

.play-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  border-top: 1px solid rgba(243, 239, 226, 0.12);
}

.play-list.is-ordering .play-row,
.play-list.is-picking .play-row { grid-template-columns: 28px 1fr auto auto; }

.play-pick {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin: 0 auto;
  padding: 0;
  border: 1px solid var(--chalk-dim);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  line-height: 1;
}

.play-pick[aria-checked="true"] {
  background: var(--amber);
  border-color: var(--amber);
}

.play-pick[aria-checked="true"]::after { content: "✓"; }

.group-use { flex: 0 0 auto; }
.group-use[aria-pressed="true"] { background: var(--amber); color: var(--ink); border-color: var(--amber); }

.play-info {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--chalk);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  font-style: italic;
  font-weight: 700;
  padding: 8px 6px;
}

.play-band {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--amber);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 4px;
}

.play-band[aria-pressed="false"] { color: var(--chalk-dim); font-weight: 600; }

.play-row:has(.play-band[aria-pressed="false"]) .play-open { opacity: 0.45; }

.play-grip {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--chalk-dim);
  font-size: 16px;
  line-height: 1;
  padding: 8px 0;
  cursor: grab;
}

.play-row.is-order-target { background: rgba(242, 193, 78, 0.16); }

.play-row.is-active { box-shadow: inset 3px 0 0 var(--amber); }

.play-cat {
  display: block;
  color: var(--chalk-dim);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.play-open, .play-delete {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.play-open {
  text-align: left;
  padding: 10px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-num {
  display: inline-block;
  min-width: 1.5em;
  margin-right: 4px;
  color: var(--amber);
  font-weight: 700;
}

.play-num.is-colored,
.print-card-num.is-colored,
.scout-num.is-colored,
.print-page-num.is-colored,
.call-num.is-colored {
  display: inline-block;
  padding: 0 4px;
  border-radius: 2px;
  line-height: 1.15;
}

.play-row.is-active .play-open { font-weight: 700; }

.play-delete {
  width: 32px;
  height: 36px;
  color: var(--chalk-dim);
  font-size: 18px;
  line-height: 1;
}

.play-delete:hover { color: var(--chalk); }

.save-note {
  margin: 4px 18px 0;
  color: var(--chalk-dim);
  font-size: 13px;
}

.stage {
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
  min-height: 0;
}

.stage-head { flex: none; }

.command {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px 0;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.command-actions {
  display: flex;
  gap: 6px;
  flex: none;
}

.command-actions button { padding: 6px 10px; }

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 2px 14px 0;
}

.category-chips {
  flex: 1 0 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 0 4px;
}

.category-chips[hidden] { display: none; }

.category-chips button {
  border: 1px solid rgba(243, 239, 226, 0.35);
  border-radius: 999px;
  background: transparent;
  color: var(--chalk);
  padding: 2px 8px;
  font-size: 12px;
}

.canvas {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
}

.dock {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: 176px;
  flex: none;
  overflow: auto;
  padding: 8px 12px 12px 0;
}

#edit-categories, #edit-groups, #edit-formations { margin-top: 8px; flex: none; }

#dock-grip { cursor: grab; align-self: flex-start; }

.anim-window {
  position: fixed;
  z-index: 4;
  left: 16px;
  bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  max-width: 320px;
  padding: 8px;
  background: var(--rail);
  border: 1px solid rgba(243, 239, 226, 0.28);
}

.anim-window[hidden] { display: none; }

.anim-window.is-placed { bottom: auto; }

#anim-grip { cursor: grab; }

#anim-done {
  background: #237844;
  color: #f7f4ea;
  border-color: #237844;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

#anim-speeds { display: flex; flex-direction: column; gap: 4px; width: 100%; }
#anim-speeds[hidden] { display: none; }
.anim-speed-row { display: flex; gap: 4px; align-items: center; }
.anim-speed-row span { min-width: 1.6em; font-weight: 700; }

#tool-ghost {
  position: fixed;
  z-index: 6;
  pointer-events: none;
  transform: translate(-50%, -50%);
  padding: 6px 10px;
  background: var(--amber);
  color: var(--ink);
  font-weight: 700;
  border-radius: 2px;
}

#tool-ghost[hidden] { display: none; }

.dock.is-floating {
  position: fixed;
  z-index: 3;
  width: 196px;
  max-height: calc(100vh - 16px);
  background: var(--rail);
  border: 1px solid rgba(243, 239, 226, 0.28);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  padding: 8px;
}

.dock .tools { flex-wrap: wrap; gap: 4px; }

.tool-label {
  align-self: center;
  color: var(--chalk-dim);
  font-size: 12px;
}

#tree-custom[hidden],
#icon-colors[hidden],
#lineup-apply[hidden],
#opponent-forms[hidden],
#copy-to-row[hidden],
#segment-row[hidden],
#line-colors[hidden],
#pass-field[hidden],
#annotation-tools[hidden],
#tree-panel[hidden],
#tree-unlock[hidden] { display: none; }

@media (max-width: 700px) and (orientation: portrait) {
  #route-tree-templates { display: none; }
}

.pass-path {
  fill: none;
  stroke: #f7f4ea;
  stroke-width: 0.16;
  stroke-dasharray: 0.4 0.24;
}

.pass-path.is-selected { stroke: var(--amber); }

.pass-ball { fill: #f7f4ea; stroke: #6b4a2a; stroke-width: 0.06; }

.pass-ball.is-selected { fill: var(--amber); }

.pass-label {
  fill: #f7f4ea;
  font-size: 0.72px;
  font-family: "Avenir Next Condensed", "Avenir Next", sans-serif;
  font-weight: 700;
  text-anchor: middle;
}

body.is-light .pass-path { stroke: #1a2744; }
body.is-light .pass-label { fill: #1a2744; }

#segment-list { display: flex; flex-wrap: wrap; gap: 6px; }

.copy-to {
  display: flex;
  gap: 6px;
  margin: 0 0 8px;
}

.copy-to select { flex: 1; min-width: 0; }

.icon-swatch {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(243, 239, 226, 0.45);
}

.icon-swatch[aria-pressed="true"] { outline: 2px solid var(--amber); }

.dock .letter-field { width: 100%; }

.dock .name-field input { width: auto; flex: 1; min-width: 0; }

.dock button { padding: 4px 8px; font-size: 13px; }

.dock .letter-field:has(input:disabled),
#clear-route:disabled { display: none; }

#play-number {
  width: 52px;
  flex: none;
  border: 0;
  border-bottom: 2px solid rgba(243, 239, 226, 0.45);
  background: transparent;
  font-family: "Avenir Next Condensed", "Avenir Next", sans-serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  padding: 0 0 2px;
}

#play-name {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-family: "Avenir Next Condensed", "Avenir Next", sans-serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
}

#play-name::placeholder { color: rgba(243, 239, 226, 0.35); }

#play-note {
  flex: 1 1 180px;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid rgba(243, 239, 226, 0.28);
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.35;
  padding: 4px 0 2px;
  resize: none;
  overflow: hidden;
}

#play-note::placeholder { color: rgba(243, 239, 226, 0.35); }

#play-group,
#play-category {
  flex: 0 1 180px;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid rgba(243, 239, 226, 0.28);
  background: transparent;
  font-size: 16px;
  padding: 4px 0 2px;
}

#play-group::placeholder,
#play-category::placeholder { color: rgba(243, 239, 226, 0.35); }

#lineup-list { display: flex; flex-wrap: wrap; gap: 4px; }
#lineup-list:empty { display: none; }
.lineup-chip { display: inline-flex; align-items: center; flex-wrap: wrap; }
.lineup-note {
  flex-basis: 100%;
  color: var(--chalk-dim);
  font-size: 12px;
  line-height: 1.2;
}
.lineup-start {
  border: 0;
  background: transparent;
  color: var(--chalk);
  padding: 4px 4px 4px 6px;
  font-size: 12px;
}
.lineup-remove {
  border: 0;
  background: transparent;
  color: var(--chalk-dim);
  padding: 4px;
  font-size: 16px;
  line-height: 1;
}

.group-sits {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 14px 0;
}
.group-sits[hidden] { display: none; }
.group-sits-label {
  align-self: center;
  color: var(--chalk-dim);
  font-size: 13px;
}
.group-sits button { padding: 4px 8px; font-size: 14px; }
.group-sits button[aria-pressed="true"] {
  background: var(--amber);
  border-color: var(--amber);
  color: #1a1403;
  font-weight: 700;
}

.tools, .file-actions {
  display: flex;
  gap: 8px;
  flex: none;
}

#new-play-pick { flex-wrap: wrap; align-items: center; }

.print-go {
  background: var(--amber);
  color: var(--ink);
  border-color: var(--amber);
  font-weight: 700;
}

.print-setup {
  position: absolute;
  z-index: 4;
  top: 8px;
  right: 12px;
  bottom: 12px;
  width: min(420px, calc(100% - 24px));
  margin: 0;
  padding: 14px;
  overflow: auto;
  background: var(--rail);
  border: 1px solid rgba(243, 239, 226, 0.35);
  box-shadow: -12px 0 32px rgba(0, 0, 0, 0.35);
}

.print-setup[hidden],
#print-scout-options[hidden],
#print-playbook-options[hidden],
#print-diagram-options[hidden],
#print-sheet-options[hidden],
#print-look[hidden],
#print-detail[hidden] { display: none; }

#print-setup [aria-label="What to print"] { flex-wrap: wrap; }

.share-code {
  margin: 8px 0 0;
  font-family: "Avenir Next Condensed", "Avenir Next", sans-serif;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--amber);
}

#share-input { width: 140px; letter-spacing: 0.14em; }

#share-make[hidden] { display: none; }

.print-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 1;
  margin: -14px -14px 12px;
  padding: 14px;
  background: var(--rail);
}

.print-head .print-go { flex: none; }

.print-title {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-family: "Avenir Next Condensed", "Avenir Next", sans-serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

#print-categories[hidden],
#print-groups[hidden],
#print-books[hidden],
#team-field[hidden],
#team-personal[hidden],
#play-notes[hidden] { display: none; }

.print-label {
  margin: 10px 0 6px;
  color: var(--chalk-dim);
  font-size: 14px;
}

.print-note {
  margin: 10px 0;
  font-size: 14px;
}

.letter-field {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--chalk-dim);
  font-size: 14px;
  flex: none;
}

.letter-field input {
  width: 52px;
  background: var(--navy);
  border: 1px solid rgba(243, 239, 226, 0.35);
  border-radius: 2px;
  padding: 8px;
  text-align: center;
  font-weight: 700;
}

.letter-field input:disabled { opacity: 0.4; }

.name-field input {
  width: 120px;
  text-align: left;
}

#clear-route,
#remove-route {
  min-width: 36px;
  font-size: 18px;
  line-height: 1;
}

#remove-route svg { display: block; }

#clear-route:not(:disabled) {
  color: #dc2626;
  border-color: #dc2626;
}

#route-done {
  margin-left: 4px;
  font-size: 18px;
  line-height: 1;
}

#route-done:not(:disabled) {
  background: #237844;
  color: #f7f4ea;
  border-color: #237844;
  font-weight: 700;
}

.tools button[aria-pressed="true"],
#words[aria-pressed="true"] {
  background: var(--amber);
  color: var(--ink);
  border-color: var(--amber);
  font-weight: 700;
}


.hint {
  margin: 6px 14px 0;
  color: var(--chalk-dim);
  font-size: 13px;
}

.how {
  margin: 2px 14px 0;
  color: var(--chalk-dim);
  font-size: 13px;
}

.how summary { cursor: pointer; }

.finish-key {
  margin: 6px 0 0;
  color: var(--chalk);
  font-size: 14px;
}

.banner {
  margin: 10px 18px 0;
  padding: 8px 10px;
  border: 1px solid rgba(243, 239, 226, 0.35);
  font-size: 14px;
}

.banner[data-kind="error"] {
  border-color: #e07a7a;
  color: #ffd2d2;
}

.field-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px 18px;
}

#field {
  width: auto;
  height: 100%;
  max-width: 100%;
  aspect-ratio: 1;
  display: block;
  background: transparent;
  touch-action: none;
  user-select: none;
}

#field .player { cursor: grab; }
#field.is-dragging .player { cursor: grabbing; }
#field.is-drawing,
#field.is-placing { cursor: crosshair; }

.field-word { cursor: grab; }
#field.is-dragging .field-word { cursor: grabbing; }

.field-word text {
  fill: #f7f4ea;
  stroke: #142033;
  stroke-width: 0.16;
  paint-order: stroke fill;
  font-family: "Avenir Next Condensed", "Avenir Next", sans-serif;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.field-word.is-selected text { fill: var(--amber); }

body.is-light .field-word text {
  fill: #1a2744;
  stroke: #f7f4ea;
}

body.is-light .field-word.is-selected text { fill: #8a6200; }

.yard-label {
  fill: rgba(243, 239, 226, 0.72);
  font-family: "Avenir Next Condensed", "Avenir Next", sans-serif;
  font-weight: 600;
}

.los-label { fill: var(--chalk); }

body.is-light .yard-label { fill: rgba(26, 39, 68, 0.72); }
body.is-light .los-label { fill: #1a2744; }
body.is-light .zone { fill: rgba(26, 39, 68, 0.1); stroke: #1a2744; }
body.is-light .ball-path { stroke: #1a2744; }
body.is-light .route-halo { stroke: #1a2744; }

.print-field.is-paper .yard-label { fill: rgba(26, 39, 68, 0.72); }
.print-field.is-paper .los-label { fill: #1a2744; }
.print-field.is-paper .zone { fill: rgba(26, 39, 68, 0.1); stroke: #1a2744; }
.print-field.is-paper .ball-path,
.print-field.is-paper .pass-path,
.print-field.is-paper .route,
.print-field.is-paper .route-halo { stroke: #1a2744; }
.print-field.is-paper .route-x { stroke: #f2c14e; }
.print-field.is-paper .route-y { stroke: #3b82f6; }
.print-field.is-paper .route-c { stroke: #ef4444; }
.print-field.is-paper .route-z { stroke: #fb923c; }
.print-field.is-paper .route-q,
.print-field.is-paper .route-s { stroke: #141414; }
.print-field.is-paper .route-a { stroke: #a78bfa; }
.print-field.is-paper .route-b { stroke: #2dd4bf; }
.print-field.is-paper .route-f { stroke: #f472b6; }
.print-field.is-paper .route-w { stroke: #a3e635; }
.print-field.is-paper .route-t { stroke: #38bdf8; }
.print-field.is-paper .pass-label,
.print-field.is-paper .player.offense text.player-name,
.print-field.is-paper .player.defense text.player-name { fill: #1a2744; }
.print-field.is-paper .field-word text { fill: #1a2744; stroke: #ffffff; }

.route {
  fill: none;
  stroke: var(--chalk);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.route-x { stroke: #f2c14e; }
.route-y { stroke: #3b82f6; }
.route-c { stroke: #ef4444; }
.route-z { stroke: #fb923c; }
.route-q { stroke: #141414; }
.route-s { stroke: #141414; }
.route-a { stroke: #a78bfa; }
.route-b { stroke: #2dd4bf; }
.route-f { stroke: #f472b6; }
.route-w { stroke: #a3e635; }
.route-t { stroke: #38bdf8; }
.route-halo { stroke: #f3efe2; }
.route.is-selected { stroke: var(--amber); }
.route.is-option { stroke-dasharray: 0.62 0.38; }
.route.is-dotted { stroke-dasharray: 0.08 0.46; stroke-linecap: round; }

.zone {
  fill: rgba(243, 239, 226, 0.16);
  stroke: #f3efe2;
  stroke-width: 0.14;
  stroke-dasharray: 0.4 0.24;
  cursor: grab;
}

.zone.is-selected {
  fill: rgba(224, 161, 6, 0.2);
  stroke: var(--amber);
}

.ball-path {
  fill: none;
  stroke: #f3efe2;
  stroke-width: 0.16;
  stroke-dasharray: 0.18 0.32;
  stroke-linecap: round;
  pointer-events: stroke;
}

.ball-path.is-selected { stroke: var(--amber); }
.ball-path.is-draft { pointer-events: none; }

.route-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 1.3;
  pointer-events: stroke;
}

.handle {
  fill: var(--chalk);
  stroke: var(--ink);
  stroke-width: 0.1;
  cursor: grab;
}

.handle.is-hot { fill: var(--amber); }

.player.offense circle {
  fill: #17315f;
  stroke: #091426;
}

.player.offense.id-X circle { fill: #f2c14e; stroke: #7a5b10; }
.player.offense.id-X text { fill: #1a1404; }
.player.offense.id-SL circle { fill: #2563eb; stroke: #0f2f86; }
.player.offense.id-SL text { fill: #f7f4ea; }
.player.offense.id-C circle { fill: #dc2626; stroke: #7f1d1d; }
.player.offense.id-C text { fill: #f7f4ea; }
.player.offense.id-Z circle { fill: #f97316; stroke: #9a3412; }
.player.offense.id-Z text { fill: #1a1404; }
.player.offense.id-QB circle { fill: #171717; stroke: #000; }
.player.offense.id-QB text { fill: #f7f4ea; }
.player.offense.id-SR circle { fill: #171717; stroke: #000; }
.player.offense.id-SR text { fill: #f7f4ea; }
.player.offense.id-A circle { fill: #7c3aed; stroke: #3b0764; }
.player.offense.id-A text { fill: #f7f4ea; }
.player.offense.id-B circle { fill: #0f766e; stroke: #042f2e; }
.player.offense.id-B text { fill: #f7f4ea; }
.player.offense.id-F circle { fill: #f472b6; stroke: #9d174d; }
.player.offense.id-F text { fill: #1a1404; }
.player.offense.id-W circle { fill: #84cc16; stroke: #3f6212; }
.player.offense.id-W text { fill: #1a1404; }
.player.offense.id-T circle { fill: #0284c7; stroke: #0c4a6e; }
.player.offense.id-T text { fill: #f7f4ea; }
.player.is-spare { display: none; }

.player.defense circle {
  fill: #f7f4ea;
  stroke: #17315f;
}

.player text {
  font-family: "Avenir Next Condensed", "Avenir Next", sans-serif;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.player-duty { pointer-events: none; }
.player-duty rect { fill: #f7f4ea; stroke: #142033; stroke-width: 0.06; }
.player-duty text { fill: #142033; text-anchor: middle; }

.player.offense text.player-name,
.player.defense text.player-name { fill: #f3efe2; cursor: grab; }

body.is-light .player.offense text.player-name,
body.is-light .player.defense text.player-name { fill: #1a2744; }

.player.offense text { fill: #f7f4ea; }
.player.defense text { fill: #17315f; }

.player.is-hot circle {
  stroke: var(--amber);
}

.player.offense circle.target-ring,
.player.defense circle.target-ring {
  fill: none;
  stroke: #e0a106;
  stroke-width: 0.14;
}

.ball {
  fill: #c4a574;
  stroke: #6b4a2a;
  stroke-width: 0.06;
}

#print-root { display: none; }

.print-page {
  page-break-after: always;
  break-after: page;
}

.print-page:last-child {
  page-break-after: auto;
  break-after: auto;
}

.print-page-play {
  color: #142033;
}

.print-page-line,
.print-page-cat,
.print-page-group,
.print-page-note {
  margin: 0;
  text-align: center;
}

.print-page-num,
.print-page-name {
  font-family: "Avenir Next Condensed", "Avenir Next", sans-serif;
  font-weight: 700;
}

.print-page-num { font-size: 22pt; }
.print-page-name { font-size: 18pt; }

.print-page-cat,
.print-page-group {
  font-size: 12pt;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.print-page-note {
  font-size: 12pt;
}

.print-page-play .print-field {
  width: 7in;
  height: auto;
  margin: 0.15in auto 0;
}

.diagram-page,
.lineup-page {
  display: flex;
  flex-direction: column;
  height: 10.2in;
  color: #142033;
}

.diagram-grid,
.lineup-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  grid-template-rows: repeat(var(--rows), 1fr);
  gap: 0.1in;
  min-height: 0;
}

.diagram-card,
.lineup-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #142033;
  padding: 3px 4px 2px;
}

.diagram-card.is-empty { border-style: solid; opacity: 0.35; }

.diagram-head,
.lineup-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
  margin: 0;
  line-height: 1.05;
}

.diagram-num,
.diagram-name,
.lineup-name {
  font-family: "Avenir Next Condensed", "Avenir Next", sans-serif;
  font-weight: 700;
  font-size: 12pt;
}

.diagram-cat {
  font-size: 9pt;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lineup-plays {
  margin: 0;
  font-size: 9pt;
  letter-spacing: 0.02em;
}

.diagram-card .print-field,
.lineup-card .print-field {
  width: 100%;
  flex: 1;
  min-height: 0;
}

.scout-page {
  display: flex;
  flex-direction: column;
  height: 10.2in;
  color: #142033;
}

.scout-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  grid-template-rows: repeat(var(--rows), 1fr);
  gap: 0.12in;
  min-height: 0;
}

.scout-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px dashed #142033;
  padding: 4px 6px 2px;
}

.scout-card.is-empty { border-style: dashed; }

.scout-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  line-height: 1.05;
}

.scout-num,
.scout-name {
  font-family: "Avenir Next Condensed", "Avenir Next", sans-serif;
  font-weight: 700;
}

.scout-num { font-size: 16pt; }
.scout-name { font-size: 13pt; }

.scout-cat,
.scout-note {
  flex: 1 0 100%;
  margin: 0;
}

.scout-cat {
  font-size: 8pt;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.scout-note { font-size: 8pt; }

.tree-page { color: #142033; }

.tree-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  grid-template-rows: 4.6in 4.6in;
  gap: 0.12in;
}

.tree-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border: 1px solid #142033;
  padding: 4px;
}

.tree-name {
  margin: 0 0 2px;
  text-align: center;
  font-family: "Avenir Next Condensed", "Avenir Next", sans-serif;
  font-size: 14pt;
  font-weight: 700;
}

.tree-card .print-field {
  width: 100%;
  flex: 1;
  min-height: 0;
}

.playbook-page {
  color: #142033;
}

.playbook-list {
  display: flex;
  flex-direction: column;
  gap: 0.12in;
}

.playbook-page[data-rows="2"] .playbook-row { height: 4.7in; }
.playbook-page[data-rows="4"] .playbook-row { height: 2.25in; }

.playbook-row {
  display: flex;
  gap: 0.15in;
  min-height: 0;
  border-bottom: 1px solid #142033;
  padding-bottom: 0.08in;
}

.playbook-picture {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
}

.playbook-picture .print-field {
  width: auto;
  height: 100%;
  max-width: 100%;
  flex: none;
}

.playbook-side {
  width: 2.5in;
  flex: none;
  overflow: hidden;
}

.playbook-line,
.playbook-cat,
.playbook-note {
  margin: 0 0 4px;
}

.playbook-num,
.playbook-name {
  font-family: "Avenir Next Condensed", "Avenir Next", sans-serif;
  font-weight: 700;
}

.playbook-num { font-size: 18pt; }
.playbook-name { font-size: 14pt; }

.playbook-page[data-rows="4"] .playbook-num { font-size: 13pt; }
.playbook-page[data-rows="4"] .playbook-name { font-size: 11pt; }

.playbook-cat {
  font-size: 9pt;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.playbook-note {
  font-size: 11pt;
  text-transform: none;
  font-weight: 500;
  letter-spacing: 0;
}

.playbook-page[data-rows="4"] .playbook-note { font-size: 9pt; }

.scout-card .print-field {
  width: 100%;
  flex: 1;
  min-height: 0;
}

.print-team {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-family: "Avenir Next Condensed", "Avenir Next", sans-serif;
  font-size: 11pt;
  font-weight: 700;
  color: #142033;
}

.print-logo,
.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #142033;
  font-family: "Avenir Next Condensed", "Avenir Next", sans-serif;
  font-weight: 700;
  line-height: 1;
}

.logo-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 10px;
}

.play-note-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0;
}

.play-note-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.play-note-icon {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(243, 239, 226, 0.35);
  font-weight: 700;
  font-size: 12px;
}

.play-note-line input {
  flex: 1;
  min-width: 0;
  background: var(--navy);
  border: 1px solid rgba(243, 239, 226, 0.35);
  color: var(--chalk);
  border-radius: 2px;
  padding: 6px 8px;
}

.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

img.print-logo {
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.logo-file {
  padding: 6px 8px;
  border: 1px solid rgba(243, 239, 226, 0.35);
  border-radius: 2px;
  font-size: 13px;
  cursor: pointer;
}

.logo-file input[hidden],
#logo-clear[hidden] { display: none; }

.logo-mark { width: 36px; height: 36px; font-size: 16px; flex: none; }
.logo-mark[hidden] { display: none; }

.logo-colors { display: flex; gap: 4px; }
.logo-colors button {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
}
.logo-colors button[aria-pressed="true"] { border-color: var(--chalk); }
.logo-colors button[data-logo="#e0a106"] { background: #e0a106; }
.logo-colors button[data-logo="#dc2626"] { background: #dc2626; }
.logo-colors button[data-logo="#2563eb"] { background: #2563eb; }
.logo-colors button[data-logo="#237844"] { background: #237844; }
.logo-colors button[data-logo="#171717"] { background: #171717; }
.logo-colors button[data-logo="#f3efe2"] { background: #f3efe2; }

.print-setup .tools { flex-wrap: wrap; }

.print-windows {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.18in;
}

.print-window {
  width: var(--band-w);
}

.print-window .print-team {
  margin: 0 0 2px;
  font-size: 8pt;
}

.print-band {
  width: 100%;
  height: var(--band-h);
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  grid-template-rows: repeat(var(--rows), 1fr);
  background: white;
  border: 1px dashed #142033;
}

.print-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px dashed #142033;
  padding: 1px 2px 0;
  color: #142033;
}

.print-card.is-empty { border: 0; }

.print-card.is-list { justify-content: center; }
.print-card.is-list .print-card-num { font-size: 16pt; }
.print-card.is-list .print-card-name { font-size: 12pt; }
.print-card.is-list .print-card-note { font-size: 10pt; }

.print-card-head {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
  line-height: 1.05;
}

.print-card-num,
.print-card-name {
  font-family: "Avenir Next Condensed", "Avenir Next", sans-serif;
  font-weight: 700;
}

.print-card-num { font-size: 13pt; flex: none; }

.print-card-name {
  font-size: 8pt;
  white-space: normal;
}

.print-card-cat {
  flex: 1 0 100%;
  font-size: 7pt;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.print-card-note {
  flex: 1 0 100%;
  margin: 1px 0 0;
  font-size: 7pt;
  line-height: 1.1;
  white-space: normal;
}

#print-root[data-count="2"] .print-card-num { font-size: 16pt; }
#print-root[data-count="2"] .print-card-name { font-size: 11pt; }
#print-root[data-count="6"] .print-card-num { font-size: 10pt; }
#print-root[data-count="6"] .print-card-name { font-size: 7pt; }

.print-field {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 0;
}

.call-sheet h2 {
  margin: 12px 0 4px;
  font-family: "Avenir Next Condensed", "Avenir Next", sans-serif;
  font-size: 13pt;
  color: #142033;
}

.call-sheet table {
  width: 100%;
  border-collapse: collapse;
}

.call-sheet td {
  padding: 5px 8px 5px 0;
  border-bottom: 1px solid #142033;
  font-size: 12pt;
  color: #142033;
  vertical-align: top;
}

.call-num,
.call-to {
  width: 2.4em;
  font-family: "Avenir Next Condensed", "Avenir Next", sans-serif;
  font-weight: 700;
  font-size: 16pt;
}

@page { size: letter; margin: 0.4in; }

.account-setup .account-card[hidden],
.account-setup[hidden],
.account-setup .err[hidden] { display: none; }

.account-field {
  display: block;
  margin: 8px 0;
  color: var(--chalk-dim);
  font-size: 14px;
}

.account-field input {
  display: block;
  width: 100%;
  margin-top: 4px;
  background: var(--navy);
  border: 1px solid rgba(243, 239, 226, 0.35);
  border-radius: 2px;
  padding: 10px;
}

.account-setup .print-go { display: block; width: 100%; margin-top: 8px; }

.account-setup .linkish {
  display: inline;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--amber);
  text-decoration: underline;
  font-weight: 600;
}

.account-setup .err { margin: 0 0 8px; color: var(--amber); }

.auth-stand {
  max-width: 28rem;
  margin: 40px auto;
  padding: 0 16px 40px;
}

.auth-stand .print-go { margin-top: 12px; }

.auth-stand a { color: var(--amber); }

@media print {
  body { background: white; }
  .app { display: none !important; }
  #print-root { display: block; }
}

@media (max-width: 800px) {
  html, body { height: auto; min-height: 100%; }
  .app { display: flex; flex-direction: column; height: auto; min-height: 100%; }
  .stage { order: -1; }
  .sidebar { order: 1; border-right: 0; border-top: 1px solid rgba(243, 239, 226, 0.12); }
  .brand { font-size: 22px; }
  .play-list { max-height: 220px; flex: none; }
  .command { flex-wrap: wrap; }
  #play-number, #play-name { font-size: 24px; }
  #play-number { width: 44px; }
  .canvas { flex-direction: column; }
  .dock { width: auto; flex-direction: row; flex-wrap: wrap; overflow: visible; padding: 0 12px 16px; }
  .field-wrap { min-height: 78vw; padding: 8px 12px 16px; }
  #field { width: 100%; height: auto; }
  .print-setup { position: fixed; top: 8px; right: 8px; bottom: 8px; left: 8px; width: auto; }
}
