/* ---------- Inicio (con sesión) ---------- */
.home {
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  position: absolute; inset: 0; z-index: 1500; overflow-y: auto; display: flex; flex-direction: column;
  background:
    radial-gradient(45% 60% at 27% 52%, rgba(255, 189, 69, .13), transparent 65%),
    linear-gradient(90deg, rgba(10, 22, 48, .97) 0%, rgba(10, 22, 48, .88) 52%, rgba(10, 22, 48, .55) 100%);
}
.hm-bar { display: flex; align-items: center; gap: 16px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 76px 14px clamp(16px, 4vw, 48px); }
.hm-bar-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.hm-coins { display: inline-flex; align-items: center; gap: 6px; padding: 8px 8px 8px 14px; border-radius: 999px; cursor: pointer;
  background: rgba(255, 189, 69, .14); color: var(--text); border: 1px solid rgba(255, 189, 69, .45); font-size: 15px; }
.hm-coins b { color: var(--accent); font-variant-numeric: tabular-nums; }
.hm-coins .plus { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #1a1205; display: grid; place-items: center; font-weight: 900; }

.hm-main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 1fr minmax(340px, 470px);
  gap: clamp(24px, 5vw, 72px); align-items: center; padding: 16px clamp(16px, 4vw, 48px) 48px; }

.hm-player { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.hm-stage { position: relative; width: min(380px, 72vw); aspect-ratio: 1; }
.hm-glow { position: absolute; inset: -14%; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 189, 69, .35), transparent);
  filter: blur(8px); }
.hm-avatar { position: relative; width: 100%; height: 100%; border-radius: 30px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55), 0 0 0 4px rgba(255, 255, 255, .08); animation: hm-bob 1.6s steps(2) infinite; }
@keyframes hm-bob { 50% { transform: translateY(-4px); } }
.hm-edit { position: absolute; right: -10px; bottom: -10px; border: 0; border-radius: 999px; padding: 11px 18px; cursor: pointer;
  background: var(--accent); color: #1a1205; font-weight: 900; font-size: 15px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
.hm-edit:hover { transform: translateY(-1px); }
.hm-id { text-align: center; }
.hm-level { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--brand-red); color: #fff;
  font-weight: 900; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.hm-id h2 { margin: 8px 0 4px; font-family: "Arial Rounded MT Bold", "Nunito", system-ui, sans-serif; font-weight: 900; font-size: 34px; letter-spacing: -.02em; }
.hm-id p { margin: 0; color: var(--muted); }

.hm-play { background: rgba(13, 30, 62, .88); backdrop-filter: blur(8px); border-radius: 24px; padding: 28px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(255, 255, 255, .07); }
.hm-play .lp-eyebrow { display: block; color: var(--accent); font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 6px; }
.hm-play h1 { font-family: var(--display); font-weight: 800; font-style: italic; text-transform: uppercase; font-size: clamp(34px, 4vw, 46px);
  line-height: .95; margin: 0 0 18px; }
.hm-play .lp-search { width: 100%; max-width: none; margin-bottom: 10px; }
.hm-results { max-height: 30vh; margin-top: 6px; }
.hm-picked { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  background: rgba(255, 189, 69, .1); border: 1px solid rgba(255, 189, 69, .45); }
.hm-picked div { flex: 1; min-width: 0; }
.hm-picked b { display: block; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-picked small { color: var(--muted); }
.hm-pin { font-size: 24px; }
.lp-btn.huge { width: 100%; margin-top: 18px; padding: 16px; font-family: var(--display); font-style: italic; font-weight: 800;
  font-size: 26px; text-transform: uppercase; letter-spacing: .01em; }

/* ---------- Editor de avatar ---------- */
.av-modal { width: min(1000px, 100%); text-align: left; padding: 24px; }
.av-layout { display: grid; grid-template-columns: 280px 1fr; gap: 28px; }
.av-preview { display: flex; flex-direction: column; align-items: stretch; gap: 12px; position: sticky; top: 0; align-self: start; }
.av-canvas { width: 100%; aspect-ratio: 1; height: auto; border-radius: 22px; box-shadow: 0 16px 40px rgba(0, 0, 0, .45); }
.av-coins { align-self: center; padding: 6px 14px; border-radius: 999px; background: rgba(255, 189, 69, .14); border: 1px solid rgba(255, 189, 69, .4); font-weight: 700; }
.av-coins b { color: var(--accent); }
.av-action { border-radius: 14px; padding: 12px; background: rgba(255, 255, 255, .05); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
  display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.av-action b { font-size: 15px; }
.av-action small { color: var(--muted); }
.av-action .lp-btn { width: 100%; }
.av-pick h1 { margin: 0 0 12px; padding-right: 40px; }
.av-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.av-tabs button { border: 0; border-radius: 999px; padding: 7px 13px; cursor: pointer; background: rgba(255, 255, 255, .07); color: var(--text); font-weight: 700; font-size: 13px; }
.av-tabs button.active { background: var(--accent); color: #1a1205; }
.av-swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.av-swatches:empty { display: none; }
.av-swatches button { width: 32px; height: 32px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .15); cursor: pointer; padding: 0; }
.av-swatches button.sel { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.av-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; max-height: 58vh; overflow-y: auto; padding: 2px; }
.av-item { position: relative; display: flex; flex-direction: column; gap: 6px; align-items: stretch; text-align: left; padding: 7px; border-radius: 14px; cursor: pointer;
  background: rgba(255, 255, 255, .05); border: 2px solid transparent; color: var(--text); }
.av-item:hover { background: rgba(255, 255, 255, .1); }
.av-item.sel { border-color: var(--accent); background: rgba(255, 189, 69, .1); }
.av-item img { width: 100%; aspect-ratio: 1; border-radius: 10px; image-rendering: pixelated; }
.av-item .nm { font-size: 12px; font-weight: 700; line-height: 1.2; }
.badge { align-self: flex-start; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.badge.free { background: rgba(255, 255, 255, .08); color: var(--muted); }
.badge.owned { background: rgba(47, 191, 113, .18); color: var(--ok); }
.badge.coins { background: rgba(255, 189, 69, .18); color: var(--accent); }
.badge.ach { background: rgba(124, 92, 255, .22); color: #b7a6ff; }
.badge.premium { background: rgba(255, 59, 59, .2); color: #ff8a8a; }
.av-item.locked img { filter: saturate(.75); }
.av-item.locked::after { content: "🔒"; position: absolute; top: 10px; right: 10px; font-size: 13px; filter: drop-shadow(0 1px 2px #000); }

/* ---------- Tienda ---------- */
.shop-modal { width: min(1000px, 100%); text-align: left; }
.shop-head { display: flex; align-items: center; gap: 16px; padding-right: 44px; }
.shop-head h1 { margin: 0; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.shop-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 16px;
  background: rgba(255, 255, 255, .05); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.shop-card img { width: 100%; aspect-ratio: 1; border-radius: 12px; image-rendering: pixelated; }
.shop-card .nm { font-weight: 800; }
.shop-card small { color: var(--muted); font-size: 12px; min-height: 2.4em; }
.shop-card .lp-btn { width: 100%; }
.shop-card .tag { position: absolute; top: -8px; right: 10px; background: var(--brand-red); color: #fff; font-size: 11px; font-weight: 900;
  padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; }
.shop-card.pack { align-items: center; text-align: center; }
.coin-pile { font-size: 52px; line-height: 1; height: 120px; display: grid; place-items: center; }
.coin-pile b { display: block; font-family: var(--display, "Barlow Condensed", sans-serif); font-style: italic; font-weight: 800; font-size: 34px; color: var(--accent); }
.shop-card .done { color: var(--ok); font-weight: 800; text-align: center; padding: 8px; }

@media (max-width: 860px) {
  .hm-main { grid-template-columns: 1fr; align-items: start; gap: 22px; padding-top: 4px; }
  .hm-stage { width: min(220px, 56vw); }
  .hm-player { gap: 14px; }
  .hm-id h2 { font-size: 26px; }
  .hm-bar .lp-btn { display: none; }
  .hm-play { padding: 20px; }
  .home { background: linear-gradient(180deg, rgba(10, 22, 48, .96), rgba(10, 22, 48, .9)); }
  .av-layout { grid-template-columns: 1fr; gap: 16px; }
  .av-preview { position: static; display: grid; grid-template-columns: 120px 1fr; align-items: center; }
  .av-preview .av-canvas { grid-row: span 3; }
  .av-preview .av-action, .av-preview .error { grid-column: 1 / -1; }
  .av-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); max-height: none; }
}
@media (max-width: 560px) {
  .hm-bar { padding-right: 66px; }
  .hm-bar .brand-word { font-size: 21px; }
  .hm-bar .brand-mark { width: 30px; height: 30px; }
  .shop-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 1 vs 1 ---------- */
.hm-modes { margin-bottom: 18px; }
.hm-league { margin: -8px 0 14px !important; color: var(--muted); font-size: 14px; }
.hm-league .elo { display: inline-block; margin-right: 8px; padding: 3px 10px; border-radius: 999px; background: rgba(255, 189, 69, .14);
  border: 1px solid rgba(255, 189, 69, .4); color: var(--accent); font-weight: 800; }
.hm-vs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.hm-vs .lp-btn { flex-direction: column; gap: 2px; padding: 11px 10px; border-radius: 14px; white-space: normal; }
.hm-vs small { font-weight: 600; font-size: 11px; color: var(--muted); }

.search-modal { width: min(400px, 100%); }
.radar { position: relative; width: 150px; height: 150px; margin: 4px auto 18px; }
.radar span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255, 189, 69, .55); animation: radar 2.4s ease-out infinite; }
.radar span:nth-child(2) { animation-delay: .8s; }
.radar span:nth-child(3) { animation-delay: 1.6s; }
@keyframes radar { from { transform: scale(.35); opacity: 1; } to { transform: scale(1); opacity: 0; } }
.radar .avatar { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px var(--accent), 0 8px 24px rgba(0, 0, 0, .5); }
.search-info { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; color: var(--muted); font-size: 13px; }
.search-info b { font-size: 30px; color: var(--text); font-variant-numeric: tabular-nums; }

.vs-intro { display: flex; align-items: center; justify-content: center; gap: clamp(16px, 5vw, 64px); width: 100%; flex-wrap: wrap; }
.vs-player { display: flex; flex-direction: column; align-items: center; gap: 8px; animation: vs-in .5s ease both; }
.vs-player.opp { animation-name: vs-in-r; }
@keyframes vs-in { from { transform: translateX(-60px); opacity: 0; } }
@keyframes vs-in-r { from { transform: translateX(60px); opacity: 0; } }
.vs-player canvas { width: min(220px, 34vw); height: auto; aspect-ratio: 1; border-radius: 22px; box-shadow: 0 0 0 4px var(--accent), 0 20px 50px rgba(0, 0, 0, .5); }
.vs-player.opp canvas { box-shadow: 0 0 0 4px var(--brand-red), 0 20px 50px rgba(0, 0, 0, .5); transform: scaleX(-1); }
.vs-player b { font-family: "Arial Rounded MT Bold", "Nunito", sans-serif; font-weight: 900; font-size: 24px; }
.vs-player small, .vs-center small { color: var(--muted); }
.vs-center { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.vs-word { font-family: "Barlow Condensed", sans-serif; font-style: italic; font-weight: 800; font-size: 64px; line-height: 1; color: var(--accent);
  text-shadow: 0 4px 0 #a86f0e, 0 10px 30px rgba(0, 0, 0, .6); }
.vs-count { font-size: 44px; font-variant-numeric: tabular-nums; }

.vsbar { display: flex; align-items: center; gap: 14px; margin-left: auto; padding: 8px 12px; }
.vs-side { display: flex; align-items: center; gap: 8px; }
.vs-side.opp { text-align: right; }
.vs-side b { display: block; font-size: 13px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-side.me .avatar { box-shadow: 0 0 0 2px var(--accent); }
.vs-side.opp .avatar { box-shadow: 0 0 0 2px var(--brand-red); }
.dots { display: flex; gap: 3px; margin-top: 4px; }
.vs-side.opp .dots { justify-content: flex-end; }
.dots i { width: 9px; height: 9px; border-radius: 2px; background: rgba(255, 255, 255, .14); }
.vs-side.me .dots i.on { background: var(--accent); }
.vs-side.opp .dots i.on { background: var(--brand-red); }
.vs-clock { font-family: "Barlow Condensed", sans-serif; font-weight: 800; font-size: 26px; font-variant-numeric: tabular-nums; min-width: 56px; text-align: center; }
body.versus #next { display: none; }

.vsover-modal h1 { font-family: "Barlow Condensed", sans-serif; font-style: italic; font-weight: 800; text-transform: uppercase; font-size: 54px; margin-bottom: 4px; }
.vsover-modal h1.win { color: var(--accent); }
.vsover-modal h1.loss { color: #ff8a8a; }
.vs-final { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 6px 0 14px; }
.vs-final-p { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; border-radius: 16px; background: rgba(255, 255, 255, .05); }
.vs-final-p.winner { background: rgba(255, 189, 69, .12); box-shadow: inset 0 0 0 2px rgba(255, 189, 69, .6); }
.vs-final-p .avatar { width: 64px; height: 64px; }
.vs-final-p small { color: var(--muted); }
.vs-elo { font-size: 18px; }
.vs-elo .up { color: var(--ok); font-weight: 800; }
.vs-elo .down { color: var(--bad); font-weight: 800; }

@media (max-width: 560px) {
  .vsbar { order: 3; width: calc(100% + 50px); justify-content: space-between; padding: 6px 10px; }
  .vs-side b { max-width: 80px; }
  .vs-side .avatar { display: none; }
  .vs-word { font-size: 44px; }
  .hm-vs { grid-template-columns: 1fr; }
}

/* ---------- Reto diario ---------- */
.hm-modes .tab { font-size: 13px; padding: 8px 6px; }
.hm-daily { display: flex; flex-direction: column; gap: 10px; }
.hm-daily-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hm-daily-stats div { background: rgba(255, 255, 255, .05); border-radius: 14px; padding: 12px; text-align: center; }
.hm-daily-stats b { display: block; font-family: "Barlow Condensed", sans-serif; font-style: italic; font-weight: 800; font-size: 38px; color: var(--accent); line-height: 1; }
.hm-daily-stats span { color: var(--muted); font-size: 13px; }
.hm-daily-done { margin: 0 !important; padding: 10px 12px; border-radius: 12px; background: rgba(47, 191, 113, .12); color: var(--text) !important; font-size: 14px; }
.hm-daily .lp-btn.huge { margin-top: 4px; }
.hm-daily .link { align-self: center; }
body.daily .stat:has(#streak), body.daily .stat:has(#lives) { display: none; }

.daily-squares { font-size: 34px; letter-spacing: 6px; margin: 4px 0 12px; }
.daily-recap { list-style: none; padding: 0; margin: 0 0 14px; text-align: left; display: grid; gap: 6px; }
.daily-recap li { display: grid; grid-template-columns: 22px 1fr auto; grid-template-rows: auto auto; column-gap: 8px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); }
.daily-recap li span { grid-row: span 2; align-self: center; font-weight: 900; }
.daily-recap li.hit span { color: var(--ok); }
.daily-recap li.miss span { color: var(--bad); }
.daily-recap li small { color: var(--muted); grid-column: 2; }
.daily-recap li em { grid-row: 1 / span 2; grid-column: 3; align-self: center; font-style: normal; font-weight: 800; color: var(--accent); }

/* ---------- Salas y amigos ---------- */
.hm-join { display: flex; gap: 8px; }
.hm-join input { text-transform: uppercase; letter-spacing: .2em; font-weight: 800; text-align: center; border-radius: 14px; min-width: 0; }
.hm-join .lp-btn { border-radius: 14px; }
.pill-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px;
  background: var(--brand-red); color: #fff; font-size: 12px; font-weight: 900; }
.room-modal { width: min(440px, 100%); }
.room-modal .lp-eyebrow { display: block; color: var(--accent); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 8px; }
.room-code { font-family: "Barlow Condensed", sans-serif; font-weight: 800; font-size: 64px; letter-spacing: .18em; color: var(--accent); margin: 4px 0 10px; }
.room-link { text-align: center; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.friend-add { display: flex; gap: 8px; margin-bottom: 8px; }
.friend-list li .actions { display: flex; gap: 6px; flex: none; }
.primary.small { padding: 7px 12px; font-size: 13px; }
.friends-modal h2 { margin-top: 18px; }

@media (max-width: 560px) {
  .hm-modes .tab { font-size: 12px; padding: 8px 4px; }
  .friend-list li { flex-wrap: wrap; }
  .friend-list li .actions { width: 100%; justify-content: flex-end; }
  .room-code { font-size: 48px; }
}

/* ---------- 1 vs 1 a dos columnas en ordenador ---------- */
.hm-variant { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.hm-variant button { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 10px 12px; border-radius: 14px; cursor: pointer;
  background: rgba(255, 255, 255, .05); color: var(--text); border: 2px solid transparent; font-weight: 800; font-size: 14px; }
.hm-variant button small { color: var(--muted); font-weight: 500; font-size: 12px; }
.hm-variant button.active { border-color: var(--accent); background: rgba(255, 189, 69, .1); }
.loading-round { grid-column: 1 / -1; text-align: center; color: var(--muted); margin: 14px 0 !important; }

@media (min-width: 861px) {
  .hm-main.vs-wide { grid-template-columns: minmax(240px, 0.75fr) minmax(560px, 780px); max-width: 1320px; }
  .hm-main.vs-wide .hm-stage { width: min(300px, 26vw); }
  /* 1 vs 1: a la izquierda ciudad y «Buscar rival»; a la derecha la variante y las demás opciones */
  .hm-play.vs .hm-cols { display: grid; grid-template-columns: 1.1fr 1fr; gap: 0 24px; align-items: start; }
  .hm-play.vs .hm-col-a, .hm-play.vs .hm-col-b { display: flex; flex-direction: column; }
  .hm-play.vs .hm-variant { grid-template-columns: 1fr; margin-bottom: 8px; }
  .hm-play.vs #hmVsButtons { grid-template-columns: 1fr; margin-top: 0; }
  .hm-play.vs #hmPlay { margin-top: 14px; }
}

/* ---------- Panel de jugar: compacto y centrado a la altura del jugador ---------- */
.hm-main { align-items: center; }
.hm-player, .hm-play { align-self: center; }
.hm-cols { display: flex; flex-direction: column; }
.hm-col-a, .hm-col-b { display: contents; }
/* en una sola columna: variante, ciudad, botón y después el resto de opciones */
.hm-variant { order: 1; } .hm-picked { order: 2; } .hm-search { order: 3; } #hmPlay { order: 4; } #hmVsButtons { order: 5; }
.hm-results { max-height: min(30vh, 236px); }
.hm-search .chips { margin-bottom: 8px; }

/* Segunda oportunidad del reto diario (anuncio con recompensa) */
.retry-btn { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 12px; border-radius: 14px; white-space: normal;
  box-shadow: inset 0 0 0 2px rgba(255, 189, 69, .55); }
.retry-btn small { font-weight: 600; font-size: 12px; color: var(--muted); }
#dailyRetry { margin: 0 0 14px; }

/* 1 vs 1 de calles famosas: qué es, junto al botón de buscar rival */
.hm-famous-info { order: 3; list-style: none; margin: 0 0 4px; padding: 14px 16px; border-radius: 14px; background: rgba(255, 255, 255, .05);
  display: grid; gap: 10px; }
.hm-famous-info li { position: relative; padding-left: 22px; color: #c9d1e4; font-size: 14px; line-height: 1.45; }
.hm-famous-info li::before { content: "⭐"; position: absolute; left: 0; top: 0; font-size: 12px; }
.hm-famous-info b { color: var(--text); }
