/* ════════════════════════════════════════════════
   KreaPass — styles.css
   Mismo lenguaje visual del proyecto NFC:
   negro, blanco y el azul KreaLab #0048FF.
════════════════════════════════════════════════ */

:root {
  --mono: 'Anybody', ui-monospace, monospace;
  --sans: 'Outfit', system-ui, sans-serif;

  --bg: #000;
  --card: #0b0b0b;
  --card-2: #121212;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .16);
  --text: #f2f2f2;
  --muted: #8a8a8a;
  --dim: #4a4a4a;
  --blue: #0048FF;
  --blue-soft: rgba(0, 72, 255, .16);
  --green: #25D366;
  --danger: #ff5a5a;

  --radius: 18px;
  --radius-sm: 12px;
}

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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.45;
  overflow-x: hidden;
}

/* Brillo de fondo */
body::before {
  content: '';
  position: fixed;
  inset: -20% -20% auto;
  height: 70vh;
  background: radial-gradient(ellipse at 50% 0%, rgba(0, 72, 255, .18), transparent 65%);
  pointer-events: none;
  z-index: 0;
}

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input { font: inherit; color: inherit; }
a { color: inherit; }

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

/* ── Layout ─────────────────────────────────── */
.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-logo {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: #0a0a0a;
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 800; font-size: 9px; letter-spacing: 1px;
  line-height: 1.05; text-align: center;
}
.brand-text { font-family: var(--mono); font-weight: 800; font-size: 13px; letter-spacing: 2px; }
.brand-text small { display: block; font-weight: 600; font-size: 9px; letter-spacing: 3px; color: var(--muted); }

.tag {
  font-family: var(--mono);
  font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 5px 10px;
  white-space: nowrap;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.section { margin-top: 28px; }

/* ── Botones ───────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 14px;
  font-weight: 700; font-size: 16px;
  text-decoration: none;
  transition: transform .15s ease, background .2s ease, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn-block { width: 100%; }
.btn-white { background: #fff; color: #000; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-wa { background: var(--green); color: #04220f; }
.btn-ghost { border: 1px solid var(--line-2); color: var(--text); }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ── Estados ───────────────────────────────── */
.state {
  min-height: 60vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center; padding: 24px;
}
.state-title { font-family: var(--mono); font-size: 20px; font-weight: 800; }
.state-text { color: var(--muted); max-width: 32ch; }
.state-icon {
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid var(--line-2);
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 800; font-size: 22px;
}
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--line-2);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50;
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 12px;
  background: #fff; color: #000; font-weight: 700;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.reveal { animation: fadeUp .5s ease-out both; }

/* ════════════════════════════════════════════════
   FAMILIA
════════════════════════════════════════════════ */
.hero-hello { color: var(--muted); font-size: 15px; }
.hero-name {
  font-family: var(--mono);
  font-size: clamp(38px, 12vw, 56px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -1px;
  margin: 6px 0 14px;
  overflow-wrap: anywhere;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 13px; font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--card-2);
  border: 1px solid var(--line);
}
.chip-blue { background: var(--blue-soft); border-color: rgba(0, 72, 255, .45); color: #cfdcff; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-family: var(--mono); font-size: 30px; font-weight: 900; line-height: 1.1; }
.stat-value small { font-size: 15px; color: var(--muted); font-weight: 700; }

.ring-card { display: flex; align-items: center; gap: 18px; grid-column: 1 / -1; }
.ring { width: 76px; height: 76px; flex: none; }
.ring circle { fill: none; stroke-width: 7; }
.ring .ring-bg { stroke: #1d1d1d; }
.ring .ring-fg { stroke: #fff; stroke-linecap: round; transition: stroke-dashoffset 1.2s cubic-bezier(.2, .8, .2, 1); }

.team-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.team-link { font-size: 14px; color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line-2); }

.session-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 22px 0 10px;
}
.session-head h3 { font-family: var(--mono); font-size: 14px; font-weight: 800; letter-spacing: 1px; }
.session-head span { font-size: 12px; color: var(--muted); }

.logro {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--line);
}
.logro + .logro { margin-top: 8px; }
.logro-icon {
  width: 42px; height: 42px; flex: none;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 22px;
  background: var(--card-2);
}
.logro-body { flex: 1; min-width: 0; }
.logro-name { font-weight: 600; font-size: 15px; }
.logro-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.logro-check {
  width: 26px; height: 26px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: #fff; color: #000; font-weight: 900; font-size: 14px;
}
.logro.pendiente { opacity: .45; }
.logro.pendiente .logro-icon { filter: grayscale(1); }
.logro.pendiente .logro-check { background: transparent; border: 1px dashed var(--line-2); color: transparent; }

.cta {
  margin-top: 32px;
  background: linear-gradient(160deg, #0a1a4d 0%, #050505 70%);
  border: 1px solid rgba(0, 72, 255, .5);
}
.cta h2 { font-family: var(--mono); font-size: 24px; font-weight: 900; line-height: 1.15; margin: 4px 0 8px; }
.cta p { color: #c8cfe0; font-size: 15px; }
.cta ul { list-style: none; margin: 16px 0 20px; display: grid; gap: 8px; }
.cta li { display: flex; gap: 10px; font-size: 14px; color: #dfe6ff; }
.cta li::before { content: '→'; color: #7f9fff; }
.cta .btn + .btn { margin-top: 10px; }

.footer { text-align: center; color: var(--dim); font-size: 12px; margin-top: 40px; }

/* ════════════════════════════════════════════════
   LEADERBOARD (proyector / TV)
════════════════════════════════════════════════ */
.lb {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  padding: clamp(20px, 4vw, 56px);
}
.lb-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.lb-title {
  font-family: var(--mono);
  font-size: clamp(34px, 7vw, 96px);
  font-weight: 900;
  line-height: .95;
  letter-spacing: -2px;
}
.lb-title span { color: var(--blue); }
.lb-sub { color: var(--muted); font-size: clamp(14px, 1.6vw, 22px); margin-top: 10px; }
.lb-live {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: clamp(11px, 1.1vw, 15px); font-weight: 700; letter-spacing: 2px;
  color: var(--muted);
}
.lb-live::before {
  content: ''; width: 9px; height: 9px; border-radius: 50%;
  background: var(--green);
  animation: pulse 1.6s ease-in-out infinite;
}
.lb-live.off::before { background: var(--danger); animation: none; }
@keyframes pulse { 50% { opacity: .25; } }

.lb-list { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: clamp(12px, 2vh, 24px); margin: clamp(24px, 5vh, 56px) 0; }
.lb-row {
  display: grid;
  grid-template-columns: clamp(52px, 7vw, 110px) 1fr auto;
  align-items: center;
  gap: clamp(12px, 2vw, 32px);
  padding: clamp(14px, 2.2vh, 28px) clamp(16px, 2.4vw, 36px);
  border-radius: clamp(16px, 2vw, 28px);
  background: var(--card);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
  transition: transform .5s ease;
}
.lb-row.first { border-color: rgba(0, 72, 255, .7); background: linear-gradient(90deg, rgba(0, 72, 255, .22), var(--card) 70%); }
.lb-pos { font-family: var(--mono); font-weight: 900; font-size: clamp(30px, 5vw, 76px); line-height: 1; color: var(--muted); }
.lb-row.first .lb-pos { color: #fff; }
.lb-team { min-width: 0; }
.lb-name { font-family: var(--mono); font-weight: 800; font-size: clamp(22px, 3.6vw, 56px); line-height: 1.05; overflow-wrap: anywhere; }
.lb-bar { height: clamp(6px, 1vh, 12px); margin-top: clamp(8px, 1.4vh, 16px); border-radius: 99px; background: #1b1b1b; overflow: hidden; }
.lb-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: #fff; transition: width 1s cubic-bezier(.2, .8, .2, 1); }
.lb-row.first .lb-bar i { background: var(--blue); }
.lb-pts { text-align: right; font-family: var(--mono); font-weight: 900; font-size: clamp(28px, 4.6vw, 72px); line-height: 1; }
.lb-pts small { display: block; font-size: .3em; color: var(--muted); letter-spacing: 3px; font-weight: 700; margin-top: 6px; }
.lb-row.bump { animation: bump 1.2s ease-out; }
@keyframes bump {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .5); }
  100% { box-shadow: 0 0 0 26px rgba(255, 255, 255, 0); }
}
.lb-delta {
  position: absolute; right: clamp(16px, 2.4vw, 36px); top: 8px;
  font-family: var(--mono); font-weight: 800; font-size: clamp(14px, 1.6vw, 24px);
  color: var(--green);
  animation: rise 2.4s ease-out forwards;
}
@keyframes rise { from { opacity: 1; transform: translateY(10px); } to { opacity: 0; transform: translateY(-20px); } }

.lb-feed { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: clamp(13px, 1.3vw, 18px); }
.lb-feed b { color: var(--text); font-weight: 700; }
.lb-feed span { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; }

/* ════════════════════════════════════════════════
   CAPTURA (instructor, celular)
════════════════════════════════════════════════ */
.pin-box { max-width: 320px; margin: 12vh auto 0; text-align: center; }
.pin-box h1 { font-family: var(--mono); font-size: 26px; font-weight: 900; margin-bottom: 6px; }
.pin-box p { color: var(--muted); margin-bottom: 22px; }
.pin-input {
  width: 100%;
  height: 64px;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: var(--card);
  text-align: center;
  font-family: var(--mono); font-size: 30px; font-weight: 800; letter-spacing: 12px;
  margin-bottom: 12px;
}
.pin-error { color: var(--danger); min-height: 22px; font-size: 14px; margin-bottom: 8px; }

.tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  padding: 5px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line);
  margin-bottom: 18px;
  position: sticky; top: 8px; z-index: 5;
}
.tab { min-height: 44px; border-radius: 10px; font-weight: 700; color: var(--muted); }
.tab[aria-selected="true"] { background: #fff; color: #000; }

.mini-rank { display: flex; gap: 8px; margin-bottom: 18px; overflow-x: auto; }
.mini-rank div {
  flex: 1 0 auto;
  padding: 8px 12px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line);
  font-size: 13px; color: var(--muted); white-space: nowrap;
}
.mini-rank b { color: var(--text); font-family: var(--mono); }

.step { margin-bottom: 22px; }
.step-title {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 12px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px;
}
.step-title i {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-style: normal; font-size: 11px;
  border: 1px solid var(--line-2);
}
.step.done .step-title i { background: #fff; color: #000; border-color: #fff; }
.step.locked { opacity: .35; pointer-events: none; }

.grid-btns { display: grid; gap: 8px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.opt {
  min-height: 56px;
  padding: 8px 10px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line-2);
  font-weight: 700; font-size: 15px; line-height: 1.2;
  transition: background .15s, transform .1s;
}
.opt:active { transform: scale(.96); }
.opt small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); margin-top: 2px; }
.opt.sel { background: #fff; color: #000; border-color: #fff; }
.opt.sel small { color: #444; }
.opt.pts { font-family: var(--mono); font-size: 18px; }
.opt.neg { color: var(--danger); }

.custom-row { display: flex; gap: 8px; margin-top: 8px; }
.custom-row input {
  flex: 1; min-width: 0; min-height: 52px;
  padding: 0 14px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line-2);
  font-size: 16px;
}

.logro-pick { display: grid; gap: 8px; }
.logro-pick .opt { display: flex; align-items: center; gap: 12px; text-align: left; }
.logro-pick .opt span:first-child { font-size: 22px; }

.team-block { margin-top: 14px; }
.team-block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.team-block-head h4 { font-family: var(--mono); font-size: 15px; font-weight: 800; }
.link-btn { font-size: 13px; color: #9fb6ff; text-decoration: underline; min-height: 36px; padding: 0 4px; }

.kid {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%;
  min-height: 56px; padding: 0 16px;
  border-radius: 14px;
  background: var(--card); border: 1px solid var(--line-2);
  font-weight: 600; font-size: 16px; text-align: left;
}
.kid + .kid { margin-top: 8px; }
.kid .tick {
  width: 28px; height: 28px; border-radius: 8px;
  border: 1px solid var(--line-2);
  display: grid; place-items: center; font-weight: 900;
  color: transparent;
}
.kid.on { border-color: rgba(255, 255, 255, .6); }
.kid.on .tick { background: #fff; color: #000; border-color: #fff; }
.kid.busy { opacity: .5; }

.logout { font-size: 13px; color: var(--muted); text-decoration: underline; }

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

/* ════════════════════════════════════════════════
   NIVEL 1 · PERFIL / PADRES
════════════════════════════════════════════════ */
.xp-card { margin-top: 24px; }
.xp-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.xp-total { font-family: var(--mono); font-size: 40px; font-weight: 900; line-height: 1; }
.xp-total small { font-size: 16px; color: var(--muted); font-weight: 700; }
.xp-bar { position: relative; height: 12px; border-radius: 99px; background: #1b1b1b; overflow: hidden; margin: 16px 0 10px; }
.xp-bar i {
  position: absolute; inset: 0 auto 0 0; width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #fff, #9fb6ff);
  overflow: hidden;
  transition: width 1.4s cubic-bezier(.2, .8, .2, 1);
}
.xp-bar i::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  animation: shimmer 2.4s ease-in-out infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(200%); } }
.xp-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }

.stats-4 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }

.badges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.badge {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--card); border: 1px solid var(--line);
  text-align: center;
}
.badge-ico {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; font-size: 24px;
  background: var(--card-2); border: 1px solid var(--line-2);
}
.badge.on .badge-ico { background: #fff; box-shadow: 0 0 22px rgba(159, 182, 255, .35); }
.badge-name { font-size: 11px; font-weight: 700; line-height: 1.2; }
.badge-s { font-family: var(--mono); font-size: 9px; letter-spacing: 1px; color: var(--muted); }
.badge.off { opacity: .4; }
.badge.off .badge-ico { filter: grayscale(1); }

.ses { display: grid; grid-template-columns: 44px 1fr; gap: 14px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--card); border: 1px solid var(--line); }
.ses + .ses { margin-top: 8px; }
.ses-n {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 900; font-size: 15px;
  background: var(--card-2); border: 1px solid var(--line-2);
}
.ses.done .ses-n { background: #fff; color: #000; border-color: #fff; }
.ses-title { font-weight: 600; font-size: 15px; }
.ses-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pill { font-size: 12px; padding: 4px 9px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); color: #cfcfcf; }
.pill b { color: #fff; font-family: var(--mono); }
.pill.ok { border-color: rgba(37, 211, 102, .45); color: #b9f5cf; }
.pill.warn { border-color: rgba(255, 90, 90, .45); color: #ffc4c4; }
.ses.pend { opacity: .45; }

/* Leaderboard con muchos equipos */
.lb-group + .lb-group { margin-top: clamp(20px, 4vh, 40px); }
.lb-group-title { font-family: var(--mono); font-size: clamp(14px, 1.6vw, 22px); font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.lb-rows { display: flex; flex-direction: column; gap: clamp(10px, 1.6vh, 20px); }
.lb.compact .lb-rows { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 900px) {
  .lb.compact .lb-rows { grid-template-columns: 1fr 1fr; gap: 12px 20px; }
}
.lb.compact .lb-row { padding: 10px 18px; border-radius: 16px; grid-template-columns: clamp(40px, 4vw, 64px) 1fr auto; }
.lb.compact .lb-pos { font-size: clamp(22px, 2.6vw, 40px); }
.lb.compact .lb-name { font-size: clamp(18px, 2vw, 30px); }
.lb.compact .lb-pts { font-size: clamp(20px, 2.4vw, 36px); }
.lb.compact .lb-pts small { margin-top: 2px; }
.lb.compact .lb-bar { margin-top: 6px; height: 6px; }

/* Inicio de sesión con Google */
.login { margin-top: 8vh; text-align: center; padding: 32px 22px; }
.login-title { font-family: var(--mono); font-size: 28px; font-weight: 900; line-height: 1.1; margin: 6px 0 10px; }
.login-text { color: var(--muted); max-width: 30ch; margin: 0 auto 24px; }
.gbtn { display: flex; justify-content: center; min-height: 44px; }
.login-error { color: var(--danger); min-height: 22px; margin-top: 14px; font-size: 14px; }
.login-help { color: var(--dim); font-size: 13px; margin-top: 18px; }
.session-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 13px; color: var(--muted);
  padding: 8px 12px; margin-bottom: 18px;
  border: 1px solid var(--line); border-radius: 12px;
}
.session-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
