/* ============================================================
   HikuGym — hoja de estilos MOBILE-FIRST
   Base = teléfonos (≥320px). Mejoras progresivas en @media (min-width).
   Tamaños fluidos con clamp() para escalar sin saltos.
   ============================================================ */

:root {
  --bg: #0d1117;
  --bg2: #161b22;
  --bg-glow: #1a2340;
  --card: #1c2333;
  --card-hover: #232c42;
  --border: #39445e;
  --text: #eef3f9;
  --muted: #aeb9cd;
  --accent: #6c8cff;
  --accent2: #9d6cff;
  --on-accent: #ffffff;
  --good: #4ec97f;
  --bad: #f0616d;
  --warn: #e8bd4e;
  --topbar-bg: rgba(13, 17, 23, .85);
  --mem-front1: #2a3554;
  --mem-front2: #1c2333;
  --react-wait: #37415c;
  --react-ready: #7d2f3c;
  --shadow: 0 4px 18px rgba(0, 0, 0, .35);
  --radius: 14px;

  /* Tamaños fluidos: mínimo móvil → máximo escritorio */
  --mem-size: clamp(64px, 20vw, 96px);
  --nb-size: clamp(84px, 26vw, 110px);
  --pad-size: clamp(118px, 38vw, 150px);
  --bottom-nav-h: 66px;

  font-size: 19px;
}
[data-theme="light"] {
  --bg: #f4f6fb;
  --bg2: #e9edf5;
  --bg-glow: #dde5f5;
  --card: #ffffff;
  --card-hover: #f2f5ff;
  --border: #c3ccdd;
  --text: #16203a;
  --muted: #4d5b76;
  --accent: #3b5bdb;
  --accent2: #6741d9;
  --on-accent: #ffffff;
  --good: #2b8a3e;
  --bad: #c2255c;
  --warn: #9a7b00;
  --topbar-bg: rgba(255, 255, 255, .88);
  --mem-front1: #dbe2f1;
  --mem-front2: #c9d3e8;
  --react-wait: #8594b5;
  --react-ready: #d98a94;
  --shadow: 0 4px 16px rgba(22, 32, 58, .12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: hidden; }
body {
  overflow-x: hidden;
  font-family: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, var(--bg-glow) 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

/* ---------- Accesibilidad ---------- */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--on-accent);
  padding: 12px 20px; border-radius: 0 0 10px 0; font-weight: 700; text-decoration: none;
}
.skip-link:focus { left: 0; }
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- Barra superior (móvil: solo marca + tema) ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-size: 1.2rem; text-decoration: none; color: var(--text); display: flex; gap: 8px; align-items: center; font-weight: 700; }
.brand b { color: var(--accent); }
.topbar nav { display: flex; gap: 6px; align-items: center; }
.topbar nav a { display: none; } /* en móvil la navegación vive abajo */
.theme-toggle {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  width: 48px; height: 48px; border-radius: 10px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: background .2s;
}
.theme-toggle:hover { background: var(--card-hover); }
.theme-toggle svg { width: 24px; height: 24px; }
.theme-toggle .ico-sun { display: none; }
[data-theme="light"] .theme-toggle .ico-sun { display: block; }
[data-theme="light"] .theme-toggle .ico-moon { display: none; }

/* ---------- Navegación inferior (móvil) ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex;
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav a {
  flex: 1; min-height: var(--bottom-nav-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 700;
  transition: color .2s;
}
.bottom-nav a svg { width: 26px; height: 26px; }
.bottom-nav a.active { color: var(--accent); }
.bottom-nav a:active { background: var(--card); }

#app {
  flex: 1; width: 100%; max-width: 1080px; margin: 0 auto;
  padding: 18px 14px calc(var(--bottom-nav-h) + 26px + env(safe-area-inset-bottom, 0));
}
#app:focus { outline: none; }
.footer {
  text-align: center; color: var(--muted); font-size: .82rem; padding: 16px;
  border-top: 1px solid var(--border);
  margin-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0));
}

/* ---------- Iconos ---------- */
.gicon { width: 1em; height: 1em; display: inline-block; vertical-align: -.12em; }
.icon-badge {
  --gcolor: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  width: 54px; height: 54px; border-radius: 15px;
  background: color-mix(in srgb, var(--gcolor) 16%, transparent);
  color: var(--gcolor);
  flex-shrink: 0;
}
.icon-badge .gicon { width: 30px; height: 30px; }
.icon-badge.sm { width: 44px; height: 44px; border-radius: 12px; }
.icon-badge.sm .gicon { width: 24px; height: 24px; }

/* ---------- Inicio ---------- */
.hero { text-align: center; margin: 6px 0 24px; }
.hero h1 { font-size: clamp(1.65rem, 6vw, 2.2rem); margin-bottom: 10px; letter-spacing: -.01em; }
.hero p { color: var(--muted); max-width: 660px; margin: 0 auto; line-height: 1.6; font-size: 1rem; }
.hero .streak { margin-top: 14px; display: inline-block; background: var(--card); border: 1px solid var(--border); padding: 10px 20px; border-radius: 999px; font-size: .95rem; font-weight: 700; }
.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.game-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; cursor: pointer; transition: transform .2s, border-color .2s, background .2s, box-shadow .2s;
  text-decoration: none; color: var(--text);
  display: flex; flex-direction: column; gap: 10px;
}
.game-card:hover {
  background: var(--card-hover); transform: translateY(-3px);
  border-color: var(--accent); box-shadow: var(--shadow);
}
.game-card .card-top { display: flex; align-items: center; gap: 14px; }
.game-card .tag {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 700;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
  padding: 4px 10px; border-radius: 999px; align-self: flex-start;
}
.game-card h3 { font-size: 1.2rem; }
.game-card p { color: var(--muted); font-size: .92rem; line-height: 1.5; flex: 1; }
.game-card .best {
  font-size: .85rem; color: var(--warn); font-weight: 700;
  border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 2px;
}
.game-card .best.empty { color: var(--muted); font-weight: 400; }

/* ---------- Marco de juego ---------- */
.game-wrap { max-width: 760px; margin: 0 auto; }
.game-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.game-head .title { display: flex; align-items: center; gap: 12px; }
.game-head h2 { font-size: clamp(1.25rem, 5vw, 1.5rem); }
.back-btn {
  color: var(--muted); text-decoration: none; font-size: .92rem; font-weight: 700;
  padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border);
  min-height: 44px; display: inline-flex; align-items: center; transition: background .2s, color .2s;
}
.back-btn:hover { color: var(--text); background: var(--card); }
.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 14px; text-align: center;
}
.panel .science-note { font-size: .85rem; color: var(--muted); line-height: 1.55; text-align: left; }
.hud { display: flex; justify-content: center; gap: 18px; margin-bottom: 16px; flex-wrap: wrap; }
.hud .stat { text-align: center; min-width: 72px; }
.hud .stat .v { font-size: clamp(1.5rem, 6vw, 1.9rem); font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.hud .stat .l { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; font: inherit;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: var(--on-accent); padding: 14px 26px; border-radius: 12px;
  font-weight: 700; font-size: 1.08rem; min-height: 56px;
  transition: filter .2s, transform .2s, background .2s;
}
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn.secondary { background: var(--bg2); border: 2px solid var(--border); color: var(--text); }
.btn.secondary:hover { border-color: var(--accent); filter: none; }
.btn.small { padding: 8px 16px; font-size: .9rem; min-height: 44px; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
/* Móvil: botones de acción a lo ancho, fáciles de tocar con el pulgar */
.btn-row { display: flex; flex-direction: column; align-items: stretch; gap: 12px; margin-top: 18px; }

/* ---------- Instrucciones ---------- */
.howto { text-align: left; max-width: 580px; margin: 0 auto 8px; }
.howto h3 { font-size: 1.15rem; margin-bottom: 14px; text-align: center; display: flex; align-items: center; justify-content: center; gap: 8px; }
.howto ol { list-style: none; counter-reset: paso; display: grid; gap: 13px; }
.howto li {
  counter-increment: paso; display: flex; gap: 12px; align-items: flex-start;
  font-size: 1.04rem; line-height: 1.55;
}
.howto li::before {
  content: counter(paso);
  flex: 0 0 38px; height: 38px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.howto .ejemplo {
  margin-top: 14px; background: var(--bg2); border: 1px dashed var(--border);
  border-radius: 10px; padding: 14px 16px; font-size: 1.02rem; line-height: 1.6; text-align: center;
}

/* ---------- Feedback / resultados ---------- */
.feedback { min-height: 36px; font-weight: 700; margin: 12px 0; font-size: 1.2rem; }
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }
.result-box { padding: 8px 0; }
.result-box .big { font-size: clamp(2.1rem, 9vw, 2.6rem); font-weight: 800; color: var(--accent); margin: 6px 0; font-variant-numeric: tabular-nums; }
.result-box .sub { color: var(--muted); font-size: 1rem; }
.new-record { color: var(--warn); font-weight: 700; margin-top: 8px; font-size: 1.1rem; animation: pop .4s; }
@keyframes pop { 0% { transform: scale(.6); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }

/* ---------- Temporizador ---------- */
.timer-wrap { display: flex; align-items: center; gap: 12px; max-width: 460px; margin: 12px auto; }
.timer-bar { flex: 1; height: 10px; background: var(--bg2); border-radius: 5px; overflow: hidden; border: 1px solid var(--border); }
.timer-bar .fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .1s linear; }
.timer-num { font-weight: 700; font-size: 1.1rem; min-width: 50px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }

/* ---------- Memorama ---------- */
.mem-grid { display: grid; gap: 9px; margin: 0 auto; justify-content: center; }
.mem-card {
  width: var(--mem-size); height: var(--mem-size); perspective: 500px; cursor: pointer; border: none; background: none; padding: 0;
}
.mem-card .inner { position: relative; width: 100%; height: 100%; transition: transform .35s; transform-style: preserve-3d; }
.mem-card.flipped .inner, .mem-card.matched .inner { transform: rotateY(180deg); }
.mem-card .face {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  border-radius: 12px; font-size: clamp(1.7rem, 7vw, 2.6rem); backface-visibility: hidden;
}
.mem-card .front { background: linear-gradient(135deg, var(--mem-front1), var(--mem-front2)); border: 2px solid var(--border); }
.mem-card .front::after { content: "?"; color: var(--muted); font-size: 1.5rem; font-weight: 700; }
.mem-card .back { background: var(--bg2); border: 2px solid var(--accent); transform: rotateY(180deg); }
.mem-card.matched .back { border-color: var(--good); box-shadow: 0 0 12px color-mix(in srgb, var(--good) 40%, transparent); }

/* ---------- N-Back ---------- */
.nb-grid { display: grid; grid-template-columns: repeat(3, var(--nb-size)); gap: 9px; justify-content: center; margin: 16px auto; }
.nb-cell { width: var(--nb-size); height: var(--nb-size); background: var(--bg2); border: 2px solid var(--border); border-radius: 12px; transition: background .1s; }
.nb-cell.on { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 55%, transparent); }
.nb-answer { padding: 16px 30px; width: 100%; max-width: 420px; margin: 0 auto; }
.nb-answer.hit { background: var(--good); }
.nb-answer.miss { background: var(--bad); }

/* ---------- Stroop ---------- */
.stroop-word { font-size: clamp(2.5rem, 11vw, 4.2rem); font-weight: 800; margin: 20px 0; letter-spacing: .02em; min-height: clamp(60px, 14vw, 90px); }
.stroop-btns { display: grid; grid-template-columns: repeat(2, minmax(130px, 180px)); gap: 11px; justify-content: center; }
.stroop-btns .btn { background: var(--bg2); border: 3px solid var(--border); color: var(--text); }
.stroop-btns .btn:hover { filter: none; }

/* ---------- Reacción ---------- */
.react-zone {
  height: clamp(240px, 45vh, 300px); border-radius: var(--radius); display: flex; flex-direction: column;
  align-items: center; justify-content: center; cursor: pointer; user-select: none;
  font-size: clamp(1.4rem, 6vw, 1.8rem); font-weight: 700; gap: 8px; transition: background .1s; color: #fff;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.react-zone small { font-size: 1rem; font-weight: 400; opacity: .9; }
.react-zone.wait { background: var(--react-wait); }
.react-zone.ready { background: var(--react-ready); }
.react-zone.go { background: var(--good); }

/* ---------- Dígitos ---------- */
.digit-display { font-size: clamp(3rem, 14vw, 4.5rem); font-weight: 800; letter-spacing: .18em; min-height: clamp(76px, 17vw, 100px); margin: 16px 0; color: var(--accent); font-variant-numeric: tabular-nums; }
.digit-input {
  font: inherit; font-size: clamp(1.5rem, 6vw, 2rem); text-align: center; letter-spacing: .2em;
  background: var(--bg2); border: 2px solid var(--border); color: var(--text);
  border-radius: 12px; padding: 14px; width: 100%; max-width: 320px;
}
.digit-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }

/* ---------- Senderos ---------- */
.trail-board {
  position: relative; width: 100%; max-width: 560px;
  height: clamp(340px, 58vh, 430px);
  margin: 0 auto; background: var(--bg2); border-radius: var(--radius); border: 2px solid var(--border);
  touch-action: manipulation;
}
.trail-node {
  position: absolute; width: 56px; height: 56px; border-radius: 50%;
  background: var(--card); border: 2px solid var(--border); color: var(--text);
  font: inherit; font-weight: 700; font-size: 1.3rem; cursor: pointer; transition: border-color .12s, background .12s;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.trail-node:hover { border-color: var(--accent); }
.trail-node.done { background: var(--good); border-color: var(--good); color: #fff; }
.trail-node.error { animation: shake .3s; border-color: var(--bad); }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* ---------- Simon ---------- */
.simon-grid { display: grid; grid-template-columns: repeat(2, var(--pad-size)); gap: 13px; justify-content: center; margin: 18px auto; }
.simon-pad {
  width: var(--pad-size); height: var(--pad-size); border-radius: 18px; border: none; cursor: pointer;
  opacity: .5; transition: opacity .1s, transform .1s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.simon-pad.lit { opacity: 1; transform: scale(1.05); box-shadow: 0 0 24px currentColor; }
.simon-pad:active { transform: scale(.96); }
.simon-pad[data-c="0"] { background: #e05561; color: #e05561; }
.simon-pad[data-c="1"] { background: #3fb970; color: #3fb970; }
.simon-pad[data-c="2"] { background: #4d8de8; color: #4d8de8; }
.simon-pad[data-c="3"] { background: #e3b341; color: #e3b341; }

/* ---------- Trivia ---------- */
.trivia-q { font-size: clamp(1.25rem, 5.5vw, 1.55rem); font-weight: 700; margin: 18px 0; line-height: 1.45; }
.trivia-opts { display: grid; gap: 11px; max-width: 540px; margin: 0 auto; }
.trivia-opts .btn { background: var(--bg2); border: 2px solid var(--border); color: var(--text); text-align: left; justify-content: flex-start; }
.trivia-opts .btn:hover { border-color: var(--accent); filter: none; }
.trivia-opts .btn.correct { background: var(--good); border-color: var(--good); color: #fff; }
.trivia-opts .btn.wrong { background: var(--bad); border-color: var(--bad); color: #fff; }

/* ---------- Progreso ---------- */
.stats-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat-card h4 { font-size: 1.05rem; margin-bottom: 12px; display: flex; gap: 10px; align-items: center; }
.stat-card .row { display: flex; justify-content: space-between; font-size: .92rem; padding: 5px 0; color: var(--muted); }
.stat-card .row b { color: var(--text); font-variant-numeric: tabular-nums; }
.summary-band { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.summary-band .chip { flex: 1; min-width: 140px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; }
.summary-band .chip .v { font-size: clamp(1.4rem, 6vw, 1.8rem); font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.summary-band .chip .l { font-size: .78rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Ciencia ---------- */
.science-list { display: grid; gap: 14px; }
.science-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.science-item h3 { margin-bottom: 8px; font-size: 1.08rem; display: flex; align-items: center; gap: 10px; }
.science-item p { color: var(--muted); font-size: .95rem; line-height: 1.6; }
.science-item .ref { display: block; margin-top: 10px; font-size: .82rem; color: var(--accent); font-style: italic; }

/* ---------- Selector de cálculo ---------- */
.picker { max-width: 560px; margin: 0 auto; text-align: left; }
.picker-label { font-weight: 700; font-size: 1.05rem; margin: 18px 0 10px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.picker-grid.three { grid-template-columns: repeat(3, 1fr); }
.pick {
  font: inherit; cursor: pointer; background: var(--bg2); color: var(--text);
  border: 2px solid var(--border); border-radius: 12px; padding: 14px 10px; min-height: 64px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  transition: border-color .15s, background .15s;
}
.pick:hover { border-color: var(--accent); }
.pick.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.pick-sym { font-size: 1.5rem; font-weight: 800; color: var(--accent); letter-spacing: .04em; }
.pick-txt { font-weight: 700; font-size: 1rem; }

/* ---------- Cuenta / inicio de sesión ---------- */
.auth-wrap { max-width: 480px; margin: 0 auto; }
.auth-hero { text-align: center; margin-bottom: 20px; }
.auth-hero h1 { font-size: 2rem; }
.auth-hero h1 b { color: var(--accent); }
.auth-hero p { color: var(--muted); line-height: 1.6; margin-top: 8px; }
.auth-card { text-align: left; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.auth-tab {
  flex: 1; font: inherit; font-weight: 700; cursor: pointer;
  background: var(--bg2); color: var(--muted);
  border: 2px solid var(--border); border-radius: 10px; padding: 12px; min-height: 52px;
  transition: color .2s, border-color .2s;
}
.auth-tab.active { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-weight: 700; margin-bottom: 6px; font-size: .98rem; }
.form-field input {
  width: 100%; font: inherit; font-size: 1.1rem;
  background: var(--bg2); border: 2px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 13px 14px; min-height: 54px;
}
.form-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.pass-row { display: flex; gap: 8px; }
.pass-row input { flex: 1; }

/* ---------- Progreso: fortalezas ---------- */
.section-title { font-size: 1.2rem; margin: 22px 0 12px; }
.strength-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 16px; }
.strength-card {
  background: var(--card); border: 1px solid var(--border); border-left: 6px solid var(--sc, var(--accent));
  border-radius: var(--radius); padding: 16px 18px;
}
.strength-title { font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.strength-game { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; margin: 8px 0 4px; }
.strength-delta { color: var(--sc, var(--accent)); font-weight: 700; }

/* ---------- Compartir / familia ---------- */
.share-panel { text-align: left; margin-bottom: 16px; }
.share-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.fam-label { font-weight: 700; margin: 16px 0 8px; }
.fam-list { display: grid; gap: 10px; }
.fam-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; color: var(--text); text-decoration: none; font-weight: 700;
  flex-wrap: wrap;
}
a.fam-item:hover { border-color: var(--accent); }
.fam-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.2rem;
}
.fam-go { margin-left: auto; color: var(--accent); font-size: .9rem; }
.fam-item .btn { margin-left: auto; }
.pill-code {
  display: inline-block; background: var(--bg2); border: 2px dashed var(--accent);
  color: var(--accent); font-weight: 800; letter-spacing: .2em; font-size: 1.3rem;
  padding: 6px 14px; border-radius: 10px;
}
.invite-code-box { margin-top: 14px; background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }

/* ============================================================
   MEJORA PROGRESIVA: tabletas y escritorio (≥768px)
   ============================================================ */
@media (min-width: 768px) {
  /* Navegación regresa a la barra superior */
  .topbar { padding: 12px 24px; }
  .topbar nav a {
    display: inline-flex; align-items: center;
    color: var(--muted); text-decoration: none; padding: 12px 16px; border-radius: 10px;
    transition: background .2s, color .2s; font-weight: 700; min-height: 48px;
  }
  .topbar nav a:hover, .topbar nav a.active { color: var(--text); background: var(--card); }
  .topbar nav a.active { box-shadow: inset 0 -3px 0 var(--accent); }
  .theme-toggle { margin-left: 8px; }
  .bottom-nav { display: none; }
  .brand { font-size: 1.3rem; }

  #app { padding: 28px 20px 60px; }
  .footer { margin-bottom: 0; font-size: .85rem; padding: 18px; }

  .hero { margin: 10px 0 34px; }
  .hero p { font-size: 1.05rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
  .game-card { padding: 22px; }

  .panel { padding: 28px; }
  .hud { gap: 30px; }
  .btn-row { flex-direction: row; justify-content: center; align-items: center; flex-wrap: wrap; }
  .btn-row .btn { min-width: 180px; }
  .icon-badge { width: 58px; height: 58px; border-radius: 16px; }
  .icon-badge .gicon { width: 32px; height: 32px; }

  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
  .strength-grid { grid-template-columns: 1fr 1fr; }
  .share-row .btn { min-width: 0; }
  .summary-band { gap: 16px; margin-bottom: 24px; }
  .science-item { padding: 22px; }
  .mem-grid { gap: 12px; }
  .nb-grid { gap: 10px; }
  .simon-grid { gap: 14px; }
}
