:root {
  --bg: #eef2f6;
  --surface: #ffffff;
  --ink: #152335;
  --muted: #627289;
  --border: #d2dbe6;
  --accent: #0e5d33;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #f8fbff, #eaf0f6 58%, #e0e8f0);
}

.app {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 12px;
  display: grid;
  gap: 12px;
}

.toolbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: end;
}

.toolbar-block {
  display: grid;
  gap: 6px;
}

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

select,
button {
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

button {
  font-weight: 600;
}

button:active:not(.player) {
  transform: translateY(1px);
}

.customization {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
}

.customization h2 {
  margin: 0 0 10px;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.collapsible {
  padding: 0;
}

.collapsible > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.collapsible > summary::-webkit-details-marker {
  display: none;
}

.collapsible-body {
  padding: 0 10px 10px;
  display: grid;
  gap: 10px;
}

.roster-controls {
  display: grid;
  gap: 8px;
}

.lineup-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.lineup-controls input,
.lineup-controls select {
  width: 100%;
}

.lineup-controls #lineupName,
.lineup-controls #savedLineups {
  grid-column: 1 / -1;
}

.roster-controls textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  resize: vertical;
  font: inherit;
}

.roster-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.roster-actions input[type="file"] {
  max-width: 62%;
}

.picker.hidden {
  display: none;
}

.picker {
  position: fixed;
  inset: 0;
  background: rgba(8, 14, 24, 0.42);
  display: grid;
  place-items: center;
  z-index: 1000;
  padding: 14px;
}

.picker-card {
  width: min(460px, 100%);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.picker-card h3 {
  margin: 0;
  font-size: 16px;
}

.picker-card input,
.picker-card select {
  width: 100%;
}

.picker-card select {
  min-height: 190px;
}

.picker-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.color-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.color-grid label {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  background: #f7fafd;
  border: 1px solid #e2eaf4;
  border-radius: 10px;
  padding: 8px;
  font-size: 12px;
}

.color-inputs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

input[type="color"] {
  width: 34px;
  height: 34px;
  border: none;
  padding: 0;
  background: transparent;
}

input[type="text"] {
  width: 84px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  text-transform: uppercase;
}

.pitch-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px;
}

.pitch {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 12px;
  overflow: hidden;
  background-image: url('./assets/pitch.svg');
  background-size: cover;
  background-position: center;
  touch-action: none;
  user-select: none;
}

.player {
  position: absolute;
  width: clamp(68px, 17.5vw, 120px);
  height: clamp(68px, 17.5vw, 120px);
  transform: translate(-50%, -50%);
  border: none;
  background: transparent;
  padding: 0;
  touch-action: none;
  cursor: grab;
}

.player.dragging {
  cursor: grabbing;
  z-index: 40;
}

.jersey-shell {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(10, 18, 28, 0.28));
}

.jersey-shell svg {
  width: 100%;
  height: 100%;
}

.jersey-chest,
.jersey-number {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) scaleY(1.12);
  width: 70%;
  text-align: center;
  color: var(--jersey-text-color, #ffffff);
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.45),
    0 0 2px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  user-select: none;
  font-family: "Arial Black", "Segoe UI", Arial, sans-serif;
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jersey-chest {
  top: 28%;
  font-size: clamp(6px, 1.35vw, 9px);
}

.jersey-number {
  top: 50%;
  font-size: clamp(9px, 2.6vw, 16px);
  transform: translateX(-50%) scaleY(1.24);
}

.player-label {
  position: absolute;
  left: 50%;
  bottom: -24px;
  transform: translateX(-50%);
  min-width: 52px;
  max-width: 180px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(14, 28, 46, 0.16);
  font-size: clamp(13px, 2.8vw, 22px);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-label.empty {
  display: none;
}

@media (min-width: 740px) {
  .app {
    padding: 20px;
  }

  .color-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .player {
    width: clamp(72px, 9vw, 112px);
    height: clamp(72px, 9vw, 112px);
  }

  .player-label {
    bottom: -26px;
    font-size: clamp(15px, 1.6vw, 24px);
  }

}
