/* =====================================================
   Base de datos Option File PES 2018-2026
   Main Stylesheet
   ===================================================== */

:root {
  --color-bg-main: #0B0B0D;
  --color-bg-secondary: #121214;
  --color-bg-card: #1A1A1D;
  --color-bg-elevated: #222226;
  --color-gold: #D6A84F;
  --color-gold-soft: #F0C96A;
  --color-text-main: #F5F5F5;
  --color-text-secondary: #B8B8B8;
  --color-accent-red: #B3262E;
  /* Para cambiar el banner principal, reemplazar: /assets/images/home-banner.png */
  --home-banner-image: url('../assets/images/home-banner.png');
  --color-primary: var(--color-bg-main);
  --color-secondary: var(--color-bg-secondary);
  --color-accent: var(--color-accent-red);
  --color-highlight: var(--color-gold);
  --color-highlight-soft: var(--color-gold-soft);
  --color-highlight-dim: rgba(214, 168, 79, 0.16);
  --color-text: var(--color-text-main);
  --color-text-muted: var(--color-text-secondary);
  --color-border: rgba(255, 255, 255, 0.08);
  --color-card: var(--color-bg-card);
  --color-card-hover: var(--color-bg-elevated);
  --color-surface: var(--color-bg-elevated);
  --color-stat-red: #e74c3c;
  --color-stat-yellow: #f1c40f;
  --color-stat-green: #2ecc71;
  --sidebar-width: 260px;
  --header-height: 64px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

img,
video,
iframe {
  max-width: 100%;
}

img,
video {
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(214,168,79,0.08), transparent 34rem),
    var(--color-primary);
  color: var(--color-text);
  min-height: 100vh;
  overflow-x: hidden;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-highlight-soft);
  outline-offset: 3px;
}

/* ── Header ── */
#header {
  height: var(--header-height);
  background: var(--color-secondary);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  gap: 16px;
}

#header .logo {
  height: 44px;
  object-fit: contain;
  image-rendering: auto;
}

#header h1,
#header .header-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

#header h1 span,
#header .header-title span {
  color: var(--color-highlight);
}

/* ── Search bar ── */
#search-container {
  display: flex;
  align-items: center;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 4px 14px;
  gap: 8px;
  min-width: 200px;
  max-width: 300px;
  transition: border-color 0.15s;
}

#search-container:focus-within {
  border-color: var(--color-highlight);
}

#search-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-text);
  font-size: 0.9rem;
  width: 100%;
}

#search-input::placeholder {
  color: var(--color-text-muted);
}

.search-icon {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* ── Layout ── */
#layout {
  display: flex;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-width);
  background: var(--color-secondary);
  border-right: 1px solid var(--color-border);
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  z-index: 50;
}

#sidebar::-webkit-scrollbar {
  width: 4px;
}

#sidebar::-webkit-scrollbar-track {
  background: var(--color-secondary);
}

#sidebar::-webkit-scrollbar-thumb {
  background: var(--color-accent);
  border-radius: 2px;
}

.sidebar-section {
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.sidebar-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  padding: 6px 16px;
}

.sidebar-league {
  padding: 2px 0;
}

.sidebar-league-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}

.sidebar-league-header:hover {
  background: var(--color-highlight-dim);
}

.sidebar-league-header.active {
  background: var(--color-highlight-dim);
  border-left: 3px solid var(--color-highlight);
}

.sidebar-league-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 2px;
}

.sidebar-league-name {
  font-size: 0.85rem;
  flex: 1;
}

.sidebar-league-count {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.sidebar-filter-wrap {
  padding: 6px 12px 8px;
}

.sidebar-filter-input {
  width: 100%;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 5px 10px;
  color: var(--color-text);
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.15s;
}

.sidebar-filter-input:focus {
  border-color: var(--color-highlight);
}

.sidebar-filter-input::placeholder {
  color: var(--color-text-muted);
}

.sidebar-league-arrow {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  transition: transform 0.2s;
}

.sidebar-league-header.open .sidebar-league-arrow {
  transform: rotate(90deg);
}

.sidebar-teams-list {
  display: none;
  padding: 0 0 4px 0;
}

.sidebar-teams-list.open {
  display: block;
}

.sidebar-team-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px 7px 32px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.82rem;
}

.sidebar-team-item:hover {
  background: var(--color-highlight-dim);
}

.sidebar-team-item.active {
  background: var(--color-highlight-dim);
  border-left: 3px solid var(--color-highlight);
  color: var(--color-highlight);
}

.sidebar-team-crest {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

/* ── Main content ── */
#main {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 24px;
  min-height: calc(100vh - var(--header-height));
}

/* ── Loading state ── */
#loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-highlight);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Infinite scroll sentinel ── */
.infinite-scroll-sentinel {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 0;
  min-height: 72px;
}

/* ── Home view ── */
#home-view {
  display: none;
}

#home-view.active {
  display: block;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.breadcrumb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.breadcrumbs a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--color-text);
}

.breadcrumbs a::after {
  content: ">";
  margin-left: 8px;
  color: var(--color-border);
}

.breadcrumbs span {
  color: var(--color-text);
  font-weight: 600;
}

.home-welcome {
  text-align: center;
  padding: 60px 20px;
}

.home-welcome h1,
.home-welcome h2 {
  font-size: 1.8rem;
  margin-bottom: 12px;
  color: var(--color-text);
}

.home-welcome p {
  color: var(--color-text-muted);
  font-size: 1rem;
}

.db-home-welcome {
  text-align: left;
  padding: 24px 0 8px;
  max-width: 760px;
}

.db-home-menu {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0 24px;
}

.seo-content-block {
  margin: 18px 0 22px;
  max-width: 920px;
  color: var(--color-text-muted);
  line-height: 1.65;
}

.seo-content-block h2 {
  color: var(--color-text);
  font-size: 1.18rem;
  margin-bottom: 8px;
}

.seo-content-block p + p {
  margin-top: 10px;
}

.seo-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.seo-link-row a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 800;
  text-decoration: none;
}

.seo-link-row a:hover {
  border-color: var(--color-highlight);
  color: var(--color-highlight);
}

.db-menu-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 124px;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-card);
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.db-menu-card:hover {
  border-color: var(--color-highlight);
  background: var(--color-card-hover);
}

.db-menu-card-title {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.db-menu-card-desc {
  color: var(--color-text-muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.db-stats-grid {
  margin-top: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 40px;
}

.stat-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
}

.stat-card:hover {
  border-color: var(--color-highlight);
  box-shadow: 0 4px 16px rgba(214, 168, 79, 0.12);
}

.stat-card .number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-highlight);
}

.stat-card .label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ── Home leagues section ── */
.home-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  margin: 32px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.home-leagues-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.home-league-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 80px;
  text-align: center;
}

.home-league-item:hover {
  border-color: var(--color-highlight);
  box-shadow: 0 4px 12px rgba(214, 168, 79, 0.12);
}

.home-league-item img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.home-league-item span {
  font-size: 0.72rem;
  color: var(--color-text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}

/* ── Home leagues + teams blocks ── */
.home-leagues-blocks {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.home-league-block {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  overflow: hidden;
}

.home-league-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.15s;
}

.home-league-header:hover {
  background: var(--color-card-hover);
}

.home-league-header img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

.home-league-header span {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text);
  flex: 1;
}

.home-league-count {
  font-size: 0.75rem !important;
  font-weight: 500 !important;
  color: var(--color-text-muted) !important;
  flex: 0 !important;
  white-space: nowrap;
}

.home-team-crests-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
}

.home-team-crest {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  transition: border-color 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.home-team-crest:hover {
  border-color: var(--color-highlight);
  box-shadow: 0 2px 8px rgba(214, 168, 79, 0.16);
}

.home-team-crest img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

/* ── Players list view ── */
#players-view {
  display: none;
}

#players-view.active {
  display: block;
}

.view-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.adv-filter-toggle {
  margin-left: auto;
  padding: 7px 16px;
  background: var(--color-surface);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.adv-filter-toggle:hover {
  background: var(--color-highlight);
  color: #fff;
  border-color: var(--color-highlight);
}

.adv-filter-toggle.active {
  background: var(--color-highlight);
  color: #fff;
  border-color: var(--color-highlight);
}

.view-header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.view-header-actions .adv-filter-toggle {
  margin-left: 0;
}

.adv-filter-panel {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 20px;
}

.filter-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.filter-panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

#player-filter-body[hidden] {
  display: none;
}

.filter-panel-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--color-text);
}

.filter-panel-subtitle {
  margin-top: 3px;
  color: var(--color-text-muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.active-filters {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--color-border);
}

.active-filters-empty {
  color: var(--color-text-muted);
  font-size: 0.84rem;
}

.active-filters-label {
  flex-shrink: 0;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding-top: 5px;
}

.active-filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.active-filter-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.78rem;
}

.filter-section {
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--color-border);
}

.filter-section:last-of-type {
  margin-bottom: 0;
}

.filter-section-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-text);
  margin-bottom: 12px;
}

.filter-section-basic {
  margin-bottom: 12px;
  padding-bottom: 14px;
}

.adv-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px 16px;
}

.adv-filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.adv-filter-group label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--color-text-muted);
}

.adv-filter-group select,
.adv-filter-group input[type="number"],
.adv-filter-group input[type="text"] {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.84rem;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

.adv-filter-group select:focus,
.adv-filter-group input[type="number"]:focus,
.adv-filter-group input[type="text"]:focus {
  border-color: var(--color-highlight);
}

.adv-filter-range .range-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.adv-filter-range .range-inputs span {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.adv-filter-range .range-inputs input {
  width: 0;
  flex: 1;
}

.adv-filter-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.advanced-filter-toggle-row {
  display: flex;
  justify-content: flex-start;
  margin: 10px 0 16px;
}

.advanced-filter-toggle {
  min-height: 40px;
  border: 1px solid var(--color-highlight);
  border-radius: 8px;
  background: var(--color-highlight-dim);
  color: var(--color-highlight);
  font-weight: 800;
  padding: 9px 14px;
  cursor: pointer;
}

.advanced-filter-toggle:hover {
  background: var(--color-highlight);
  color: #fff;
}

.advanced-filter-section[hidden] {
  display: none;
}

.stat-filter-grid {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

.skill-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
}

.skill-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.84rem;
  cursor: pointer;
}

.skill-check input {
  accent-color: var(--color-highlight);
}

.skill-check.is-selected {
  border-color: var(--color-highlight);
  background: var(--color-highlight-dim);
  color: var(--color-text);
}

.filter-help {
  margin-top: 10px;
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.adv-filter-reset {
  padding: 6px 14px;
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.adv-filter-reset:disabled {
  opacity: 0.45;
  cursor: default;
}

.adv-filter-reset:disabled:hover {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
}

.adv-filter-reset:hover {
  background: var(--color-highlight);
  color: #fff;
  border-color: var(--color-highlight);
}

.view-header .team-crest {
  width: 56px;
  height: 56px;
  object-fit: contain;
  transition: opacity 0.15s;
}

.view-header a:has(.team-crest):hover .team-crest,
.view-header a:hover .team-crest {
  opacity: 0.8;
}

.view-header .view-title {
  font-size: 1.4rem;
  font-weight: 700;
}

.view-title-link {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  transition: color 0.15s;
}

.view-title-link:hover {
  color: var(--color-highlight);
  text-decoration: underline;
}

.view-header .view-subtitle {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.players-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-card);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.players-table thead tr {
  background: var(--color-surface);
}

.players-table th {
  padding: 12px 14px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  white-space: nowrap;
  border-bottom: 2px solid var(--color-border);
}

.players-table td {
  padding: 10px 14px;
  font-size: 0.88rem;
  border-top: 1px solid var(--color-border);
  vertical-align: middle;
}

.players-table tr:hover td {
  background: var(--color-card-hover);
  cursor: pointer;
}

.shirt-number-cell {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  min-width: 28px;
}

.player-row-photo {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
}

.player-row-team-crest {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 3px;
  display: block;
  transition: transform 0.12s;
}

.player-row-team-crest:hover {
  transform: scale(1.15);
}

.team-crest-cell {
  padding: 0 4px;
}

.player-flag {
  width: 26px;
  height: 18px;
  object-fit: cover;
  border-radius: 2px;
  vertical-align: middle;
}

.overall-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  font-weight: 700;
  font-size: 0.85rem;
}

/* ── Player profile view ── */
#player-view {
  display: none;
}

#player-view.active {
  display: block;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  margin-bottom: 20px;
  transition: background 0.15s, border-color 0.15s;
}

.back-btn:hover {
  background: var(--color-card);
  border-color: var(--color-highlight);
}

.player-profile {
  display: grid;
  grid-template-columns: 200px 1fr 300px;
  gap: 20px;
}

/* Left column */
.player-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.player-photo-container {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-photo {
  width: 130px;
  height: 140px;
  object-fit: cover;
  border-radius: 6px;
}

.player-info-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 14px;
}

.player-info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--color-border);
}

.player-info-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.player-info-row .info-label {
  color: var(--color-text-muted);
  font-size: 0.75rem;
  width: 70px;
  flex-shrink: 0;
}

.player-info-row img {
  width: 24px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
}

.player-info-row .team-crest-sm {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

/* Center column */
.player-center {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 20px;
}

.player-center h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.player-center .player-name-line {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 4px;
}

.player-center .player-position-overall {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
}

.position-badge {
  background: transparent;
  border: 1px solid currentColor;
  color: #8b949e;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  min-width: 26px;
  text-align: center;
}

.overall-large {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--color-highlight);
}

.ability-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
}

.stat-name {
  width: 170px;
  flex-shrink: 0;
  color: var(--color-text);
}

.stat-value {
  width: 38px;
  height: 26px;
  line-height: 26px;
  text-align: center;
  border-radius: 5px;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.stat-bar-container {
  flex: 1;
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
}

.stat-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Stat color classes */
/* Updated stat color classes - 6 levels */
.stat-range-1 { background: #d33d35; color: #fff; }
.stat-range-2 { background: #e59f01; color: #fff; }
.stat-range-3 { background: #e5dc00; color: #111; }
.stat-range-4 { background: #a8ff00; color: #111; }
.stat-range-5 { background: #62ff51; color: #111; }
.stat-range-6 { background: #00ff87; color: #111; }
/* Keep old classes for backward compatibility */
.stat-red { background: #d33d35; color: #fff; }
.stat-yellow { background: #e59f01; color: #fff; }
.stat-green { background: #a8ff00; color: #111; }

/* Right column */
.player-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.radar-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
}

.radar-card h3 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  margin-bottom: 14px;
}

#radar-canvas {
  display: block;
  margin: 0 auto;
}

.appearance-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 16px;
}

.appearance-card h3 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.appearance-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.appearance-item {
  text-align: center;
  padding: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
}

.appearance-item .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-highlight);
}

.appearance-item .label {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ── Search results view ── */
#search-view {
  display: none;
}

#search-view.active {
  display: block;
}

/* ── Error state ── */
.error-message {
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid var(--color-stat-red);
  border-radius: 8px;
  padding: 16px;
  color: var(--color-stat-red);
  font-size: 0.9rem;
  margin: 20px 0;
}

/* ── Player page (player.html) ── */
#player-page {
  margin-top: var(--header-height);
  padding: 24px 32px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Team page (team.html) ── */
#team-page {
  margin-top: var(--header-height);
  padding: 24px 32px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

/* ── League page (league.html) ── */
#league-page {
  margin-top: var(--header-height);
  padding: 24px 32px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.header-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.player-profile-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Player profile header: 3-column layout ── */
.player-profile-header {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 20px;
}

/* Column 1: info col – fills height like the other two cards */
.player-header-info-col {
  display: flex;
  flex-direction: column;
}

.player-header-info-col .player-header-card {
  flex: 1;
}

/* Shared card base for all three header columns */
.player-header-card {
  background: linear-gradient(160deg, var(--color-bg-elevated) 0%, var(--color-bg-card) 100%);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Player info card: photo inside the card between top and body */
.player-info-card-photo-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.15);
  height: 130px;
  overflow: hidden;
}

.player-info-card-photo {
  width: 110px;
  height: 130px;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.player-info-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 12px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.player-info-card-ovr-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.player-info-card-ovr {
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -1px;
}

.player-info-card-pos {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.player-info-card-badge-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.player-info-card-flag {
  width: 26px;
  height: 18px;
  object-fit: contain;
}

.player-info-card-crest {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.player-info-card-dorsal {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--color-text-muted);
  letter-spacing: 0px;
  text-align: center;
}

.player-info-card-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.player-info-card-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--color-text);
  line-height: 1.2;
  margin-bottom: 2px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-info-card-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.85rem;
  color: var(--color-text);
}

.player-info-card-flag-sm {
  width: 22px;
  height: 15px;
  object-fit: contain;
  border-radius: 1px;
}

.player-info-card-nationality {
  color: var(--color-text-muted);
  font-size: 0.83rem;
}

.player-info-card-type {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* 4-stat grid inside the info card (Age / Height / Weight / Foot) */
.player-info-card .player-info-card-stats {
  grid-template-columns: repeat(2, 1fr);
}

/* Radar card */
.player-radar-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.player-header-card-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--color-text-muted);
  padding: 12px 16px 0;
}

.player-header-radar-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 8px 12px;
  flex: 1;
}

/* Positions card */
.player-positions-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.player-positions-card .player-section {
  margin-bottom: 0;
  width: 100%;
}

/* Legacy: keep old .profile-header-card hidden behind new layout */
.profile-header-card {
  display: none;
}

.profile-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--color-text);
}

.profile-meta-row img {
  width: 24px;
  height: 18px;
  object-fit: cover;
  border-radius: 2px;
}

.profile-meta-row .team-crest-sm {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.team-crest-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: inherit;
  text-decoration: none;
  transition: color 0.15s;
}

.team-crest-link:hover {
  color: var(--color-highlight);
  text-decoration: underline;
}

.profile-flag {
  width: 26px !important;
  height: 18px !important;
}

.national-team-note {
  font-size: 0.82rem;
  color: var(--color-highlight-soft);
  font-weight: 500;
  margin-top: 4px;
}

.profile-miniface-note {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-top: 4px;
}

.national-team-badge {
  margin-left: 6px;
  font-size: 0.82rem;
  opacity: 0.85;
}

.profile-quick-stats {
  display: flex;
  gap: 20px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.quick-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 8px 14px;
  min-width: 58px;
}

.qs-label {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.qs-val {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  margin-top: 2px;
}

/* Tabs */
.profile-tabs {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
}

.profile-tab-bar {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.profile-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 12px 24px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.profile-tab-btn:hover {
  color: var(--color-text);
}

.profile-tab-btn.active {
  color: var(--color-highlight);
  border-bottom-color: var(--color-highlight);
}

.profile-tab-panel {
  display: none;
  padding: 24px;
}

.profile-tab-panel.active {
  display: block;
}

/* Stats tab layout */
.profile-stats-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
}

.profile-stats-left {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.profile-stats-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stats-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border);
}

/* Position ratings grid */
.pos-rating-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.pos-rating-cell {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 6px 4px;
  text-align: center;
}

.pos-rating-label {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.pos-rating-value {
  font-size: 0.9rem;
  font-weight: 700;
  margin-top: 2px;
  border-radius: 4px;
  padding: 1px 4px;
}

/* Ability stat groups */
.stats-group {
  background: var(--color-surface);
  border-radius: 8px;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
}

.stats-group-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border);
}

/* Appearance tab */
.appearance-info {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-bottom: 20px;
  padding: 10px 14px;
  background: var(--color-surface);
  border-radius: 6px;
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-highlight);
}

.appearance-empty {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  padding: 20px 0;
}

.scanned-face-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  background: rgba(46, 204, 113, 0.1);
  border: 1px solid rgba(46, 204, 113, 0.35);
  border-radius: 8px;
  color: #2ecc71;
  font-size: 0.92rem;
  font-weight: 600;
  margin: 8px 0;
}

.scanned-face-icon {
  font-size: 1.3rem;
}

/* ── Appearance structured sections ── */
.appearance-section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.appearance-section-btn {
  padding: 6px 16px;
  background: var(--color-secondary);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  letter-spacing: 0.3px;
}

.appearance-section-btn.active,
.appearance-section-btn:hover {
  background: var(--color-highlight);
  color: #111;
  border-color: var(--color-highlight);
  box-shadow: 0 2px 8px rgba(214, 168, 79, 0.18);
}

.face-section {
  display: none;
}

.face-section.active {
  display: block;
}

.face-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 12px;
  padding: 8px 14px;
  background: var(--color-surface);
  border-left: 4px solid var(--color-highlight);
  border-radius: 0 6px 6px 0;
  letter-spacing: 0.5px;
}

.face-subsection {
  margin-bottom: 18px;
}

.face-subsection-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--color-text-muted);
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--color-border);
}

/* kept for backwards compat */
.face-group {
  margin-bottom: 20px;
}

.face-group-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border);
}

.face-data-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-flow: row;
  gap: 3px 8px;
}

.face-data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--color-surface);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.8rem;
  gap: 8px;
  min-height: 28px;
  border: 1px solid transparent;
  transition: border-color 0.12s;
}

.face-data-row:hover {
  border-color: var(--color-border);
}

.face-data-label {
  color: var(--color-text-muted);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.76rem;
}

.face-data-value {
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
  min-width: 30px;
  text-align: right;
}

.face-data-dash {
  color: var(--color-text-muted);
  font-weight: 400;
}

.face-data-na {
  color: var(--color-text-muted);
  font-weight: 400;
  font-style: italic;
}

/* Image value: inline row so height matches text-only rows */
.face-data-with-img {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 60px;
}

.appearance-thumb {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 3px;
  background: var(--color-accent);
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}

.appearance-thumb-val {
  font-size: 0.8rem;
  color: var(--color-text);
  font-weight: 600;
  min-width: 22px;
  text-align: right;
}

.skill-item-empty {
  color: var(--color-text-muted);
  font-weight: 400;
}

/* ── Position proficiency (C/B/A) ── */
.pos-prof-c {
  color: var(--color-stat-red);
  font-weight: 800;
}
.pos-prof-b {
  color: var(--color-stat-yellow);
  font-weight: 800;
}
.pos-prof-a {
  color: var(--color-stat-green);
  font-weight: 800;
}

/* ── Special attribute display (stars/pips) ── */
.special-attr-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
}

.special-attr-pips {
  display: flex;
  gap: 3px;
}

.pip {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-border);
}

.pip.filled {
  background: var(--color-highlight);
}

/* ── Sort/Filter toolbar ── */
.filters-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
}

.filter-label {
  color: var(--color-text-muted);
  white-space: nowrap;
}

.filter-select,
.filter-input {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 5px 10px;
  color: var(--color-text);
  font-size: 0.82rem;
  outline: none;
  cursor: pointer;
}

.filter-input {
  width: 80px;
}

.filter-select:hover,
.filter-input:hover {
  border-color: var(--color-highlight);
}

.filter-reset-btn {
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text-muted);
  padding: 5px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.filter-reset-btn:hover {
  border-color: var(--color-highlight);
  color: var(--color-text);
}

.players-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.players-table th.sortable:hover {
  color: var(--color-text);
}

.players-table th .sort-icon {
  margin-left: 4px;
  font-size: 0.65rem;
  opacity: 0.5;
}

.players-table th.sort-asc .sort-icon,
.players-table th.sort-desc .sort-icon {
  opacity: 1;
  color: var(--color-highlight);
}

/* ── League grouping ── */
.sidebar-country-group {
  padding: 2px 0;
}

.sidebar-country-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-top: 1px solid var(--color-border);
}

.sidebar-country-header:hover {
  background: var(--color-highlight-dim);
  color: var(--color-text);
}

.sidebar-country-arrow {
  font-size: 0.6rem;
  transition: transform 0.2s;
  margin-left: auto;
}

.sidebar-country-header.open .sidebar-country-arrow {
  transform: rotate(90deg);
}

.sidebar-country-teams {
  display: none;
  padding: 0;
}

.sidebar-country-teams.open {
  display: block;
}

/* ── Responsive ── */
@media (max-width: 1100px) {
  .player-profile {
    grid-template-columns: 180px 1fr;
  }

  .player-right {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .profile-stats-layout {
    grid-template-columns: 240px 1fr;
  }
}

@media (max-width: 1100px) {
  .stats-compact-layout {
    grid-template-columns: 1fr 220px;
  }
}

@media (max-width: 768px) {
  #sidebar {
    width: 100%;
    position: relative;
    top: 0;
  }

  #layout {
    flex-direction: column;
  }

  #main {
    margin-left: 0;
    padding: 16px;
  }

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

  .player-right {
    display: block;
  }

  #header h1,
  #header .header-title {
    font-size: 0.9rem;
  }

  /* Player page responsive */
  #player-page {
    padding: 16px;
  }

  /* Team page responsive */
  #team-page {
    padding: 16px;
  }

  /* League page responsive */
  #league-page {
    padding: 16px;
  }

  .profile-header-card {
    flex-direction: column;
    gap: 16px;
  }

  .player-profile-header {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  .player-header-info-col {
    grid-column: 1 / -1;
  }

  .player-radar-card canvas {
    width: 200px !important;
    height: 200px !important;
  }

  .profile-stats-layout {
    grid-template-columns: 1fr;
  }

  .profile-stats-left {
    order: 2;
  }

  .profile-stats-right {
    order: 1;
  }

  .stats-compact-layout {
    grid-template-columns: 1fr;
  }

  .face-data-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Player profile header: single-column on small screens ── */
@media (max-width: 540px) {
  .player-profile-header {
    grid-template-columns: 1fr;
  }

  .player-header-info-col {
    grid-column: 1;
  }
}

/* ── Sidebar nav sections (Ligas / Equipos / Jugadores) ── */
.sidebar-nav-section {
  border-bottom: 1px solid var(--color-border);
}

.sidebar-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 0;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  background: var(--color-secondary);
}

.sidebar-nav-header:hover {
  background: var(--color-highlight-dim);
}

.db-sidebar-btn {
  appearance: none;
  font: inherit;
}

.db-sidebar-btn:hover {
  background: var(--color-secondary);
}

.sidebar-nav-header.active {
  background: var(--color-highlight-dim);
  border-left: 3px solid var(--color-highlight);
}

.sidebar-nav-header.active .sidebar-nav-title {
  color: var(--color-highlight);
}

.sidebar-nav-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text);
}

.sidebar-nav-arrow {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  transition: transform 0.2s;
}

.sidebar-nav-body {
  padding-bottom: 6px;
}

/* League items inside Ligas section reuse existing .sidebar-league styles */
.sidebar-league-item {
  padding: 2px 0;
}

/* ── Position groups on team page ── */
.squad-groups {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.position-group {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
}

.position-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.position-group-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.position-group-positions {
  font-size: 0.75rem;
  color: var(--color-highlight);
  font-weight: 600;
}

.position-group-count {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-left: auto;
}

/* ── Player page sections (Habilidades, Estilo de juego, etc.) ── */
.player-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 0;
}

.player-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border);
}

/* Playing style display */
.playing-style-display {
  padding: 4px 0;
}

.playing-style-badge {
  display: inline-block;
  background: var(--color-highlight-dim);
  border: 1px solid var(--color-highlight);
  color: var(--color-text);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
}

/* Skills and COM styles */
.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.skill-badge {
  display: inline-block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 4px;
}

.skill-badge.com-style {
  background: var(--color-highlight-dim);
  border-color: var(--color-highlight);
  color: var(--color-text);
}

/* ── Skill items list (Estilo de juego / Habilidades / COM styles) ── */
.skill-items-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.skill-item-row {
  font-size: 0.88rem;
  color: var(--color-text);
  padding: 5px 0;
  border-bottom: 1px solid var(--color-border);
}

.skill-item-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* ── Leagues view & Teams grid view ── */
#leagues-view {
  display: none;
}

#leagues-view.active {
  display: block;
}

#teams-grid-view {
  display: none;
}

#teams-grid-view.active {
  display: block;
}

/* ── Grid cards (leagues and teams) ── */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
  margin-top: 8px;
}

.grid-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  text-align: center;
}

.grid-card:hover {
  background: var(--color-card-hover);
  border-color: var(--color-highlight);
  box-shadow: 0 4px 16px rgba(214, 168, 79, 0.14);
  transform: translateY(-2px);
}

.grid-card-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 4px;
}

.grid-card-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
  word-break: break-word;
}

.grid-card-sub {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.grid-card-ovr {
  display: flex;
  justify-content: center;
}

.team-avg-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 700;
}

/* ── Formation pitch ── */
.formation-section {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 16px 18px 18px;
  margin-bottom: 24px;
}

/* Fluid formation tab buttons */
.formation-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.formation-tab-btn {
  padding: 5px 14px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.formation-tab-btn:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.formation-tab-btn.active {
  background: var(--color-highlight);
  border-color: var(--color-highlight);
  color: #fff;
}

.formation-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.formation-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 380px minmax(260px, 1fr);
  gap: 18px;
  align-items: stretch;
  min-height: 420px;
}

.pitch-container {
  display: flex;
  justify-content: center;
  align-items: stretch;
  width: 100%;
  min-height: 420px;
}

.pitch-field {
  position: relative;
  width: 380px;
  height: 420px;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 22px,
      rgba(0,0,0,0.045) 22px,
      rgba(0,0,0,0.045) 44px
    ),
    linear-gradient(to bottom, #1b5c16, #2e7a27);
  border: 1.5px solid rgba(255,255,255,0.36);
  border-radius: 6px;
  overflow: visible;
}

/* Full-pitch CSS field markings */
.pf-mark {
  position: absolute;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.28);
}

.pf-halfway {
  left: 0; right: 0; top: 50%;
  height: 0;
  border-top: 1px solid rgba(255,255,255,0.28);
  border-left: none; border-right: none; border-bottom: none;
}

.pf-center-circle {
  width: 40px; height: 40px;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.22);
}

.pf-penalty-top {
  left: 18%; right: 18%; top: 0;
  height: 18%;
  border-top: none;
  border-left: 1px solid rgba(255,255,255,0.28);
  border-right: 1px solid rgba(255,255,255,0.28);
  border-bottom: 1px solid rgba(255,255,255,0.28);
}

.pf-goal-top {
  left: 36%; right: 36%; top: 0;
  height: 6%;
  border-top: none;
  border-left: 1px solid rgba(255,255,255,0.28);
  border-right: 1px solid rgba(255,255,255,0.28);
  border-bottom: 1px solid rgba(255,255,255,0.28);
}

.pf-penalty-bottom {
  left: 18%; right: 18%; bottom: 0;
  height: 18%;
  border-bottom: none;
  border-left: 1px solid rgba(255,255,255,0.28);
  border-right: 1px solid rgba(255,255,255,0.28);
  border-top: 1px solid rgba(255,255,255,0.28);
}

.pf-goal-bottom {
  left: 36%; right: 36%; bottom: 0;
  height: 6%;
  border-bottom: none;
  border-left: 1px solid rgba(255,255,255,0.28);
  border-right: 1px solid rgba(255,255,255,0.28);
  border-top: 1px solid rgba(255,255,255,0.28);
}

/* ── Player element: portrait → badge → name ── */
.pitch-player {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 62px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s;
}

.pitch-player:hover {
  transform: translate(-50%, -50%) scale(1.1);
  z-index: 9999 !important;
}

.pitch-player-photo-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  margin-bottom: 0;
  background: transparent;
  z-index: 1;
}

.pitch-player-photo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Captain indicator: white circle with dark "C", top-right of face */
.pitch-captain-badge {
  position: absolute;
  right: 0;
  top: 0;
  background: #fff;
  color: #111;
  font-size: 0.5rem;
  font-weight: 900;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 2;
}

/* Badge: flat horizontal rectangle, dark background, square corners */
.pitch-player-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 52px;
  box-sizing: border-box;
  padding: 1px 4px;
  border-radius: 0;
  background: #1a1a1e;
  gap: 3px;
  z-index: 0;
}

.pitch-badge-pos {
  font-size: 0.62rem;
  font-weight: 800;
  white-space: nowrap;
  line-height: 1.4;
  font-family: sans-serif;
}

.pitch-badge-ovr {
  font-size: 0.62rem;
  font-weight: 800;
  white-space: nowrap;
  line-height: 1.4;
  font-family: sans-serif;
  color: #fff;
}

/* Player name: below badge, white, single line, scrolls if too long */
.pitch-player-name {
  font-size: 0.58rem;
  color: #fff;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  max-width: 52px;
  text-align: center;
  margin-top: 1px;
  line-height: 1.2;
  font-family: sans-serif;
}

.pitch-player-name span {
  display: inline-block;
}

.pitch-player-name.scrolling span {
  animation: pitch-name-marquee 6s linear infinite;
}

@keyframes pitch-name-marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Formation label: bottom-left of the pitch */
.pitch-formation-label {
  position: absolute;
  bottom: 6px;
  left: 8px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: sans-serif;
  line-height: 1;
  pointer-events: none;
  z-index: 200;
}

/* ── Formation tactics & assignments ── */
.formation-info-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  width: 100%;
  min-width: 200px;
}

.formation-tactic-block {
  min-width: 0;
  min-height: 420px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow: hidden;
}

.formation-tactic-block.is-empty {
  visibility: hidden;
}

.formation-block-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  margin-bottom: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--color-border);
}

.tactic-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 6px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.84rem;
}

.tactic-row:last-child {
  border-bottom: none;
}

.tactic-label {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  min-width: 0;
}

.tactic-value {
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.82rem;
  text-align: right;
  max-width: 52%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 820px) {
  .formation-layout {
    grid-template-columns: 1fr;
  }

  .pitch-field {
    width: min(100%, 320px);
    height: auto;
    aspect-ratio: 5 / 7;
  }
}

/* ── Player cards carousel ── */
.player-cards-section {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 24px;
}

.player-cards-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.player-cards-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
}

.player-cards-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-cards-nav-btn {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  padding: 0;
}

.player-cards-nav-btn:hover:not(:disabled) {
  background: var(--color-card-hover);
  border-color: var(--color-highlight);
  color: var(--color-highlight);
}

.player-cards-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.player-cards-counter {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  min-width: 90px;
  text-align: center;
  white-space: nowrap;
}

.player-cards-viewport {
  overflow: hidden;
  width: 100%;
}

.player-cards-track {
  display: flex;
  gap: 12px;
  transition: transform 0.3s ease;
  will-change: transform;
}

.player-cards-group {
  margin-bottom: 18px;
}

.player-cards-group:last-child {
  margin-bottom: 0;
}

.player-cards-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border);
}

.player-cards-group-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text-muted);
}

.player-cards-group-count {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1px 7px;
  line-height: 1.6;
}

.player-cards-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 2px 12px;
  scrollbar-color: var(--color-border) var(--color-surface);
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.player-cards-row::-webkit-scrollbar {
  height: 10px;
}

.player-cards-row::-webkit-scrollbar-track {
  background: var(--color-surface);
  border-radius: 999px;
}

.player-cards-row::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 999px;
}

.player-cards-row::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

.player-card {
  flex-shrink: 0;
  width: 136px;
  background: linear-gradient(160deg, var(--color-bg-elevated) 0%, var(--color-bg-card) 100%);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  scroll-snap-align: start;
}

/* Responsive player cards: shrink on small screens */
@media (max-width: 640px) {
  .player-card {
    width: 124px;
    min-width: 124px;
    max-width: 124px;
  }
  .player-card-photo-wrap {
    height: 75px;
  }
  .player-card-photo {
    width: 66px;
    height: 75px;
  }
  .player-card-ovr {
    font-size: 1.5rem;
  }
  .player-card-footer {
    padding: 6px 6px 8px;
  }
  .player-card-stats {
    gap: 2px;
  }
  .pcs-val {
    font-size: 0.68rem;
  }
  .pcs-key {
    font-size: 0.45rem;
  }
}

.player-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(0,0,0,0.48);
  border-color: var(--color-highlight);
}

.player-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 8px 5px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.player-card-ovr-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.player-card-ovr {
  font-size: 1.7rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.player-card-pos {
  font-size: 0.64rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.player-card-badge-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.player-card-flag {
  width: 23px;
  height: 16px;
  object-fit: contain;
}

.player-card-crest {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.player-card-photo-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  background: rgba(0,0,0,0.15);
  height: 78px;
  overflow: hidden;
}

.player-card-photo {
  width: 70px;
  height: 78px;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.player-card-footer {
  padding: 7px 8px 8px;
  flex: 1;
}

.player-card-name {
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.player-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 6px;
}

.pcs {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.pcs-val {
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}

.pcs-key {
  font-size: 0.48rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* ── Position field visualization ── */
.position-field-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.position-field {
  position: relative;
  width: min(100%, 190px);
  aspect-ratio: 2 / 3;
  height: auto;
  background: linear-gradient(to bottom, #264d21 0%, #224020 48%, #224020 52%, #264d21 100%);
  border: 1.5px solid rgba(255,255,255,0.45);
  border-radius: 4px;
  overflow: hidden;
}

.position-field-line {
  position: absolute;
  background: rgba(255,255,255,0.3);
}

.pf-halfway {
  left: 0; right: 0; top: 50%;
  height: 1px;
}

.pf-penalty-bottom {
  left: 18%; right: 18%;
  bottom: 0; height: 22%;
  border: 1px solid rgba(255,255,255,0.3);
  border-bottom: none;
  background: transparent;
}

.pf-penalty-top {
  left: 18%; right: 18%;
  top: 0; height: 22%;
  border: 1px solid rgba(255,255,255,0.3);
  border-top: none;
  background: transparent;
}

.pf-goal-bottom {
  left: 35%; right: 35%;
  bottom: 0; height: 8%;
  border: 1px solid rgba(255,255,255,0.3);
  border-bottom: none;
  background: transparent;
}

.pf-goal-top {
  left: 35%; right: 35%;
  top: 0; height: 8%;
  border: 1px solid rgba(255,255,255,0.3);
  border-top: none;
  background: transparent;
}

.position-field-center-circle {
  position: absolute;
  left: 50%; top: 50%;
  width: 44px; height: 44px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: transparent;
}

.field-pos-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 4px;
  border: 1px solid;
  min-width: 28px;
  padding: 3px 5px;
  font-size: 0.6rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: default;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.field-pos-primary {
  z-index: 10;
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
  font-size: 0.65rem;
}

.field-pos-secondary {
  background: rgba(0,0,0,0.5);
  opacity: 0.85;
}

.field-pos-label {
  line-height: 1;
}

.position-field-legend {
  display: flex;
  gap: 14px;
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.pf-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.pf-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.pf-legend-primary {
  background: var(--color-text-muted);
}

.pf-legend-secondary {
  background: transparent;
  border: 2px solid var(--color-text-muted);
}

/* PES-style position aptitude map */
.position-map-section {
  --position-forward: #C62828;
  --position-midfielder: #4CAF50;
  --position-defender: #3EBEC8;
  --position-goalkeeper: #D6A84F;
}

.positions-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
}

.position-menu {
  min-width: 0;
}

.position-menu summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  background: rgba(255,255,255,0.04);
  color: var(--color-text);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.position-menu summary::-webkit-details-marker {
  display: none;
}

.position-menu summary::after {
  content: "▾";
  color: var(--color-text-muted);
  font-size: 0.72rem;
}

.position-menu[open] summary {
  border-color: rgba(214, 168, 79, 0.35);
}

.position-menu[open] summary::after {
  transform: rotate(180deg);
}

.position-list {
  display: grid;
  gap: 4px;
  min-width: 0;
  margin-top: 8px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 2px;
}

.position-list-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 26px;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 30px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
}

.position-list-row:hover,
.position-list-row.is-selected {
  border-color: rgba(214, 168, 79, 0.34);
  background: rgba(255, 255, 255, 0.04);
}

.position-list-row.is-empty {
  opacity: 0.52;
}

.position-list-abbr {
  font-size: 0.76rem;
  font-weight: 900;
  text-align: center;
}

.position-list-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-muted);
  font-size: 0.72rem;
}

.position-list-grade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  width: 24px;
  height: 22px;
  border-radius: 5px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.72rem;
  font-weight: 900;
}

.position-pitch {
  position: relative;
  width: min(100%, 260px);
  aspect-ratio: 2 / 3;
  margin-inline: auto;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 2px;
  background:
    repeating-linear-gradient(
      to bottom,
      #244f25 0%,
      #244f25 12.5%,
      #1f4721 12.5%,
      #1f4721 25%
    );
}

.position-pitch-panel {
  display: flex;
  justify-content: center;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  background: #050506;
}

.position-pitch::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(0,0,0,0.38);
  pointer-events: none;
  z-index: 3;
}

.pitch-line,
.pitch-circle,
.pitch-box {
  position: absolute;
  pointer-events: none;
  z-index: 2;
}

.pitch-line.half {
  left: 9px;
  right: 9px;
  top: 50%;
  height: 1px;
  background: rgba(0,0,0,0.34);
}

.pitch-circle.center {
  left: 50%;
  top: 50%;
  width: 24%;
  aspect-ratio: 1;
  border: 1px solid rgba(0,0,0,0.34);
  border-radius: 999px;
  transform: translate(-50%, -50%);
}

.pitch-box {
  left: 24%;
  width: 52%;
  border: 1px solid rgba(0,0,0,0.34);
}

.pitch-box.top-large {
  top: 9px;
  height: 18%;
  border-top: 0;
}

.pitch-box.bottom-large {
  bottom: 9px;
  height: 18%;
  border-bottom: 0;
}

.pitch-box.top-small {
  left: 36%;
  width: 28%;
  top: 9px;
  height: 7%;
  border-top: 0;
}

.pitch-box.bottom-small {
  left: 36%;
  width: 28%;
  bottom: 9px;
  height: 7%;
  border-bottom: 0;
}

.position-dot {
  position: absolute;
  width: 24px;
  height: 18px;
  padding: 0;
  border: 2px solid rgba(255,255,255,0.78);
  border-radius: 999px / 70%;
  box-shadow: 0 0 8px rgba(0,0,0,0.45);
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 5;
}

.position-dot.position-forward {
  background: var(--position-forward);
}

.position-dot.position-midfielder {
  background: var(--position-midfielder);
}

.position-dot.position-defender {
  background: var(--position-defender);
}

.position-dot.position-goalkeeper {
  background: var(--position-goalkeeper);
}

.position-dot.value-a {
  opacity: 1;
}

.position-dot.value-b {
  opacity: 0.82;
}

.position-dot.value-c {
  opacity: 0.64;
}

.position-dot.is-selected::after {
  content: "";
  position: absolute;
  inset: -9px;
  border: 2px solid #29F0F0;
  border-radius: 4px;
  opacity: 0.92;
}

/* Tactical block map for player position aptitude */
.position-map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.position-map-header .player-section-title {
  margin-bottom: 0;
}

.position-view-switch {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #11141B;
}

.position-view-toggle {
  min-height: 28px;
  padding: 4px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

.position-view-toggle.is-active {
  background: var(--color-highlight);
  color: #111;
}

.positions-map {
  width: 100%;
  max-width: 520px;
  margin-inline: auto;
  padding: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: #11141B;
}

.positions-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(7, 52px);
  gap: 4px;
}

.position-cell {
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 7px;
  background: #171A22;
  color: rgba(180,185,195,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: border-color 0.15s, filter 0.15s, background 0.15s, color 0.15s, outline-color 0.15s;
}

.position-cell:hover {
  border-color: var(--position-color);
  filter: brightness(1.08);
}

.position-cell.is-selected {
  outline: 2px solid #29F0F0;
  outline-offset: -2px;
}

.position-cell.is-primary {
  background: var(--position-color);
  border-color: color-mix(in srgb, var(--position-color) 80%, #fff);
  color: #061014;
  box-shadow: 0 0 12px color-mix(in srgb, var(--position-color) 30%, transparent);
}

.position-cell.is-strong {
  background: color-mix(in srgb, var(--position-color) 65%, #10131A);
  border-color: color-mix(in srgb, var(--position-color) 60%, transparent);
  color: #F5F5F5;
}

.position-cell.is-medium {
  background: color-mix(in srgb, var(--position-color) 25%, #171A22);
  border-color: color-mix(in srgb, var(--position-color) 38%, transparent);
  color: var(--position-color);
}

.position-cell.is-low,
.position-cell.is-disabled {
  background: #171A22;
  color: rgba(180,185,195,0.45);
}

.position-code {
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.position-grade {
  display: none;
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
}

.position-map-section[data-view-mode="letters"] .position-cell {
  flex-direction: column;
}

.position-map-section[data-view-mode="letters"] .position-grade {
  display: block;
}

.position-map-section[data-view-mode="letters"] .position-cell.is-medium,
.position-map-section[data-view-mode="letters"] .position-cell.is-low {
  background: color-mix(in srgb, var(--position-color) 18%, #171A22);
}

/* ── Team extra info (league, stadium, manager) ── */
.team-extra-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 6px;
}

.team-info-item {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.team-info-label {
  color: var(--color-text);
  font-weight: 700;
}

/* ── Grid search box ── */
.grid-search-wrap {
  margin-bottom: 12px;
}

.grid-search-input {
  width: 100%;
  max-width: 360px;
  padding: 8px 12px;
  background: var(--color-secondary);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text);
  font-size: 0.9rem;
  outline: none;
  box-sizing: border-box;
}

.grid-search-input:focus {
  border-color: var(--color-highlight);
}

/* ── Player stats sections ── */
.stats-section {
  margin-bottom: 24px;
}

.stats-section:last-child {
  margin-bottom: 0;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 0 8px;
  flex-wrap: wrap;
}

.page-numbers {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.page-btn {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s, border-color 0.15s;
  min-width: 36px;
  text-align: center;
  line-height: 1.4;
}

.page-btn:hover:not(:disabled) {
  background: var(--color-surface);
  border-color: var(--color-highlight);
}

.page-btn.active {
  background: var(--color-highlight);
  color: #fff;
  border-color: var(--color-highlight);
  cursor: default;
}

.page-btn:disabled:not(.active) {
  color: var(--color-text-muted);
  opacity: 0.45;
  cursor: default;
}

.page-nav {
  padding: 6px 14px;
}

.page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

/* ── Responsive table wrapper ── */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  border: 1px solid var(--color-border);
}

.table-responsive .players-table {
  border-radius: 0;
  border: none;
}

.mobile-team-col {
  display: none;
}

.quick-filter-chip,
.player-flag {
  cursor: pointer;
}

.row-team-filter {
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  font: inherit;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.row-team-filter:hover {
  color: var(--color-highlight);
}

@media (max-width: 640px) {
  .page-nav {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .page-btn {
    min-width: 30px;
    padding: 5px 8px;
    font-size: 0.8rem;
  }

  .players-table th,
  .players-table td {
    padding: 8px 8px;
    font-size: 0.82rem;
  }

  .players-table .desktop-stat {
    display: none;
  }

  .players-table .mobile-team-col {
    display: table-cell;
  }

  .player-row-photo {
    width: 34px;
    height: 38px;
  }

  .fav-col {
    display: none;
  }

  .tutorial-detail {
    grid-template-columns: 1fr;
  }

  .download-card-footer {
    grid-template-columns: 1fr;
  }
}

/* ─── Squad organizer ─────────────────────────────────────────────────────── */

#squad-organizer-page {
  max-width: 1400px;
  margin: 24px auto 40px;
  padding: 0 16px;
  display: grid;
  gap: 16px;
}

.squad-organizer-panel,
.squad-results {
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  padding: 16px;
}

.squad-organizer-panel h2 {
  margin: 0 0 8px 0;
}

.squad-organizer-help {
  margin: 0 0 12px 0;
  color: var(--color-text-muted);
}

#squad-input {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-primary);
  color: var(--color-text);
  padding: 10px 12px;
  font-family: inherit;
  margin-bottom: 12px;
}

.squad-organizer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.squad-organizer-actions button {
  border: 1px solid var(--color-border);
  background: var(--color-highlight);
  color: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

.squad-organizer-actions button.secondary {
  background: transparent;
  color: var(--color-text);
}

.squad-feedback {
  margin-top: 10px;
  color: var(--color-text-muted);
}

.squad-filters {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-bottom: 10px;
}

.squad-filters input,
.squad-filters select {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-primary);
  color: var(--color-text);
  padding: 8px 10px;
}

.squad-summary {
  margin-bottom: 8px;
  color: var(--color-text-muted);
}

.no-results-row {
  text-align: center;
  padding: 20px;
  color: var(--color-text-muted);
}

/* =====================================================
   Hub – Header nav links (downloads / tutorials / etc.)
   ===================================================== */

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.header-nav-link {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.header-nav-link:hover {
  color: var(--color-text);
  background: var(--color-card);
}

.header-nav-link.active {
  color: var(--color-highlight);
  background: var(--color-highlight-dim);
  font-weight: 600;
}

/* =====================================================
   Sidebar – divider + external links
   ===================================================== */

.sidebar-nav-divider {
  height: 1px;
  background: var(--color-border);
  margin: 6px 12px;
}

.sidebar-nav-link {
  display: flex;
  text-decoration: none;
  color: inherit;
}

.sidebar-nav-badge {
  margin-left: auto;
  background: var(--color-highlight);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  line-height: 1;
}

/* =====================================================
   Favorites – row button
   ===================================================== */

.fav-col {
  width: 36px;
  min-width: 36px;
  text-align: center;
  padding: 0 2px !important;
}

.fav-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 5px;
  line-height: 1;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.fav-btn:hover {
  color: #f1c40f;
  background: rgba(241, 196, 15, 0.12);
  border-color: rgba(241, 196, 15, 0.3);
}

.fav-btn.is-fav {
  color: #f1c40f;
  border-color: transparent;
}

/* =====================================================
   Favorites – profile page button
   ===================================================== */

.profile-fav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  width: 100%;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--color-border);
  background: var(--color-card);
  color: var(--color-text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.profile-fav-btn:hover {
  color: #f1c40f;
  background: rgba(241, 196, 15, 0.1);
  border-color: rgba(241, 196, 15, 0.4);
}

.profile-fav-btn.is-fav {
  color: #f1c40f;
  border-color: rgba(241, 196, 15, 0.5);
  background: rgba(241, 196, 15, 0.08);
}

/* =====================================================
   Favorites – empty state + misc
   ===================================================== */

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--color-text-muted);
}

.empty-state-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 1rem;
  margin-bottom: 6px;
}

.favorites-missing-note {
  background: rgba(241, 196, 15, 0.08);
  border: 1px solid rgba(241, 196, 15, 0.3);
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 16px;
  color: #f1c40f;
  font-size: 0.85rem;
}

.btn-danger {
  color: var(--color-highlight) !important;
  border-color: var(--color-highlight) !important;
}

.btn-danger:hover {
  background: rgba(179, 38, 46, 0.14) !important;
}

/* =====================================================
   Standalone pages (downloads / tutorials)
   ===================================================== */

#downloads-page,
#tutorials-page,
#news-page {
  padding-top: calc(var(--header-height) + 24px);
  padding-bottom: 48px;
  max-width: 1100px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

#downloads-page #loading-overlay,
#tutorials-page #loading-overlay,
#news-page #loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(11, 11, 13, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

/* ── Shared page header ── */

.page-section-header {
  margin-bottom: 28px;
}

.page-section-title {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
}

.page-section-subtitle {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* =====================================================
   Downloads page
   ===================================================== */

.downloads-how-to {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 14px 20px;
  margin-bottom: 28px;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.downloads-how-to h3 {
  font-size: 0.95rem;
  color: var(--color-text);
  margin-bottom: 4px;
}

.downloads-how-to a {
  color: var(--color-highlight);
  text-decoration: none;
}

.downloads-how-to a:hover {
  text-decoration: underline;
}

/* ── Download groups ── */

.download-group {
  margin-bottom: 36px;
}

.download-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text);
  border-bottom: 1.5px solid var(--color-border);
  padding-bottom: 10px;
  margin-bottom: 16px;
}

.download-group-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

/* ── Download cards grid ── */

.download-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.download-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.download-card:hover {
  border-color: var(--color-highlight);
  box-shadow: 0 4px 16px rgba(214, 168, 79, 0.16);
}

.download-card-media {
  aspect-ratio: 16 / 9;
  background: var(--color-surface);
  overflow: hidden;
}

.download-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.download-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
  gap: 8px;
}

.download-platform-badge {
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--color-border);
}

.download-version-badge {
  background: var(--color-highlight-dim);
  color: var(--color-highlight);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

.download-card-body {
  padding: 4px 16px 12px;
  flex: 1;
}

.download-card-title {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.download-card-game {
  color: var(--color-highlight);
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.download-description {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.download-card-footer {
  padding: 10px 16px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ── Download button ── */

.download-btn {
  display: block;
  text-align: center;
  padding: 11px 16px;
  border-radius: 9px;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  background: var(--color-highlight);
  color: #111;
  border: none;
  width: 100%;
}

.download-btn:hover {
  background: var(--color-highlight-soft);
  transform: translateY(-1px);
}

.download-btn-secondary {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.download-btn:active {
  transform: translateY(0);
}

.download-btn-unavailable {
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: default;
}

.download-btn-unavailable:hover {
  transform: none;
  background: var(--color-surface);
}

/* =====================================================
   Tutorials page
   ===================================================== */

.tutorial-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

/* ── Tutorial card ── */

.tutorial-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tutorial-card:hover {
  border-color: var(--color-highlight);
  box-shadow: 0 4px 16px rgba(214, 168, 79, 0.16);
}

.tutorial-card--expanded {
  grid-column: 1 / -1;
  border-color: var(--color-highlight);
}

/* ── Thumbnail wrap ── */

.tutorial-card-thumb-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  background: var(--color-secondary);
  overflow: hidden;
}

.tutorial-card-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tutorial-card-thumb-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: var(--color-surface);
  padding-bottom: 0; /* override the ratio padding */
}

.tutorial-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(11, 13, 16, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  color: transparent;
  font-size: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  backdrop-filter: blur(3px);
}

.tutorial-play-btn::before {
  content: "";
  display: block;
  width: 0;
  height: 0;
  margin-left: 4px;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 15px solid #fff;
}

.tutorial-card:hover .tutorial-play-btn,
.tutorial-play-btn:hover {
  background: var(--color-highlight);
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 28px rgba(214, 168, 79, 0.24);
  transform: translate(-50%, -50%) scale(1.06);
}

/* ── Tutorial card body ── */

.tutorial-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tutorial-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.35;
}

.tutorial-card-date {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.tutorial-card-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.55;
  flex: 1;
}

.tutorial-watch-btn {
  margin-top: 4px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1.5px solid var(--color-highlight);
  background: var(--color-highlight-dim);
  color: var(--color-highlight);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-align: center;
}

.tutorial-watch-btn:hover {
  background: var(--color-highlight);
  color: #111;
}

/* ── Embedded video ── */

.tutorial-embed-wrap {
  width: 100%;
  position: relative;
  padding-bottom: 56.25%;
  background: #000;
}

.tutorial-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.tutorial-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 20px;
  align-items: start;
}

.tutorial-detail-media {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 12px;
}

.tutorial-detail-media .tutorial-iframe {
  position: static;
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  background: #000;
}

.tutorial-detail-thumb {
  width: 100%;
  border-radius: 10px;
  display: block;
}

.tutorial-detail-body {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 20px;
}

.tutorial-detail-body h1 {
  font-size: 1.5rem;
  margin: 8px 0 12px;
}

.tutorial-detail-body p,
.tutorial-steps {
  color: var(--color-text-muted);
  line-height: 1.6;
}

.tutorial-steps {
  margin-top: 14px;
  padding-left: 20px;
}

/* =====================================================
   News page
   ===================================================== */

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.news-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 220px;
  padding: 18px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-card);
}

.news-card-kicker {
  color: var(--color-highlight);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.news-card-title {
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1.35;
}

.news-card-desc {
  color: var(--color-text-muted);
  font-size: 0.86rem;
  line-height: 1.55;
  flex: 1;
}

.news-card-meta {
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

.news-card-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  min-height: 38px;
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--color-highlight);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
}


/* =====================================================
   Landing hub page (index.html)
   ===================================================== */

.landing-body #landing-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(var(--header-height) + 48px) 24px 60px;
  min-height: 100vh;
}

.landing-hero {
  position: relative;
  text-align: center;
  width: min(100%, 1120px);
  min-height: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 48px;
  padding: 64px 28px;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(11,11,13,0.64), rgba(11,11,13,0.94)),
    var(--home-banner-image),
    radial-gradient(circle at center, rgba(214,168,79,0.12), transparent 60%),
    var(--color-secondary);
  background-size: cover;
  background-position: center;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

.landing-hero-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  margin-bottom: 20px;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.45));
}

.landing-hero-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 12px;
}

.landing-hero-title span {
  color: var(--color-highlight);
}

.landing-hero-desc {
  color: var(--color-text-muted);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 680px;
}

.landing-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  width: 100%;
  max-width: 900px;
}

.landing-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 32px 20px;
  text-decoration: none;
  color: var(--color-text);
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  cursor: pointer;
}

.landing-card:hover {
  border-color: var(--color-highlight);
  box-shadow: 0 6px 24px rgba(214, 168, 79, 0.14);
  transform: translateY(-3px);
}

.landing-card-icon {
  font-size: 2.6rem;
  line-height: 1;
}

.landing-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
}

.landing-card-desc {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

@media (max-width: 600px) {
  .landing-cards {
    grid-template-columns: 1fr 1fr;
  }
  .landing-hero-title {
    font-size: 1.5rem;
  }
}

@media (max-width: 400px) {
  .landing-cards {
    grid-template-columns: 1fr;
  }
}

/* ── Hero CTA buttons ── */

.landing-hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 28px;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, transform 0.1s, box-shadow 0.15s;
  white-space: nowrap;
}

.hero-cta-primary {
  background: var(--color-highlight);
  color: #111;
  box-shadow: none;
}

.hero-cta-primary:hover {
  background: var(--color-highlight-soft);
  transform: translateY(-2px);
  box-shadow: none;
}

.hero-cta-secondary {
  background: var(--color-card);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.hero-cta-secondary:hover {
  border-color: var(--color-highlight);
  color: var(--color-highlight);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(214, 168, 79, 0.12);
}

@media (max-width: 500px) {
  .landing-hero-ctas {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-cta {
    justify-content: center;
  }
}

/* ── Landing sections ── */

.landing-section {
  width: 100%;
  max-width: 960px;
  margin-bottom: 48px;
}

.landing-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
}

.landing-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
}

.landing-section-link {
  font-size: 0.85rem;
  color: var(--color-highlight);
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.15s;
}

.landing-section-link:hover {
  opacity: 0.75;
  text-decoration: underline;
}

/* ── Featured Option File cards ── */

.featured-of-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.featured-of-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.featured-of-card:hover {
  border-color: var(--color-highlight);
  box-shadow: 0 4px 18px rgba(214, 168, 79, 0.14);
}

.featured-of-media {
  aspect-ratio: 16 / 9;
  background: var(--color-surface);
  overflow: hidden;
}

.featured-of-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.featured-of-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 16px 0;
}

.featured-of-game {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
}

.featured-of-game-sub {
  color: var(--color-text-muted);
  font-size: 0.84rem;
  padding: 0 16px;
}

.featured-of-platform {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
}

.featured-of-desc {
  font-size: 0.83rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  flex: 1;
  padding: 0 16px;
}

.featured-of-actions {
  display: flex;
  gap: 8px;
  margin: 4px 16px 16px;
}

.featured-of-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
  border: none;
  text-align: center;
}

.featured-of-btn-download {
  background: var(--color-highlight);
  color: #111;
}

.featured-of-btn-download:hover {
  background: var(--color-highlight-soft);
  transform: translateY(-1px);
}

.featured-of-btn-soon {
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: default;
}

.featured-of-btn-details {
  background: var(--color-surface);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.featured-of-btn-details:hover {
  border-color: var(--color-highlight);
  color: var(--color-highlight);
}

/* ── Compact landing cards (quick access) ── */

.landing-cards-compact {
  grid-template-columns: repeat(3, 1fr);
  max-width: 900px;
}

.landing-card-highlight {
  border-color: var(--color-highlight);
  background: linear-gradient(160deg, var(--color-card) 0%, rgba(61,16,16,0.4) 100%);
}

.landing-card-highlight .landing-card-title {
  color: var(--color-highlight);
}

@media (max-width: 640px) {
  .landing-cards-compact {
    grid-template-columns: 1fr;
  }
}

/* ── Header nav: Option Files primary link ── */

.header-nav-link-primary {
  color: var(--color-text-muted);
  font-weight: 600;
}

.header-nav-link-primary:hover {
  background: var(--color-highlight-dim);
  color: var(--color-highlight);
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.language-switcher select {
  min-height: 34px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-card);
  color: var(--color-text);
  padding: 0 8px;
  cursor: pointer;
}

#header > .language-switcher {
  margin-left: 0;
}

.shirt-number-directory {
  margin-top: 18px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-card);
  overflow: hidden;
}

.shirt-number-directory summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: var(--color-text);
  font-weight: 800;
  cursor: pointer;
}

.shirt-number-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--color-border);
}

.shirt-number-slot {
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
}

.shirt-number-slot.is-free {
  color: var(--color-text-muted);
  opacity: 0.72;
}

.shirt-number-value {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-secondary);
  color: var(--color-highlight);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.shirt-number-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.84rem;
  font-weight: 700;
}

.shirt-number-slot:hover .shirt-number-name {
  text-overflow: clip;
}

.shirt-number-slot:hover .shirt-number-name:not(:only-child) {
  animation: shirt-number-name-marquee 4.8s linear infinite;
}

@keyframes shirt-number-name-marquee {
  0%, 12% {
    transform: translateX(0);
  }
  88%, 100% {
    transform: translateX(calc(-100% + 100px));
  }
}

.language-prompt {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 300;
  width: min(360px, calc(100vw - 28px));
  border: 1px solid rgba(214, 168, 79, 0.34);
  border-radius: 10px;
  background: var(--color-bg-elevated);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
  padding: 16px;
}

.language-prompt-title {
  color: var(--color-text);
  font-weight: 800;
  margin-bottom: 5px;
}

.language-prompt-body {
  color: var(--color-text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.language-prompt-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.language-prompt-actions button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  padding: 0 12px;
  color: var(--color-text);
  background: var(--color-surface);
  font-weight: 800;
  cursor: pointer;
}

.language-prompt-actions .language-prompt-accept {
  border-color: var(--color-highlight);
  background: var(--color-highlight);
  color: #111;
}



@media (max-width: 900px) {
  .header-nav {
    display: flex;
    overflow-x: auto;
    margin-left: 0;
    scrollbar-width: none;
  }

  .header-nav::-webkit-scrollbar {
    display: none;
  }

  #header h1,
  #header .header-title {
    display: none;
  }

  #search-container {
    min-width: 150px;
    max-width: 210px;
  }

  .language-switcher span {
    display: none;
  }

  .download-cards-grid {
    grid-template-columns: 1fr 1fr;
  }

  .tutorial-cards-grid {
    grid-template-columns: 1fr;
  }

  .db-home-menu,
  .db-stats-grid {
    grid-template-columns: 1fr;
  }

  .landing-cards-compact {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .download-cards-grid {
    grid-template-columns: 1fr;
  }

  .landing-cards-compact {
    grid-template-columns: 1fr;
  }
}

.site-footer {
  background: var(--color-secondary);
  border-top: 1px solid var(--color-border);
  margin-top: 44px;
  padding: 22px 24px;
}

.site-footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.site-footer-title {
  font-weight: 800;
  color: var(--color-text);
}

.site-footer-copy {
  margin-top: 4px;
  color: var(--color-text-muted);
  font-size: 0.84rem;
}

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.site-footer-links a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.84rem;
}

.site-footer-links a:hover {
  color: var(--color-highlight);
}

body:has(#layout) .site-footer {
  margin-left: var(--sidebar-width);
}

.info-page {
  max-width: 1000px;
}

.info-hero,
.info-section,
.faq-item {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 22px;
}

.info-hero {
  margin-bottom: 20px;
}

.info-hero h2,
.info-section h2 {
  font-size: 1.55rem;
  margin-bottom: 8px;
}

.info-hero p,
.info-section p,
.faq-item p {
  color: var(--color-text-muted);
  line-height: 1.6;
}

.faq-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.faq-item h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.info-section {
  margin-bottom: 16px;
}

.about-page {
  width: min(100%, 1040px);
}

.about-hero,
.about-section {
  width: 100%;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
}

.about-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
  align-items: center;
  padding: clamp(24px, 4vw, 36px);
  margin-bottom: 18px;
}

.about-kicker {
  margin-bottom: 10px;
  color: var(--color-highlight);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.9px;
  text-transform: uppercase;
}

.about-hero h1 {
  margin-bottom: 14px;
  color: var(--color-text);
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.05;
}

.about-hero p,
.about-section p,
.about-feature-list {
  color: var(--color-text-muted);
  line-height: 1.7;
}

.about-hero p + p,
.about-section p + p,
.about-feature-list + p {
  margin-top: 12px;
}

.about-author-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px;
  border: 1px solid rgba(214, 168, 79, 0.24);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(214,168,79,0.10), rgba(255,255,255,0.03));
  text-align: center;
}

.about-author-image {
  width: min(100%, 170px);
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 12px;
  background: var(--color-surface);
  padding: 12px;
}

.about-author-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.about-author-meta strong {
  color: var(--color-text);
  font-size: 1.05rem;
}

.about-author-meta span {
  color: var(--color-text-muted);
  font-size: 0.86rem;
}

.about-section {
  margin-bottom: 16px;
  padding: clamp(20px, 3vw, 26px);
}

.about-section h2 {
  margin-bottom: 10px;
  color: var(--color-text);
  font-size: clamp(1.25rem, 3vw, 1.55rem);
}

.about-feature-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.about-feature-list li {
  position: relative;
  min-height: 44px;
  padding: 12px 12px 12px 36px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
}

.about-feature-list li::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 1.15rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-highlight);
}

.about-independent {
  border-color: rgba(214, 168, 79, 0.28);
  background: linear-gradient(160deg, var(--color-card) 0%, rgba(61,16,16,0.28) 100%);
}

.about-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.about-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.about-links a:hover {
  border-color: var(--color-highlight);
  color: var(--color-highlight);
  background: var(--color-highlight-dim);
}

.similar-players-section {
  margin-top: 22px;
}

.similar-players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.similar-player-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.similar-player-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.similar-player-photo {
  width: 48px;
  height: 52px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--color-surface);
}

.similar-player-name {
  font-weight: 800;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.similar-player-team {
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.similar-player-meta {
  display: flex;
  gap: 8px;
}

.similar-player-meta span {
  min-width: 36px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.similar-player-link {
  margin-top: auto;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--color-highlight);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.84rem;
}

.similar-players-empty {
  color: var(--color-text-muted);
}

@media (max-width: 900px) {
  body:has(#layout) .site-footer {
    margin-left: 0;
  }

  .site-footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* =====================================================
   Mobile-first responsive polish
   ===================================================== */

.mobile-sort-controls {
  display: none;
}

.download-btn,
.tutorial-watch-btn,
.hero-cta,
.advanced-filter-toggle,
.adv-filter-reset,
.page-btn,
.db-menu-card,
.db-sidebar-btn,
.similar-player-link,
.formation-tab-btn,
.profile-tab-btn,
.site-footer-links a,
.news-card-link {
  min-height: 44px;
}

.adv-filter-group select,
.adv-filter-group input[type="number"],
.adv-filter-group input[type="text"],
.filter-select,
.filter-input,
#search-input {
  min-height: 42px;
}

.skill-check {
  min-height: 44px;
}

@media (max-width: 1024px) {
  .landing-body #landing-main {
    padding: calc(var(--header-height) + 32px) clamp(14px, 4vw, 24px) 48px;
  }

  .landing-hero {
    min-height: clamp(340px, 58vh, 480px);
    padding: clamp(36px, 7vw, 60px) clamp(16px, 4vw, 28px);
  }

  .landing-hero-title {
    font-size: clamp(1.9rem, 7vw, 3rem);
    line-height: 1.1;
  }

  .page-section-title {
    font-size: clamp(1.4rem, 4vw, 1.9rem);
  }
}

@media (max-width: 900px) {
  #header {
    padding: 0 10px;
    gap: 8px;
  }

  #header .logo {
    height: 38px;
  }

  .header-nav {
    flex: 1 1 auto;
    min-width: 0;
    gap: 6px;
  }

  .header-nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 10px;
    font-size: 0.78rem;
  }

  #downloads-page,
  #tutorials-page,
  #news-page {
    padding-left: clamp(14px, 4vw, 20px);
    padding-right: clamp(14px, 4vw, 20px);
  }

  .tutorial-detail {
    grid-template-columns: 1fr;
  }

  .tutorial-detail-media .tutorial-iframe {
    width: 100%;
    height: auto;
  }
}

@media (max-width: 768px) {
  body {
    background: var(--color-primary);
  }

  #search-container {
    min-width: 0;
    max-width: 180px;
    flex: 0 1 180px;
    padding: 3px 10px;
  }

  #layout {
    display: block;
  }

  #sidebar {
    position: sticky;
    top: var(--header-height);
    z-index: 80;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
    scrollbar-width: none;
  }

  #sidebar::-webkit-scrollbar {
    display: none;
  }

  #sidebar .sidebar-nav-section {
    display: inline-flex;
    border-bottom: 0;
  }

  #sidebar {
    display: flex;
    gap: 8px;
    padding: 8px;
  }

  .sidebar-nav-header {
    border: 1px solid var(--color-border);
    border-radius: 999px;
    min-width: max-content;
    min-height: 44px;
    padding: 0 14px;
  }

  .sidebar-nav-header.active {
    border-left: 1px solid var(--color-highlight);
    border-color: rgba(214, 168, 79, 0.45);
  }

  #main,
  #player-page,
  #team-page,
  #league-page {
    width: 100%;
    max-width: 100%;
    padding: 16px;
  }

  .view-header,
  .filter-panel-head,
  .landing-section-header,
  .player-cards-header,
  .position-group-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .view-header-actions,
  .filter-panel-actions {
    width: 100%;
    margin-left: 0;
  }

  .view-header-actions .adv-filter-toggle,
  .filter-panel-actions .advanced-filter-toggle,
  .filter-panel-actions .adv-filter-reset {
    flex: 1 1 160px;
    justify-content: center;
  }

  .adv-filter-panel,
  .formation-section,
  .player-cards-section,
  .profile-tabs,
  .player-section,
  .tutorial-detail-body,
  .tutorial-detail-media {
    border-radius: 10px;
  }

  .db-home-menu,
  .db-stats-grid,
  .stats-grid,
  .download-cards-grid,
  .featured-of-grid,
  .tutorial-cards-grid,
  .news-grid,
  .faq-list,
  .similar-players-grid {
    grid-template-columns: 1fr;
  }

  .about-hero,
  .about-feature-list {
    grid-template-columns: 1fr;
  }

  .about-author-card {
    align-items: flex-start;
    flex-direction: row;
    text-align: left;
  }

  .about-author-image {
    width: 92px;
    flex: 0 0 92px;
  }

  .profile-tab-bar,
  .formation-tabs,
  .appearance-section-nav {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .profile-tab-bar::-webkit-scrollbar,
  .formation-tabs::-webkit-scrollbar,
  .appearance-section-nav::-webkit-scrollbar {
    display: none;
  }

  .profile-tab-btn,
  .formation-tab-btn,
  .appearance-section-btn {
    flex: 0 0 auto;
  }

  .profile-tab-panel {
    padding: 16px;
  }

  .stats-list,
  .stats-group,
  .face-data-grid,
  .appearance-stats,
  .formation-info-columns {
    min-width: 0;
  }

  .stat-row {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .stat-name {
    width: auto;
    min-width: 0;
    flex: 1 1 140px;
  }

  .stat-bar-container {
    flex: 1 1 100%;
  }

  .position-field {
    width: min(100%, 180px);
  }

  .positions-layout {
    grid-template-columns: 1fr;
  }

  .position-pitch {
    width: min(100%, 320px);
    max-width: 320px;
  }

  .position-list {
    max-height: 220px;
  }

  .positions-map {
    max-width: 100%;
    padding: 6px;
  }

  .positions-grid {
    grid-template-rows: repeat(7, 48px);
    gap: 3px;
  }

  .position-code {
    font-size: 0.72rem;
  }

  .position-map-header {
    align-items: stretch;
    flex-direction: column;
  }

  .position-view-switch {
    width: 100%;
  }

  .position-view-toggle {
    flex: 1;
    min-height: 34px;
  }

  .position-grade {
    font-size: 0.9rem;
  }
}

@media (max-width: 640px) {
  .breadcrumb-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  #header {
    overflow: hidden;
  }

  .header-nav {
    justify-content: flex-start;
  }

  #search-container {
    display: none;
  }

  .landing-hero {
    min-height: clamp(300px, 68vh, 420px);
    margin-bottom: 32px;
    border-radius: 14px;
  }

  .landing-hero-logo {
    width: clamp(64px, 20vw, 84px);
    height: clamp(64px, 20vw, 84px);
  }

  .landing-hero-title {
    font-size: clamp(1.75rem, 9vw, 2.45rem);
  }

  .landing-hero-desc,
  .page-section-subtitle,
  .download-description,
  .tutorial-card-desc {
    font-size: 0.92rem;
  }

  .landing-cards {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .landing-card {
    padding: 22px 16px;
  }

  .download-card-header,
  .download-card-footer {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .download-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .download-card-title,
  .tutorial-card-title,
  .news-card-title {
    font-size: clamp(1rem, 4vw, 1.15rem);
    overflow-wrap: anywhere;
  }

  .adv-filter-panel {
    padding: 14px;
  }

  .active-filters {
    flex-direction: column;
    gap: 8px;
  }

  #player-filter-body:not([hidden]) {
    max-height: min(72vh, 680px);
    overflow-y: auto;
    padding-right: 2px;
  }

  .adv-filter-grid,
  .basic-filter-grid,
  .stat-filter-grid,
  .skill-filter-grid {
    grid-template-columns: 1fr;
  }

  .adv-filter-range .range-inputs {
    gap: 8px;
  }

  .mobile-sort-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 0 0 12px;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-card);
  }

  .mobile-sort-controls label {
    color: var(--color-text-muted);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
  }

  .mobile-sort-controls select,
  .mobile-sort-controls button {
    min-height: 44px;
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text);
    padding: 0 12px;
  }

  .mobile-sort-controls button:disabled {
    opacity: 0.45;
  }

  .table-responsive {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  .players-table {
    display: block;
    background: transparent;
    border: 0;
  }

  .players-table thead {
    display: none;
  }

  .players-table tbody {
    display: grid;
    gap: 7px;
  }

  .players-table tbody tr {
    display: grid;
    grid-template-columns: 48px 30px minmax(0, 1fr) 30px auto auto;
    align-items: center;
    gap: 6px;
    min-height: 64px;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-card);
  }

  .players-table tbody tr:hover td {
    background: transparent;
  }

  .players-table td {
    display: flex;
    align-items: center;
    min-width: 0;
    border: 0;
    padding: 0;
    font-size: 0.84rem;
  }

  .players-table .desktop-stat:not(.team-crest-cell),
  .players-table .fav-col {
    display: none;
  }

  .players-table--directory .mobile-team-col {
    display: none;
  }

  .players-table .team-crest-cell {
    display: flex;
  }

  .players-table td:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
  }

  .players-table td:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
    justify-content: center;
  }

  .players-table td:nth-child(3) {
    grid-column: 3;
    grid-row: 1;
    font-size: 0.9rem;
  }

  .players-table td:nth-child(3) strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .players-table td:nth-child(4) {
    grid-column: 4;
    grid-row: 1;
    justify-content: center;
  }

  .players-table td:nth-child(5) {
    grid-column: 5;
    grid-row: 1;
    justify-content: flex-end;
  }

  .players-table td:nth-child(6) {
    display: none;
  }

  .players-table td:nth-child(7) {
    grid-column: 6;
    grid-row: 1;
    justify-content: flex-end;
  }

  .players-table td:nth-child(n+8) {
    display: none;
  }

  .player-row-photo {
    width: 44px;
    height: 48px;
    border-radius: 5px;
  }

  .player-row-team-crest {
    width: 28px;
    height: 28px;
  }

  .position-badge,
  .overall-badge,
  .quick-filter-chip {
    min-height: 28px;
    height: 28px;
    padding: 4px 7px;
    font-size: 0.76rem;
    line-height: 1;
  }

  .overall-badge {
    width: 30px;
    min-width: 30px;
    font-size: 0.8rem;
  }

  .player-flag {
    width: 26px;
    height: 18px;
    min-height: 18px;
  }

  .pagination {
    gap: 8px;
  }

  .page-numbers {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .page-btn {
    min-width: 42px;
  }

  .player-profile-header,
  .profile-stats-layout,
  .stats-compact-layout,
  .formation-layout,
  .face-data-grid,
  .appearance-stats {
    grid-template-columns: 1fr;
  }

  .formation-layout,
  .pitch-container,
  .formation-tactic-block {
    min-height: 0;
  }

  .player-info-card-name,
  .similar-player-name {
    white-space: normal;
  }

  .player-radar-card canvas {
    width: min(100%, 260px) !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
  }

  .position-field-wrap {
    overflow: hidden;
  }

  .field-pos-marker {
    min-width: 26px;
    padding: 3px 4px;
    font-size: 0.56rem;
  }

  .pitch-field {
    width: min(100%, 380px);
  }

  .pitch-player {
    width: 52px;
  }

  .pitch-player-photo-wrap,
  .pitch-player-badge {
    width: 44px;
  }

  .pitch-player-photo-wrap {
    height: 44px;
  }

  .pitch-player-name {
    max-width: 46px;
    font-size: 0.52rem;
  }

  .tactic-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .tactic-value {
    text-align: left;
  }

  .similar-players-grid {
    grid-template-columns: 1fr;
  }

  .site-footer {
    padding: 20px 16px;
  }

  .site-footer-links {
    width: 100%;
    flex-direction: column;
    gap: 4px;
  }

  .site-footer-links a {
    align-items: center;
    display: flex;
  }
}

@media (max-width: 430px) {
  #header .logo {
    height: 34px;
  }

  .header-nav-link {
    padding: 0 8px;
    font-size: 0.74rem;
  }

  #main,
  #player-page,
  #team-page,
  #league-page {
    padding: 12px;
  }

  .landing-body #landing-main {
    padding-left: 12px;
    padding-right: 12px;
  }

  .download-card-header,
  .download-card-body,
  .download-card-footer,
  .tutorial-card-body,
  .news-card,
  .player-header-card,
  .profile-tab-panel,
  .formation-section {
    padding-left: 12px;
    padding-right: 12px;
  }

  .players-table tbody tr {
    grid-template-columns: 42px 26px minmax(0, 1fr) 26px auto auto;
    min-height: 58px;
    gap: 5px;
    padding: 7px 8px;
  }

  .player-row-photo {
    width: 38px;
    height: 42px;
  }

  .player-row-team-crest {
    width: 24px;
    height: 24px;
  }

  .player-flag {
    width: 24px;
    height: 16px;
    min-height: 16px;
  }

  .position-badge,
  .overall-badge,
  .quick-filter-chip {
    min-height: 26px;
    height: 26px;
    padding: 3px 6px;
    font-size: 0.72rem;
  }

  .overall-badge {
    width: 28px;
    min-width: 28px;
  }

  .similar-player-card {
    padding: 10px;
  }
}
