:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --panel: #ffffff;
  --ink: #172018;
  --muted: #5d685f;
  --line: #d9e0d7;
  --green: #0f6f3c;
  --green-dark: #0a4e2a;
  --green-soft: #e6f3eb;
  --red: #b42318;
  --amber: #a15c07;
  --blue: #1f5f99;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
}

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

button {
  border: 0;
  border-radius: 7px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 9px 12px;
}

button.secondary {
  background: var(--green-soft);
  color: var(--green-dark);
}

button.ghost {
  background: transparent;
  color: var(--green-dark);
  border: 1px solid var(--line);
}

button.danger {
  background: #f8e6e3;
  color: var(--red);
}

.button-link {
  background: var(--green);
  border-radius: 7px;
  color: #fff;
  display: inline-flex;
  font-weight: 700;
  justify-content: center;
  padding: 9px 12px;
  text-decoration: none;
  width: max-content;
}

.button-link.secondary-link {
  background: var(--green-soft);
  color: var(--green-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  width: 100%;
}

label {
  color: var(--muted);
  display: grid;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
}

.shell {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: #0e2416;
  color: #fff;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  padding: 14px 22px;
}

.brand {
  display: grid;
  gap: 2px;
  min-width: 230px;
}

.brand strong {
  font-size: 18px;
}

.brand span,
.userbar {
  color: #cfe0d3;
  font-size: 13px;
}

.version-badge {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  margin-top: 4px;
  padding: 3px 8px;
  width: max-content;
}

.storage-badge {
  background: rgba(109, 209, 139, 0.16);
  border-color: rgba(158, 231, 180, 0.38);
}

.admin-menu {
  align-items: center;
  display: flex;
  flex: 1 1 280px;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.admin-menu-button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
}

.admin-menu-button.featured {
  border-color: rgba(255, 255, 255, 0.45);
}

.admin-menu-button.active {
  background: #fff;
  color: var(--green-dark);
}

.userbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.page {
  display: grid;
  gap: 16px;
  margin: 0 auto;
  max-width: 1500px;
  padding: 18px;
  width: 100%;
}

.page-heading {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
}

.page-heading h1 {
  font-size: 24px;
  line-height: 1.15;
  margin: 0 0 4px;
}

.eyebrow {
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 3px;
  text-transform: uppercase;
}

.login-page {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  margin: auto;
  max-width: 430px;
  padding: 22px;
  width: 100%;
}

.login-card h1,
.section h2,
.section h3 {
  margin: 0;
}

.hint {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.grid {
  display: grid;
  gap: 16px;
}

.dashboard-grid {
  align-items: start;
  grid-template-columns: 280px minmax(0, 1fr);
}

.match-review-grid {
  align-items: start;
  grid-template-columns: 1fr;
}

.lower-admin-grid {
  align-items: start;
  grid-template-columns: 1fr;
}

.matches-page-grid,
.player-match-grid {
  align-items: start;
  grid-template-columns: 300px minmax(0, 1fr);
  min-width: 0;
}

.player-portal-grid {
  align-items: start;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  min-width: 0;
}

.player-content-grid {
  min-width: 0;
}

.player-playlist-browser,
.player-match-events {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  margin-top: 4px;
  padding-top: 16px;
}

.player-playlist-browser > label {
  max-width: 620px;
}

.player-navigation {
  position: sticky;
  top: 16px;
}

.sidebar-divider {
  border-top: 1px solid var(--line);
  margin: 4px 0;
}

.review-grid {
  align-items: start;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  min-width: 0;
}

.playlist-editor-grid {
  align-items: start;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  min-width: 0;
}

.lower-admin-grid > *,
.matches-page-grid > *,
.player-match-grid > *,
.player-portal-grid > *,
.review-grid > *,
.playlist-editor-grid > *,
.playlist-editor-grid .stack,
.two-col > * {
  min-width: 0;
}

.players-page-grid {
  align-items: start;
  grid-template-columns: 260px minmax(0, 1fr);
  min-width: 0;
}

.match-summary-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
}

.summary-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 12px;
}

.summary-box strong {
  color: var(--green-dark);
  font-size: 26px;
  line-height: 1;
}

.summary-box span {
  color: var(--muted);
  font-size: 13px;
}

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
}

.collapsible-section {
  padding: 0;
}

.collapsible-section > summary,
.inner-details > summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-size: 17px;
  font-weight: 800;
  gap: 10px;
  justify-content: space-between;
  list-style-position: inside;
  padding: 14px;
}

.collapsible-section > summary:hover,
.inner-details > summary:hover {
  background: var(--green-soft);
}

.collapsible-content {
  display: grid;
  gap: 12px;
  padding: 0 14px 14px;
}

.inner-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.inner-details > summary {
  font-size: 15px;
  padding: 11px 12px;
}

.inner-details .collapsible-content {
  padding: 4px 12px 12px;
}

.summary-hint {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 400;
  margin-top: 3px;
}

.review-match-bar {
  align-items: end;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 1fr) auto;
}

.review-match-summary {
  display: grid;
  gap: 4px;
  padding-bottom: 4px;
}

.compact-match-picker {
  grid-template-columns: minmax(0, 1fr);
}

.compact-match-picker select {
  max-height: 320px;
}

.team-name-editor {
  max-width: 420px;
}

.team-settings {
  align-items: end;
  background: var(--soft, #f3f7f2);
  border: 1px solid var(--line, #d8dfd5);
  border-radius: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  margin: 18px 0;
  padding: 16px;
}

.team-settings .team-name-editor {
  max-width: none;
}

.stack {
  display: grid;
  gap: 10px;
}

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

.row.between {
  justify-content: space-between;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab {
  background: #edf2ec;
  color: var(--green-dark);
}

.tab.active {
  background: var(--green);
  color: #fff;
}

.team-menu {
  display: grid;
  gap: 8px;
}

.team-menu-button {
  align-items: center;
  background: #edf2ec;
  color: var(--green-dark);
  display: flex;
  justify-content: space-between;
  text-align: left;
  width: 100%;
}

.team-menu-button.active {
  background: var(--green);
  color: #fff;
}

.team-menu-button span {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 2px 7px;
}

.match-list,
.playlist-list,
.event-list,
.team-list,
.player-login-list {
  display: grid;
  gap: 8px;
}

.match-card,
.playlist-card,
.event-card,
.player-login-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.match-card.active {
  border-color: var(--green);
  box-shadow: inset 4px 0 0 var(--green);
}

.playlist-card-heading {
  align-items: center;
}

.playlist-card-heading strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.compact-button {
  flex: 0 0 auto;
  padding: 6px 9px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
}

.video-wrap {
  background: #111;
  border-radius: 8px;
  max-width: 100%;
  min-width: 0;
  position: relative;
  overflow: hidden;
  width: 100%;
}

video {
  aspect-ratio: 16 / 9;
  display: block;
  width: 100%;
}

.bunny-player {
  aspect-ratio: 16 / 9;
  border: 0;
  display: block;
  max-width: 100%;
  min-width: 0;
  width: 100%;
}

.video-stage {
  min-height: 260px;
}

.match-setup-video .video-stage {
  min-height: 520px;
}

.match-setup-video .bunny-player,
.match-setup-video video,
.match-setup-video .fake-video {
  height: 100%;
  min-height: 520px;
  object-fit: contain;
}

#drawing-canvas {
  inset: 0;
  height: 100%;
  pointer-events: none;
  position: absolute;
  touch-action: none;
  width: 100%;
  z-index: 2;
}

#drawing-canvas.active {
  cursor: crosshair;
  pointer-events: auto;
}

.timed-drawing-overlay {
  display: none;
  height: 100%;
  inset: 0;
  object-fit: fill;
  pointer-events: none;
  position: absolute;
  width: 100%;
  z-index: 2;
}

.timed-drawing-overlay.visible {
  display: block;
}

.player-drawing-status {
  margin-top: -2px;
}

.fake-video {
  align-items: center;
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.08) 1px, transparent 1px),
    #163f23;
  background-size: 9% 18%;
  color: #fff;
  display: grid;
  justify-items: center;
  padding: 24px;
  text-align: center;
  width: 100%;
}

.fake-video > div {
  max-width: 100%;
  min-width: 0;
  width: 100%;
}

.fake-video p,
.fake-video strong {
  overflow-wrap: anywhere;
}

.fake-video strong {
  font-size: 22px;
}

.filters {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
}

.compact-filters {
  align-items: end;
  grid-template-columns: minmax(180px, 260px) minmax(240px, 1fr);
}

.match-access-note {
  background: var(--green-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green-dark);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 41px;
  padding: 10px;
}

.selector-flow {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.disabled-filter input {
  background: #f2f4f1;
  color: var(--muted);
}

.event-results {
  display: grid;
  gap: 8px;
}

.list-form {
  gap: 6px;
}

.scrollable-event-list {
  max-height: 520px;
  overflow: auto;
  padding: 8px;
}

.matching-clips > summary .meta {
  margin-left: auto;
}

.event-row {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(130px, 0.8fr) minmax(180px, 1fr) auto minmax(190px, 0.8fr);
  padding: 10px;
}

.event-row:hover {
  background: var(--green-soft);
}

.event-row.player-clip-row {
  grid-template-columns: minmax(150px, 0.8fr) minmax(220px, 1.4fr) auto;
}

.event-row > div {
  display: grid;
  gap: 3px;
}

.clip-play-button {
  min-width: 76px;
}

.upload-control {
  align-content: start;
  display: grid;
  gap: 7px;
}

.upload-status {
  background: var(--green-soft);
  border: 1px solid #a9d5b6;
  border-radius: 7px;
  color: #174c29;
  font-size: 13px;
  line-height: 1.4;
  padding: 7px 9px;
}

.uploaded-file-list {
  display: grid;
  gap: 8px;
}

.uploaded-file-row {
  align-items: center;
  background: #f7faf7;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 9px 10px;
}

.uploaded-file-row > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.uploaded-file-row strong,
.uploaded-file-row .meta {
  overflow-wrap: anywhere;
}

.file-actions {
  flex-wrap: nowrap;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.permission-box,
.player-comment {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.playlist-email-panel {
  background: #f7faf7;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.player-comment {
  background: var(--green-soft);
}

.player-comment p {
  margin: 0;
}

textarea {
  max-width: 100%;
  resize: vertical;
}

.check-row {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.check-row input {
  width: auto;
}

.team-share-grid {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.playlist-video {
  display: grid;
  gap: 8px;
  margin: 4px 0 8px;
}

.playlist-video.large-drawing-mode {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  display: grid;
  gap: 10px;
  grid-template-rows: minmax(0, 1fr) auto;
  inset: 12px;
  margin: 0;
  padding: 12px;
  position: fixed;
  z-index: 100;
}

.playlist-video .video-stage {
  aspect-ratio: 16 / 9;
  min-height: 420px;
}

.playlist-video.large-drawing-mode .video-stage {
  aspect-ratio: auto;
  min-height: 0;
}

.playlist-video .bunny-player,
.playlist-video video,
.playlist-video .fake-video {
  height: 100%;
  min-height: 420px;
  object-fit: contain;
}

.playlist-video.large-drawing-mode .bunny-player,
.playlist-video.large-drawing-mode video,
.playlist-video.large-drawing-mode .fake-video {
  aspect-ratio: auto;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.playlist-video.large-drawing-mode .drawing-toolbar {
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.drawing-toolbar {
  display: grid;
  gap: 10px;
}

.timed-drawing-list {
  display: grid;
  gap: 6px;
}

.timed-drawing-row {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 8px 10px;
}

.compact-label {
  max-width: 210px;
}

.inline-control {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns: 80px auto;
}

.draw-tools {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.draw-tools label {
  min-width: 96px;
}

.event-card {
  cursor: pointer;
  min-width: 0;
}

.event-list-clean {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.event-card.selected {
  background: var(--green-soft);
  border-color: var(--green);
}

.pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  max-width: 100%;
  padding: 4px 8px;
  overflow-wrap: anywhere;
}

.pill.green {
  background: var(--green-soft);
  color: var(--green-dark);
}

.pill.red {
  background: #f9e5e2;
  color: var(--red);
}

.pill.amber {
  background: #fff3da;
  color: var(--amber);
}

.pill.blue {
  background: #e7f0f8;
  color: var(--blue);
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.table {
  border-collapse: collapse;
  table-layout: fixed;
  width: 100%;
}

.table-wrap {
  overflow-x: auto;
  width: 100%;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
}

.table th {
  color: var(--muted);
  font-size: 12px;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: var(--green-soft);
}

.player-login-table {
  min-width: 820px;
}

.player-login-table th:nth-child(1) {
  width: 20%;
}

.player-login-table th:nth-child(2) {
  width: 28%;
}

.player-login-table th:nth-child(3) {
  width: 18%;
}

.player-login-table th:nth-child(4) {
  width: 18%;
}

.player-login-table th:nth-child(5) {
  width: 180px;
}

.player-actions {
  flex-wrap: nowrap;
}

.password-control {
  align-items: center;
  display: flex;
  gap: 6px;
}

.password-control input {
  min-width: 150px;
}

.review-video .video-stage {
  min-height: 500px;
}

.review-video .bunny-player,
.review-video video,
.review-video .fake-video {
  min-height: 500px;
  object-fit: contain;
}

.player-login-table input,
.player-login-table select {
  padding: 7px 8px;
}

.add-player-form {
  background: #f6f9f6;
  border: 1px solid var(--line);
  border-radius: 9px;
  display: grid;
  gap: 8px;
  margin: 14px 0 18px;
  padding: 14px;
}

.add-player-form .hint {
  margin: 0;
}

.add-player-grid {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(150px, 1fr) minmax(210px, 1.3fr) minmax(180px, 1fr) auto;
}

@media (max-width: 980px) {
  .team-settings {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .add-player-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .lower-admin-grid,
  .matches-page-grid,
  .player-match-grid,
  .player-portal-grid,
  .review-grid,
  .playlist-editor-grid,
  .players-page-grid {
    grid-template-columns: 1fr;
  }

  .player-navigation {
    position: static;
  }

  .review-match-bar {
    grid-template-columns: 1fr;
  }

  .filters,
  .compact-filters,
  .selector-flow,
  .event-row,
  .two-col,
  .match-summary-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .match-setup-video .video-stage,
  .match-setup-video .bunny-player,
  .match-setup-video video,
  .match-setup-video .fake-video {
    min-height: 360px;
  }

  .review-video .video-stage,
  .review-video .bunny-player,
  .review-video video,
  .review-video .fake-video {
    min-height: 360px;
  }
}

@media (max-width: 580px) {
  .add-player-grid {
    grid-template-columns: 1fr;
  }
  .topbar {
    align-items: flex-start;
    display: grid;
  }

  .page {
    padding: 12px;
  }

  .uploaded-file-row {
    align-items: stretch;
    flex-direction: column;
  }

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

  .filters,
  .compact-filters,
  .selector-flow,
  .event-row,
  .two-col,
  .match-summary-grid {
    grid-template-columns: 1fr;
  }

  .match-setup-video .video-stage,
  .review-video .video-stage,
  .playlist-video .video-stage {
    aspect-ratio: 16 / 9;
    height: auto;
    min-height: 0;
    width: 100%;
  }

  .match-setup-video .bunny-player,
  .match-setup-video video,
  .match-setup-video .fake-video,
  .review-video .bunny-player,
  .review-video video,
  .review-video .fake-video,
  .playlist-video .bunny-player,
  .playlist-video video,
  .playlist-video .fake-video {
    aspect-ratio: 16 / 9;
    height: auto;
    max-width: 100%;
    min-height: 0;
    width: 100%;
  }

  .fake-video {
    padding: 14px;
  }

  .fake-video strong {
    font-size: 18px;
  }
}


/* Player portal: keep Bunny/video embeds inside the iPhone viewport.
   The previous 420px video minimum height forced a 16:9 player
   wider than its grid column on portrait phones. */
@media (max-width: 980px) {
  .player-portal-grid,
  .player-content-grid,
  .player-portal-grid > *,
  .player-content-grid > *,
  .player-content-grid .collapsible-content,
  .player-playlist-video {
    min-width: 0;
    max-width: 100%;
  }

  .player-playlist-video .video-stage {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 0;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .player-playlist-video .bunny-player,
  .player-playlist-video video,
  .player-playlist-video .fake-video {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 100%;
    min-height: 0;
    aspect-ratio: 16 / 9;
  }

  .player-playlist-video.large-drawing-mode .video-stage,
  .player-playlist-video.large-drawing-mode .bunny-player,
  .player-playlist-video.large-drawing-mode video,
  .player-playlist-video.large-drawing-mode .fake-video {
    aspect-ratio: auto;
  }
}

@media (max-width: 580px) {
  .player-portal-grid .section,
  .player-portal-grid .collapsible-content {
    min-width: 0;
  }

  .player-portal-grid .collapsible-content > .row.between {
    align-items: flex-start;
  }

  .player-portal-grid .collapsible-content > .row.between .compact-label {
    width: 100%;
    max-width: 100%;
  }

  .player-portal-grid .collapsible-content > .row.between .inline-control {
    width: max-content;
    max-width: 100%;
  }
}

/* Tactical Board integration */
.tactics-management{min-width:0}.tactics-editor{display:block;width:100%;height:760px;border:1px solid var(--line);border-radius:12px;background:#fff;margin:14px 0 24px}.tactics-viewer{display:block;width:100%;height:520px;border:1px solid var(--line);border-radius:10px;margin-top:12px;background:#fff}.tactics-player-menu{margin-top:22px;border-top:1px solid var(--line);padding-top:16px;min-width:0}.tactics-entry{border-bottom:1px solid var(--line);padding:10px 0}.tactics-management input[type=file]{max-width:100%}@media(max-width:700px){.tactics-editor{height:650px}.tactics-viewer{height:420px}}

/* v20.12: Keep tactics selection in sidebar and display playback in a separate viewer. */
.tactics-player-menu select{width:100%;max-width:100%}
.tactic-modal-open{overflow:hidden}
.tactic-modal{position:fixed;inset:0;z-index:9999;display:flex;flex-direction:column;padding:12px;background:rgba(11,26,19,.92);box-sizing:border-box;overflow:hidden}
.tactic-modal-header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 12px;background:#fff;border-radius:10px 10px 0 0;min-height:48px}
.tactic-modal-header strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tactic-modal .tactics-viewer{flex:1;display:block;min-height:0;height:auto;width:100%;margin:0;border:0;border-radius:0 0 10px 10px;background:#fff}
.player-actions{flex-wrap:wrap}
.password-control input{min-width:0;flex:1}
.password-control button{flex-shrink:0}
@media(max-width:700px){.tactic-modal{padding:0}.tactic-modal-header{border-radius:0}.tactic-modal .tactics-viewer{border-radius:0}.player-actions{flex-wrap:wrap}}

/* v20.13 — tactical play selection remains in a properly scrollable left column. */
@media(min-width:701px){
 .player-portal-grid{align-items:start}
 .player-navigation{position:sticky;top:12px;max-height:calc(100dvh - 24px);overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scrollbar-width:thin;scrollbar-color:#8d9f9a #edf2ee;padding-bottom:24px}
}
.player-navigation{min-width:0;scroll-padding-block:16px}
.player-navigation select{max-width:100%;min-width:0}
.tactics-player-menu{margin-bottom:16px}
.tactic-modal-header{flex-shrink:0}
@media(max-width:700px){.player-navigation{overflow:visible;max-height:none}.tactic-modal{height:100dvh}}

/* v20.14: restore tactics playback within the independently scrollable player menu. */
@media (min-width:701px) {
 .player-portal-grid {align-items:start;min-height:0}
 .player-navigation {position:sticky!important;top:12px!important;height:calc(100dvh - 24px);max-height:calc(100dvh - 24px);overflow-y:scroll!important;overflow-x:hidden!important;overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch;scrollbar-gutter:stable;scrollbar-width:auto;scrollbar-color:#77948a #e6eeea}
}
.player-navigation {min-width:0;}
.tactic-inline-player {min-width:0;width:100%;margin-top:10px;}
.tactics-inline-frame {display:block;width:100%;min-width:0;height:640px;margin:0;border:1px solid var(--line);border-radius:12px;background:#fff;}
@media(max-width:700px){.player-navigation{position:static!important;max-height:none!important;height:auto!important;overflow:visible!important}.tactics-inline-frame{height:600px;}}

/* v20.15 independently scrollable sidebar for desktop player */
@media(min-width:701px){
 .player-portal-grid{align-items:start!important;min-height:0!important;}
 .player-portal-grid>.player-navigation{position:sticky!important;top:10px!important;height:calc(100vh - 20px)!important;height:calc(100dvh - 20px)!important;max-height:calc(100dvh - 20px)!important;overflow-y:auto!important;overflow-x:hidden!important;overscroll-behavior-y:contain!important;scrollbar-width:auto!important;}
 .player-navigation .tactic-inline-player{max-width:100%;}
 .player-navigation .tactics-inline-frame{height:640px!important;max-width:100%;}
}

/* v20.17: permanently pin the match selector above the independently scrolling tactics.
   This also avoids scroll jumps when the inline tactical iframe is mounted/unmounted. */
.player-navigation .player-matches-pinned {
  display: grid;
  gap: 12px;
  min-width: 0;
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
  background: var(--panel);
}
.player-navigation .player-tactics-scroll {
  min-width: 0;
  min-height: 0;
}
.player-navigation .player-matches-pinned select {width:100%;max-width:100%;}
@media (min-width: 981px) {
  .player-portal-grid > .player-navigation {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    height: calc(100dvh - 20px) !important;
    max-height: calc(100dvh - 20px) !important;
    overflow: hidden !important;
    padding-bottom: 0;
  }
  .player-navigation .player-matches-pinned {
    padding-bottom: 15px;
    border-bottom: 1px solid var(--line);
  }
  .player-navigation .player-tactics-scroll {
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
    scrollbar-width: auto;
    scrollbar-color: #77948a #e6eeea;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 16px;
  }
  .player-navigation .tactics-player-menu {
    margin-top: 0;
    border-top: 0;
    padding-top: 16px;
  }
}
@media (max-width: 980px) {
  .player-navigation .player-matches-pinned,
  .player-navigation .player-tactics-scroll {max-width:100%;}
  .player-navigation .player-tactics-scroll {overflow:visible;}
}

/* Player bulk import: admin only */
.bulk-player-import { padding: 16px; margin: 14px 0 20px; border: 1px solid var(--line); border-radius: 10px; background: #f7faf7; }
.bulk-player-import h3 { margin: 0 0 7px; }
.bulk-player-import .row { flex-wrap: wrap; gap: 12px; align-items: center; }
.bulk-player-import input[type=file] { max-width: 100%; }
.bulk-player-import #bulk-player-preview { margin-top: 9px; overflow-wrap: anywhere; }

/* v20.20: optional player password update, separate from the match/video layout */
body.player-password-open { overflow: hidden; }
.player-password-overlay { position: fixed; inset: 0; z-index: 10020; background: rgba(13, 28, 27, .74); display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; box-sizing: border-box; }
.player-password-dialog { width: min(100%, 430px); max-height: calc(100dvh - 32px); overflow-y: auto; display: grid; gap: 14px; background: #fff; color: #172b25; padding: 22px; border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.27); box-sizing: border-box; }
.player-password-dialog h2 { margin: 0; }
.player-password-dialog label { display: grid; gap: 5px; min-width: 0; }
.player-password-dialog .password-control { display: flex; width: 100%; max-width: 100%; min-width: 0; gap: 8px; }
.player-password-dialog .password-control input { min-width: 0; width: 100%; flex: 1; }
.player-password-dialog .player-password-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.player-password-feedback { min-height: 1.4em; color: #ac4c18; overflow-wrap: anywhere; }
@media(max-width: 600px) { .player-password-overlay { align-items: flex-start; padding: 10px; } .player-password-dialog { padding: 16px; max-height: calc(100dvh - 20px); } .userbar { flex-wrap: wrap; } }


/* v20.21: Player Logins - readable card layout, avoiding password/team overlap. */
.player-account-list {display:grid;gap:12px;margin-top:16px;min-width:0;}
.player-account-card {display:grid;gap:12px;min-width:0;padding:15px;border:1px solid var(--line);border-radius:11px;background:var(--panel);}
.player-account-main {display:grid;grid-template-columns:minmax(155px,1fr) minmax(235px,1.45fr) minmax(135px,.75fr);gap:12px;align-items:end;min-width:0;}
.player-account-main label,.player-account-password {display:grid;gap:6px;min-width:0;}
.player-account-main input,.player-account-main select {width:100%;min-width:0;height:43px;}
.player-account-bottom {display:grid;grid-template-columns:minmax(0,1fr) auto;gap:16px;align-items:center;border-top:1px solid #edf0ec;padding-top:11px;min-width:0;}
.player-account-password .password-control {display:grid;grid-template-columns:minmax(130px,1fr) auto auto;gap:7px;width:100%;min-width:0;align-items:center;}
.player-account-password .password-control input {min-width:0;width:100%;height:42px;}
.player-account-password .password-control button {min-width:0;min-height:42px;padding:8px 11px;white-space:nowrap;}
.player-account-field-note {color:var(--muted);font-size:11px;font-weight:400;line-height:1.25;}
.player-account-actions {display:flex;align-items:center;justify-content:flex-end;gap:7px;flex-wrap:wrap;min-width:0;}
.player-account-actions button {min-height:42px;padding:8px 12px;white-space:nowrap;}
@media (max-width: 1250px) {
  .player-account-main {grid-template-columns:repeat(2,minmax(0,1fr));}
  .player-account-main label:last-child {grid-column:1 / -1;max-width:280px;}
}
@media (max-width: 1050px) {
  .player-account-bottom {grid-template-columns:1fr;gap:10px;}
  .player-account-actions {justify-content:flex-start;}
}
@media (max-width: 700px) {
  .player-account-main {grid-template-columns:1fr;}
  .player-account-main label:last-child {grid-column:auto;max-width:none;}
  .player-account-card {padding:12px;}
  .player-account-password .password-control {grid-template-columns:minmax(0,1fr) auto auto;gap:6px;}
  .player-account-password .password-control button {padding:8px;}
}
@media (max-width: 370px) {
  .player-account-password .password-control {grid-template-columns:1fr 1fr;}
  .player-account-password .password-control input {grid-column:1/-1;}
  .player-account-actions button {flex:1 1 auto;}
}

/* Player and admin header account actions: clear contrast on dark top bar. */
.topbar .userbar button.ghost {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.68);
  background: rgba(255, 255, 255, 0.08);
}
.topbar .userbar button.ghost:hover,
.topbar .userbar button.ghost:focus-visible {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.18);
  border-color: #ffffff;
}
