:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #e3e6eb;
  --ink: #111827;
  --muted: #6b7280;
  --accent: #0d7a4f;
  --accent-ink: #ffffff;
  --error: #b91c1c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 1px 3px rgba(17, 24, 39, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    'Nunito',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

h1,
h2,
h3,
h4,
.favourite-card-name,
.player-detail-name,
.brand {
  font-family:
    'Urbanist',
    'Nunito',
    -apple-system,
    sans-serif;
  font-weight: 600;
  letter-spacing: 0.01em;
}

a {
  color: var(--ink);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  letter-spacing: -0.01em;
}
.site-nav {
  display: flex;
  gap: 12px;
  align-items: center;
}
.muted {
  color: var(--muted);
  font-size: 0.9rem;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.landing {
  min-height: 100vh;
  min-height: 100svh;
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 48px;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 1.4fr;
  gap: 80px;
  align-content: center;
  align-items: start;
}
@media (max-width: 880px) {
  .landing {
    grid-template-columns: 1fr;
    gap: 48px;
    /* Drop the desktop align-content: center on mobile — when the right column
       appears on expand the grid grows past 100vh, which would re-centre
       everything and visibly pull the title upward. Top-align so the title
       sits at a fixed offset across states. */
    align-content: start;
    padding: 48px 24px;
    justify-items: center;
  }
  /* Higher specificity (.landing-left >) so this beats the base .landing-title
     rule that appears later in the file with a `margin` shorthand which
     otherwise resets margin-top to 0. */
  .landing-left > .landing-title {
    margin-top: 10vh;
  }
  .landing-title br {
    display: none;
  }
  /* Higher specificity (.landing >) so this beats the base .landing-left's
     width: fit-content rule that appears later in the file. Locks the column
     width across collapsed / expanded states. */
  .landing > .landing-left,
  .landing > .landing-right {
    width: 100%;
    max-width: 420px;
  }
  /* Hover-preview has no meaning on touch devices, so hide the right column
     entirely until a selection is made. */
  .landing-right {
    display: none;
  }
  .landing:has(.landing-menu.is-expanded) .landing-right {
    display: block;
  }
}

.landing-left {
  display: flex;
  flex-direction: column;
  width: fit-content;
  max-width: 360px;
  position: relative;
}
.landing-title {
  font-family: 'Urbanist', sans-serif;
  font-weight: 900;
  font-size: clamp(2.75rem, 5.5vw, 4.5rem);
  line-height: 0.92;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 18px;
}
.landing-tagline {
  font-size: 1.4rem;
  font-weight: 300;
  color: var(--ink);
  margin: 0 0 80px;
  max-width: 30ch;
  line-height: 1.5;
  opacity: 0.8;
}

.landing-menu {
  position: relative;
}
.landing-menu ul {
  position: relative;
  z-index: 1;
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 298px;
  transition: gap 0.42s cubic-bezier(0.32, 0.72, 0, 1);
}
.landing-menu.is-expanded ul {
  gap: 0;
}
.landing-menu li {
  height: 48px;
  overflow: hidden;
  transition:
    height 0.42s cubic-bezier(0.32, 0.72, 0, 1),
    opacity 0.32s ease;
}
.landing-menu.is-expanded li:not(.is-expanded-item) {
  height: 0;
  opacity: 0;
  pointer-events: none;
}
.landing-menu button {
  background: none;
  border: none;
  padding: 12px 0;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: color 0.15s ease;
}
.landing-menu button[data-menu-item]::before {
  content: '';
  display: block;
  width: 0.85em;
  height: 0.85em;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask: url('../assets/images/soccer-ball.svg') center / contain
    no-repeat;
  mask: url('../assets/images/soccer-ball.svg') center / contain no-repeat;
  opacity: 0.55;
  transition: opacity 0.15s ease;
}
.landing-menu button:hover {
  color: var(--ink);
}
.landing-menu button[data-menu-item]:hover::before,
.landing-menu button[data-menu-item].is-active::before {
  opacity: 0.85;
}
.landing-menu-outline {
  position: absolute;
  left: -14px;
  right: -14px;
  top: 0;
  height: 0;
  background: var(--surface);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  pointer-events: none;
  z-index: 0;
  box-shadow: rgba(0, 0, 0, 0.05) 0px 0px 0px 1px;
  transition:
    transform 0.28s cubic-bezier(0.32, 0.72, 0, 1),
    height 0.28s cubic-bezier(0.32, 0.72, 0, 1),
    opacity 0.18s ease;
}
.landing-menu:not(:has(button.is-active)) .landing-menu-outline {
  opacity: 0;
}
.landing-menu button.is-active {
  color: var(--ink);
}
.landing-menu.is-expanded button[data-menu-item] {
  cursor: default;
}

.landing-menu-detail {
  position: absolute;
  top: 76px;
  left: 0;
  right: 0;
  z-index: 2;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
  /* Fading OUT (back button): quick, no delay so menu items can expand cleanly */
  transition:
    opacity 0.12s ease,
    transform 0.12s ease,
    visibility 0s linear 0.12s;
}
.landing-menu.is-expanded .landing-menu-detail {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  /* Fading IN: smooth eased fade up, no delay */
  transition:
    opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0s linear 0s;
}
.landing-menu-detail p {
  margin: 0 0 18px;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  max-width: 40ch;
  line-height: 2rem;
  font-weight: 400;
  opacity: 0.9;
}
.landing-menu-detail p:first-of-type {
  font-weight: 600;
}
.landing-menu-back {
  margin-top: 24px;
  background: none;
  border: none;
  padding: 6px 0;
  font: inherit;
  font-size: 0.95rem;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease;
}
.landing-menu-back:hover {
  color: var(--ink);
}

@media (max-width: 880px) {
  /* In the stacked layout, the detail panel needs to push the right column
     down rather than floating absolutely over it. */
  .landing-menu-detail {
    position: relative;
    top: auto;
    margin-top: 24px;
  }
  .landing-menu.is-expanded ul {
    min-height: 0;
  }
}

.landing-right {
  position: relative;
  margin-top: -1vh;
}
.landing-extras {
  position: absolute;
  top: calc(100% + 24px);
  left: 0;
  right: 0;
  display: none;
  flex-direction: column;
  gap: 24px;
  padding-bottom: 48px;
  pointer-events: none;
}
.landing-screenshot-extra {
  width: 100%;
  height: auto;
  display: block;
  box-shadow: 0 12px 24px rgba(17, 24, 39, 0.1);
  opacity: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow:
    rgba(9, 30, 66, 0.25) 0px 1px 1px,
    rgba(9, 30, 66, 0.13) 0px 0px 1px 1px;
  transform: translateY(24px);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}
.landing:has(.landing-menu.is-expanded) .landing-extras {
  pointer-events: auto;
}
.landing:has(.landing-menu.is-expanded) .landing-screenshot-extra {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}
.landing:has(.landing-menu.is-expanded)
  .landing-screenshot-extra:nth-of-type(1) {
  transition-delay: 0s;
}
.landing:has(.landing-menu.is-expanded)
  .landing-screenshot-extra:nth-of-type(2) {
  transition-delay: 0.15s;
}
.landing-screen-frame {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: url('../assets/images/screenBck.webp');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}
.landing-screenshot {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  display: block;
  transform: scale(0.75);
  transform-origin: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow:
    rgba(9, 30, 66, 0.25) 0px 1px 1px,
    rgba(9, 30, 66, 0.13) 0px 0px 1px 1px;
  transition: transform 0.35s ease;
}
.landing:has(.landing-menu.is-expanded) .landing-screenshot {
  transform: scale(1);
}

.inline-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.inline-link:hover {
  filter: brightness(1.1);
}

#interest-form button[type='submit'],
#contact-form button[type='submit'] {
  margin-top: 16px;
}
#contact-form textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  resize: vertical;
  font-size: 1rem;
  font-weight: 400;
}
#contact-form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.landing-top-nav {
  position: absolute;
  top: 24px;
  right: 32px;
  z-index: 100;
  display: flex;
  gap: 6px;
}
.landing-top-link {
  background: #f7f8fa;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 0 0 1px transparent;
  transition:
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}
.landing-top-link:hover {
  color: var(--ink);
  background: var(--surface);
  border-top-color: rgba(255, 255, 255, 0.15);
  border-bottom-color: rgba(0, 0, 0, 0.15);
  box-shadow: rgba(0, 0, 0, 0.05) 0px 0px 0px 1px;
}
@media (max-width: 720px) {
  .landing-top-nav {
    top: 16px;
    right: 16px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

.signin-dialog {
  border: none;
  border-radius: 12px;
  padding: 32px;
  width: min(92vw, 420px);
  background: var(--surface);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.signin-dialog::backdrop {
  background: rgba(15, 23, 42, 0.5);
}
.signin-dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0 0 4px;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  transition:
    color 0.15s ease,
    background 0.15s ease;
}
.signin-dialog-close:hover {
  color: var(--ink);
  background: var(--bg);
}
.signin-section h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.signin-dialog--split {
  width: min(94vw, 780px);
  padding: 0;
  overflow: hidden;
}
.signin-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.signin-copy {
  padding: 40px 36px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.signin-copy h2 {
  font-family: 'Urbanist', sans-serif;
  font-weight: 800;
  font-size: 1.7rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 18px;
}
.signin-copy p {
  margin: 0 0 14px;
  line-height: 1.55;
  color: var(--ink);
}
.signin-copy p:last-child {
  margin-bottom: 0;
}
.signin-split .signin-section {
  padding: 40px 36px;
}
.signin-images {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
}
.signin-images img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(9, 30, 66, 0.08);
}
@media (max-width: 720px) {
  .signin-dialog--split {
    width: min(94vw, 460px);
  }
  .signin-split {
    grid-template-columns: 1fr;
  }
  .signin-copy {
    padding: 32px 28px 8px;
  }
  .signin-copy h2 {
    font-size: 1.5rem;
  }
  .signin-split .signin-section {
    padding: 20px 28px 32px;
  }
  .signin-images {
    padding: 20px 28px 28px;
  }
}

.hero {
  text-align: center;
  margin-bottom: 40px;
}
.hero h1 {
  font-size: 2rem;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}
.hero .lede {
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto;
}

.entry-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.card h2 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.tabs {
  display: flex;
  gap: 4px;
  margin: 16px 0 12px;
  border-bottom: 1px solid var(--border);
}
.tab {
  background: none;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  font: inherit;
}
.tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 12px;
}
.auth-form.is-active {
  display: flex;
}
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
}

.auth-form label:first-of-type {
  margin-top: 12px;
}
.auth-form input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  font-size: 1rem;
  font-weight: 400;
}
.auth-form input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button.primary:hover {
  filter: brightness(1.05);
}
button.primary:disabled,
button.primary.is-disabled {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
}
button.primary:disabled:hover,
button.primary.is-disabled:hover {
  filter: none;
}

button:where(:not(.primary)):where(:not(.tab)) {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}

.error {
  color: var(--error);
  min-height: 1.2em;
  margin: 8px 0 0;
  font-size: 0.9rem;
}

.dashboard {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ----- Page-level tab nav ----- */
.tabs-main {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
/* The `display: flex` rule above overrides the user-agent's [hidden] display:none.
   Re-assert it for the hidden attribute to do its job. Same below for sub-tabs. */
.tabs-main[hidden],
.tabs-sub[hidden] {
  display: none;
}
.tab-main {
  flex: 1 1 auto;
  background: transparent;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--muted);
  cursor: pointer;
  transition:
    background 0.1s,
    color 0.1s;
}
.tab-main:hover {
  color: var(--ink);
}
.tab-main.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}
.tab-main.is-active:hover {
  color: var(--accent-ink);
}

/* ----- Sub-tab nav (used inside the League tab) ----- */
/* Sits in its own pill-panel like the main tabs, but with section-label-style
   text (small uppercase) and a light yellow active state so it reads as a
   secondary filter row, not competing with the main green-on-active tabs. */
.tabs-sub {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.tab-sub {
  flex: 1 1 auto;
  background: transparent;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  transition:
    background 0.1s,
    color 0.1s;
}
.tab-sub:hover {
  color: var(--ink);
}
.tab-sub.is-active {
  background: #fde68a;
  color: var(--ink);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.leagues {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.leagues li {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

code {
  background: #eef0f3;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

/* ----- Squad builder ----- */

.name-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.name-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
}
.name-form input {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-weight: normal;
  color: var(--ink);
  background: var(--surface);
}
.name-form input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.formation-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.formation-card {
  text-align: left;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  transition:
    border-color 0.1s,
    transform 0.1s;
}
.formation-card:hover {
  border-color: var(--accent);
}
.formation-card.is-active {
  border-color: var(--accent);
  background: #f0fbf6;
}
.formation-name {
  font-weight: 700;
}
.formation-shape {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--accent);
  font-size: 0.95rem;
  margin: 4px 0;
}
.formation-desc {
  color: var(--muted);
  font-size: 0.85rem;
}

.budget {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.95rem;
}
.budget-stars {
  display: inline-flex;
  gap: 3px;
  font-size: 1.4rem;
  line-height: 1;
}
.budget-star {
  color: var(--border);
}
.budget-star.is-filled {
  color: #f59e0b;
}

.slots {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  padding: 8px 8px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid #fff;
}
.slot-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  width: 100%;
}
.slot {
  position: relative;
  background: var(--surface);
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition:
    box-shadow 0.1s,
    transform 0.08s;
}

.slot.is-empty {
  min-height: 270px;
  border: 2px dashed var(--border);
  padding: 10px;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.slot.is-empty:hover {
  border-color: var(--accent);
}

.slot.is-filled {
  border: 1px solid var(--border);
  border-top: 4px solid var(--club-color, var(--border));
}
.slot.is-filled:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.slot.is-selected {
  box-shadow: 0 0 0 3px var(--accent);
}

.slot-pos {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.slot-prompt {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 6px;
}

.slot.is-filled .player-info {
  padding: 8px 10px;
}
.slot.is-filled .player-name {
  font-size: 0.85rem;
  margin-bottom: 4px;
}
.slot.is-filled .player-card-club,
.slot.is-filled .player-sub {
  font-size: 0.72rem;
}

.slot-remove {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  z-index: 2;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.slot-remove:hover {
  background: var(--error);
  color: white;
}

.filter-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.position-filter {
  display: flex;
  gap: 4px;
}
.pos-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink);
}
.pos-btn.is-active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.player-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.player-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--club-color, var(--border));
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
  transition:
    transform 0.08s,
    box-shadow 0.08s;
}
.player-card:hover:not(.is-disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.player-card.is-disabled {
  opacity: 0.55;
}

.player-card-photo {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--surface);
  overflow: hidden;
  isolation: isolate;
}

.player-portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.player-card-stars {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #f59e0b;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 3px 7px;
  border-radius: 4px;
  z-index: 2;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  letter-spacing: 0.04em;
  line-height: 1;
}

.player-card-pos {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.7rem;
  padding: 4px 7px;
  border-radius: 4px;
  z-index: 2;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  letter-spacing: 0.06em;
  line-height: 1;
}

.player-info {
  background: var(--surface);
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

.player-name {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  margin-bottom: 6px;
}

.player-pos {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-weight: 600;
}

.player-card-club {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 2px;
}

.player-sub {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--muted);
}

.player-reason {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
  background: rgba(15, 23, 42, 0.72);
  padding: 3px 8px;
  border-radius: 4px;
  z-index: 3;
  white-space: nowrap;
}

.favourite-detail-star .player-card {
  max-width: 200px;
  margin: 0 auto;
}

.actions:not([hidden]) {
  display: flex;
  gap: 12px;
  align-items: center;
}
#actions-panel {
  margin-top: 20px;
}
#actions-panel #save {
  margin-left: auto;
}
#save-status {
  font-size: 0.9rem;
}
#save-status.error {
  color: var(--error);
}

.badge-tiny {
  width: 14px;
  height: 14px;
  object-fit: contain;
}

.stat-bars {
  padding: 8px 20px 20px;
}
.stat-row {
  display: grid;
  grid-template-columns: 78px 1fr 22px;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.9rem;
}
.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
}
.stat-segs {
  display: flex;
  gap: 3px;
}
.stat-seg {
  flex: 1 1 0;
  height: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
}
.stat-seg.is-filled {
  background: var(--accent);
  border-color: var(--accent);
}
.stat-value {
  font-weight: 700;
  text-align: right;
  font-size: 0.9rem;
}

/* ----- Flags ----- */

.flag {
  display: inline-block;
  height: 12px;
  width: auto;
  vertical-align: -1px;
  margin-right: 4px;
}

/* ----- Favourite club picker ----- */

.favourite-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (max-width: 560px) {
  .favourite-picker {
    grid-template-columns: 1fr;
  }
}

.favourite-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  background: var(--bg);
  border: 3px solid var(--club-color);
  border-radius: 10px;
  overflow: hidden;
  font: inherit;
  color: var(--ink);
  text-align: left;
}
.favourite-card-top {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  padding: 16px 16px 0;
}
.favourite-card-stadium-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 12px;
  align-items: stretch;
  padding: 12px 16px 0;
  border-top: 1px solid var(--border);
  margin-top: 0;
}
.favourite-card-location {
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}
.favourite-card-location strong {
  color: var(--ink);
  font-weight: 600;
}
.favourite-card-stadium-info {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.favourite-card-stadium-info:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.favourite-card-label {
  display: block;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 2px;
}
.favourite-card-stadium-info > div {
  color: var(--ink);
  font-weight: 500;
}
.favourite-card-star-pos {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-left: 4px;
}

/* ----- Favourite confirm overlay ----- */

.favourite-confirm {
  padding: 28px 24px 20px;
  text-align: center;
  background: var(--surface);
  border-top: 4px solid var(--club-color, var(--accent));
  border-radius: 12px;
}
.favourite-confirm-badge {
  width: 88px;
  height: 88px;
  object-fit: contain;
  margin-bottom: 14px;
}
.favourite-confirm-title {
  margin: 0 0 6px;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}
.favourite-confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 22px;
}
.favourite-confirm-actions .primary {
  background: var(--club-color, var(--accent));
}
.favourite-card-stadium-image {
  border-radius: 6px;
  overflow: hidden;
  box-shadow:
    rgba(14, 63, 126, 0.04) 0px 0px 0px 1px,
    rgba(42, 51, 69, 0.04) 0px 1px 1px -0.5px,
    rgba(42, 51, 70, 0.04) 0px 3px 3px -1.5px,
    rgba(42, 51, 70, 0.04) 0px 6px 6px -3px,
    rgba(14, 63, 126, 0.04) 0px 12px 12px -6px,
    rgba(14, 63, 126, 0.04) 0px 24px 24px -12px;
}
.favourite-card-stadium-image img {
  width: 100%;
  height: auto;
  display: block;
}
.favourite-card-footer {
  background: var(--club-color, var(--accent));
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.favourite-card-motto {
  color: #fff;
  font-size: 0.8rem;
  flex: 1 1 auto;
  min-width: 0;
  text-transform: uppercase;
  font-weight: 900;
}
.favourite-card-pledge {
  background: white;
  color: var(--ink);
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  flex: 0 0 auto;
  transition:
    filter 0.1s,
    transform 0.08s;
}
.favourite-card-pledge:hover {
  filter: brightness(0.97);
  transform: translateY(-1px);
}
.favourite-card-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
  text-align: center;
  width: 160px;
}
.favourite-card-right {
  flex: 1 1 auto;
  min-width: 0;
}
.favourite-card-badge {
  width: 140px;
  height: 140px;
  object-fit: contain;
}
.favourite-card-name {
  font-weight: 900;
  font-size: 2rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}
.favourite-card-identity {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.3;
  text-transform: uppercase;
}

.favourite-card-rival {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 0.78rem;
  color: var(--ink);
}
.favourite-card-rival-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.62rem;
  font-weight: 700;
  color: #b45309;
  margin-right: 2px;
}

.identity-list {
  list-style: disc;
  padding-left: 18px;
  margin: 0;
  text-align: left;
}
.identity-list li {
  padding: 1px 0;
}
.favourite-detail-identity .identity-list {
  font-style: normal;
  padding-left: 22px;
}

/* ----- Favourite detail (preview before pledging) ----- */

.favourite-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.favourite-detail-hero {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 1.5fr;
  border-bottom: 4px solid var(--club-color, var(--accent));
}

.favourite-detail-badge-pane {
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.favourite-detail-badge {
  width: 100%;
  max-width: 140px;
  height: auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.12));
}

.favourite-detail-stadium {
  background: #0f172a;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.favourite-detail-stadium img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.favourite-detail-body {
  padding: 22px 24px;
  background: var(--bg);
}

@media (max-width: 560px) {
  .favourite-detail-hero {
    grid-template-columns: 1fr;
  }
  .favourite-detail-badge-pane {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 18px;
  }
  .favourite-detail-badge {
    max-width: 100px;
  }
  .favourite-detail-stadium {
    aspect-ratio: 16 / 9;
  }
}
.favourite-detail-name {
  font-size: 1.4rem;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.favourite-detail-meta {
  font-size: 0.9rem;
  margin-bottom: 14px;
}
.favourite-detail-identity {
  font-style: italic;
  font-size: 1rem;
  color: var(--ink);
  border-left: 3px solid var(--club-color, var(--accent));
  padding: 4px 0 4px 14px;
  margin: 16px 0 18px;
}

.favourite-detail-rival {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fff8e6;
  border: 1px solid #fbbf24;
  border-radius: 8px;
  margin-bottom: 18px;
}
.favourite-detail-rival-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b45309;
}
.favourite-detail-rival-club {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.favourite-detail-star {
  margin: 18px 0 8px;
}
.favourite-detail-star h4 {
  margin: 0 0 10px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.favourite-detail-description {
  margin: 10px 2px 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
}

.player-card.readonly {
  cursor: default;
}
.player-card.readonly:hover {
  transform: none;
  box-shadow: none;
}

.favourite-detail-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.favourite-detail-actions .primary {
  background: var(--club-color, var(--accent));
}

/* ----- Inline player detail (replaces the modal) ----- */

.player-detail {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  padding: 20px;
  background: var(--surface);
  border-radius: 12px;
}

.player-detail-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.player-detail-description {
  margin: 0;
  line-height: 1.5;
  font-size: 0.95rem;
}

.player-detail-season {
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--bg);
  padding: 8px 12px;
  border-radius: 6px;
}
.player-detail-season strong {
  color: var(--accent);
}

.card-icon {
  display: inline-block;
  width: 8px;
  height: 11px;
  margin-left: 3px;
  border-radius: 1px;
  vertical-align: -1px;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.15);
}
.card-icon.card-yellow {
  background: #fbbf24;
}
.card-icon.card-red {
  background: #dc2626;
}

.player-detail-info .stat-bars {
  padding: 0;
}

.player-detail-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.player-detail-actions-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.player-detail-actions .primary {
  background: var(--club-color, var(--accent));
}

.player-detail-actions .primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.player-detail-status {
  font-size: 0.85rem;
  font-weight: 700;
  text-wrap: balance;
  text-align: center;
}

@media (max-width: 540px) {
  .player-detail {
    grid-template-columns: 1fr;
  }
}

/* ----- Modal overlay (dialog) ----- */

.overlay {
  border: none;
  padding: 0;
  background: transparent;
  width: min(92vw, 640px);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.overlay::backdrop {
  background: rgba(15, 23, 42, 0);
  animation: overlay-backdrop-in 0.22s ease-out forwards;
}

.overlay[open] {
  animation: overlay-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes overlay-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes overlay-backdrop-in {
  from {
    background: rgba(15, 23, 42, 0);
  }
  to {
    background: rgba(15, 23, 42, 0.55);
  }
}

#overlay-body {
  display: contents;
}

.overlay:has(.confirm-modal) {
  width: min(96vw, 960px);
}
.confirm-modal {
  background: var(--surface);
  border-radius: 12px;
  padding: 28px 28px 24px;
}
.confirm-header {
  text-align: center;
  margin-bottom: 20px;
}
.confirm-eyebrow {
  margin: 0 0 4px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.confirm-team-name {
  font-family: 'Urbanist', sans-serif;
  font-weight: 600;
  font-size: 3rem;
  margin: 0;
}
.confirm-players {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}
.confirm-players .player-card {
  flex: 1 1 0;
  max-width: 170px;
}
.confirm-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.confirm-actions .primary {
  margin-left: auto;
}

#slots-panel.is-locked .slot-remove {
  display: none;
}
#slots-panel.is-locked .slot {
  cursor: pointer;
}
#slots-panel.is-locked .step-num {
  display: none;
}
#slots-panel h1 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}
#slots-panel.is-locked h1 {
  font-size: 2rem;
  margin-bottom: 16px;
}

/* Shared eyebrow heading style for panel and sub-section titles. */
.section-label {
  display: block;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 8px;
}

/* ----- Teacher: matchday Run button (in Matches tab) ----- */
.matchday-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}
.matchday-controls p {
  margin: 0;
  flex: 1;
}

/* ----- Class roster (teacher Admin tab) ----- */
.roster-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 0.95rem;
  resize: vertical;
  background: var(--bg);
}
.roster-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.roster-actions {
  margin-top: 12px;
  margin-bottom: 8px;
}
#roster-status.error {
  color: var(--error);
}

/* ----- Print handout ----- */
.print-handout {
  display: none;
}
@media print {
  body * {
    visibility: hidden;
  }
  .print-handout,
  .print-handout * {
    visibility: visible;
  }
  .print-handout {
    display: block;
    position: absolute;
    inset: 0;
    padding: 16mm;
    background: white;
    color: black;
    font-family: 'Nunito', sans-serif;
  }
  .print-handout-header {
    text-align: center;
    margin-bottom: 12mm;
  }
  .print-handout-header h1 {
    font-family: 'Urbanist', sans-serif;
    font-size: 22pt;
    margin: 0 0 4mm;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .print-handout-header p {
    font-size: 10pt;
    color: #555;
    margin: 0;
  }
  .print-ticket {
    border: 1px dashed #999;
    border-radius: 4mm;
    padding: 6mm 8mm;
    margin-bottom: 4mm;
    page-break-inside: avoid;
  }
  .print-ticket-name {
    font-family: 'Urbanist', sans-serif;
    font-size: 16pt;
    font-weight: 600;
    margin-bottom: 2mm;
  }
  .print-ticket-meta {
    display: flex;
    gap: 10mm;
    font-size: 10pt;
    margin-bottom: 2mm;
  }
  .print-ticket-url {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 9pt;
    color: #333;
    word-break: break-all;
  }
}

.manager-block {
  display: none;
}
#slots-panel.is-locked .manager-block {
  display: block;
  padding-bottom: 14px;
}
.manager-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.manager-name {
  font-family: 'Urbanist', sans-serif;
  font-weight: 600;
  font-size: 1.4rem;
}
.manager-points {
  margin-left: auto;
  font-size: 0.95rem;
  color: var(--muted);
}
.manager-points strong {
  font-family: 'Urbanist', sans-serif;
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--accent);
  margin-right: 4px;
}

.supporting-block {
  display: none;
}
#slots-panel.is-locked .supporting-block {
  display: block;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  padding-bottom: 14px;
}
.supporting-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.supporting-badge {
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.supporting-name {
  font-family: 'Urbanist', sans-serif;
  font-weight: 600;
  font-size: 1.4rem;
}
.supporting-points {
  margin-left: auto;
  font-size: 0.95rem;
  color: var(--muted);
}
.supporting-points strong {
  font-family: 'Urbanist', sans-serif;
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--accent);
  margin-right: 4px;
}

#slots-panel.is-locked .rating-block {
  display: none;
}
#slots-panel.is-locked .players-block,
#slots-panel.is-locked .team-total {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  padding-bottom: 14px;
}
#slots-panel.is-locked .team-total {
  padding-bottom: 0;
}

.slot-points {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}
.slot-points strong {
  font-family: 'Urbanist', sans-serif;
  font-size: 1.05rem;
  color: var(--accent);
  margin-right: 2px;
}

.team-total {
  display: none;
}
#slots-panel.is-locked .team-total {
  display: block;
  text-align: right;
}
#slots-panel.is-locked .team-total .section-label {
  text-align: left;
}
.team-total strong {
  font-family: 'Urbanist', sans-serif;
  font-weight: 600;
  font-size: 1.6rem;
  color: var(--accent);
}

/* ----- Teacher: student squads table ----- */

.squads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin-top: 10px;
}
.squads-table thead th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}
.squads-table tbody td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
}
.squads-table tbody tr:last-child td {
  border-bottom: none;
}
.squads-table tbody tr:hover {
  background: var(--bg);
}
.squads-table .leader-club {
  display: inline-flex;
}
.squads-table .row-action {
  font-size: 0.78rem;
  padding: 4px 10px;
}

.overlay:has(.admin-modal) {
  width: min(92vw, 380px);
}
.admin-modal {
  background: var(--surface);
  border-radius: 12px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.admin-modal-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.admin-modal-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}
.admin-modal-team {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}
.admin-modal h2 {
  margin: 0;
  font-size: 1.05rem;
}
.admin-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-modal-actions button {
  text-align: left;
}
.admin-modal-actions button.danger {
  background: var(--error);
  color: #fff;
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.admin-modal-actions button.danger:hover {
  filter: brightness(1.05);
}
.admin-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.admin-edit-input {
  width: 100%;
  padding: 8px 10px;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}
.admin-edit-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.results-heading {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 4px;
  color: var(--ink);
}
.match-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas:
    'home center away'
    'home-scorers . away-scorers'
    'divider divider divider'
    'home-cards . away-cards';
  align-items: center;
  column-gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: 6px;
  margin-bottom: 6px;
}
.match-cards-divider {
  grid-area: divider;
  border-top: 1px dashed var(--border);
  margin: 6px 0;
}
.match-row.is-derby {
  background: #fff0f0;
  border: 1px solid #f5b5b5;
}
.match-home {
  grid-area: home;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}
.match-away {
  grid-area: away;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}
.match-home.is-favourite,
.match-away.is-favourite {
  font-weight: 700;
}
.match-home:hover,
.match-away:hover {
  color: var(--accent);
}
.match-center {
  grid-area: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  line-height: 1;
}
.match-score {
  font-family: 'Urbanist', sans-serif;
  font-weight: 600;
  font-size: 1.5rem;
}
.match-vs {
  font-size: 0.85rem;
  text-transform: lowercase;
}
.match-home-scorers {
  grid-area: home-scorers;
  text-align: right;
  align-self: start;
}
.match-away-scorers {
  grid-area: away-scorers;
  text-align: left;
  align-self: start;
}
.match-home-cards {
  grid-area: home-cards;
  text-align: right;
  align-self: start;
}
.match-away-cards {
  grid-area: away-cards;
  text-align: left;
  align-self: start;
}
.match-detail {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 4px;
}
.match-detail:empty {
  display: none;
}
.event-icon {
  font-size: 0.95em;
  white-space: nowrap;
}
.match-goal {
  margin-bottom: 2px;
}
.match-goal:last-child {
  margin-bottom: 0;
}
.match-minute {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.85em;
  margin-right: 2px;
}
.is-my-player {
  font-weight: 700;
  color: var(--ink);
}
.derby-tag {
  position: absolute;
  top: 4px;
  right: 8px;
  background: var(--error);
  color: white;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
}

.results-block,
.upcoming-block {
  margin-bottom: 14px;
}
.results-block h3,
.upcoming-block h3 {
  font-size: 0.95rem;
  margin: 0 0 8px;
}
.results-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.results-nav h3 {
  margin: 0;
  flex: 1;
  text-align: center;
}
.md-arrow {
  padding: 4px 10px;
  font-size: 1rem;
  line-height: 1;
  aspect-ratio: 1;
}
.md-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

[data-player-link],
[data-club-link] {
  cursor: pointer;
  transition: color 0.1s;
}
[data-player-link]:hover,
[data-club-link]:hover {
  color: var(--accent);
}
.standings tbody tr:hover {
  background: var(--bg);
}

/* ----- Club detail overlay (reuses favourite-detail layout) ----- */

.club-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px 0;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: 8px;
}
.club-detail-row {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 0.9rem;
}
.club-detail-label {
  flex: 0 0 70px;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.club-detail-value {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.club-detail-value strong {
  font-weight: 600;
}

.club-detail-section {
  margin-top: 18px;
}
.club-detail-section h4 {
  margin: 0 0 10px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.club-detail-squad {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px;
}
.club-detail-squad li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--bg);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.1s;
}
.club-detail-squad li:hover {
  background: #e8f3eb;
}
.club-detail-player-name {
  flex: 1 1 auto;
  font-weight: 600;
}
.club-detail-player-stars {
  color: #f59e0b;
  font-size: 0.85rem;
}

.class-standings {
  font-size: 0.88rem;
}
.class-standings-head,
.class-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
}
.class-standings-head {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  padding: 6px 8px;
}
.class-standings-head > span:last-child,
.class-row-pts {
  text-align: right;
  justify-self: end;
}
.class-row:last-child {
  border-bottom: none;
}
.class-row.is-me {
  background: #f0fbf6;
}
.class-row.is-clickable {
  cursor: pointer;
}
.class-row.is-clickable:hover {
  background: #f6f8fa;
}
.class-row.is-me.is-clickable:hover {
  background: #e6f7ee;
}
.class-row-team {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.class-team {
  font-weight: 600;
  color: var(--ink);
}
.class-manager {
  color: var(--muted);
  margin-left: 6px;
  font-size: 0.85em;
}

.standings {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.standings thead th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}
.standings tbody td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
}
.standings tbody tr:last-child td {
  border-bottom: none;
}
.standings tbody tr.is-favourite {
  background: #fffbeb;
}
.standings tbody tr.is-favourite:hover {
  background: #fff4d6;
}
.standings-club {
  display: flex;
  align-items: center;
  gap: 6px;
  border-left: 3px solid var(--club-color, var(--border));
  padding-left: 8px;
}
.standings-form span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 0.7rem;
  font-weight: 500;
  color: white;
}
.standings-form span:not(:last-of-type) {
  margin-right: 3px;
}
.form-W {
  background: #16a34a;
}
.form-D {
  background: #94a3b8;
}
.form-L {
  background: #dc2626;
}

.leader-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 0.88rem;
}
.leader-row.is-clickable {
  cursor: pointer;
}
.leader-row.is-clickable:hover {
  background: #f6f8fa;
}
.leader-value {
  font-weight: 700;
  color: var(--accent);
}
.leader-value .leader-cards {
  color: var(--ink);
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}
.leader-rank {
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.leader-table th:last-child,
.leader-table td.leader-table-value {
  text-align: right;
}
.leader-table td.leader-table-value strong {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ----- Podium row for top 5 in each leader list ----- */
.leader-podium {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  justify-content: center;
}
.leader-podium-slot {
  flex: 1 1 140px;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.leader-rank-label {
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
  color: var(--muted);
}
.leader-club {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
}
@media (max-width: 600px) {
  .standings {
    font-size: 0.78rem;
  }
  .standings thead th,
  .standings tbody td {
    padding: 6px 4px;
  }
  .standings-club {
    border-left-width: 2px;
    padding-left: 5px;
    gap: 4px;
  }
  .standings-form span {
    width: 16px;
    height: 16px;
    font-size: 0.62rem;
  }
}

/* ----- Matchday replay overlay ----- */
.replay-overlay {
  width: min(1200px, 96vw);
  max-width: none;
  height: min(820px, 92vh);
  padding: 0;
  border: none;
  border-radius: 14px;
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.replay-overlay::backdrop {
  background: rgba(8, 12, 18, 0.78);
  backdrop-filter: blur(2px);
}

.replay-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.replay-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.replay-title {
  font-family: 'Urbanist', sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 1.05rem;
  color: var(--muted);
}
.replay-title strong {
  color: var(--ink);
  font-size: 1.4rem;
  margin-left: 4px;
}
.replay-clock {
  margin-left: auto;
  margin-right: auto;
  font-family: 'Urbanist', sans-serif;
  font-weight: 700;
  font-size: 2.4rem;
  color: var(--accent);
  line-height: 1;
}
.replay-skip {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 8px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.replay-skip:hover {
  color: var(--ink);
  border-color: var(--ink);
}
.replay-skip.is-done {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 700;
  padding: 8px 18px;
}
.replay-skip.is-done:hover {
  filter: brightness(1.05);
  color: var(--accent-ink);
}

.replay-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 18px;
  padding: 18px 22px;
  overflow: hidden;
  min-height: 0;
}

.replay-fixtures {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.replay-fixtures .match-row {
  margin-bottom: 0;
}
.replay-fixtures .match-row.is-pending {
  animation: replay-row-pulsate 500ms ease-in-out;
}
@keyframes replay-row-pulsate {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.985);
  }
  100% {
    transform: scale(1);
  }
}

.replay-leaderboard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.replay-leaderboard .section-label {
  margin-bottom: 8px;
  padding: 0 4px;
}

.replay-leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.replay-leader-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 0.92rem;
  position: relative;
  z-index: 0;
  will-change: transform;
}
.replay-leader-rank {
  font-family: 'Urbanist', sans-serif;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}
.replay-leader-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.replay-leader-delta {
  font-family: 'Urbanist', sans-serif;
  font-weight: 700;
  color: var(--accent);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.replay-leader-row.is-flash-pos {
  animation: replay-row-flash-pos 700ms ease-out;
}
.replay-leader-row.is-flash-neg {
  animation: replay-row-flash-neg 700ms ease-out;
}
@keyframes replay-row-flash-pos {
  0% {
    background: rgba(13, 122, 79, 0.3);
  }
  100% {
    background: transparent;
  }
}
@keyframes replay-row-flash-neg {
  0% {
    background: rgba(185, 28, 28, 0.25);
  }
  100% {
    background: transparent;
  }
}

@media (max-width: 720px) {
  .replay-body {
    grid-template-columns: 1fr;
  }
  .replay-leaderboard {
    max-height: 240px;
  }
}

/* ----- Manager bonus overlay ----- */
.overlay:has(.manager-bonus-overlay) {
  width: min(94vw, 720px);
}
.manager-bonus-overlay {
  background: var(--surface);
  border-radius: 16px;
  padding: 36px 40px 32px;
  text-align: center;
}
.manager-bonus-eyebrow {
  margin: 0 0 6px;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.manager-bonus-name {
  font-family: 'Urbanist', sans-serif;
  font-weight: 900;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 32px;
}
.manager-bonus-total {
  margin: 0 0 18px;
  font-size: 0.95rem;
  color: var(--muted);
}
.manager-bonus-total strong {
  font-family: 'Urbanist', sans-serif;
  font-weight: 800;
  color: var(--ink);
  font-size: 1.15rem;
  margin-right: 2px;
}
.manager-bonus-label {
  display: block;
  text-align: left;
  margin: 0 0 12px;
}
.manager-bonus-label-hint {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--muted);
  margin-left: 2px;
}
.manager-bonus-categories {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 28px;
}
.manager-bonus-categories button {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
}
.manager-bonus-categories button:hover {
  color: var(--ink);
  border-color: #cfd4dc;
}
.manager-bonus-categories button.is-selected {
  color: var(--ink);
  background: #ffda79;
  border-color: #fff;
  font-weight: 600;
  border: 1px solid #fff;
  box-shadow:
    rgba(14, 63, 126, 0.06) 0px 0px 0px 1px,
    rgba(42, 51, 70, 0.03) 0px 1px 1px -0.5px,
    rgba(42, 51, 70, 0.04) 0px 2px 2px -1px,
    rgba(42, 51, 70, 0.04) 0px 3px 3px -1.5px,
    rgba(42, 51, 70, 0.03) 0px 5px 5px -2.5px,
    rgba(42, 51, 70, 0.03) 0px 10px 10px -5px,
    rgba(42, 51, 70, 0.03) 0px 24px 24px -8px;
}
.manager-bonus-points {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}
.manager-bonus-cluster {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--border);
}
.manager-bonus-cluster.is-neg {
  background: #fef2f2;
  border-color: #fbd5d5;
}
.manager-bonus-cluster.is-pos {
  background: #ecfaf2;
  border-color: #b7e0c8;
}
.manager-bonus-cluster button {
  font-family: 'Urbanist', sans-serif;
  font-weight: 800;
  font-size: 1.6rem;
  padding: 16px 0;
  border-radius: 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition:
    background 0.18s ease,
    transform 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}
.manager-bonus-cluster.is-neg button {
  color: var(--error);
}
.manager-bonus-cluster.is-pos button {
  color: var(--accent);
}
.manager-bonus-cluster button:hover {
  background: rgba(255, 255, 255, 0.7);
}
.manager-bonus-cluster.is-neg button.is-selected {
  background: var(--error);
  color: #fff;
  transform: translateY(-2px);
  border: 1px solid #fff;
  box-shadow:
    rgba(14, 63, 126, 0.06) 0px 0px 0px 1px,
    rgba(42, 51, 70, 0.03) 0px 1px 1px -0.5px,
    rgba(42, 51, 70, 0.04) 0px 2px 2px -1px,
    rgba(42, 51, 70, 0.04) 0px 3px 3px -1.5px,
    rgba(42, 51, 70, 0.03) 0px 5px 5px -2.5px,
    rgba(42, 51, 70, 0.03) 0px 10px 10px -5px,
    rgba(42, 51, 70, 0.03) 0px 24px 24px -8px;
}
.manager-bonus-cluster.is-pos button.is-selected {
  background: #ffda79;
  color: var(--ink);
  transform: translateY(-2px);
  border: 1px solid #fff;
  box-shadow:
    rgba(14, 63, 126, 0.06) 0px 0px 0px 1px,
    rgba(42, 51, 70, 0.03) 0px 1px 1px -0.5px,
    rgba(42, 51, 70, 0.04) 0px 2px 2px -1px,
    rgba(42, 51, 70, 0.04) 0px 3px 3px -1.5px,
    rgba(42, 51, 70, 0.03) 0px 5px 5px -2.5px,
    rgba(42, 51, 70, 0.03) 0px 10px 10px -5px,
    rgba(42, 51, 70, 0.03) 0px 24px 24px -8px;
}
.manager-bonus-reason {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  margin-bottom: 22px;
  background: var(--surface);
  color: var(--ink);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.manager-bonus-reason::placeholder {
  color: var(--muted);
}
.manager-bonus-reason:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
}
.manager-bonus-actions {
  display: flex;
  justify-content: center;
}
.manager-bonus-actions .primary {
  min-width: 220px;
  padding: 14px 32px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 999px;
  letter-spacing: 0.01em;
}
.manager-bonus-actions .primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.manager-bonus-history {
  margin-top: 18px;
  text-align: left;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.manager-bonus-history .section-label {
  margin-bottom: 8px;
}
.manager-bonus-history ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
}
.manager-bonus-history li {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  align-items: center;
  font-size: 0.9rem;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.manager-bonus-history li:last-child {
  border-bottom: none;
}
.bonus-history-delta {
  font-family: 'Urbanist', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  text-align: center;
}
.bonus-history-delta.is-pos {
  color: var(--accent);
}
.bonus-history-delta.is-neg {
  color: var(--error);
}
.bonus-history-body {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.bonus-history-category {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
  flex-shrink: 0;
}
.bonus-history-reason {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
  min-width: 0;
}
.bonus-history-date {
  font-size: 0.78rem;
}
