:root {
  --bg: #070d17;
  --panel: #101827;
  --panel2: #182035;
  --purple: #513db0;
  --red: #ed3d44;
  --gold: #ffd34e;
  --green: #65e6a8;
  --white: #f7f8fc;
  --muted: #9aa6bc;
  --lilac: #b8aaff;
  --body-text: #cdd3e0;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--white);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overscroll-behavior-y: contain;
}

#jawka-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

/* ---------- Top bar ---------- */
.j-top {
  position: relative;
  height: 52px;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;
  padding-top: calc(2px + env(safe-area-inset-top));
  background: var(--bg);
}
.j-top img { height: 44px; max-width: 118px; object-fit: contain; opacity: 0; transform: scale(.94); transition: opacity .26s ease, transform .26s ease; }
.j-top img.show { opacity: 1; transform: scale(1); }
.j-gear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
  font-size: 20px;
  background: none;
  border: none;
  cursor: pointer;
}

/* ---------- Content ---------- */
.j-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
.j-box { padding: 8px 16px 24px; display: flex; flex-direction: column; }
.j-box.pad-top-10 { padding-top: 10px; }

/* ---------- Bottom nav ---------- */
.j-nav {
  display: flex;
  gap: 7px;
  padding: 6px 7px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom));
  background: var(--panel);
  border-radius: 20px 20px 0 0;
  min-height: 68px;
}
.j-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 14px;
  background: var(--panel2);
  color: var(--muted);
  border: none;
  padding: 6px 0;
  font-weight: 700;
  cursor: pointer;
}
.j-nav-btn .icon { font-size: 17px; color: var(--white); line-height: 1; }
.j-nav-btn .label { font-size: 9px; letter-spacing: .02em; }
.j-nav-btn.active { background: var(--purple); }
.j-nav-btn.active .label { color: var(--white); }

/* ---------- Splash ---------- */
.j-splash {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  z-index: 50;
  transition: opacity .35s ease;
}
.j-splash-box { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.j-splash img { height: 90px; opacity: 0; transform: scale(.72); transition: opacity .6s ease, transform .6s ease; }
.j-splash img.show { opacity: 1; transform: scale(1); }
.j-splash .tag { font-size: 12px; font-weight: 700; letter-spacing: .25em; color: var(--muted); }

/* ---------- Generic labels ---------- */
.eyebrow { font-size: 11px; font-weight: 700; color: var(--lilac); letter-spacing: .02em; }
.h1 { font-size: 27px; font-weight: 700; color: var(--white); margin: 4px 0 14px; }
.h1-small { font-size: 22px; font-weight: 700; color: var(--white); margin: 4px 0 10px; }

.j-empty {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 20px;
  background: var(--panel2);
  border-radius: 18px;
}

/* ---------- Chips (game filter) ---------- */
.j-chips { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 12px; scrollbar-width: none; }
.j-chips::-webkit-scrollbar { display: none; }
.j-chip {
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--panel2);
  border: none;
  border-radius: 28px;
  padding: 0 14px;
  height: 36px;
  cursor: pointer;
}
.j-chip.active { background: var(--purple); color: var(--white); }

/* ---------- Event card ---------- */
.j-card {
  background: var(--panel);
  border-radius: 22px;
  padding: 14px;
  margin-bottom: 12px;
}
.j-card .cover { width: 100%; height: 145px; object-fit: cover; border-radius: 16px; background: var(--panel2); margin-bottom: 10px; display: block; }
.j-card .title { font-size: 19px; font-weight: 700; color: var(--white); }
.j-card .meta { font-size: 12px; font-weight: 700; color: var(--lilac); margin: 5px 0 6px; }
.j-card .loc { font-size: 12px; color: var(--muted); }
.j-card .excerpt { font-size: 13px; color: var(--muted); margin-top: 7px; }
.j-actions { display: flex; gap: 10px; margin-top: 9px; }
.j-btn {
  flex: 1;
  height: 42px;
  border-radius: 10px;
  border: none;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--white);
  background: var(--panel2);
  cursor: pointer;
  text-transform: uppercase;
}
.j-btn.primary { background: var(--purple); }
.j-btn.full { flex: none; width: 100%; height: 52px; font-size: 12px; border-radius: 12px; margin-top: 12px; }
.j-btn[disabled] { opacity: .6; cursor: default; }
.j-btn-back {
  width: 110px; height: 42px;
  border-radius: 10px; border: none;
  background: var(--panel2); color: var(--white);
  font-size: 10px; font-weight: 700;
  margin-bottom: 10px; cursor: pointer;
}

/* ---------- Event detail ---------- */
.j-detail .cover { width: 100%; height: 185px; object-fit: cover; border-radius: 20px; background: var(--panel2); margin-bottom: 12px; }
.j-detail .game { font-size: 11px; font-weight: 700; color: var(--lilac); }
.j-detail .title { font-size: 28px; font-weight: 700; color: var(--white); margin: 4px 0 10px; }
.j-detail .row { font-size: 13px; color: var(--muted); }
.j-detail .desc { font-size: 14px; color: var(--body-text); margin: 16px 0 8px; white-space: pre-line; }
.j-status { font-size: 11px; font-weight: 700; margin: 8px 0 4px; }
.j-status.open { color: var(--green); }
.j-status.closed { color: var(--red); }
.j-cap { font-size: 11px; color: var(--muted); }

/* ---------- Login ---------- */
.j-login { display: flex; flex-direction: column; align-items: center; padding: 28px 28px 30px; }
.j-login .spacer { height: 16px; }
.j-login h1 { font-size: 29px; font-weight: 700; color: var(--white); margin: 5px 0 10px; }
.j-login input {
  width: 100%;
  height: 54px;
  border-radius: 16px;
  border: none;
  background: var(--panel2);
  color: var(--white);
  padding: 0 14px;
  font-size: 15px;
  margin-bottom: 10px;
}
.j-login input::placeholder { color: var(--muted); }
.j-login .j-btn.primary { width: 100%; height: 52px; margin-top: 4px; text-transform: uppercase; }
.j-login-error { color: var(--red); font-size: 12px; margin-top: 10px; text-align: center; }

/* ---------- Profile ---------- */
.j-profile-card {
  position: relative;
  background: var(--panel);
  border-radius: 26px;
  padding: 16px;
  overflow: hidden;
  margin-bottom: 4px;
}
.j-profile-card .bgimg { position: absolute; inset: 0; object-fit: cover; opacity: .34; }
.j-profile-card .body { position: relative; z-index: 1; }
.j-profile-row { display: flex; align-items: center; }
.j-avatar { position: relative; border-radius: 18px; background: var(--purple); padding: 3px; flex-shrink: 0; overflow: hidden; }
.j-avatar img.photo { width: 100%; height: 100%; object-fit: cover; border-radius: 15px; background: var(--panel2); display: block; }
.j-avatar img.frame { position: absolute; inset: 0; width: 100%; height: 100%; }
.j-avatar .badge { position: absolute; right: 1px; bottom: 1px; }
.j-profile-info { padding-left: 13px; flex: 1; min-width: 0; }
.j-profile-info .nick { font-size: 20px; font-weight: 700; color: var(--white); }
.j-profile-info .code { font-size: 12px; font-weight: 700; color: var(--lilac); margin: 4px 0 7px; }
.j-profile-info .points { font-size: 12px; font-weight: 700; color: var(--gold); }
.j-rate { text-align: center; font-size: 43px; font-weight: 700; color: var(--white); margin-top: 12px; }
.j-rate-label { text-align: center; font-size: 9px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.j-badges { display: flex; justify-content: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.j-badges img { width: 38px; height: 38px; object-fit: contain; }

.j-section { padding: 18px 0 9px; }
.j-section .t { font-size: 19px; font-weight: 700; color: var(--white); }
.j-section .s { font-size: 11px; color: var(--muted); margin-top: 4px; }

.j-game-row {
  display: flex;
  align-items: center;
  background: var(--panel2);
  border-radius: 18px;
  padding: 12px 14px;
  margin-bottom: 9px;
  cursor: pointer;
  border: none;
  width: 100%;
  text-align: left;
}
.j-game-row .icon { font-size: 22px; width: 34px; }
.j-game-row .info { flex: 1; min-width: 0; }
.j-game-row .info .name { font-size: 16px; font-weight: 700; color: var(--white); }
.j-game-row .info .rec { font-size: 11px; font-weight: 700; color: var(--lilac); margin-top: 4px; }
.j-game-row .wr { font-size: 16px; font-weight: 700; color: var(--gold); }

.j-t-card {
  background: var(--panel);
  border-radius: 18px;
  padding: 13px 15px;
  margin-bottom: 9px;
}
.j-t-card .name { font-size: 17px; font-weight: 700; color: var(--white); }
.j-t-card .meta { font-size: 11px; color: var(--muted); }
.j-t-card .pos { font-size: 15px; font-weight: 700; color: var(--gold); margin-top: 7px; }
.j-t-card .rec { font-size: 11px; color: var(--muted); margin-top: 2px; }

.j-match {
  background: var(--panel2);
  border-radius: 18px;
  padding: 12px 14px;
  margin-bottom: 9px;
}
.j-match .res { font-size: 10px; font-weight: 700; }
.j-match .res.win { color: var(--green); }
.j-match .res.loss { color: var(--red); }
.j-match .vs { font-size: 14px; font-weight: 700; color: var(--white); margin: 5px 0 3px; }
.j-match .score { font-size: 11px; color: var(--muted); }

/* ---------- Ranking ---------- */
.j-rank-game-title { font-size: 18px; font-weight: 700; color: var(--white); padding: 12px 0 8px; }
.j-rank-row {
  display: flex;
  align-items: center;
  background: var(--panel2);
  border-radius: 16px;
  padding: 7px 10px;
  margin-bottom: 7px;
}
.j-rank-row .pos { width: 28px; text-align: center; font-size: 17px; font-weight: 700; color: var(--white); }
.j-rank-row .pos.gold { color: var(--gold); }
.j-rank-row .name { flex: 1; font-size: 13px; font-weight: 700; color: var(--white); padding: 0 9px 0 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.j-rank-row .wins { font-size: 11px; font-weight: 700; color: var(--lilac); }
.j-rank-avatar { width: 46px; height: 46px; border-radius: 12px; background: var(--purple); padding: 3px; flex-shrink: 0; }
.j-rank-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 9px; background: var(--panel2); display: block; }

/* ---------- ID Card ---------- */
.j-idcard-wrap { display: flex; flex-direction: column; align-items: center; }
.j-idcard {
  width: 100%;
  max-width: 340px;
  background: #f5f7fc;
  border-radius: 30px;
  padding: 12px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 14px 30px rgba(0,0,0,.35);
}
.j-idcard .brand { width: 100%; height: 70px; background: var(--bg); border-radius: 24px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.j-idcard .brand img { height: 46px; max-width: 118px; object-fit: contain; }
.j-idcard .avatar { width: 112px; height: 112px; border-radius: 22px; margin-bottom: 10px; }
.j-idcard .nickname { font-size: 22px; font-weight: 700; color: var(--bg); text-align: center; }
.j-idcard .code { font-size: 12px; font-weight: 700; color: var(--purple); text-align: center; padding: 2px 0 8px; }
.j-idcard .hint { font-size: 9px; font-weight: 700; color: var(--muted); letter-spacing: .12em; text-align: center; padding-bottom: 8px; }
.j-idcard .qr { width: 100%; max-width: 288px; aspect-ratio: 1/1; background: #fff; border-radius: 18px; object-fit: contain; margin-top: 4px; }

/* ---------- Loading ---------- */
.j-loading { display: flex; align-items: center; justify-content: center; height: 100%; min-height: 200px; }
.j-spinner {
  width: 40px; height: 40px;
  border: 4px solid rgba(184,170,255,.25);
  border-top-color: var(--lilac);
  border-radius: 50%;
  animation: j-spin 0.8s linear infinite;
}
@keyframes j-spin { to { transform: rotate(360deg); } }

/* ---------- Fade-in animation for children ---------- */
.j-fade-in { animation: j-fadein .24s ease both; }
@keyframes j-fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Toast ---------- */
.j-toast {
  position: absolute;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  background: var(--panel2);
  color: var(--white);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  max-width: 85%;
  text-align: center;
  z-index: 80;
  box-shadow: 0 8px 20px rgba(0,0,0,.4);
}

/* Variante usada por las páginas de Torneos Oficiales (staff) con este mismo look */
.j-btn.danger { background: #3a1c1f; color: #ff9b9b; }
.wpa-shell { max-width: 560px; margin: 0 auto; min-height: 100vh; background: var(--bg); }
.wpa-shell .j-top { justify-content: space-between; }
.wpa-shell .j-top img { opacity: 1; transform: none; height: 38px; }
.wpa-shell .j-top a.j-btn-back { width: auto; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; margin: 0; text-decoration: none; }
.wpa-shell .j-actions a.j-btn { text-decoration: none; display: flex; align-items: center; justify-content: center; }
.wpa-shell .j-card + .j-card { margin-top: 12px; }
.wpa-shell form { margin: 0; flex: 1; }
.wpa-shell form .j-btn { width: 100%; }
.wpa-shell .official-table,.wpa-shell .official-vs { color: var(--lilac); }
.wpa-shell .official-standing em { color: var(--gold); }
.wpa-shell .j-status.open { animation: none; }


/* ---------- Deck Builder ---------- */
.j-deck-card { border: 1px solid rgba(184,170,255,.08); }
.j-deck-card .title { margin-bottom: 3px; }
.j-deck-count { font-size: 18px; font-weight: 700; color: var(--gold); text-align: center; background: var(--panel2); border-radius: 14px; padding: 12px; margin: 4px 0 12px; }
.j-deck-search { width: 100%; height: 48px; border: none; border-radius: 14px; background: var(--panel2); color: var(--white); padding: 0 14px; font-size: 14px; outline: none; margin-bottom: 10px; }
.j-deck-search::placeholder { color: var(--muted); }
.j-deck-results { display: flex; flex-direction: column; gap: 8px; }
.j-search-card { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; margin-bottom: 0; padding: 10px; }
.j-search-card .card-img { width: 56px; height: 78px; object-fit: contain; border-radius: 7px; background: var(--panel2); }
.j-search-card .info { min-width: 0; }
.j-search-card .title { font-size: 15px; }
.j-search-card .meta { font-size: 10px; }
.j-search-card .j-btn { grid-column: 1 / -1; }
.j-deck-list { display: flex; flex-direction: column; gap: 7px; }
.j-deck-card-row { display: flex; align-items: center; gap: 9px; background: var(--panel2); border-radius: 14px; padding: 8px; }
.j-deck-card-row img { width: 42px; height: 58px; object-fit: contain; border-radius: 5px; flex-shrink: 0; }
.j-deck-card-row .info { flex: 1; min-width: 0; }
.j-deck-card-row .name { font-size: 13px; font-weight: 700; color: var(--white); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.j-deck-card-row .meta { font-size: 10px; color: var(--muted); margin-top: 3px; }
.j-deck-card-row .qty { font-size: 13px; font-weight: 700; color: var(--gold); }
.j-mini-btn { width: 34px; height: 34px; border: none; border-radius: 10px; background: var(--panel); color: var(--white); font-size: 19px; font-weight: 700; cursor: pointer; flex-shrink: 0; }
.j-deck-summary { margin-top: 12px; padding: 12px; border-radius: 14px; background: var(--panel2); color: var(--lilac); font-size: 11px; font-weight: 700; text-align: center; }

.j-deck-card-row img, .j-search-card .card-img { cursor: zoom-in; }
.j-card-zoom-overlay { position: fixed; inset: 0; z-index: 130; background: rgba(0,0,0,.82); display: flex; align-items: center; justify-content: center; padding: 18px; }
.j-card-zoom-panel { max-width: 92vw; max-height: 88vh; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.j-card-zoom-panel img { max-width: 92vw; max-height: 74vh; object-fit: contain; border-radius: 16px; box-shadow: 0 18px 50px rgba(0,0,0,.55); }
.j-card-zoom-caption { color: var(--white); text-align: center; }
.j-card-zoom-caption .name { font-size: 15px; font-weight: 800; }
.j-card-zoom-caption .meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.j-card-zoom-close { border: none; border-radius: 10px; padding: 9px 18px; background: var(--panel); color: var(--white); font-weight: 700; cursor: pointer; }
.j-mini-deck-row { display:flex; align-items:center; gap:8px; overflow-x:auto; margin-top:8px; padding-top:8px; border-top:1px solid rgba(184,170,255,.12); }
.j-mini-deck-row img { width:34px; height:47px; object-fit:contain; border-radius:5px; cursor:zoom-in; flex-shrink:0; }
.j-mini-deck-label { font-size:10px; font-weight:800; color:var(--lilac); text-transform:uppercase; margin-top:6px; }
.j-mini-deck-empty { font-size:10px; color:var(--muted); margin-top:6px; }

.j-import-overlay { position: fixed; inset: 0; z-index: 120; background: rgba(0,0,0,.72); display: flex; align-items: flex-end; justify-content: center; padding: 14px; }
.j-import-panel { width: 100%; max-width: 560px; background: var(--panel); border-radius: 20px; padding: 18px; box-shadow: 0 18px 50px rgba(0,0,0,.45); }
.j-import-title { font-size: 18px; font-weight: 800; color: var(--white); margin-bottom: 5px; }
.j-import-help { color: var(--muted); font-size: 11px; line-height: 1.45; margin-bottom: 12px; }
.j-import-textarea { width: 100%; min-height: 300px; resize: vertical; box-sizing: border-box; border: 1px solid rgba(184,170,255,.14); border-radius: 14px; background: var(--panel2); color: var(--white); padding: 12px; font: 12px/1.5 monospace; outline: none; }
.j-import-textarea:focus { border-color: rgba(184,170,255,.45); }
.j-import-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.j-import-actions .j-btn.primary { grid-column: 1 / -1; }

.j-catalog-status{font-size:12px;opacity:.75;margin:6px 0 10px}.j-catalog-status.ready{opacity:.9}.j-catalog-status.warning{opacity:1}
