body.gr-open {
  overflow: hidden;
}

.gr-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.65);
  overflow: auto;
  padding: 20px;
}

.gr-panel {
  width: min(1400px, 100%);
  margin: 0 auto;
  background: #fff;
  color: #111827;
  border-radius: 12px;
  overflow: hidden;
}

.gr-header,
.gr-side-header,
.gr-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

.gr-header {
  padding: 20px;
  background: #111827;
  color: white;
}

.gr-header h2,
.gr-side-header h3 {
  margin: 0;
}

.gr-close {
  border: 0;
  background: #fff;
  color: #111827;
  min-width: 48px;
  min-height: 48px;
  border-radius: 8px;
  cursor: pointer;
}

.gr-status {
  padding: 14px 20px;
  border-bottom: 1px solid #d1d5db;
  font-weight: 700;
}

.gr-game-info {
  padding: 18px 20px;
  display: flex;
  gap: 15px;
  justify-content: center;
  font-size: 18px;
  flex-wrap: wrap;
}

.gr-rosters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 20px;
}

.gr-side {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  overflow: hidden;
}

.gr-side-header {
  padding: 15px;
  background: #f1f5f9;
}

.gr-side-label {
  font-weight: 900;
  font-size: 12px;
}

.gr-side-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.gr-player-list {
  max-height: 58vh;
  overflow: auto;
}

.gr-player {
  padding: 0;
  border-bottom: 1px solid #e5e7eb;
}

.gr-player-summary {
  display: grid;
  grid-template-columns: 118px 82px minmax(190px, 1.35fr) 100px minmax(210px, 1fr) 118px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.gr-participation {
  position: relative;
  display: block;
  cursor: pointer;
}

.gr-participation input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.gr-participation-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 10px;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}

.gr-participation input:checked + .gr-participation-state {
  border-color: #16a34a;
  background: #16a34a;
  color: white;
}

.gr-participation input:focus-visible + .gr-participation-state {
  outline: 3px solid rgba(37, 99, 235, .35);
  outline-offset: 2px;
}

.gr-quick-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gr-quick-field span,
.gr-player-facts > span {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.gr-quick-field input {
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  padding: 7px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  font: inherit;
  font-weight: 800;
}

.gr-quick-field > strong {
  display: flex;
  align-items: center;
  min-height: 42px;
  color: #0f172a;
  font-size: 15px;
}

.gr-player-identity {
  min-width: 0;
}

.gr-player-identity strong,
.gr-player-identity span {
  display: block;
}

.gr-player-identity strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gr-player-identity span {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
}

.gr-player-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.gr-player-facts strong {
  display: block;
  margin-top: 3px;
  color: #0f172a;
  font-size: 12px;
  text-transform: none;
}

.gr-edit-player {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #2563eb;
  border-radius: 7px;
  background: #eff6ff;
  color: #1d4ed8;
  cursor: pointer;
  font-weight: 900;
}

.gr-player-actions {
  display: grid;
  gap: 6px;
}

.gr-move-player {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid #d97706;
  border-radius: 7px;
  background: #fffbeb;
  color: #92400e;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.gr-player-details {
  padding: 16px;
  border-top: 1px dashed #94a3b8;
  background: #f8fafc;
}

.gr-player-details[hidden] {
  display: none;
}

.gr-player-details-heading {
  margin-bottom: 12px;
}

.gr-player-details-heading strong,
.gr-player-details-heading span {
  display: block;
}

.gr-player-details-heading span {
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
}

.gr-roster-edit-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.gr-player-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.gr-save-player {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 7px;
  background: #16a34a;
  color: white;
  cursor: pointer;
  font-weight: 900;
}

.gr-save-player:disabled {
  opacity: .6;
  cursor: wait;
}

.gr-side-selector-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px 0;
}

.gr-side-selector-wrap label {
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

.gr-side-selector-wrap select {
  min-height: 48px;
  min-width: min(420px, 100%);
  padding: 0 42px 0 14px;
  border: 2px solid #2563eb;
  border-radius: 8px;
  background: white;
  color: #0f172a;
  font: inherit;
  font-weight: 900;
}

.gr-player-search {
  margin: 14px 20px 0;
  padding: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
}

.gr-player-search > label {
  display: block;
  margin-bottom: 8px;
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

.gr-player-search-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.gr-player-search-controls input {
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid #94a3b8;
  border-radius: 7px;
  font: inherit;
}

.gr-player-search-controls button,
.gr-search-result button {
  min-height: 46px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: #2563eb;
  color: white;
  cursor: pointer;
  font-weight: 900;
}

.gr-player-search-results {
  margin-top: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.gr-search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
}

.gr-search-result:last-child {
  border-bottom: 0;
}

.gr-search-result strong,
.gr-search-result span {
  display: block;
}

.gr-search-result span {
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
}

.gr-search-empty {
  padding: 14px;
  color: #64748b;
}

.gr-side[hidden] {
  display: none;
}

.gr-player-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.gr-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.gr-field span {
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.gr-field input,
.gr-field textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 40px;
  padding: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font: inherit;
}

.gr-field textarea {
  min-height: 72px;
  resize: vertical;
}

.gr-field-wide {
  grid-column: span 2;
}

.gr-side-date {
  margin: 4px 0;
  color: #334155;
  font-weight: 800;
}

.gr-secondary,
.gr-primary {
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 800;
}

.gr-secondary {
  padding: 9px 12px;
  background: #e2e8f0;
  color: #111827;
}

.gr-primary {
  min-height: 50px;
  padding: 0 25px;
  background: #155eef;
  color: white;
}

.gr-primary:disabled {
  opacity: .6;
  cursor: wait;
}

.gr-footer {
  justify-content: flex-end;
  padding: 18px 20px;
  border-top: 1px solid #d1d5db;
}

.gr-empty {
  padding: 20px;
}

@media (max-width: 800px) {

  .gr-overlay {
    padding: 0;
  }

  .gr-panel {
    min-height: 100vh;
    border-radius: 0;
  }

  .gr-rosters {
    grid-template-columns: 1fr;
  }

  .gr-side-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .gr-player-list {
    max-height: none;
  }

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

  .gr-player-summary {
    grid-template-columns: 1fr 84px;
    gap: 10px;
    padding: 14px;
  }

  .gr-participation {
    grid-column: 1;
  }

  .gr-quick-field {
    grid-column: 2;
  }

  .gr-player-identity,
  .gr-player-facts,
  .gr-player-actions {
    grid-column: 1 / -1;
  }

  .gr-quick-position {
    grid-column: 1 / -1;
  }

  .gr-player-identity strong {
    overflow: visible;
    white-space: normal;
  }

  .gr-side-selector-wrap {
    align-items: stretch;
    flex-direction: column;
  }

  .gr-side-selector-wrap select {
    width: 100%;
    min-width: 0;
  }

  .gr-player-search {
    margin-inline: 14px;
  }

  .gr-player-search-controls {
    grid-template-columns: 1fr;
  }

  .gr-search-result {
    align-items: stretch;
    flex-direction: column;
  }

  .gr-footer {
    position: sticky;
    bottom: 0;
    background: white;
  }

  .gr-primary {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .gr-player-fields {
    grid-template-columns: 1fr;
  }

  .gr-field-wide {
    grid-column: auto;
  }

  .gr-player-facts {
    grid-template-columns: 1fr;
  }

  .gr-roster-edit-fields {
    grid-template-columns: 1fr;
  }

  .gr-player-edit-actions {
    flex-direction: column-reverse;
  }

  .gr-player-edit-actions button {
    width: 100%;
  }
}


/* ==========================================================
   SPORT UX
   Identidad visual inspirada en marcador y terreno de juego
   ========================================================== */

.gr-panel {
  --gr-navy: #071a2f;
  --gr-blue: #155eef;
  --gr-red: #d92d20;
  --gr-green: #15803d;
  --gr-gold: #d97706;
  background: #eef3f8;
  box-shadow: 0 28px 80px rgba(2, 12, 27, .38);
}

.gr-header {
  position: relative;
  background:
    linear-gradient(115deg, #061426 0%, #0b2948 62%, #12395f 100%);
  border-bottom: 4px solid var(--gr-red);
}

.gr-header::after {
  position: absolute;
  right: 92px;
  bottom: -4px;
  width: 120px;
  height: 4px;
  background: white;
  content: "";
  opacity: .85;
}

.gr-status {
  background: white;
  color: #243b53;
}

.gr-game-info {
  background: var(--gr-navy);
  color: white;
  letter-spacing: .02em;
}

.gr-game-info > span:first-child {
  color: #fbbf24;
  font-weight: 900;
}

.gr-side-selector-wrap {
  padding-block: 18px 4px;
}

.gr-side-selector-wrap select {
  border-color: #12395f;
  background: var(--gr-navy);
  color: white;
  box-shadow: 0 6px 18px rgba(7, 26, 47, .16);
}

.gr-player-search {
  position: relative;
  padding: 18px;
  border: 0;
  background:
    radial-gradient(circle at 92% 18%, rgba(217, 45, 32, .09) 0 54px, transparent 55px),
    linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 8px 24px rgba(15, 35, 60, .1);
  overflow: hidden;
}

.gr-search-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.gr-search-heading label,
.gr-search-heading span {
  display: block;
}

.gr-search-heading label {
  color: var(--gr-navy);
  font-size: 15px;
  font-weight: 900;
}

.gr-search-heading span {
  margin-top: 2px;
  color: #64748b;
  font-size: 12px;
}

.gr-search-ball {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 50%;
  background: white;
  box-shadow: 0 4px 12px rgba(15, 35, 60, .15);
  font-size: 24px;
}

.gr-player-search-controls input {
  min-height: 52px;
  border: 2px solid #b8c7d9;
  border-radius: 10px;
  background: white;
  font-size: 15px;
  transition: border-color .2s, box-shadow .2s;
}

.gr-player-search-controls input:focus {
  border-color: var(--gr-blue);
  box-shadow: 0 0 0 4px rgba(21, 94, 239, .13);
  outline: none;
}

.gr-player-search-controls button {
  min-width: 112px;
  border-radius: 10px;
  background: linear-gradient(135deg, #155eef, #0b46bd);
  box-shadow: 0 5px 14px rgba(21, 94, 239, .24);
}

.gr-search-hint {
  margin-top: 7px;
  color: #718096;
  font-size: 11px;
}

.gr-player-search-results {
  max-height: 430px;
  border: 0;
  box-shadow: 0 8px 20px rgba(15, 35, 60, .11);
  overflow-y: auto;
}

.gr-search-result {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  padding: 13px 14px;
  transition: background .18s, transform .18s;
}

.gr-search-result:hover {
  background: #f0f7ff;
}

.gr-search-player-number {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--gr-navy);
  color: white;
  font-size: 14px;
  font-weight: 900;
}

.gr-search-player-info {
  min-width: 0;
}

.gr-search-player-info > strong {
  color: #102a43;
  font-size: 14px;
}

.gr-search-player-academy {
  color: #486581 !important;
  font-weight: 700;
}

.gr-search-player-chips {
  display: flex;
  gap: 5px;
  margin-top: 7px;
  flex-wrap: wrap;
}

.gr-search-player-chips span {
  margin: 0;
  padding: 4px 7px;
  border-radius: 999px;
  background: #e8eef6;
  color: #334e68;
  font-size: 10px;
  font-weight: 800;
}

.gr-search-result button {
  align-self: center;
  background: linear-gradient(135deg, #16a34a, #15803d);
  box-shadow: 0 5px 14px rgba(21, 128, 61, .2);
}

.gr-search-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  color: #486581;
  font-weight: 800;
}

.gr-search-loading span {
  width: 18px;
  height: 18px;
  border: 3px solid #cbd5e1;
  border-top-color: var(--gr-blue);
  border-radius: 50%;
  animation: gr-spin .7s linear infinite;
}

@keyframes gr-spin {
  to { transform: rotate(360deg); }
}

.gr-side {
  border: 0;
  box-shadow: 0 10px 28px rgba(15, 35, 60, .12);
}

.gr-side-header {
  background: linear-gradient(100deg, #071a2f, #12395f);
  color: white;
}

.gr-side-label {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--gr-red);
  color: white;
}

.gr-side-date,
.gr-side-header small {
  color: #dbeafe;
}

.gr-player:nth-child(even) {
  background: #f8fafc;
}

.gr-player-summary {
  transition: background .18s;
}

.gr-player-summary:hover {
  background: #eef6ff;
}

.gr-edit-player {
  background: linear-gradient(135deg, #155eef, #0b46bd);
  color: white;
  box-shadow: 0 4px 10px rgba(21, 94, 239, .2);
}

.gr-move-player {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #3b2500;
  box-shadow: 0 4px 10px rgba(217, 119, 6, .2);
}

.gr-primary {
  background: linear-gradient(135deg, #15803d, #11632f);
  box-shadow: 0 7px 18px rgba(21, 128, 61, .22);
}

@media (max-width: 800px) {
  .gr-search-result {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .gr-search-result button {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width: 520px) {
  .gr-player-search {
    padding: 14px;
  }

  .gr-search-heading span {
    display: none;
  }

  .gr-player-search-controls button {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gr-search-loading span {
    animation: none;
  }
}

/* Crear jugadores maestros sin salir de Editar Rosters. */
.gr-player-search-controls {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.gr-player-search-controls .gr-create-player {
  background: linear-gradient(135deg, #16834b, #0f6739);
  box-shadow: 0 5px 14px rgba(22, 131, 75, .24);
}

.gr-new-player-overlay {
  position: fixed;
  z-index: 100002;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(7, 18, 34, .78);
  backdrop-filter: blur(5px);
}

.gr-new-player-modal {
  width: min(820px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
}

.gr-new-player-modal header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  background: #0b213d;
  color: #fff;
}

.gr-new-player-modal header span {
  color: #74d69e;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .8px;
}

.gr-new-player-modal header h3 {
  margin: 5px 0 0;
  font-size: 22px;
}

.gr-new-player-modal header button {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 27px;
  cursor: pointer;
}

.gr-new-player-help {
  margin: 0;
  padding: 15px 22px 5px;
  color: #52627a;
}

.gr-new-player-error {
  min-height: 20px;
  padding: 4px 22px;
  color: #b42318;
  font-weight: 800;
}

.gr-new-player-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
  padding: 10px 22px 20px;
}

.gr-new-player-fields label {
  display: grid;
  gap: 5px;
  color: #34445b;
  font-size: 12px;
  font-weight: 900;
}

.gr-new-player-fields input,
.gr-new-player-fields select,
.gr-new-player-fields textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #b8c5d5;
  border-radius: 7px;
  padding: 8px 10px;
  background: #fff;
  color: #10233f;
  font: inherit;
  font-weight: 600;
}

.gr-new-player-fields textarea {
  min-height: 76px;
  resize: vertical;
}

.gr-new-player-fields input[readonly] {
  background: #eef3f8;
}

.gr-new-player-wide {
  grid-column: 1 / -1;
}

.gr-new-player-modal footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px 22px 20px;
  border-top: 1px solid #d9e1eb;
}

@media (max-width: 800px) {
  .gr-player-search-controls {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .gr-player-search-controls .gr-create-player {
    grid-column: 1 / -1;
  }

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

@media (max-width: 520px) {
  .gr-player-search-controls .gr-create-player {
    display: block;
    width: 100%;
  }

  .gr-new-player-fields {
    grid-template-columns: 1fr;
    padding-inline: 14px;
  }

  .gr-new-player-wide {
    grid-column: auto;
  }

  .gr-new-player-modal footer {
    flex-direction: column-reverse;
  }

  .gr-new-player-modal footer button {
    width: 100%;
  }
}
