/* =====================================================================
   LigaPro
   Concepto: el tablero de anotación. Superficies tranquilas, el
   marcador oscuro es lo único que levanta la voz.
   ===================================================================== */

:root {
  --board:    #1B2430;  /* tablero de anotación */
  --board-2:  #29394B;
  --stripe:   #C8102E;  /* anillo del pin, único acento */
  --lane:     #C8964B;  /* arce de la pista */
  --paper:    #F3F1EC;
  --card:     #FFFFFF;
  --ink:      #1B2430;
  --slate:    #5C6975;
  --rule:     #DCD8D0;

  --shell:    68rem;
  --radius:   3px;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Barlow', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--stripe);
  outline-offset: 2px;
}

/* ---------- Barra superior ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 0.7rem 1.25rem;
  background: var(--board);
  color: #fff;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}

/* Pin: cuerpo blanco con la franja roja */
.brand__pin {
  width: 10px;
  height: 22px;
  border-radius: 5px 5px 3px 3px;
  background:
    linear-gradient(var(--stripe) 0 0) center 6px / 100% 3px no-repeat,
    #fff;
  display: inline-block;
}

.topnav {
  display: flex;
  gap: 1.1rem;
  margin-right: auto;
  flex-wrap: wrap;
}

.topnav__link {
  color: #B9C4CF;
  text-decoration: none;
  font-weight: 500;
  padding: 0.15rem 0;
  border-bottom: 2px solid transparent;
}

.topnav__link:hover { color: #fff; }

.topnav__link.is-active {
  color: #fff;
  border-bottom-color: var(--stripe);
}

.topbar__session {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar__who {
  color: #93A2B0;
  font-size: 0.9rem;
}

.linkbtn {
  background: none;
  border: 0;
  color: #B9C4CF;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.linkbtn:hover { color: #fff; }

/* ---------- Contenedor ---------- */

.shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.pagehead { margin-bottom: 0.5rem; }

.pagehead__title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2.1rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.1;
}

.pagehead__meta {
  margin: 0.2rem 0 0;
  color: var(--slate);
}

.upnext {
  margin: 1.25rem 0 1.75rem;
  padding-left: 0.85rem;
  border-left: 3px solid var(--lane);
  color: var(--slate);
}

/* ---------- Avisos ---------- */

.notice {
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  border-left: 3px solid;
  margin: 0 0 1.25rem;
}

.notice--ok  { background: #EAF3EC; border-color: #3F7D4F; }
.notice--bad { background: #FBEAEC; border-color: var(--stripe); }

/* ---------- Tabla de posiciones ---------- */

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--rule);
}

.table__caption {
  text-align: left;
  color: var(--slate);
  font-size: 0.9rem;
  padding-bottom: 0.5rem;
}

.table th,
.table td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}

.table thead th {
  background: var(--board);
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  border-bottom: 0;
}

.table tbody tr:last-child td { border-bottom: 0; }

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rank {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  color: var(--slate);
  width: 3rem;
}

.strong {
  font-weight: 600;
  font-size: 1.05rem;
}

.muted { color: var(--slate); }

/* ---------- Estado vacío ---------- */

.empty {
  background: var(--card);
  border: 1px solid var(--rule);
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.empty__title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.6rem;
  margin: 0 0 0.4rem;
}

.empty p {
  margin: 0 0 1.25rem;
  color: var(--slate);
}

/* ---------- Formularios ---------- */

.form { display: grid; gap: 1rem; }

.field { display: grid; gap: 0.3rem; }

.field__label {
  font-size: 0.9rem;
  color: var(--slate);
  font-weight: 500;
}

.field input {
  font: inherit;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  width: 100%;
}

.field input:focus {
  border-color: var(--board);
}

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  padding: 0.65rem 1.4rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--board);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover { background: var(--board-2); }

/* ---------- Acceso ---------- */

.entry {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--paper);
}

.entry__board {
  background: var(--board);
  padding: 1.5rem 1rem;
  overflow: hidden;
}

.board__frames {
  display: flex;
  justify-content: center;
  gap: 2px;
  max-width: var(--shell);
  margin: 0 auto;
}

.board__frame {
  flex: 1 1 0;
  min-width: 0;
  max-width: 4.5rem;
  border: 1px solid #3A4B5E;
  display: grid;
  font-family: 'Barlow Condensed', sans-serif;
  color: #8FA0B1;
}

.board__frame b {
  font-size: 1.1rem;
  text-align: right;
  padding: 0.1rem 0.3rem;
  border-bottom: 1px solid #3A4B5E;
  color: #fff;
  font-weight: 600;
}

.board__frame i {
  font-style: normal;
  font-size: 1rem;
  text-align: center;
  padding: 0.15rem;
}

.entry__panel {
  width: 100%;
  max-width: 22rem;
  margin: 0 auto;
  padding: 3rem 1.25rem;
  align-self: start;
}

.entry__title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2.6rem;
  font-weight: 700;
  margin: 0;
  line-height: 1;
}

.entry__sub {
  margin: 0.15rem 0 2rem;
  color: var(--slate);
}

.entry .btn { width: 100%; }

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .topbar { gap: 0.75rem; }
  .topnav { order: 3; width: 100%; gap: 0.9rem; }
  .topbar__session { margin-left: auto; }
  .pagehead__title { font-size: 1.75rem; }
  .table th, .table td { padding: 0.55rem 0.6rem; }
  .board__frame:nth-child(n+7) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* =====================================================================
   Administración
   ===================================================================== */

.pagehead--split {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ---------- Formularios en línea ---------- */

.inlineform {
  display: flex;
  align-items: flex-end;
  gap: 0.9rem;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--rule);
  padding: 1rem;
  margin: 1.5rem 0;
}

.inlineform--quiet {
  background: transparent;
  border: 0;
  padding: 0;
  margin-bottom: 0.5rem;
}

.field--grow { flex: 1 1 14rem; }

.rowform {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.rowform input[type="text"] {
  font: inherit;
  padding: 0.35rem 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  width: 100%;
  max-width: 20rem;
}

.rowform input[type="text"]:hover,
.rowform input[type="text"]:focus {
  border-color: var(--rule);
  background: #fff;
}

.linkbtn--dark {
  color: var(--slate);
  text-decoration: underline;
}

.linkbtn--dark:hover { color: var(--ink); }

/* ---------- Formulario largo ---------- */

.form--wide { max-width: 52rem; }

.group {
  border: 1px solid var(--rule);
  background: var(--card);
  padding: 1.25rem;
  margin: 0 0 1.25rem;
}

.group__title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  padding: 0 0.4rem;
}

/* La regla traducida a palabras, sobre fondo de pista */
.group__preview {
  margin: 0 0 1.25rem;
  padding: 0.7rem 0.85rem;
  background: #FBF6EC;
  border-left: 3px solid var(--lane);
  color: #5A4A31;
}

.grid { display: grid; gap: 1rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }

.field--wide { grid-column: 1 / -1; }

.field select {
  font: inherit;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  width: 100%;
}

.field__hint {
  font-size: 0.85rem;
  color: var(--slate);
  line-height: 1.35;
}

.field__error {
  font-size: 0.85rem;
  color: var(--stripe);
  font-weight: 500;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.check--inline { margin-top: 0; }

.check input { width: 1.05rem; height: 1.05rem; }

.formactions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* ---------- Etiquetas de estado ---------- */

.pill {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid;
}

.pill--activa   { color: #2F6B41; border-color: #9CC5A9; background: #EAF3EC; }
.pill--borrador { color: var(--slate); border-color: var(--rule); background: var(--paper); }
.pill--cerrada  { color: #6B5330; border-color: #D8C4A0; background: #FBF6EC; }
.pill--repo     { color: #7A2230; border-color: #E0AEB6; background: #FBEAEC; }

.hintbox {
  border-left: 3px solid var(--lane);
  padding: 0.7rem 0.85rem;
  background: #FBF6EC;
  color: #5A4A31;
  margin: 0 0 1.5rem;
}

.notice--warn { background: #FBF6EC; border-color: var(--lane); }

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

@media (max-width: 640px) {
  .inlineform { flex-direction: column; align-items: stretch; }
  .inlineform .btn { width: 100%; }
  .formactions { flex-direction: column-reverse; align-items: stretch; gap: 0.75rem; }
  .formactions .btn { width: 100%; }
  .rowform input[type="text"] { max-width: none; }
}

/* ---------- Selector de temporada ---------- */

.seasonpick select {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid #3A4B5E;
  border-radius: var(--radius);
  background: var(--board-2);
  color: #fff;
  max-width: 15rem;
}

.seasontag {
  font-size: 0.9rem;
  color: #93A2B0;
  border-left: 1px solid #3A4B5E;
  padding-left: 1rem;
}

/* ---------- Edición en línea de equipos ---------- */

.teamrow__name { font-weight: 500; }

.teamrow__input {
  font: inherit;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: #fff;
  width: 100%;
  max-width: 20rem;
}

.rowactions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.iconbtn {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--slate);
  padding: 0.25rem;
  cursor: pointer;
  line-height: 0;
}

.iconbtn:hover {
  color: var(--ink);
  border-color: var(--rule);
  background: #fff;
}

@media (max-width: 640px) {
  .seasonpick { order: 4; width: 100%; }
  .seasonpick select { max-width: none; width: 100%; }
  .seasontag { border-left: 0; padding-left: 0; }
  .teamrow__input { max-width: none; }
}

/* ---------- Lista de secciones del panel ---------- */

.sections {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  border: 1px solid var(--rule);
  background: var(--card);
}

.section {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  border-bottom: 1px solid var(--rule);
}

.section:last-child { border-bottom: 0; }

.section__link {
  flex: 1;
  display: grid;
  gap: 0.1rem;
  padding: 1rem 1.2rem;
  text-decoration: none;
  color: inherit;
  border-left: 3px solid transparent;
}

a.section__link:hover {
  background: #FBF6EC;
  border-left-color: var(--lane);
}

.section__name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.15;
}

.section__desc {
  color: var(--slate);
  font-size: 0.95rem;
}

.section__count {
  font-variant-numeric: tabular-nums;
  color: var(--slate);
  padding-right: 1.2rem;
}

.section--soon .section__name,
.section--soon .section__desc { color: #94A0AB; }
