/* ============================================================
   La Liga de Catán — hoja de estilos v3 "isla de noche"
   Mar azul profundo, luces doradas, tipografía de juego.
   Mobile-first: base = móvil, media queries = pantallas grandes.
   ============================================================ */

@font-face {
  font-family: "Lilita One";
  src: url("/fonts/lilita-one.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  /* mar y superficies */
  --bg: #0a1017;
  --bg-2: #0e1621;
  --card: #131e2b;
  --card-2: #1a2939;
  --line: rgba(185, 210, 240, 0.09);
  --line-strong: rgba(185, 210, 240, 0.17);
  /* tinta */
  --ink: #eef3f8;
  --ink-2: #c2cfdc;
  --muted: #8494a6;
  /* oro de la isla */
  --gold: #f2b94f;
  --gold-2: #d9962e;
  --gold-grad: linear-gradient(180deg, #f7ca6b 0%, #e09a30 100%);
  --good: #2fbf5f;
  --danger: #e05252;
  --live: #ff6b5e;
  /* colores de jugador (fichas, validados sobre superficie oscura) */
  --c-rojo: #e66767;
  --c-azul: #3987e5;
  --c-naranja: #d95926;
  --c-blanco: #f2ede1;
  --c-verde: #199e70;
  --c-amarillo: #c98500;
  --c-violeta: #9085e9;
  --c-marron: #ab8262;
  /* métricas */
  --r: 20px;
  --r-sm: 14px;
  --nav-h: 68px;
  --shadow: 0 14px 40px rgba(2, 8, 18, 0.55);
  --shadow-sm: 0 6px 18px rgba(2, 8, 18, 0.45);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --display: "Lilita One", "Segoe UI Black", system-ui, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; }

body {
  font-family: var(--font);
  background:
    radial-gradient(900px 420px at 85% -160px, rgba(242, 185, 79, 0.13), transparent 65%),
    radial-gradient(700px 500px at -10% 8%, rgba(35, 130, 160, 0.14), transparent 60%),
    radial-gradient(900px 700px at 50% 115%, rgba(20, 90, 130, 0.12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.45;
}

/* trama de hexágonos: la isla bajo el agua */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cg fill='none' stroke='%23f2b94f' stroke-opacity='0.045' stroke-width='1.5'%3E%3Cpath d='M28 1 55 17v32L28 65 1 49V17z'/%3E%3Cpath d='M28 65 55 81v32L28 129 1 113V81z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 56px 97px;
  z-index: 0;
}

#app { position: relative; z-index: 1; }

button { font-family: inherit; color: inherit; }
img { max-width: 100%; display: block; }

::selection { background: rgba(242, 185, 79, 0.35); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

h1, .display { font-family: var(--display); font-weight: 400; letter-spacing: 0.3px; }

/* ------------------------------------------------------------ layout */

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

main.wrap { padding-bottom: calc(var(--nav-h) + 52px); }

@media (min-width: 860px) {
  main.wrap { padding-bottom: 70px; }
}

/* cambio de vista: fundido sutil en lugar de parpadeo de recarga */
.view-in { animation: viewIn 0.16s ease both; }
@keyframes viewIn { from { opacity: 0.35; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* entrada escalonada de tarjetas */
.stagger > * { animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.07s; }
.stagger > *:nth-child(3) { animation-delay: 0.12s; }
.stagger > *:nth-child(4) { animation-delay: 0.17s; }
.stagger > *:nth-child(5) { animation-delay: 0.22s; }
.stagger > *:nth-child(6) { animation-delay: 0.27s; }
.stagger > *:nth-child(7) { animation-delay: 0.32s; }

@keyframes rise {
  from { transform: translateY(14px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ------------------------------------------------------------ header */

header.top {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(9, 15, 23, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.top-in {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  max-width: 1080px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  cursor: pointer;
  background: none;
  border: 0;
  min-width: 0;
}

.logo-hex {
  width: 36px;
  height: 40px;
  flex: 0 0 auto;
  filter: drop-shadow(0 3px 10px rgba(242, 185, 79, 0.4));
  animation: floaty 5s ease-in-out infinite;
}

.logo-name {
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 0.6px;
  background: linear-gradient(180deg, #f9d98a, #e2a338);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.15;
}

.logo-sub {
  display: block;
  font-family: var(--font);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 2.4px;
  color: var(--muted);
  text-transform: uppercase;
  -webkit-text-fill-color: var(--muted);
}

.top-spacer { flex: 1; }

.tabs { display: none; gap: 4px; }

@media (min-width: 860px) {
  .tabs { display: flex; }
}

.tab {
  border: 0;
  background: none;
  color: var(--ink-2);
  font-size: 14.5px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tab:hover { background: rgba(190, 215, 245, 0.08); color: var(--ink); }
.tab.on { background: rgba(242, 185, 79, 0.15); color: var(--gold); }

.me-btn {
  border: 1px solid var(--line-strong);
  background: var(--card);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  transition: border-color 0.15s;
  flex-shrink: 0;
}

.me-btn:hover { border-color: var(--gold-2); }

@media (max-width: 430px) {
  .top-in { gap: 8px; }
  .logo-sub { display: none; }
  .logo-name { font-size: 16px; }
  .me-btn { font-size: 12px; }
}

.me-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 16px;
  background: var(--card-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
  padding: 6px;
  min-width: 210px;
  z-index: 60;
  animation: pop 0.16s ease;
}

.me-menu .mi {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: none;
  border-radius: 9px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  text-align: left;
}

.me-menu .mi:hover { background: rgba(190, 215, 245, 0.08); color: var(--ink); }
.me-menu .mi.on { color: var(--gold); }
.me-menu .mi-label {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px 4px;
}

/* ------------------------------------------------------- nav móvil */

nav.bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: stretch;
  background: rgba(12, 19, 29, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0));
}

@media (min-width: 860px) {
  nav.bottom { display: none; }
}

.nav-it {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  padding-top: 6px;
  -webkit-tap-highlight-color: transparent;
}

.nav-it .ico { font-size: 21px; line-height: 1; transition: transform 0.15s; }
.nav-it.on { color: var(--gold); }
.nav-it.on .ico { transform: translateY(-2px) scale(1.12); }

/* botón central hexagonal */
.nav-center-slot {
  flex: 1;
  min-width: 0;
  position: relative;
}

.nav-center {
  position: absolute;
  left: 50%;
  top: -20px;
  transform: translateX(-50%);
  width: 58px;
  height: 64px;
  border: 0;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: var(--gold-grad);
  color: #2c1d04;
  font-size: 26px;
  font-weight: 800;
  cursor: pointer;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 8px 18px rgba(224, 154, 48, 0.5));
  transition: transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.nav-center:active { transform: translateX(-50%) scale(0.93); }

.nav-center.live {
  background: linear-gradient(180deg, #ff8a7a, #d94a3d);
  color: #fff;
  font-size: 20px;
  filter: drop-shadow(0 8px 18px rgba(217, 74, 61, 0.55));
  animation: centerPulse 1.8s ease-in-out infinite;
}

@keyframes centerPulse {
  0%, 100% { filter: drop-shadow(0 8px 18px rgba(217, 74, 61, 0.55)); }
  50% { filter: drop-shadow(0 8px 26px rgba(255, 107, 94, 0.85)); }
}

.nav-center-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 8px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
}

/* ------------------------------------------------------------ hex avatar */

.hexa {
  --c: var(--gold);
  --hex-size: 52px;
  position: relative;
  width: var(--hex-size);
  height: calc(var(--hex-size) * 1.12);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: var(--c);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.hexa::before {
  content: "";
  position: absolute;
  inset: 3px;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: var(--card-2);
}

.hexa > span {
  position: relative;
  z-index: 1;
  font-size: calc(var(--hex-size) * 0.52);
  line-height: 1;
}

.hexa > svg {
  position: relative;
  z-index: 1;
  width: calc(var(--hex-size) * 0.86);
  height: calc(var(--hex-size) * 0.86);
}

.hexa.sm { --hex-size: 34px; }
.hexa.lg { --hex-size: 74px; }
.hexa.xl { --hex-size: 104px; }

.mini-ava {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 13px;
  background: var(--card-2);
  border: 2px solid var(--c, var(--gold));
  flex: 0 0 auto;
  overflow: hidden;
}

.mini-ava svg { width: 19px; height: 19px; }

/* ------------------------------------------------------------ botones */

.btn {
  border: 1px solid var(--line-strong);
  background: var(--card-2);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  border-radius: 15px;
  padding: 12px 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s, box-shadow 0.12s, filter 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px) scale(0.99); }

.btn-gold {
  background: var(--gold-grad);
  color: #2c1d04;
  border: 0;
  box-shadow: 0 8px 22px rgba(224, 154, 48, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  position: relative;
  overflow: hidden;
}

.btn-gold::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 40%;
  left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  transform: skewX(-20deg);
  animation: shine 4.2s ease-in-out infinite;
}

.btn-ghost { background: none; border-color: var(--line-strong); color: var(--ink-2); }
.btn-danger { background: none; border-color: rgba(224, 82, 82, 0.5); color: #f09a9a; }
.btn-danger:hover { background: rgba(224, 82, 82, 0.12); }

.btn.big { font-size: 16.5px; padding: 15px 26px; border-radius: 17px; }
.btn.small { font-size: 13px; padding: 8px 14px; border-radius: 11px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
.btn:disabled::after { display: none; }

/* FAB solo escritorio (en móvil está el botón central del nav) */
.fab {
  display: none;
  position: fixed;
  right: 22px;
  bottom: 26px;
  z-index: 45;
  border: 0;
  border-radius: 999px;
  padding: 16px 24px;
  font-size: 15.5px;
  font-weight: 800;
  background: var(--gold-grad);
  color: #2c1d04;
  box-shadow: 0 12px 30px rgba(224, 154, 48, 0.45);
  cursor: pointer;
  align-items: center;
  gap: 8px;
  animation: pop 0.25s ease;
}

.fab:active { transform: scale(0.96); }

.fab.fab-live {
  background: linear-gradient(180deg, #ff8a7a, #d94a3d);
  color: #fff;
  box-shadow: 0 12px 30px rgba(217, 74, 61, 0.5);
}

@media (min-width: 860px) {
  .fab { display: flex; }
}

/* ------------------------------------------------------------ cards */

.card {
  background: linear-gradient(180deg, var(--card-2), var(--card) 70%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.card + .card, .vgap { margin-top: 16px; }

.card-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.card-title .sub { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: auto; text-align: right; }

/* ------------------------------------------------------------ hero */

.hero { padding: 24px 0 16px; }

.hero h1 {
  font-size: clamp(27px, 6.4vw, 38px);
  line-height: 1.1;
}

.hero h1 .name {
  background: linear-gradient(180deg, #f9d98a, #e2a338);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p { color: var(--muted); font-size: 14.5px; margin-top: 6px; font-weight: 600; }

.streak-banner {
  margin-top: 14px;
  background: linear-gradient(90deg, rgba(255, 140, 70, 0.18), rgba(242, 185, 79, 0.1));
  border: 1px solid rgba(242, 165, 70, 0.4);
  border-radius: var(--r-sm);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: pop 0.3s ease;
}

/* ------------------------------------------------------------ stat tiles */

.tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 700px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
}

.tile {
  background: linear-gradient(180deg, var(--card-2), var(--card) 75%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.tile::after {
  content: "";
  position: absolute;
  top: 0; left: 12px; right: 12px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(242, 185, 79, 0.35), transparent);
}

.tile .t-val {
  font-family: var(--display);
  font-size: 29px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-height: 36px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tile .t-val .t-emoji { font-size: 19px; }
.tile .t-label { font-size: 11.5px; font-weight: 700; color: var(--muted); margin-top: 2px; letter-spacing: 0.2px; }

/* ------------------------------------------------------------ podio */

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  padding: 28px 6px 0;
}

.pod {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 150px;
  min-width: 0;
}

.pod .pod-ava { position: relative; }

.pod .crown {
  position: absolute;
  top: -27px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 27px;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.6));
  animation: crownBounce 2.4s ease-in-out infinite;
}

.pod .pod-name {
  font-size: 13.5px;
  font-weight: 800;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pod .pod-wins { font-size: 12px; color: var(--muted); font-weight: 700; margin-top: -6px; }

.pod .pedestal {
  width: 100%;
  border-radius: 12px 12px 5px 5px;
  background: linear-gradient(180deg, #1f3450, #16273c);
  border: 1px solid rgba(120, 160, 210, 0.22);
  border-bottom: 0;
  box-shadow: inset 0 2px 0 rgba(190, 220, 255, 0.14);
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 24px;
  color: rgba(230, 240, 250, 0.55);
}

.pod.p1 .pedestal {
  height: 98px;
  background: linear-gradient(180deg, #6b4f16, #4a350d);
  border-color: rgba(242, 185, 79, 0.45);
  box-shadow: inset 0 2px 0 rgba(255, 230, 160, 0.3), 0 0 30px rgba(242, 185, 79, 0.15);
  color: var(--gold);
}

.pod.p2 .pedestal { height: 66px; }
.pod.p3 .pedestal { height: 46px; }

/* ------------------------------------------------------------ clasificación */

/* tarjetas-fila (móvil) */
.lb-rows { display: flex; flex-direction: column; gap: 8px; }

.lb-row {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  cursor: pointer;
  transition: border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.lb-row:active { border-color: var(--gold-2); }

.lb-row .lb-rank {
  font-family: var(--display);
  font-size: 17px;
  width: 26px;
  text-align: center;
  color: var(--muted);
  flex: 0 0 auto;
}

.lb-row .lb-name { font-weight: 800; font-size: 14.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .lb-sub { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 1px; }
.lb-row .lb-mid { flex: 1; min-width: 0; }

.lb-row .lb-wins { text-align: right; flex: 0 0 auto; }
.lb-row .lb-wins b { font-family: var(--display); font-size: 21px; color: var(--gold); display: block; line-height: 1; }
.lb-row .lb-wins span { font-size: 10.5px; color: var(--muted); font-weight: 700; }

.lb-row.top1 { border-color: rgba(242, 185, 79, 0.5); background: linear-gradient(90deg, rgba(242, 185, 79, 0.1), var(--card) 60%); }

/* tabla (escritorio) */
.table-scroll { display: none; overflow-x: auto; margin: 0 -18px; padding: 0 18px; }

.board { width: 100%; border-collapse: collapse; font-size: 14px; }

.board th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  text-align: right;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}

.board th:first-child, .board td:first-child { text-align: left; }

.board td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.board tr:last-child td { border-bottom: 0; }
.board tr:hover td { background: rgba(190, 215, 245, 0.04); }

.board .pcell { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.board .rank { width: 30px; font-weight: 800; color: var(--muted); }
.board .hot { color: var(--gold); font-weight: 700; }

@media (min-width: 700px) {
  .lb-rows { display: none; }
  .table-scroll { display: block; }
}

/* ------------------------------------------------------------ gráfica */

.race-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 5px 12px 5px 7px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, border-color 0.15s;
}

.chip .dot { width: 11px; height: 11px; border-radius: 999px; background: var(--c); }
.chip.off { opacity: 0.38; }

.race-wrap { position: relative; }
.race-wrap svg { width: 100%; height: auto; display: block; }

.race-tip {
  position: absolute;
  pointer-events: none;
  background: #0e1826;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 9px 12px;
  font-size: 12.5px;
  min-width: 150px;
  z-index: 5;
  display: none;
}

.race-tip .tt-date { color: var(--muted); font-weight: 700; font-size: 11px; margin-bottom: 5px; }
.race-tip .tt-row { display: flex; align-items: center; gap: 7px; padding: 1.5px 0; font-weight: 600; color: var(--ink-2); }
.race-tip .tt-row .dot { width: 9px; height: 9px; border-radius: 99px; flex: 0 0 auto; }
.race-tip .tt-row .v { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 700; }

/* ------------------------------------------------------------ partidas */

.seg-row { display: flex; gap: 8px; margin-bottom: 16px; }

.seg {
  flex: 1;
  border: 1.5px solid var(--line-strong);
  background: var(--card);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 9px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.seg.on { border-color: var(--gold); color: var(--gold); background: rgba(242, 185, 79, 0.1); }

.month-h {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 22px 2px 10px;
}

.game-card {
  background: linear-gradient(180deg, var(--card-2), var(--card) 75%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.14s, border-color 0.14s;
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.game-card:hover { transform: translateY(-2px); border-color: rgba(242, 185, 79, 0.4); }
.game-card + .game-card { margin-top: 10px; }

.gc-body { flex: 1; min-width: 0; }

.gc-cover {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  align-self: center;
  flex: 0 0 auto;
}

.game-card.open-card {
  border-color: rgba(255, 107, 94, 0.55);
  box-shadow: 0 0 24px rgba(255, 107, 94, 0.15), var(--shadow-sm);
}

.gc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.gc-date { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.gc-meta { margin-left: auto; display: flex; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 600; }

.gc-players { display: flex; flex-wrap: wrap; gap: 8px; }

.gp-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 11px 4px 5px;
  font-size: 13px;
  font-weight: 700;
}

.gp-chip .pts { color: var(--muted); font-variant-numeric: tabular-nums; }

.gp-chip.winner {
  border-color: rgba(242, 185, 79, 0.65);
  background: rgba(242, 185, 79, 0.13);
  box-shadow: 0 0 14px rgba(242, 185, 79, 0.2);
}

.gp-chip.winner .pts { color: var(--gold); }

.gc-notes { margin-top: 10px; font-size: 13px; color: var(--muted); font-style: italic; }

.badge-ico { font-size: 13px; }

/* ------------------------------------------------------------ partida en vivo */

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--live);
  display: inline-block;
  flex: 0 0 auto;
  animation: livePulse 1.7s ease-out infinite;
}

@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 107, 94, 0.55); }
  70%, 100% { box-shadow: 0 0 0 8px rgba(255, 107, 94, 0); }
}

.live-banner {
  background: linear-gradient(135deg, rgba(255, 107, 94, 0.16), var(--card-2) 55%);
  border: 1px solid rgba(255, 107, 94, 0.5);
  border-radius: var(--r);
  padding: 16px;
  box-shadow: 0 0 28px rgba(255, 107, 94, 0.13), var(--shadow-sm);
  cursor: pointer;
}

.live-banner .lb-head { display: flex; align-items: center; gap: 9px; font-size: 15px; margin-bottom: 12px; }
.live-banner .lb-when { margin-left: auto; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.live-banner .lb-avas { display: flex; gap: 8px; flex-wrap: wrap; }
.live-banner .lb-preds { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.live-banner .lb-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.pred-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px 8px;
}

.pred-chip .pc-arrow { font-size: 12px; }
.pred-chip .pc-q {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(190, 215, 245, 0.1);
  border: 1px dashed var(--line-strong);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}

.pred-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--ink-2);
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  margin-bottom: 6px;
}

.pred-row b { color: var(--ink); }
.pred-row .pr-mark { margin-left: auto; font-weight: 800; font-size: 15px; }
.pred-row.hit .pr-mark { color: var(--good); }
.pred-row.miss .pr-mark { color: #f09a9a; }

.as-opt {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 16px;
  cursor: pointer;
  color: var(--ink);
  font-size: 15px;
  margin-bottom: 10px;
  transition: border-color 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.as-opt:hover { border-color: var(--gold-2); }
.as-opt:active { transform: scale(0.98); }
.as-opt small { color: var(--muted); font-weight: 500; line-height: 1.4; display: inline-block; margin-top: 3px; }

.as-opt .as-ico {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--card-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 20px;
  flex: 0 0 auto;
}

/* ------------------------------------------------------------ tronos */

.titles-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.title-card {
  --c: var(--gold);
  scroll-snap-align: start;
  flex: 0 0 auto;
  width: 138px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--c) 9%, var(--card)) 0%, var(--card) 65%);
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--c);
  border-radius: var(--r-sm);
  padding: 12px 10px;
  text-align: center;
}

.title-card .tc-emoji { font-size: 27px; margin-bottom: 6px; filter: drop-shadow(0 3px 7px rgba(0,0,0,.4)); }
.title-card .tc-name { font-size: 12.5px; font-weight: 800; line-height: 1.25; min-height: 31px; }
.title-card .tc-holder {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12.5px;
  margin-top: 7px;
  color: var(--ink-2);
}
.title-card .tc-val { font-size: 11px; color: var(--muted); font-weight: 700; margin-top: 5px; }

.title-card.vacant { opacity: 0.5; border-style: dashed; border-top-style: solid; border-top-color: var(--line-strong); background: var(--card); }
.title-card.vacant .tc-emoji { filter: grayscale(1); }
.title-card.vacant .tc-holder { color: var(--muted); font-style: italic; }
.title-card.vacant .tc-val { font-weight: 500; }

.p-titles { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin-top: 8px; }

.p-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--gold);
  background: rgba(242, 185, 79, 0.1);
  border: 1px solid rgba(242, 185, 79, 0.35);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}

/* ------------------------------------------------------------ modal / sheet */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 14, 0.74);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade 0.18s ease;
}

@media (min-width: 640px) {
  .overlay { align-items: center; padding: 24px; }
}

.sheet {
  background: linear-gradient(180deg, #1c2c40, #131f2e);
  border: 1px solid var(--line-strong);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 92dvh;
  overflow-y: auto;
  padding: 12px 18px calc(20px + env(safe-area-inset-bottom, 0));
  animation: slideUp 0.26s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.sheet::before {
  content: "";
  display: block;
  width: 44px;
  height: 4px;
  border-radius: 99px;
  background: var(--line-strong);
  margin: 0 auto 12px;
}

@media (min-width: 640px) {
  .sheet { border-radius: 24px; max-height: 86vh; padding: 24px; }
  .sheet::before { display: none; }
}

.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.sheet-head h2 { font-family: var(--display); font-size: 20px; letter-spacing: 0.4px; display: flex; align-items: center; gap: 8px; }
.sheet-head .x {
  margin-left: auto;
  border: 1px solid var(--line-strong);
  background: var(--card);
  border-radius: 999px;
  width: 36px; height: 36px;
  font-size: 16px;
  cursor: pointer;
  color: var(--ink-2);
  flex: 0 0 auto;
}

.steps-dots { display: flex; gap: 6px; margin-bottom: 18px; }
.steps-dots .d { height: 5px; border-radius: 99px; flex: 1; background: var(--line-strong); transition: background 0.2s; }
.steps-dots .d.on { background: var(--gold); }

.sheet-foot { display: flex; gap: 10px; margin-top: 22px; }
.sheet-foot .btn { flex: 1; }

/* ------------------------------------------------- wizard */

.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}

.pick {
  border: 2px solid var(--line);
  background: var(--card);
  border-radius: var(--r-sm);
  padding: 12px 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-2);
  transition: border-color 0.15s, transform 0.12s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.pick:active { transform: scale(0.96); }

.pick.on {
  border-color: var(--gold);
  background: rgba(242, 185, 79, 0.1);
  color: var(--ink);
}

.pick .pick-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 16px 0 8px;
}

input[type="text"], input[type="password"], input[type="date"], input[type="time"], textarea, select {
  width: 100%;
  background: #0d1521;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-family: inherit;
  font-size: 15.5px;
  padding: 12px 14px;
  transition: border-color 0.15s;
}

input:focus, textarea:focus { outline: none; border-color: var(--gold-2); }
textarea { resize: vertical; min-height: 74px; }
input[type="date"], input[type="time"] { color-scheme: dark; }

.when-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }

.score-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.score-row:last-child { border-bottom: 0; }

.score-name {
  font-weight: 700;
  font-size: 14.5px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.score-name .win-crown { font-size: 15px; }

.stepper { display: flex; align-items: center; gap: 2px; }

.stepper button {
  width: 44px; height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--card-2);
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

.stepper button:active { transform: scale(0.92); background: rgba(242, 185, 79, 0.16); }

.stepper .sv {
  width: 44px;
  text-align: center;
  font-family: var(--display);
  font-size: 22px;
}

.special-toggles { display: flex; gap: 6px; }

/* modo desglose: bloque por jugador con mini-steppers */
.score-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
}

.score-block .sb-head { display: flex; align-items: center; gap: 10px; }

.score-block .sb-pts {
  font-family: var(--display);
  font-size: 23px;
  color: var(--gold);
  min-width: 34px;
  text-align: right;
}

.det-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.mini-step { text-align: center; }

.mini-step .ms-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
  white-space: nowrap;
}

.mini-step .ms-ctl {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.mini-step .ms-ctl button {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--card-2);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

.mini-step .ms-ctl button:active { transform: scale(0.9); background: rgba(242, 185, 79, 0.16); }

.mini-step .ms-ctl b {
  font-family: var(--display);
  font-size: 17px;
  min-width: 20px;
  text-align: center;
}

.gd-det {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
  margin-left: 6px;
}

.sp-tg {
  width: 40px; height: 40px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 17px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s, border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.sp-tg.on {
  opacity: 1;
  border-color: var(--gold);
  background: rgba(242, 185, 79, 0.15);
  box-shadow: 0 0 10px rgba(242, 185, 79, 0.22);
}

.hint { font-size: 12.5px; color: var(--muted); margin-top: 10px; line-height: 1.5; }

.tie-warn {
  margin-top: 12px;
  background: rgba(255, 150, 80, 0.12);
  border: 1px solid rgba(255, 150, 80, 0.4);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 600;
}

.tie-pick { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.photo-drop {
  border: 2px dashed var(--line-strong);
  border-radius: var(--r-sm);
  padding: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s;
}

.photo-drop:hover { border-color: var(--gold-2); color: var(--ink-2); }

.photo-previews { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.photo-previews .pp { position: relative; }
.photo-previews img { width: 74px; height: 74px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line-strong); }
.photo-previews .pp-x {
  position: absolute;
  top: -6px; right: -6px;
  width: 22px; height: 22px;
  border-radius: 99px;
  border: 0;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.resumen {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.resumen .r-row { display: flex; align-items: center; gap: 8px; }
.resumen .r-row .rv { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }

/* ------------------------------------------------------------ medallas */

.player-select { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 16px; }

.ps-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--line-strong);
  background: var(--card);
  border-radius: 999px;
  padding: 6px 14px 6px 6px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}

.ps-chip.on { border-color: var(--gold); color: var(--gold); background: rgba(242, 185, 79, 0.1); }

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

.medal {
  background: linear-gradient(180deg, var(--card-2), var(--card) 75%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 12px 14px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.medal .m-hex {
  --mc: #c08a52;
  width: 64px; height: 71px;
  margin: 0 auto 10px;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: linear-gradient(180deg, var(--mc), color-mix(in srgb, var(--mc) 55%, #000));
  display: grid;
  place-items: center;
  font-size: 30px;
}

.medal.t-plata .m-hex { --mc: #b9c2cf; }
.medal.t-oro .m-hex { --mc: var(--gold); }

.medal.earned .m-hex { box-shadow: 0 0 24px color-mix(in srgb, var(--mc) 50%, transparent); }
.medal.earned { border-color: rgba(242, 185, 79, 0.32); }

.medal.locked .m-hex { filter: grayscale(1) brightness(0.5); }
.medal.locked { opacity: 0.72; }

.medal .m-name { font-size: 13.5px; font-weight: 800; }
.medal .m-desc { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.35; min-height: 30px; }
.medal .m-date { font-size: 11px; color: var(--gold); font-weight: 700; margin-top: 6px; }

.medal .m-prog {
  margin-top: 8px;
  height: 5px;
  background: rgba(190, 215, 245, 0.09);
  border-radius: 99px;
  overflow: hidden;
}

.medal .m-prog > i {
  display: block;
  height: 100%;
  background: var(--gold-2);
  border-radius: 99px;
  transition: width 0.4s ease;
}

.medal .m-count { font-size: 11px; color: var(--muted); font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ galería */

.gallery { columns: 2; column-gap: 10px; }

@media (min-width: 700px) { .gallery { columns: 3; } }

.ph {
  break-inside: avoid;
  margin-bottom: 10px;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--line);
}

.ph img { width: 100%; transition: transform 0.25s ease; }
.ph:hover img { transform: scale(1.04); }

.ph .ph-cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 26px 10px 8px;
  background: linear-gradient(180deg, transparent, rgba(4, 8, 14, 0.88));
  font-size: 11.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(3, 6, 11, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade 0.15s ease;
}

.lightbox img {
  max-width: 94vw;
  max-height: 82dvh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.lb-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px; height: 46px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(22, 33, 48, 0.88);
  color: var(--ink);
  font-size: 18px;
  cursor: pointer;
  z-index: 2;
}

.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-x { position: absolute; top: 14px; right: 14px; transform: none; }
.lb-cap {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  background: rgba(14, 22, 33, 0.88);
  border: 1px solid var(--line);
  padding: 7px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ------------------------------------------------------------ jugadores */

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

.player-card {
  background: linear-gradient(180deg, var(--card-2), var(--card) 75%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 16px 14px;
  text-align: center;
  position: relative;
}

.player-card .rank-tag {
  position: absolute;
  top: 10px; left: 12px;
  font-family: var(--display);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 1px;
}

.player-card .edit-btn {
  position: absolute;
  top: 8px; right: 8px;
  border: 0;
  background: none;
  font-size: 15px;
  cursor: pointer;
  opacity: 0.6;
  padding: 6px;
}

.player-card .edit-btn:hover { opacity: 1; }

.player-card .p-name { font-weight: 800; font-size: 16.5px; margin-top: 10px; }

.player-card .p-mini {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}

.player-card .p-mini b { color: var(--ink); font-family: var(--display); font-size: 16px; display: block; }

.add-player-card {
  border: 2px dashed var(--line-strong);
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
  background: none;
  font-size: 14px;
  min-height: 180px;
  transition: border-color 0.15s, color 0.15s;
}

.add-player-card:hover { border-color: var(--gold-2); color: var(--ink-2); }
.add-player-card .plus { font-size: 34px; }

/* ---------------------------------------------- editor de avatar */

.ab-mode { display: flex; gap: 8px; margin-bottom: 4px; }

.ab-preview { display: flex; justify-content: center; margin: 6px 0 4px; position: relative; }

.ab-random {
  position: absolute;
  right: calc(50% - 84px);
  bottom: 0;
  border: 1px solid var(--line-strong);
  background: var(--card);
  border-radius: 999px;
  width: 40px; height: 40px;
  font-size: 18px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ab-random:active { transform: rotate(40deg) scale(0.92); }

.ab-cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 8px; }

.ab-cat {
  border: 1.5px solid var(--line-strong);
  background: var(--card);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}

.ab-cat.on { border-color: var(--gold); color: var(--gold); background: rgba(242, 185, 79, 0.1); }

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

.ab-opt {
  aspect-ratio: 1;
  border-radius: 13px;
  border: 2px solid var(--line);
  background: var(--card);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 6px;
  transition: border-color 0.12s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.ab-opt:active { transform: scale(0.93); }
.ab-opt.on { border-color: var(--gold); background: rgba(242, 185, 79, 0.1); }
.ab-opt svg { width: 100%; height: 100%; }

.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }

.emoji-grid button {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px solid transparent;
  background: var(--card);
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s;
}

.emoji-grid button:hover { transform: scale(1.12); }
.emoji-grid button.on { border-color: var(--gold); background: rgba(242, 185, 79, 0.12); }

.color-row { display: flex; gap: 10px; flex-wrap: wrap; }

.color-sw {
  width: 38px; height: 38px;
  border-radius: 999px;
  border: 3px solid transparent;
  background: var(--c);
  cursor: pointer;
  position: relative;
  transition: transform 0.12s;
}

.color-sw:hover { transform: scale(1.1); }
.color-sw.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--bg), 0 0 14px var(--c); }
.color-sw:disabled { opacity: 0.25; cursor: not-allowed; transform: none; }

/* ------------------------------------------------------------ detalle partida */

.gd-podium { display: flex; flex-direction: column; gap: 8px; }

.gd-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 12px;
}

.gd-row.win {
  border-color: rgba(242, 185, 79, 0.55);
  background: linear-gradient(90deg, rgba(242, 185, 79, 0.14), var(--card));
}

.gd-row .gd-name { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.gd-row .gd-badges { display: flex; gap: 5px; font-size: 14px; }
.gd-row .gd-pts { font-family: var(--display); font-size: 20px; min-width: 34px; text-align: right; }
.gd-row.win .gd-pts { color: var(--gold); }

.gd-photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.gd-photos img { width: 86px; height: 86px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line-strong); cursor: pointer; }

/* ------------------------------------------------------------ gate (entrada) */

.gate {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.gate .g-logo { width: 110px; height: 122px; margin-bottom: 18px; filter: drop-shadow(0 8px 34px rgba(242, 185, 79, 0.45)); animation: floaty 5s ease-in-out infinite; }

.gate h1 {
  font-size: clamp(34px, 8vw, 52px);
  background: linear-gradient(180deg, #f9d98a, #e2a338);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.gate .g-sub { color: var(--muted); font-size: 15px; margin: 10px 0 30px; max-width: 400px; font-weight: 600; }

.gate .g-form { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 12px; }

.gate input {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 15px;
}

.gate .g-err { color: #f09a9a; font-size: 13.5px; font-weight: 600; min-height: 20px; }
.gate.shake .g-form { animation: shake 0.4s ease; }

/* ------------------------------------------------------------ intro animada */

.intro {
  position: fixed;
  inset: 0;
  z-index: 500;
  background:
    radial-gradient(700px 420px at 50% 30%, rgba(35, 120, 160, 0.18), transparent 65%),
    var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  cursor: pointer;
  transition: opacity 0.45s ease;
}

.intro.out { opacity: 0; pointer-events: none; }

.intro-island { position: relative; width: 210px; height: 216px; }

.intro-island .ihex {
  --hc: var(--gold);
  position: absolute;
  width: 66px;
  height: 74px;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: linear-gradient(180deg, color-mix(in srgb, var(--hc) 92%, #fff) 0%, var(--hc) 55%, color-mix(in srgb, var(--hc) 62%, #000) 100%);
  display: grid;
  place-items: center;
  font-size: 26px;
  animation: hexPop 0.5s cubic-bezier(0.3, 1.6, 0.4, 1) both;
  box-shadow: 0 10px 24px rgba(2, 8, 18, 0.5);
}

/* disposición en flor: centro + 6 pétalos */
.ihex.h0 { left: 72px; top: 71px; animation-delay: 0.72s; z-index: 2; font-size: 30px; }
.ihex.h1 { left: 72px; top: 0; animation-delay: 0.1s; }
.ihex.h2 { left: 133px; top: 35px; animation-delay: 0.2s; }
.ihex.h3 { left: 133px; top: 107px; animation-delay: 0.3s; }
.ihex.h4 { left: 72px; top: 142px; animation-delay: 0.4s; }
.ihex.h5 { left: 11px; top: 107px; animation-delay: 0.5s; }
.ihex.h6 { left: 11px; top: 35px; animation-delay: 0.6s; }

@keyframes hexPop {
  from { transform: scale(0) rotate(-14deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

.intro-title {
  font-family: var(--display);
  font-size: clamp(32px, 9vw, 46px);
  background: linear-gradient(180deg, #f9d98a, #e2a338);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rise 0.55s ease 1.05s both;
  text-align: center;
  line-height: 1.1;
}

.intro-tag {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  animation: rise 0.55s ease 1.3s both;
  margin-top: -18px;
}

.intro-skip {
  position: absolute;
  bottom: calc(30px + env(safe-area-inset-bottom, 0));
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  animation: fade 1s ease 1.8s both;
}

/* ------------------------------------------------------------ victoria */

.victory {
  position: fixed;
  inset: 0;
  z-index: 400;
  background:
    radial-gradient(600px 600px at 50% 38%, rgba(242, 185, 79, 0.22), transparent 60%),
    rgba(4, 8, 14, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  cursor: pointer;
  animation: fade 0.3s ease;
  text-align: center;
  padding: 24px;
}

.victory .v-crown {
  font-size: 56px;
  animation: crownDrop 0.7s cubic-bezier(0.3, 1.5, 0.4, 1) 0.25s both;
  filter: drop-shadow(0 6px 16px rgba(242, 185, 79, 0.5));
}

.victory .v-ava { animation: pop 0.45s cubic-bezier(0.3, 1.6, 0.4, 1) both; }

.victory .v-name {
  font-family: var(--display);
  font-size: clamp(30px, 8vw, 44px);
  background: linear-gradient(180deg, #f9d98a, #e2a338);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rise 0.5s ease 0.4s both;
}

.victory .v-sub { color: var(--ink-2); font-size: 15.5px; font-weight: 700; animation: rise 0.5s ease 0.55s both; max-width: 420px; }
.victory .v-hint { color: var(--muted); font-size: 12.5px; font-weight: 600; margin-top: 18px; animation: fade 1s ease 1.4s both; }

@keyframes crownDrop {
  from { transform: translateY(-70px) rotate(-18deg); opacity: 0; }
  to { transform: translateY(0) rotate(0); opacity: 1; }
}

/* ------------------------------------------------------------ tutorial */

.tut-cards {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 4px 2px 10px;
  -webkit-overflow-scrolling: touch;
}

.tut-card {
  scroll-snap-align: center;
  flex: 0 0 86%;
  max-width: 330px;
  background: linear-gradient(180deg, var(--card-2), var(--card) 75%);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  padding: 20px 18px;
  text-align: center;
}

@media (min-width: 700px) {
  .tut-card { flex: 0 0 300px; }
}

.tut-card .tt-ico { font-size: 40px; display: block; margin-bottom: 10px; filter: drop-shadow(0 4px 10px rgba(0,0,0,.4)); }
.tut-card h3 { font-family: var(--display); font-size: 18px; letter-spacing: 0.4px; margin-bottom: 6px; }
.tut-card p { font-size: 13.5px; color: var(--muted); font-weight: 600; line-height: 1.5; }

.tut-mock {
  margin-top: 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: none;
}

.tut-mock .gp-chip { font-size: 12px; }
.tut-mock .pred-row { margin-bottom: 0; font-size: 12px; }

/* ------------------------------------------------------------ estados vacíos */

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .e-ico { font-size: 52px; display: block; margin-bottom: 12px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.4)); }
.empty p { font-size: 15px; font-weight: 600; max-width: 380px; margin: 0 auto 18px; line-height: 1.55; }

/* ------------------------------------------------------------ toasts */

#toasts {
  position: fixed;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0) + 14px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: max-content;
  max-width: 92vw;
}

@media (min-width: 860px) { #toasts { bottom: 24px; } }

.toast {
  background: #1c2c40;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--shadow);
  animation: pop 0.22s ease;
  max-width: 92vw;
}

.toast.err { border-color: rgba(224, 82, 82, 0.55); color: #f4b0b0; }

#confetti { position: fixed; inset: 0; z-index: 450; pointer-events: none; }

.dice-load { display: inline-block; font-size: 22px; animation: diceWiggle 0.5s ease-in-out infinite; }

/* ------------------------------------------------------------ animaciones */

@keyframes pop {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@keyframes slideUp {
  from { transform: translateY(60px); opacity: 0.4; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes crownBounce {
  0%, 100% { transform: translateX(-50%) translateY(0) rotate(-4deg); }
  50% { transform: translateX(-50%) translateY(-5px) rotate(4deg); }
}

@keyframes shine {
  0%, 60% { left: -60%; }
  100% { left: 130%; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-9px); }
  40%, 80% { transform: translateX(9px); }
}

@keyframes diceWiggle {
  0%, 100% { transform: rotate(-14deg); }
  50% { transform: rotate(14deg); }
}

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #24384f; border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
