@font-face {
  font-family: "Suisse Int Mono";
  src: url("assets/font/SuisseIntlMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-top: #0a1338;
  --bg-bottom: #5a0e2a;
  --neon: #ffffff;
  --ink: #ffffff;
  --ink-muted: rgba(255, 255, 255, 0.6);
  --ink-faint: rgba(255, 255, 255, 0.35);
  --tile-bg: rgba(8, 12, 36, 0.45);
  --tile-stripe: rgba(255, 255, 255, 0.85);
  --col-max: 480px;
  --pitch-aspect: 3 / 4;
  --font-mono:
    "Suisse Int Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.01em;
  line-height: 1.45;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  overflow-x: hidden;
}

.page {
  width: 100%;
  max-width: var(--col-max);
  margin: 0 auto;
  padding: 12px 16px 32px;
}

/* ───── Hero ───── */
.hero {
  display: flex;
  /* flex-direction: column; */
  align-items: center;
  gap: 18px;
  padding: 8px 0 18px;
}
.hero__logos {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: min(200px, 40%);
}
.hero__logo {
  display: block;
  height: auto;
  flex: 0 0 auto;
}
.hero__logo--main {
  width: min(170px, 60%);
}
.hero__logo--sub {
  width: min(170px, 55%);
}
.hero__title {
  margin: 4px 0 0;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1;
  text-align: center;
}
.hero__sub {
  margin: 4px 0 0;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  text-align: center;
}

/* ───── Formation chips ───── */
.formations {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0 12px;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 24px,
    #000 calc(100% - 24px),
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 24px,
    #000 calc(100% - 24px),
    transparent 100%
  );
}
.formations::-webkit-scrollbar {
  display: none;
}
.chip {
  flex: 0 0 auto;
  padding: 8px 12px;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink-faint);
  border-radius: 0;
  cursor: pointer;
}
.chip:hover {
  border-color: var(--ink-muted);
}
.chip--active {
  background: var(--ink);
  color: #0a1338;
  border-color: var(--ink);
}

/* ───── Pitch ───── */
.pitch {
  position: relative;
  width: 100%;
  aspect-ratio: var(--pitch-aspect);
  margin: 8px 0 16px;
  border: 1.5px solid var(--neon);
  background-color: transparent;
  background-image:
    url("assets/pitch-lines.svg"),
    radial-gradient(
      ellipse at 50% 100%,
      rgba(255, 40, 80, 0.22),
      transparent 60%
    ),
    linear-gradient(180deg, rgba(10, 19, 56, 0.5), rgba(90, 14, 42, 0.5));
  background-size:
    100% 100%,
    100% 100%,
    100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  overflow: hidden;
}

/* ───── Slot tiles ───── */
.slot {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%);
  width: 20%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0px 4px 0;
  background: var(--tile-bg);
  border: none;
  border-top: 3px solid var(--tile-stripe);
  color: var(--ink);
  cursor: grab;
  font: inherit;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  touch-action: none;
  transition: transform 80ms ease-out;
}
.slot:active {
  cursor: grabbing;
}
/* All children non-interactive so pointer events always hit the .slot button itself */
.slot > * {
  pointer-events: none;
}

.slot__handle {
  position: absolute;
  top: 5px;
  left: 4px;
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--ink);
  opacity: 0.8;
  line-height: 1;
}
.slot__label {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.slot__img {
  width: 45%;
  aspect-ratio: 1;
  object-fit: contain;
  opacity: 0.85;
  -webkit-user-drag: none;
}
.slot-div {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.slot__name {
  width: 100%;
  text-align: center;
  font-size: 8px;
  line-height: 1.15;
  letter-spacing: 0.01em;
  padding: 3px 2px;
  background: rgba(0, 0, 0, 0.45);
  min-height: 20px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
  &.slot__name--empty {
    color: var(--ink-muted);
    opacity: 0.5;
    font-size: 8px;
    letter-spacing: -0.05em;
    padding: 10px 1px;
    min-height: auto;
    white-space: nowrap;
    line-height: 1;
  }
}

/* drag states */
.slot--dragging {
  opacity: 0.35;
}
.slot--target {
  outline: 1.5px solid var(--neon);
  outline-offset: 2px;
}
.slot-ghost {
  position: fixed;
  z-index: 100;
  transform: translate(-50%, -50%) scale(1.05);
  pointer-events: none;
  width: min(110px, 20vw);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ───── Head coach picker ───── */
.coach-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0 2px;
}
.coach-picker__label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.coach-picker__trigger {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink);
  border: 1px solid var(--ink-faint);
  padding: 10px 12px;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.02em;
  border-radius: 0;
  text-align: left;
  cursor: pointer;
}
.coach-picker__trigger--empty {
  color: var(--ink-muted);
}

/* ───── Action buttons ───── */
.actions {
  display: flex;
  gap: 8px;
  padding-top: 8px;
}
.btn {
  flex: 1;
  padding: 12px 14px;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 0;
  background: transparent;
  border: 1px solid var(--ink);
  color: var(--ink);
}
.btn:hover {
  background: rgba(255, 255, 255, 0.06);
}
.btn--primary {
  background: var(--ink);
  color: #0a1338;
}
.btn--primary:hover {
  background: rgba(255, 255, 255, 0.92);
}

/* ───── Modal ───── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
}
.modal[hidden] {
  display: none;
}
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal__sheet {
  position: absolute;
  left: 2.5vw;
  right: 2.5vw;
  bottom: 5vh;
  height: 90vh; /* fixed so list shrinking doesn't reflow the sheet */
  background: linear-gradient(180deg, #14204d 0%, #391127 100%);
  border-top: 1.5px solid var(--neon);
  border-left: 1.5px solid var(--neon);
  border-bottom: 1.5px solid var(--neon);
  border-right: 1.5px solid var(--neon);
  padding: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@media (min-width: 600px) {
  .modal__sheet {
    bottom: auto;
    left: 50%;
    top: 50%;
    right: auto;
    transform: translate(-50%, -50%);
    width: min(560px, 90vw);
    height: 80vh;
    border: 1.5px solid var(--neon);
  }
}
.modal__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.modal__title {
  flex: 1;
  margin: 0;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.modal__btn {
  background: transparent;
  border: 1px solid var(--ink-faint);
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 0;
  cursor: pointer;
}
.modal__btn:hover {
  border-color: var(--ink);
}
.modal__grid {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  padding-bottom: 4px;
}

/* ───── Player picker list ───── */
.plist__input {
  flex: 0 0 auto;
  font: inherit;
  font-size: 13px;
  padding: 12px 14px;
  border-radius: 0;
  border: 1px solid var(--ink-faint);
  background: rgba(0, 0, 0, 0.35);
  color: var(--ink);
  outline: none;
  letter-spacing: 0.02em;
}
.plist__input::placeholder {
  color: var(--ink-muted);
  letter-spacing: 0.05em;
}
.plist__input:focus {
  border-color: var(--neon);
}

.plist__list {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.plist__row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 13px;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  letter-spacing: 0.01em;
}
.plist__row:hover,
.plist__row:focus-visible {
  background: rgba(255, 255, 255, 0.05);
  outline: none;
}
.plist__row--active {
  background: rgba(255, 255, 255, 0.12);
}
.plist__row--active::after {
  content: "✓";
  margin-left: auto;
  color: var(--neon);
}
.plist__row--custom {
  color: var(--ink-muted);
}
.plist__name {
  flex: 1;
  font-weight: 400;
}
.plist__years {
  font-size: 11px;
  color: var(--ink-muted);
}
.plist__plus {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px dashed var(--ink-muted);
  font-size: 14px;
  line-height: 1;
}

/* ───── Share PNG frame (1080×1920) ───── */
.share-frame {
  position: absolute;
  left: -10000px;
  top: 0;
  width: 1080px;
  height: 1920px;
  pointer-events: none;
}
.share-frame__inner {
  width: 1080px;
  height: 1920px;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  display: flex;
  flex-direction: column;
  padding: 80px 80px 64px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 400;
}
.share-frame__header {
  text-align: center;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.share-frame__logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  transform: translateY(-25px);
}
.share-frame__logo {
  width: 180px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}
.share-frame__logo--main {
  width: 180px;
  height: auto;
}
.share-frame__logo--sub {
  width: 200px;
  height: auto;
}
.share-frame__title {
  margin: 0;
  font-size: 64px;
  line-height: 0.95;
  letter-spacing: 0.02em;
}
.share-frame__sub {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}
.share-frame__pitch {
  position: relative;
  flex: 1;
  min-height: 0;
  border: 3px solid var(--neon);
  background-color: transparent;
  background-image:
    radial-gradient(
      ellipse at 50% 100%,
      rgba(255, 40, 80, 0.22),
      transparent 60%
    ),
    linear-gradient(180deg, rgba(10, 19, 56, 0.5), rgba(90, 14, 42, 0.5));
  background-size:
    100% 100%,
    100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  margin-bottom: 32px;
  overflow: hidden;
}
.share-pitch-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.share-pitch-lines__halfway {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 3px solid rgba(255, 255, 255, 0.9);
}
.share-pitch-lines__box {
  position: absolute;
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-sizing: border-box;
}
.share-pitch-lines__box--top-penalty {
  left: 20%;
  width: 60%;
  top: 0;
  height: 13.5%;
}
.share-pitch-lines__box--top-goal {
  left: 36%;
  width: 28%;
  top: 0;
  height: 4.9%;
}
.share-pitch-lines__box--bottom-penalty {
  left: 20%;
  width: 60%;
  bottom: 0;
  height: 13.5%;
}
.share-pitch-lines__box--bottom-goal {
  left: 36%;
  width: 28%;
  bottom: 0;
  height: 4.9%;
}
.share-pitch-lines__spot {
  position: absolute;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  margin-top: -4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  left: 50%;
}
.share-pitch-lines__spot--center {
  top: 50%;
}
.share-pitch-lines__spot--top {
  top: 9.75%;
}
.share-pitch-lines__spot--bottom {
  top: 90.25%;
}
.share-frame__pitch .slot {
  width: 22%;
  border-top-width: 3px;
  padding: 18px 8px 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.share-frame__pitch .slot__handle {
  display: none;
}
.share-frame__pitch .slot__label {
  font-size: 18px;
  letter-spacing: 0.18em;
}
.share-frame__pitch .slot__img {
  width: 44%;
  opacity: 0.85;
}
.share-frame__pitch .slot__name {
  font-size: 22px;
  padding: 6px 4px;
  min-height: 60px;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.share-frame__coach {
  text-align: center;
  font-size: 26px;
  letter-spacing: 0.05em;
  margin-bottom: 18px;
  color: var(--ink);
}
.share-frame__footer {
  text-align: center;
  font-size: 22px;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
