/* === Kotei TCG · styles === */
:root {
  --bg: #0b0b0d;
  --bg-2: #14141a;
  --bg-3: #1c1c25;
  --border: #26262f;
  --text: #f5f5f7;
  --muted: #9a9aa6;
  --accent: #ffb800;
  --accent-2: #ffd95c;
  --primary: #6c5cff;
  --primary-2: #8e7fff;
  --danger: #ff4d6d;
  --ok: #2ecc71;
  --warn: #ffb800;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 6px 24px rgba(0,0,0,.35);
  --max: 1200px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
body { min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); font-weight: 800; }
h2 { font-size: 1.4rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 700; }
p  { line-height: 1.6; color: var(--text); }
.muted { color: var(--muted); }
.mt { margin-top: 2rem; }
.center { text-align: center; }
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }

/* === topbar === */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(11,11,13,.85); backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--border); }
.topbar__row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1.25rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--text); font-weight: 800; }
.brand img { display: block; }
.topnav { display: flex; gap: 1rem; }
.topnav a { color: var(--text); font-weight: 500; padding: .35rem .6rem; border-radius: 8px; }
.topnav a:hover { background: var(--bg-2); color: var(--text); }
.topbar__right { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.user-chip { font-size: .85rem; color: var(--muted); padding: .25rem .6rem; border: 1px solid var(--border); border-radius: 999px; }
.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 2px; background: var(--bg-2); }
.lang-pill { font-size: .72rem; font-weight: 700; padding: .25rem .55rem; border-radius: 999px; color: var(--muted); }
.lang-pill.is-active { background: var(--primary); color: white; }
.lang-pill:hover { color: var(--text); }
.lang-pill.is-active:hover { color: white; }

/* === buttons === */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .55rem 1rem; border-radius: 10px; font-weight: 600; font-size: .92rem; border: 1px solid transparent; cursor: pointer; transition: .15s ease; text-decoration: none; }
.btn--primary { background: var(--primary); color: white; }
.btn--primary:hover { background: var(--primary-2); color: white; }
.btn--ghost   { background: var(--bg-2); color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--bg-3); color: var(--text); }
.btn--danger  { background: transparent; color: var(--danger); border-color: rgba(255,77,109,.4); }
.btn--danger:hover { background: rgba(255,77,109,.1); }
.btn--block   { width: 100%; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; margin-right: .5rem; }
.link:hover { color: var(--accent-2); }
.link-danger { background: none; border: 0; color: var(--danger); cursor: pointer; padding: 0; font: inherit; }
.link-danger:hover { text-decoration: underline; }

/* === hero === */
.hero { padding: 3rem 0 1.5rem; text-align: center; }
.hero__eyebrow { color: var(--accent); font-weight: 700; font-size: .85rem; letter-spacing: .15em; text-transform: uppercase; margin-bottom: 1rem; }
.hero__title { font-size: clamp(2.2rem, 5.5vw, 4rem); margin-bottom: 1rem; }
.hero__title .accent { background: linear-gradient(120deg, var(--accent) 0%, var(--primary-2) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero__sub { color: var(--muted); max-width: 720px; margin: 0 auto 1.5rem; font-size: 1.05rem; }
.hero__cta { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1.5rem; }
.hero__chips { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.chip { padding: .4rem .85rem; background: var(--bg-2); color: var(--text); border: 1px solid var(--border); border-radius: 999px; font-size: .82rem; font-weight: 500; }
.chip:hover { background: var(--bg-3); color: var(--text); }
.chip.is-active { background: var(--primary); border-color: var(--primary); color: white; }
.chip--clear { background: transparent; color: var(--muted); }

/* === stats === */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 2rem 0; }
.stat { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; text-align: center; }
.stat__num { font-size: 2rem; font-weight: 800; color: var(--accent); }
.stat__lbl { color: var(--muted); font-size: .85rem; }

/* === features === */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: 2rem 0; }
.feature { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.feature__icon { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-bottom: .75rem; }
.feature p { color: var(--muted); font-size: .95rem; }

/* === how === */
.how { margin: 3rem 0; }
.how__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-top: 1rem; }
.how__step { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.how__step h3 { color: var(--accent); margin-bottom: .35rem; }
.how__step p { color: var(--muted); margin: 0; font-size: .95rem; }

/* === leaderboard === */
.leaderboard { margin: 2rem 0 4rem; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: .8rem 1rem; text-align: left; font-size: .92rem; }
.table th { background: var(--bg-3); color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: .72rem; letter-spacing: .08em; }
.table tbody tr { border-top: 1px solid var(--border); }
.table tbody tr:hover { background: var(--bg-3); }
.th-num { text-align: right; }
.th-rank { width: 60px; color: var(--muted); }
.pos { color: var(--ok); }
.neg { color: var(--danger); }

/* === pills / status === */
.pill { display: inline-block; padding: .2rem .55rem; border-radius: 999px; background: var(--bg-3); color: var(--muted); font-size: .78rem; font-weight: 600; }
.pill--ok  { background: rgba(46,204,113,.15); color: var(--ok); }
.pill--bad { background: rgba(255,77,109,.15); color: var(--danger); }
.status { display: inline-block; padding: .2rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.status--created  { background: var(--bg-3); color: var(--muted); }
.status--active   { background: rgba(108,92,255,.15); color: var(--primary-2); }
.status--finished { background: rgba(46,204,113,.15); color: var(--ok); }
.status--canceled { background: rgba(255,77,109,.12); color: var(--danger); }

/* === page head === */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 2rem 0 1rem; flex-wrap: wrap; }
.page-head__meta { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .5rem; }
.back { display: inline-block; color: var(--muted); font-size: .9rem; margin-bottom: .5rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* === tabs === */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab { padding: .6rem 1rem; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

/* === cards (tournaments) === */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.card { display: block; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; color: var(--text); transition: .15s; }
.card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.card__head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.card__title { margin: 0 0 .75rem; font-size: 1.1rem; }
.card__meta { display: flex; gap: 1rem; color: var(--muted); font-size: .85rem; margin-bottom: .75rem; }
.card__foot { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--border); padding-top: .75rem; }

/* === forms === */
.form { display: flex; flex-direction: column; gap: 1rem; }
.form--card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.form--inline { flex-direction: row; align-items: center; gap: .5rem; flex-wrap: wrap; }
.form__actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .5rem; }
.form label { display: flex; flex-direction: column; gap: .35rem; }
.form label > span { color: var(--muted); font-size: .85rem; font-weight: 600; }
.form input, .form select, .form textarea {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: .65rem .85rem; font: inherit; font-size: .95rem;
  width: 100%;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,92,255,.15);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* === auth === */
.auth-card { max-width: 440px; margin: 3rem auto; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; }
.auth-card h1 { margin-bottom: .5rem; }
.auth-card form { margin-top: 1rem; }

/* === flash === */
.flash { padding: .75rem 1rem; border-radius: 10px; margin: 1rem 0; font-weight: 500; border: 1px solid var(--border); }
.flash--ok { background: rgba(46,204,113,.12); color: var(--ok); border-color: rgba(46,204,113,.3); }
.flash--error { background: rgba(255,77,109,.12); color: var(--danger); border-color: rgba(255,77,109,.3); }
.flash--warn { background: rgba(255,184,0,.12); color: var(--warn); border-color: rgba(255,184,0,.3); }

/* === two cols on tournament page === */
.cols { display: grid; grid-template-columns: 1fr 1.4fr; gap: 1.5rem; margin-top: 1.5rem; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }
.player-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.player-list li { display: flex; align-items: center; gap: .75rem; padding: .55rem .75rem; border-bottom: 1px solid var(--border); }
.player-list li:last-child { border-bottom: 0; }
.player-list li .muted { margin-left: auto; }

/* === stat row === */
.stat-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: .75rem; margin: 1rem 0 2rem; }
@media (max-width: 700px) { .stat-row { grid-template-columns: repeat(3, 1fr); } }

/* === empty === */
.empty { padding: 2rem; text-align: center; color: var(--muted); background: var(--bg-2); border: 1px dashed var(--border); border-radius: var(--radius); }

/* === footer === */
.footer { margin-top: auto; padding: 2rem 0 1rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; }
.footer__row { display: flex; justify-content: space-between; align-items: center; }
.footer__legal { text-align: center; margin-top: .5rem; opacity: .7; }

/* === responsive === */
@media (max-width: 720px) {
  .topnav { display: none; }
  .stats, .features, .how__grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}


/* ============================================================
   TOURNAMENT HEADER (estilo nexus)
   ============================================================ */
.tournament-head {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}
.tournament-head__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .5rem;
}
.tournament-head__actions { display: flex; gap: .5rem; align-items: center; }
.tournament-head__title {
  font-size: 1.75rem;
  font-weight: 800;
  margin: 0 0 .5rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.tournament-head__caret { color: var(--muted); font-weight: 400; }
.pill--tcg {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .85rem;
  font-weight: 600;
  padding: 4px 10px;
  background: rgba(255, 230, 109, .12);
  color: #ffe66d;
  border: 1px solid rgba(255, 230, 109, .25);
  border-radius: 999px;
}
.pill--tcg::before { content: "🎮"; font-size: .9em; }

.tournament-stats {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding: 0;
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
}
.tournament-stats li { display: inline-flex; align-items: center; gap: .35rem; }
.tournament-stats strong { color: #f5f5f7; font-weight: 700; }
.tournament-stats__icon { font-size: 1.05em; }
.dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; margin-right: .15rem; }
.dot--ok   { background: #5ad17a; box-shadow: 0 0 6px #5ad17a; }
.dot--warn { background: #ffe66d; box-shadow: 0 0 6px #ffe66d; }

/* ============================================================
   BRACKET (linear left-to-right: R1 | R2 | ... | Final)
   ============================================================ */
.bracket-wrapper {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 0;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}
.bracket {
  display: flex;
  gap: 1.5rem;
  padding: 0 1.5rem;
  min-width: max-content;
  align-items: stretch;
}
.bracket-round {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 240px;
  flex: 1;
}
.bracket-round__label {
  text-align: center;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: .25rem;
}

/* Match card */
.bm {
  background: #0f0f12;
  border: 1.5px solid #ffe66d;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.bm:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255, 230, 109, .15);
}
.bm--done { border-color: #5ad17a; }
.bm--done:hover { box-shadow: 0 4px 14px rgba(90, 209, 122, .15); }
.bm--final { border-width: 2px; box-shadow: 0 0 0 4px rgba(255, 230, 109, .08); }

.bm__header {
  background: #1a1a1f;
  padding: 6px 12px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-align: center;
  color: #ffe66d;
  border-bottom: 1px solid rgba(255, 230, 109, .25);
}
.bm--done .bm__header {
  color: #5ad17a;
  background: rgba(90, 209, 122, .08);
  border-bottom-color: rgba(90, 209, 122, .25);
}

.bm__row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: .5rem;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  font-size: .9rem;
}
.bm__row:last-of-type { border-bottom: none; }
.bm__row .bm__name { color: #d6d6dc; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: .35rem; }
.bm__row .bm__elo  { color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
.bm__row .bm__score{ color: #f5f5f7; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 1.5em; text-align: right; }

.bm__row.is-winner { background: rgba(255, 230, 109, .08); }
.bm__row.is-winner .bm__name  { color: #ffe66d; font-weight: 700; }
.bm__row.is-winner .bm__score { color: #ffe66d; }
.bm__row.is-loser  .bm__name  { color: #6b6b75; }
.bm__row.is-loser  .bm__score { color: #6b6b75; }
.bm__row.is-loser  .bm__elo   { color: #555560; }

.bm__crown { font-size: .9em; }

.bm__champion {
  background: rgba(255, 230, 109, .06);
  color: #ffe66d;
  text-align: center;
  font-size: .82rem;
  padding: 8px 12px;
  border-top: 1px solid rgba(255, 230, 109, .2);
  font-weight: 600;
}

/* ============================================================
   MODAL para registrar game
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal[hidden] { display: none; }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(2px);
}
.modal__card {
  position: relative;
  background: #16161a;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  min-width: 360px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.modal__close {
  position: absolute;
  top: .75rem;
  right: .75rem;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.modal__close:hover { background: var(--bg-2); color: #f5f5f7; }
.modal__title { margin: 0 0 .25rem; font-size: 1.1rem; }
.modal__subtitle { margin: 0 0 1rem; color: var(--muted); font-size: .9rem; }

.modal__series { margin-bottom: 1.25rem; }
.series-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: .5rem;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.series-name { color: #d6d6dc; }
.series-elo  { color: var(--muted); font-size: .8rem; }
.series-score{ color: #f5f5f7; font-weight: 700; }
.series-games { margin-top: .75rem; display: flex; flex-direction: column; gap: 4px; }
.series-game {
  font-size: .78rem;
  padding: 4px 8px;
  background: rgba(90, 209, 122, .08);
  border-left: 2px solid #5ad17a;
  color: #c4e8d0;
  border-radius: 3px;
}
.series-game--pending {
  background: var(--bg-2);
  border-left-color: var(--border);
  color: var(--muted);
}
.series-game__crown { color: #ffe66d; }

.modal__form { margin: 0; }
.modal__buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}
.modal__btn {
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  color: #f5f5f7;
  padding: 12px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  transition: all .15s ease;
}
.modal__btn:hover { border-color: #ffe66d; background: rgba(255, 230, 109, .05); }
.modal__btn--p1:hover { box-shadow: 0 0 0 2px rgba(255, 230, 109, .15); }
.modal__btn--p2:hover { box-shadow: 0 0 0 2px rgba(90, 209, 122, .15); }
.modal__btn-name { font-weight: 700; font-size: .95rem; }
.modal__btn-elo  { color: var(--muted); font-size: .75rem; }
.modal__readonly {
  text-align: center;
  padding: 1rem;
  color: var(--muted);
  font-size: .9rem;
}
.modal__undo {
  margin-top: 1rem;
  text-align: center;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 700px) {
  .tournament-head__title { font-size: 1.35rem; }
  .tournament-stats { gap: .75rem; font-size: .8rem; }
  .bracket-round { min-width: 200px; }
  .bm__row { padding: 6px 8px; font-size: .82rem; }
}

/* Responsive: en mobile, scroll horizontal */
@media (max-width: 900px) {
  .bracket-side--left  .bracket-round + .bracket-round,
  .bracket-side--right .bracket-round + .bracket-round { margin-left: 36px; }
  .bracket-side--left  .bracket-round:not(:last-child) .bracket-match::after { right: -18px; width: 18px; }
  .bracket-side--left  .bracket-round:not(:last-child)::before { right: -18px; }
  .bracket-side--right .bracket-round:not(:last-child) .bracket-match::before { left: -18px; width: 18px; }
  .bracket-side--right .bracket-round:not(:last-child)::after { left: -18px; }
  .bracket-round { min-width: 170px; }
  .bracket-match { min-width: 170px; }
}

/* ============================================================
   TCG SELECTOR (leaderboard)
   ============================================================ */
.leaderboard__head { margin-bottom: 1rem; }
.leaderboard__title { margin: 0 0 .25rem; font-size: 1.5rem; }

.tcg-selector {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 0 0 1.25rem;
  padding: .75rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.tcg-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all .15s ease;
  cursor: pointer;
}
.tcg-pill:hover {
  border-color: var(--accent);
  color: #f5f5f7;
}
.tcg-pill.is-active {
  background: rgba(255, 184, 0, .12);
  border-color: var(--accent);
  color: #ffe66d;
  font-weight: 700;
}
.tcg-pill__icon { font-size: .9em; }

/* ============================================================
   TOURNAMENT PICKER (players.php)
   ============================================================ */
.players-section-title {
  margin: 1.5rem 0 .75rem;
  font-size: 1.1rem;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: .02em;
}
.tournament-picker {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: .75rem;
}
.tournament-picker__item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: all .15s ease;
}
.tournament-picker__item:hover {
  border-color: var(--accent);
  background: var(--bg-3);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255, 184, 0, .08);
}
.tournament-picker__main { flex: 1; min-width: 0; }
.tournament-picker__name { font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.tournament-picker__meta { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.tournament-picker__arrow { color: var(--muted); font-size: 1.4rem; transition: transform .15s ease; }
.tournament-picker__item:hover .tournament-picker__arrow {
  color: var(--accent);
  transform: translateX(3px);
}

/* Tournament context header (when a tournament is selected in players.php) */
.tournament-context {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}
.tournament-context .back { font-size: .85rem; }
.tournament-context__name {
  margin: .5rem 0 .25rem;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

/* ============================================================
   HERO SLIDER (logo + 3 slides)
   ============================================================ */
.hero {
  text-align: center;
}
.hero__cta { margin-top: 1.5rem; display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

.hero-slider {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto 1rem;
  padding: 1rem;
}
.hero-slider__track {
  position: relative;
  width: 100%;
  aspect-ratio: 876 / 618;  /* Mantiene proporción del logo KoteiTCG (cropped) */
  max-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-slider__slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  opacity: 0;
  transform: translateX(40px) scale(.96);
  transition: opacity .7s ease, transform .7s ease;
  pointer-events: none;
}
.hero-slider__slide.is-active {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}
.hero-slider__slide:not(.is-active) {
  transform: translateX(-40px) scale(.96);
}

.hero-slider__logo {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 32px rgba(255, 184, 0, .35))
          drop-shadow(0 0 60px rgba(255, 184, 0, .15));
  animation: heroFloat 4s ease-in-out infinite;
}
@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

.hero-slider__card {
  max-width: 600px;
  text-align: center;
  padding: 1rem 1.5rem;
}
.hero-slider__icon {
  font-size: 4rem;
  margin-bottom: .5rem;
  filter: drop-shadow(0 0 20px rgba(255, 184, 0, .3));
  animation: heroFloat 3s ease-in-out infinite;
}
.hero-slider__title {
  font-size: 2rem;
  font-weight: 800;
  margin: 0 0 .5rem;
  background: linear-gradient(135deg, #fff 0%, #ffe66d 50%, #fff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -.02em;
  line-height: 1.15;
}
.hero-slider__sub {
  font-size: 1rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.hero-slider__dots {
  display: flex;
  justify-content: center;
  gap: .5rem;
  margin-top: .75rem;
}
.hero-slider__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: all .25s ease;
}
.hero-slider__dot:hover { background: var(--muted); transform: scale(1.2); }
.hero-slider__dot.is-active {
  background: var(--accent);
  width: 28px;
  border-radius: 4px;
  box-shadow: 0 0 12px rgba(255, 184, 0, .5);
}

/* ============================================================
   MOBILE-FRIENDLY OVERHAUL
   ============================================================ */

/* === Hamburger button (hidden on desktop) === */
.hamburger {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  margin-left: auto;
}
.hamburger span {
  display: block;
  height: 2px;
  background: #f5f5f7;
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
  transform-origin: center;
}
.hamburger.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger.is-open span:nth-child(2) { opacity: 0; }
.hamburger.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Extras (solo visibles en mobile menu) */
.topnav__mobile-extras { display: none; }

/* ============================================================
   MOBILE (max-width: 720px)
   ============================================================ */
@media (max-width: 720px) {
  :root { --max: 100%; }

  .container { padding: 0 .75rem; }

  /* Topbar: hamburguesa visible, nav como drawer */
  .topbar__row { padding: .6rem .75rem; gap: .5rem; flex-wrap: wrap; }
  .hamburger { display: flex; }
  .topbar__right { display: none; }

  .topnav {
    position: fixed;
    top: 0; right: 0;
    height: 100dvh;
    width: 78vw;
    max-width: 320px;
    background: #0f0f12;
    border-left: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 4.5rem 1rem 1.5rem;
    gap: .25rem;
    transform: translateX(100%);
    transition: transform .25s ease;
    z-index: 40;
    box-shadow: -8px 0 24px rgba(0,0,0,.4);
    overflow-y: auto;
  }
  .topnav.is-open { transform: translateX(0); }
  .topnav a {
    padding: .85rem .75rem;
    border-radius: 8px;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
  }
  .topnav a:hover { background: var(--bg-2); }
  .topnav__mobile-extras {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
  }
  .topnav__mobile-extras .lang-switch { justify-content: flex-start; }
  .topnav__mobile-extras .btn { width: 100%; text-align: center; }

  /* Backdrop cuando el menú está abierto */
  body.nav-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 35;
  }

  /* Tipografía más cómoda */
  .hero__title { font-size: 1.8rem !important; line-height: 1.1; }
  .hero__sub { font-size: .95rem; }
  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.15rem; }

  /* Stats compactos */
  .stats { grid-template-columns: 1fr !important; gap: .5rem; }
  .stat { padding: .9rem; }
  .stat__num { font-size: 1.6rem; }
  .stat-row { grid-template-columns: repeat(2, 1fr) !important; }

  /* Features y how */
  .features, .how__grid { grid-template-columns: 1fr !important; }
  .feature { padding: 1.25rem; }

  /* TCG selector pills — scrollable horizontal */
  .tcg-selector { flex-wrap: nowrap; overflow-x: auto; padding: .5rem; scrollbar-width: none; }
  .tcg-selector::-webkit-scrollbar { display: none; }
  .tcg-pill { flex-shrink: 0; }

  /* Tables: scroll horizontal con shadow */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
  }
  .table { min-width: 480px; }

  /* Tournament head: stats apilados */
  .tournament-head { padding: 1rem; }
  .tournament-head__title { font-size: 1.2rem !important; gap: .5rem; }
  .tournament-stats {
    flex-direction: row;
    flex-wrap: wrap;
    gap: .5rem .75rem;
    font-size: .8rem;
  }
  .tournament-stats li { white-space: nowrap; }

  /* Bracket: scroll horizontal, sin tocar widths */
  .bracket-wrapper {
    margin: 0 -.75rem;
    padding: 1rem 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .bracket {
    padding: 0 1rem;
    gap: 1rem;
  }
  .bracket-round { min-width: 200px; gap: .5rem; }
  .bm { font-size: .85rem; }
  .bm__row { padding: 6px 8px; }
  .bm__name, .bm__elo, .bm__score { font-size: .82rem; }
  .bm__header { font-size: .62rem; padding: 4px 8px; }

  /* Players picker */
  .tournament-picker { grid-template-columns: 1fr; }
  .tournament-picker__item { padding: .85rem 1rem; }

  /* Formularios: inputs más grandes para touch */
  input[type="text"], input[type="email"], input[type="password"], input[type="number"],
  select, textarea {
    font-size: 16px !important; /* evita zoom en iOS */
    min-height: 44px;
  }
  .form--inline { flex-direction: column; align-items: stretch; }
  .form--inline input { width: 100%; }
  .btn { min-height: 44px; padding: .65rem 1.1rem; }
  .btn--block { width: 100%; }

  /* Hero slider más compacto, mantiene aspect-ratio */
  .hero-slider { padding: .5rem; margin-bottom: .5rem; }
  .hero-slider__track {
    aspect-ratio: 876 / 618;
    max-height: 200px;
  }
  .hero-slider__card { padding: .5rem; }
  .hero-slider__title { font-size: 1.25rem; }
  .hero-slider__sub { font-size: .85rem; line-height: 1.35; }
  .hero-slider__icon { font-size: 2.25rem; margin-bottom: .25rem; }
  .hero__cta { flex-direction: column; align-items: stretch; }

  /* Modal full-screen en mobile */
  .modal { padding: 0; align-items: stretch; }
  .modal__card {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    border: none;
    overflow-y: auto;
    padding: 1.5rem 1rem;
  }
  .modal__buttons { grid-template-columns: 1fr; gap: .75rem; }
  .modal__btn { padding: 16px 12px; min-height: 60px; }

  /* Auth card */
  .auth-card { padding: 1.5rem 1rem; }
  .auth-card h1 { font-size: 1.5rem; }

  /* Columns: single col en mobile */
  .cols { grid-template-columns: 1fr !important; gap: 1.5rem; }

  /* Hide arrows en inputs number */
  input[type=number]::-webkit-outer-spin-button,
  input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
  input[type=number] { -moz-appearance: textfield; }

  /* Picker list spacing */
  .players-section-title { font-size: 1rem; }
  .tournament-context { padding: 1rem; }
  .tournament-context__name { font-size: 1.1rem; }
}

/* ============================================================
   TABLET (721px a 1024px) — ajustes intermedios
   ============================================================ */
@media (min-width: 721px) and (max-width: 1024px) {
  .topnav { gap: .5rem; }
  .topnav a { padding: .35rem .5rem; font-size: .9rem; }
  .topbar__right { font-size: .85rem; }
  .topbar__right .btn { padding: .5rem .75rem; font-size: .85rem; }
  .lang-pill { padding: 4px 8px; font-size: .75rem; }
  .tournament-head__title { font-size: 1.4rem !important; }
  .stats { grid-template-columns: repeat(3, 1fr) !important; }
}

/* ============================================================
   Scroll suave (iOS)
   ============================================================ */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: rgba(255, 184, 0, .15); }

/* Safe area iOS */
@supports (padding: env(safe-area-inset-top)) {
  .topbar { padding-top: env(safe-area-inset-top); }
  .container { padding-left: max(.75rem, env(safe-area-inset-left)); padding-right: max(.75rem, env(safe-area-inset-right)); }
}

/* ============================================================
   Tablas con sticky header y sombra para indicar scroll
   ============================================================ */
.table-wrap {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-wrap::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 30px;
  background: linear-gradient(to right, transparent, rgba(11,11,13,.6));
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease;
}
.table-wrap.has-scroll::after { opacity: 1; }

.table {
  width: 100%;
  border-collapse: collapse;
}
.table thead { background: var(--bg-3); }
.table th, .table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.table th {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
.table tbody tr:hover { background: var(--bg-3); }
.table .th-num { text-align: right; }
.table .th-rank { width: 60px; color: var(--muted); font-weight: 700; }
.table tbody tr:last-child td { border-bottom: none; }
.table .pos { color: #5ad17a; }
.table .neg { color: #ff6b81; }
.table .pill { font-size: .72rem; padding: 2px 8px; }

@media (max-width: 720px) {
  .table th, .table td { padding: 10px 8px; font-size: .82rem; }
  .table .th-rank { width: 44px; }
  .table-wrap { font-size: .82rem; }
  .table { min-width: 520px; }
}

/* ============================================================
   Bracket: hint visual de scroll horizontal en mobile
   ============================================================ */
@media (max-width: 720px) {
  .bracket-wrapper { position: relative; }
  .bracket-wrapper::after {
    content: '→ swipe';
    position: absolute;
    right: 12px;
    top: 12px;
    background: rgba(255, 184, 0, .15);
    color: #ffe66d;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .05em;
    pointer-events: none;
    border: 1px solid rgba(255, 184, 0, .3);
    animation: pulseHint 2s ease-in-out infinite;
  }
  .bracket-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(11,11,13,0) 70%, rgba(11,11,13,.4));
    pointer-events: none;
    z-index: 1;
  }
  @keyframes pulseHint {
    0%, 100% { opacity: .6; }
    50%      { opacity: 1; }
  }
}

/* ============================================================
   Tournament picker card (mobile)
   ============================================================ */
@media (max-width: 720px) {
  .tournament-picker__item { font-size: .9rem; }
  .tournament-picker__name { font-size: .95rem; }
  .tournament-picker__meta { font-size: .75rem; }
}
