:root {
  --bg-1: #070b10;
  --bg-2: #0d151b;
  --bg-3: #121d28;
  --line: rgba(165, 181, 194, 0.13);
  --text: #edf6ff;
  --red: #ee3b3b;
  --grass-1: #1e9b52;
  --grass-2: #0e713d;
  --grass: linear-gradient(180deg, var(--grass-1) 0%, var(--grass-2) 100%);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(126, 216, 255, 0.07), transparent 30%),
    linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 52%, var(--bg-3) 100%);
  color: var(--text);
  font-family: "Inter", "Segoe UI", sans-serif;
}

body {
  padding: 8px;
  display: flex;
  flex-direction: column;
}

button {
  font: inherit;
}

.app-shell {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(9, 13, 18, 0.92);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.app-footer {
  flex-shrink: 0;
  padding: 8px 4px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.app-disclaimer {
  margin: 0;
  max-width: 100%;
  text-align: center;
  font-size: 0.64rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: rgba(237, 246, 255, 0.56);
  white-space: nowrap;
}

.app-credit {
  margin: 0;
  text-align: center;
  font-size: 0.62rem;
  letter-spacing: 0.02em;
  color: rgba(237, 246, 255, 0.32);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 19, 25, 0.82);
}

.brand-block {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.league-picker {
  position: relative;
}

.league-picker-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border-radius: 12px;
  border: 1px solid rgba(126, 216, 255, 0.28);
  background: linear-gradient(135deg, rgba(126, 216, 255, 0.14), rgba(238, 59, 59, 0.08));
  color: var(--text);
  cursor: pointer;
  transition: 0.15s ease;
}

.league-picker-toggle:hover,
.league-picker.open .league-picker-toggle {
  border-color: rgba(126, 216, 255, 0.55);
  box-shadow: inset 0 0 0 1px rgba(126, 216, 255, 0.2);
}

.league-picker-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  object-fit: contain;
  padding: 3px;
  flex-shrink: 0;
}

.league-picker-name {
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.league-picker-caret {
  color: rgba(237, 246, 255, 0.6);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.league-picker.open .league-picker-caret {
  transform: rotate(180deg);
}

.league-picker-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  min-width: 200px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(14, 19, 25, 0.98);
  box-shadow: var(--shadow);
}

.league-picker.open .league-picker-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.league-picker-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: 0.15s ease;
}

.league-picker-option:hover {
  background: rgba(126, 216, 255, 0.1);
}

.league-picker-option.active {
  background: linear-gradient(135deg, rgba(238, 59, 59, 0.16), rgba(126, 216, 255, 0.1));
  box-shadow: inset 0 0 0 1px rgba(238, 59, 59, 0.24);
}

.league-picker-option-logo {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  object-fit: contain;
  padding: 2px;
  flex-shrink: 0;
}

.league-picker-option-name {
  font-size: 0.78rem;
  font-weight: 700;
}

h1, h2 {
  margin: 0;
}

h1 {
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.05em;
}

h2 {
  font-size: 1rem;
  font-weight: 800;
}

.formation-picker,
.lang-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.formation-picker {
  justify-content: flex-start;
}

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

.generate-btn {
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(34, 197, 94, 0.35);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.16), rgba(34, 197, 94, 0.06));
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  transition: 0.15s ease;
}

.generate-btn:hover {
  border-color: rgba(34, 197, 94, 0.6);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.24), rgba(34, 197, 94, 0.1));
}

.lang-picker {
  justify-content: flex-end;
}

.formation-btn,
.lang-btn {
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(17, 24, 31, 0.9);
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: 0.15s ease;
}

.formation-btn:hover,
.formation-btn.active,
.lang-btn:hover,
.lang-btn.active {
  border-color: rgba(238, 59, 59, 0.42);
  background: linear-gradient(135deg, rgba(238, 59, 59, 0.12), rgba(126, 216, 255, 0.08));
  box-shadow: inset 0 0 0 1px rgba(238, 59, 59, 0.18);
}

.main-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(340px, 420px);
  gap: 12px;
  padding: 10px 12px 12px;
}

.pitch-panel,
.players-panel {
  background: rgba(12, 18, 25, 0.88);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px 10px;
}

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

.panel-header-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.captain-picker-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.squad-value-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.squad-value-label {
  margin: 0;
  font-size: 0.54rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(237, 246, 255, 0.5);
}

.squad-value {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
}

.reset-btn {
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(17, 24, 31, 0.9);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  transition: 0.15s ease;
}

.reset-btn:hover:not(:disabled) {
  border-color: rgba(238, 59, 59, 0.5);
  background: rgba(238, 59, 59, 0.14);
}

.reset-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.captain-picker {
  position: relative;
}

.captain-picker-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 180px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(20, 27, 33, 1), rgba(12, 18, 24, 1));
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(126, 216, 255, 0.06), 0 10px 22px rgba(0, 0, 0, 0.12);
  transition: 0.15s ease;
}

.captain-picker-toggle:hover:not(:disabled),
.captain-picker.open .captain-picker-toggle {
  border-color: rgba(126, 216, 255, 0.52);
  box-shadow: 0 0 0 3px rgba(126, 216, 255, 0.12), inset 0 0 0 1px rgba(126, 216, 255, 0.18), 0 12px 24px rgba(0, 0, 0, 0.18);
}

.captain-picker-toggle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.captain-picker-name {
  flex: 1;
  min-width: 0;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.captain-picker-caret {
  color: rgba(237, 246, 255, 0.6);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.captain-picker.open .captain-picker-caret {
  transform: rotate(180deg);
}

.captain-picker-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  min-width: 220px;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(14, 19, 25, 0.98);
  box-shadow: var(--shadow);
}

.captain-picker.open .captain-picker-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.captain-picker-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: 0.15s ease;
}

.captain-picker-option:hover {
  background: rgba(126, 216, 255, 0.1);
}

.captain-picker-option.active {
  background: linear-gradient(135deg, rgba(238, 59, 59, 0.16), rgba(126, 216, 255, 0.1));
  box-shadow: inset 0 0 0 1px rgba(238, 59, 59, 0.24);
}

.captain-picker-option.is-placeholder {
  color: rgba(237, 246, 255, 0.5);
  font-weight: 600;
}

.captain-picker-option-logo {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  object-fit: contain;
  padding: 2px;
  flex-shrink: 0;
}

.captain-picker-option-name {
  font-size: 0.78rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pitch-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.pitch {
  position: relative;
  width: 100%;
  aspect-ratio: 105 / 68;
  min-height: 420px;
  margin: 0 auto;
  background: var(--grass);
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.pitch::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to right,
    transparent 0,
    transparent 36px,
    rgba(255, 255, 255, 0.04) 37px,
    transparent 38px
  );
  opacity: 0.4;
}

.pitch-halo {
  position: absolute;
  inset: 12px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
}

.center-line {
  position: absolute;
  left: 50%;
  top: 0;
  width: 2px;
  height: 100%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.8);
}

.center-circle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 17.4%;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, 0.78);
}

.penalty-box,
.goal-box {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 2px solid rgba(255, 255, 255, 0.8);
}

.penalty-box {
  width: 15.7%;
  height: 59.3%;
}

.goal-box {
  width: 5.2%;
  height: 26.9%;
}

.penalty-box.left {
  left: 0;
  border-left: none;
}

.penalty-box.right {
  right: 0;
  border-right: none;
}

.goal-box.left {
  left: 0;
  border-left: none;
}

.goal-box.right {
  right: 0;
  border-right: none;
}

.field-grid {
  position: absolute;
  inset: 18px;
  z-index: 1;
  pointer-events: none;
}

.coord-line {
  position: absolute;
  background: rgba(255, 255, 255, 0.2);
}

.coord-line.x-line {
  top: 0;
  bottom: 0;
  width: 1px;
  transform: translateX(-50%);
}

.coord-line.y-line {
  left: 0;
  right: 0;
  height: 1px;
  transform: translateY(-50%);
}

.coord-label {
  position: absolute;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.coord-label.x-label {
  bottom: -18px;
  transform: translateX(-50%);
}

.coord-label.y-label {
  left: -20px;
  transform: translateY(-50%);
}

.field-positions {
  position: absolute;
  inset: 18px;
  z-index: 2;
}

.pitch-slot {
  position: absolute;
  left: 0;
  top: 0;
  width: clamp(52px, 5.4vw, 90px);
  height: clamp(52px, 5.4vw, 90px);
  margin-left: calc(clamp(52px, 5.4vw, 90px) / -2);
  margin-top: calc(clamp(52px, 5.4vw, 90px) / -2);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.18);
  border: 3px dashed rgba(255, 255, 255, 0.7);
  display: grid;
  place-items: center;
  transition: 0.15s ease;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.pitch-slot.dragover {
  border-style: solid;
  background: rgba(59, 130, 246, 0.22);
  box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.12);
}

.pitch-slot.is-dragging {
  opacity: 0.7;
}

/* A filled slot's background always reads "player placed" (green) —
   only the dashed border (and its glow) carries the optimal/compatible/
   incompatible suitability signal now. */
.pitch-slot.is-optimal,
.pitch-slot.is-compatible,
.pitch-slot.is-incompatible {
  background: rgba(34, 197, 94, 0.2);
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.32);
}

.pitch-slot.is-optimal {
  border-color: rgba(34, 197, 94, 0.9);
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.32), 0 0 18px rgba(34, 197, 94, 0.18);
}

.pitch-slot.is-compatible {
  border-color: rgba(250, 204, 21, 0.9);
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.32), 0 0 18px rgba(250, 204, 21, 0.16);
}

.pitch-slot.is-incompatible {
  border-color: rgba(239, 68, 68, 0.92);
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.32), 0 0 18px rgba(239, 68, 68, 0.16);
}

.captain-mark {
  position: absolute;
  top: 2px;
  left: 2px;
  z-index: 4;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: linear-gradient(135deg, #f8fafc 0%, #dbeafe 100%);
  border: 2px solid rgba(15, 23, 42, 0.9);
  color: #0f172a;
  font-size: 0.72rem;
  font-weight: 900;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.28);
}

.number-mark {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 4;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(7, 12, 17, 0.82);
  border: 2px solid rgba(15, 23, 42, 0.9);
  color: #ffffff;
  font-size: 0.66rem;
  font-weight: 900;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.28);
}

.slot-label {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(7, 12, 17, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(237, 246, 255, 0.94);
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* Solid (not translucent) fills — the pill sits right on top of pitch
   lines in some formations, and a see-through background made both the
   position code and the fit signal hard to read against them. */
.pitch-slot.is-optimal .slot-label {
  background: #16a34a;
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.pitch-slot.is-compatible .slot-label {
  background: #f59e0b;
  border-color: rgba(255, 255, 255, 0.3);
  color: #1f2937;
}

.pitch-slot.is-incompatible .slot-label {
  background: #dc2626;
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.slot-player {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(40px, 3.7vw, 62px);
  height: clamp(40px, 3.7vw, 62px);
  border-radius: 16px;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.14);
  color: #0f172a;
  font-size: clamp(0.36rem, 0.75vw, 0.52rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.1;
  padding: 0;
  text-transform: none;
}

.slot-player.name-size-lg {
  font-size: 0.82rem;
}

.slot-player.name-size-md {
  font-size: 0.72rem;
}

.slot-player.name-size-sm {
  font-size: 0.6rem;
}

.slot-player-logo {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 58%;
  height: 58%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  object-fit: contain;
  padding: 5px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
  display: block;
}

.slot-player-name {
  position: absolute;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(17px, 1.7vw, 24px);
  max-width: calc(100% + 44px);
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #ffffff;
  font-size: clamp(0.56rem, 1.15vw, 0.82rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  z-index: 3;
  overflow: visible;
  text-overflow: clip;
}

/* Filled-slot badge always reads "player placed" (green) — position
   suitability is now judged solely by the dashed border color above, not
   by this fill. Keyed off .is-empty rather than :has(.slot-player:empty):
   .slot-player always contains a name <span>, even when empty, so it
   never actually matches :empty. */
.pitch-slot:not(.is-empty) .slot-player {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.9);
  width: clamp(46px, 4.5vw, 76px);
  height: clamp(46px, 4.5vw, 76px);
  border-radius: 18px;
}

.players-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.club-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.club-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(17, 24, 31, 0.9);
  cursor: pointer;
  transition: 0.15s ease;
}

.club-chip:hover {
  border-color: rgba(126, 216, 255, 0.35);
}

.club-chip.active {
  border-color: rgba(238, 59, 59, 0.42);
  background: linear-gradient(135deg, rgba(238, 59, 59, 0.12), rgba(126, 216, 255, 0.08));
  box-shadow: inset 0 0 0 1px rgba(238, 59, 59, 0.18);
}

.club-chip-logo {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  object-fit: contain;
  padding: 3px;
  flex-shrink: 0;
}

.club-chip-name {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text);
  opacity: 0.65;
}

.club-chip.active .club-chip-name {
  opacity: 1;
}

.club-filter-empty,
.players-empty {
  margin: 0;
  padding: 10px 4px;
  font-size: 0.74rem;
  font-weight: 600;
  color: rgba(237, 246, 255, 0.5);
}

.club-chip-checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.player-search {
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(17, 24, 31, 0.9);
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  outline: none;
  transition: 0.15s ease;
}

.player-search::placeholder {
  color: rgba(237, 246, 255, 0.4);
}

.player-search:focus {
  border-color: rgba(126, 216, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(126, 216, 255, 0.12);
}

.players-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.position-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.group-title {
  color: var(--red);
  font-size: 0.55rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 4px 0;
}

.player-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: linear-gradient(180deg, #ffffff 0%, #edf2f7 100%);
  color: #111827;
  cursor: grab;
  transition: 0.15s ease;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.player-side-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  flex-shrink: 0;
}

.player-card:hover {
  transform: translateY(-1px);
  border-color: rgba(14, 165, 233, 0.26);
}

.player-card:active {
  cursor: grabbing;
}

.player-card:not(.is-assigned) {
  border-color: rgba(148, 163, 184, 0.45);
}

.player-card.is-assigned {
  background: linear-gradient(135deg, #1ecf8d 0%, #0ea5e9 100%);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 12px 22px rgba(14, 165, 233, 0.18);
}

.player-card.is-dragging {
  opacity: 0.55;
}

.player-card.is-selected {
  outline: 2px solid rgba(126, 216, 255, 0.9);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(126, 216, 255, 0.18), 0 12px 20px rgba(14, 165, 233, 0.12);
}

.player-avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.player-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  display: block;
}

.player-card.is-assigned .player-avatar {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.player-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.player-name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
  max-width: 100%;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.2;
  color: #0f172a;
  letter-spacing: -0.02em;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.player-number {
  flex-shrink: 0;
  color: rgba(15, 23, 42, 0.58);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.player-market-value {
  flex-shrink: 0;
  color: #94a3b8;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.player-card.is-assigned .player-name {
  color: #ffffff;
}

.player-card.is-assigned .player-number {
  color: rgba(255, 255, 255, 0.74);
}

.player-card.is-assigned .player-market-value {
  color: rgba(255, 255, 255, 0.55);
}

.player-role {
  font-size: 0.62rem;
  color: #475569;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.player-card.is-assigned .player-role {
  color: rgba(255, 255, 255, 0.88);
}

.assignment-chip {
  padding: 5px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(15, 23, 42, 0.1);
  color: #334155;
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.drag-preview {
  position: fixed;
  top: -1000px;
  left: -1000px;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: linear-gradient(135deg, #1ecf8d 0%, #0ea5e9 100%);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.drag-preview-logo {
  position: absolute;
  top: 8%;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 60%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  object-fit: contain;
  padding: 4px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  display: block;
}

.drag-preview-name {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: calc(100% + 14px);
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.player-card.is-assigned .assignment-chip {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

@media (max-width: 980px) {
  html, body {
    overflow: auto;
  }

  body {
    padding: 8px;
  }

  .app-shell {
    min-height: calc(100vh - 16px);
    height: auto;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .main-grid {
    grid-template-columns: 1fr;
  }

  .pitch {
    min-height: 320px;
    max-height: 72vh;
  }

  .app-disclaimer {
    white-space: normal;
    font-size: 0.6rem;
  }
}

