/* ============================================================
   SUSHI LAB GAME · Design System
   Paleta extraída del logo oficial: washi crema, rojo japonés,
   dorado de farolito, madera tostada.
   ============================================================ */

/* ---------------------------- TOKENS ---------------------------- */
:root[data-theme="light"], :root {
  --bg-primary:    #FBF6E9;
  --bg-secondary:  #F3EAD6;
  --bg-tertiary:   #E8DAC0;
  --text-primary:  #241109;
  --text-secondary:#5C3A26;
  --text-muted:    #8E6A50;
  --border:        #D9C4A4;
  --accent:        #D93B22;
  --accent-hover:  #B72E17;
  --accent-text:   #FFFFFF;
  --gold:          #E29411;
  --gold-soft:     #F5C862;
  --wood:          #8C3C00;
  --wood-deep:     #4A1E08;
  --danger:        #C0392B;
  --success:       #1F7A4C;
  --warning:       #B8650A;
  --surface:       #FFFDF6;
  --surface-alt:   #FFFFFF;
  --shadow:        rgba(74, 30, 8, 0.14);
  --shadow-strong: rgba(74, 30, 8, 0.28);
}

:root[data-theme="dark"] {
  --bg-primary:    #16100C;
  --bg-secondary:  #1F1712;
  --bg-tertiary:   #2A201A;
  --text-primary:  #F7EEE2;
  --text-secondary:#C9AF98;
  --text-muted:    #8A7260;
  --border:        #3A2C22;
  --accent:        #F0523A;
  --accent-hover:  #D93B22;
  --accent-text:   #FFFFFF;
  --gold:          #F0A81E;
  --gold-soft:     #FFD27A;
  --wood:          #A85520;
  --wood-deep:     #100A07;
  --danger:        #E05252;
  --success:       #3DBE7A;
  --warning:       #E8900A;
  --surface:       #1F1712;
  --surface-alt:   #261C16;
  --shadow:        rgba(0, 0, 0, 0.45);
  --shadow-strong: rgba(0, 0, 0, 0.65);
}

/* ---------------------------- RESET ---------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
input, textarea, select, [contenteditable="true"] {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
}
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  background: var(--bg-primary);
  color: var(--text-primary);
  overscroll-behavior: none;
  transition: background .25s ease, color .25s ease;
}
h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: 28px; } h2 { font-size: 22px; } h3 { font-size: 18px; } h4 { font-size: 15px; }
p  { margin: 0 0 1em; }
a  { color: var(--accent); text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font: inherit; }
.label {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); font-weight: 600;
}

/* ---------------------------- LAYOUT ---------------------------- */
.container { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }
.stack     { display: flex; flex-direction: column; gap: 1rem; }
.row       { display: flex; align-items: center; gap: .75rem; }
@media (max-width: 768px) { .container { padding: 1.25rem 1rem; } }

/* ---------------------------- BOTONES ---------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .7rem 1.4rem;
  border: none; border-radius: 12px;
  font-size: 15px; font-weight: 600;
  position: relative; overflow: hidden;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
}
.btn:active { transform: translateY(1px) scale(.985); }
.btn-primary {
  background: linear-gradient(160deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: var(--accent-text);
  box-shadow: 0 4px 14px var(--shadow), inset 0 1px 0 rgba(255,255,255,.22);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-gold {
  background: linear-gradient(160deg, var(--gold-soft) 0%, var(--gold) 100%);
  color: var(--wood-deep);
  box-shadow: 0 4px 14px var(--shadow);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------------------- SUPERFICIES ---------------------------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 6px 24px var(--shadow);
  padding: 1.5rem;
}
/* Composición asimétrica: esquina "cortada" tipo hanko */
.panel--washi {
  position: relative;
  background:
    radial-gradient(circle at 12% 8%, rgba(226,148,17,.10), transparent 55%),
    var(--surface);
  border-radius: 22px 6px 22px 6px;
}

/* ---------------------------- RIPPLE (skill 31) ---------------------------- */
.ripple { position: relative; overflow: hidden; }
.ripple-wave {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.45);
  transform: scale(0); animation: ripple-anim .6s linear;
  pointer-events: none;
}
.btn-secondary .ripple-wave, .btn-ghost .ripple-wave, .btn-gold .ripple-wave {
  background: rgba(74,30,8,.18);
}
@keyframes ripple-anim { to { transform: scale(4); opacity: 0; } }

/* ---------------------------- FORM ---------------------------- */
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 46px;
  padding: .65rem .9rem;
  border: 1.5px solid var(--border); border-radius: 12px;
  background: var(--bg-primary); color: var(--text-primary);
  font-size: 16px; /* 16px evita el zoom automático de iOS */
  outline: none; transition: border-color .18s ease, box-shadow .18s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217,59,34,.16);
}
.password-field { position: relative; }
.password-field input { padding-right: 46px; }
.toggle-password {
  position: absolute; right: 6px; bottom: 3px;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--text-muted); border-radius: 10px;
}

/* ---------------------------- TOASTS ---------------------------- */
#toast-host {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: .5rem; align-items: center;
  z-index: 9999; pointer-events: none; width: min(92vw, 420px);
}
.toast {
  padding: .7rem 1.2rem; border-radius: 12px;
  font-size: 14px; font-weight: 500; color: #fff;
  box-shadow: 0 8px 24px var(--shadow-strong);
  animation: toast-in .25s ease;
  max-width: 100%; text-align: center;
}
.toast-error   { background: var(--danger); }
.toast-success { background: var(--success); }
.toast-warning { background: var(--warning); }
.toast-info    { background: var(--wood); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------------------------- ESTADOS (skill 04) ---------------------------- */
.empty-state, .error-state {
  text-align: center; padding: 3rem 1.5rem;
  color: var(--text-secondary);
}
.empty-state i, .error-state i { width: 44px; height: 44px; color: var(--text-muted); margin-bottom: .75rem; }

/* ---------------------------- THEME TOGGLE ---------------------------- */
#theme-toggle {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-secondary);
}
:root[data-theme="light"] #theme-toggle .icon-dark  { display: none; }
:root[data-theme="dark"]  #theme-toggle .icon-light { display: none; }

/* ---------------------------- SPLASH ---------------------------- */
#splash {
  position: fixed; inset: 0; z-index: 9998;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 35%, #2A1A10 0%, #120B07 100%);
  transition: opacity .5s ease;
}
#splash .splash-logo { width: min(46vw, 190px); filter: drop-shadow(0 10px 30px rgba(0,0,0,.6)); }
#splash h1 { color: #FBF6E9; margin: 1rem 0 .25rem; font-size: clamp(22px, 6vw, 32px); }
#splash p  { color: #C9AF98; font-size: 14px; margin: 0 0 1.75rem; }
#splash-track { width: min(62vw, 220px); height: 4px; background: rgba(255,255,255,.14); border-radius: 4px; overflow: hidden; }
#splash-bar   { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--accent)); transition: width .12s linear; }

/* ---------------------------- CANVAS 3D ---------------------------- */
#renderCanvas {
  width: 100%; height: 100%;
  display: block; outline: none;
  touch-action: none;
}
.canvas-wrap {
  position: relative; width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 18px; overflow: hidden;
  border: 1px solid var(--border);
  background: #1a120c;
  box-shadow: 0 10px 34px var(--shadow);
}
@media (max-width: 768px) { .canvas-wrap { aspect-ratio: 4 / 5; } }

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

/* ---------------------------- FILA CLAVE / VALOR ---------------------------- */
.datarow {
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--border);
}
.datarow .label { flex: 0 0 auto; padding-top: 2px; }
.datarow strong {
  flex: 1 1 auto;
  min-width: 0;                 /* clave: permite que el flex item se encoja */
  font-size: 14px;
  text-align: right;
  overflow-wrap: anywhere;      /* nunca desborda horizontalmente */
}

/* Red de seguridad global: ningún contenido genera scroll lateral */
html, body { max-width: 100%; overflow-x: hidden; }

/* ============================================================
   FASE 2 · APP SHELL, HOME, AUTH, PERFIL
   ============================================================ */

/* ---------------------------- APP SHELL ---------------------------- */
#app { min-height: 100dvh; display: flex; flex-direction: column; }
.main-content { flex: 1; padding-bottom: 1rem; }

.appbar {
  position: sticky; top: 0; z-index: 90;
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem 1.25rem;
  padding-top: calc(.7rem + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg-primary) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
@supports not (backdrop-filter: blur(1px)) { .appbar { background: var(--bg-primary); } }
.appbar-brand { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.appbar-brand img { width: 38px; height: 38px; border-radius: 10px; flex: 0 0 auto; }
.appbar-brand b { font-size: 16px; letter-spacing: -.01em; white-space: nowrap; }
.appbar-spacer { flex: 1; }
.appbar-actions { display: flex; align-items: center; gap: .4rem; }

/* Navegación desktop */
.nav-desktop { display: flex; align-items: center; gap: .25rem; }
.nav-desktop a {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .85rem; border-radius: 10px;
  font-size: 14px; font-weight: 600; color: var(--text-secondary);
  min-height: 40px;
}
.nav-desktop a.active { background: var(--bg-tertiary); color: var(--accent); }
.nav-desktop a svg { width: 17px; height: 17px; }
@media (max-width: 900px) { .nav-desktop { display: none; } }

/* Monedas / nivel en el appbar */
.coin-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .7rem; border-radius: 999px;
  background: linear-gradient(160deg, var(--gold-soft), var(--gold));
  color: var(--wood-deep); font-weight: 800; font-size: 13px;
  border: 1px solid rgba(0,0,0,.08);
}
.coin-pill svg { width: 15px; height: 15px; }

/* ---------------------------- FOOTER MOBILE (skill 31) ---------------------------- */
.app-footer-nav { display: none; }
@media (max-width: 900px) {
  .app-footer-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
    display: flex; height: 64px;
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px var(--shadow);
  }
  .app-footer-nav a {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 3px;
    font-size: 10px; font-weight: 700; letter-spacing: .01em;
    color: var(--text-muted); min-height: 44px;
  }
  .app-footer-nav a svg { width: 21px; height: 21px; }
  .app-footer-nav a.active { color: var(--accent); }
  .main-content { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
}

/* Modal "Ver más": TODA opción del desktop accesible en mobile */
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.menu-grid button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem;
  padding: 1rem .5rem; min-height: 84px;
  border: 1.5px solid var(--border); border-radius: 14px;
  background: var(--bg-secondary); color: var(--text-primary);
  font-size: 12px; font-weight: 700; text-align: center;
}
.menu-grid button svg { width: 22px; height: 22px; color: var(--accent); }
.menu-grid button.danger { color: var(--danger); }
.menu-grid button.danger svg { color: var(--danger); }

/* ---------------------------- MODALES (skill 02) ---------------------------- */
.modal-wrapper {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(20, 10, 5, .58);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fade-in .18s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 18px;
  width: 100%; max-width: 520px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px var(--shadow-strong);
  animation: modal-in .22s cubic-bezier(.2,.9,.3,1);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; gap: .6rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; flex: 1; font-size: 17px; }
.modal-close {
  width: 38px; height: 38px; border: none; border-radius: 10px;
  background: var(--bg-secondary); color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
}
.modal-body   { flex: 1; overflow-y: auto; padding: 1.25rem; -webkit-overflow-scrolling: touch; }
.modal-footer {
  padding: 1rem 1.25rem; border-top: 1px solid var(--border);
  display: flex; gap: .7rem; justify-content: flex-end;
  background: var(--bg-primary); border-radius: 0 0 18px 18px;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}
.modal-footer .btn { flex: 1; }
@media (max-width: 640px) {
  .modal-wrapper { align-items: flex-end; padding: 0; }
  .modal { max-width: 100%; border-radius: 20px 20px 0 0; max-height: 92vh; }
  .modal-footer { border-radius: 0; }
  @keyframes modal-in { from { transform: translateY(100%); } to { transform: none; } }
}

/* ---------------------------- HOME (skill 50) ---------------------------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: 0 0 28px 28px;
  min-height: min(78vh, 620px);
  display: flex; align-items: flex-end;
  isolation: isolate;
}
.hero-bg {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%; object-fit: cover;
}
.hero::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg,
    rgba(20,10,5,.20) 0%, rgba(20,10,5,.55) 48%, rgba(20,10,5,.92) 100%);
}
.hero-inner {
  position: relative; width: 100%;
  max-width: 1200px; margin: 0 auto;
  padding: 3rem 1.5rem 2.5rem;
  color: #FFF8EA;
}
.hero-kicker {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .35rem .8rem; border-radius: 999px;
  background: rgba(217,59,34,.92); color: #fff;
  font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: .9rem;
}
.hero h1 {
  font-size: clamp(30px, 7.5vw, 58px);
  line-height: 1.03; margin: 0 0 .6rem;
  text-shadow: 0 4px 24px rgba(0,0,0,.55);
  max-width: 15ch;
}
.hero h1 em { font-style: normal; color: var(--gold-soft); }
.hero p.lead {
  font-size: clamp(15px, 2.4vw, 18px);
  color: rgba(255,248,234,.9); max-width: 52ch;
  margin: 0 0 1.6rem; text-shadow: 0 2px 12px rgba(0,0,0,.5);
}
.hero-cta { display: flex; flex-wrap: wrap; gap: .75rem; }
.hero-cta .btn { min-height: 52px; padding: .8rem 1.7rem; font-size: 16px; }
@media (max-width: 640px) { .hero-cta .btn { flex: 1 1 100%; } }

/* Franja de stats */
.stats-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: 18px; overflow: hidden;
  margin: -2.2rem auto 2.5rem; max-width: 1000px; position: relative; z-index: 2;
  box-shadow: 0 12px 34px var(--shadow);
}
.stats-strip div { background: var(--surface); padding: 1.1rem .75rem; text-align: center; }
.stats-strip strong { display: block; font-size: 26px; color: var(--accent); line-height: 1.1; }
.stats-strip span { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 700; }

/* Cards de features — composición asimétrica */
.feat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(268px, 1fr)); gap: 1.25rem; }
.feat-card {
  border: 1px solid var(--border); border-radius: 20px 6px 20px 6px;
  overflow: hidden; background: var(--surface);
  box-shadow: 0 6px 22px var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.feat-card:nth-child(even) { border-radius: 6px 20px 6px 20px; }
.feat-card:hover { transform: translateY(-4px); box-shadow: 0 14px 34px var(--shadow); }
.feat-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--bg-tertiary); }
.feat-card .feat-body { padding: 1.1rem 1.2rem 1.3rem; }
.feat-card h3 { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.feat-card h3 svg { width: 19px; height: 19px; color: var(--accent); }
.feat-card p { margin: 0; font-size: 14px; color: var(--text-secondary); }

.section-title {
  display: flex; align-items: center; gap: .6rem;
  margin: 0 0 .4rem;
}
.section-title svg { width: 22px; height: 22px; color: var(--accent); }
.section-sub { color: var(--text-secondary); margin-bottom: 1.5rem; max-width: 60ch; }

/* ---------------------------- AUTH ---------------------------- */
.auth-wrap {
  min-height: 100dvh; display: grid;
  grid-template-columns: 1.05fr .95fr;
}
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } }
.auth-visual {
  position: relative; overflow: hidden;
  display: flex; align-items: flex-end; padding: 2.5rem;
  min-height: 220px;
}
.auth-visual img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.auth-visual::after {
  content: ''; position: absolute; inset: 0;
  /* Vertical, no diagonal: el texto está anclado abajo, así que la parte
     más oscura tiene que estar abajo para que se lea (WCAG AA). */
  background: linear-gradient(180deg,
    rgba(20,10,5,.22) 0%, rgba(20,10,5,.58) 45%, rgba(20,10,5,.94) 100%);
}
.auth-visual .auth-visual-txt { position: relative; color: #FFF8EA; max-width: 30ch; }
.auth-visual h2 { font-size: clamp(22px, 3.4vw, 34px); margin-bottom: .4rem; text-shadow: 0 3px 18px rgba(0,0,0,.6); }
.auth-visual p  { color: rgba(255,248,234,.85); margin: 0; font-size: 14.5px; }
@media (max-width: 900px) { .auth-visual { min-height: 190px; padding: 1.5rem; } }

.auth-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 2.5rem 1.5rem; background: var(--bg-primary);
}
.auth-form { width: 100%; max-width: 380px; }
.auth-form .brand { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.75rem; }
.auth-form .brand img { width: 46px; border-radius: 12px; }
.auth-tabs {
  display: flex; gap: .3rem; padding: .3rem;
  background: var(--bg-secondary); border-radius: 12px; margin-bottom: 1.4rem;
}
.auth-tabs button {
  flex: 1; min-height: 42px; border: none; border-radius: 9px;
  background: transparent; color: var(--text-secondary);
  font-size: 14px; font-weight: 700;
}
.auth-tabs button.active { background: var(--surface); color: var(--accent); box-shadow: 0 2px 8px var(--shadow); }
.auth-form .btn { width: 100%; }
.auth-hint { font-size: 13px; color: var(--text-muted); text-align: center; margin-top: 1rem; }
.field-error { font-size: 12.5px; color: var(--danger); font-weight: 600; min-height: 1em; }

/* ---------------------------- PERFIL ---------------------------- */
.perfil-head {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  padding: 1.5rem; border-radius: 22px 6px 22px 6px;
  background: linear-gradient(135deg, var(--surface), var(--bg-secondary));
  border: 1px solid var(--border); margin-bottom: 1.5rem;
  box-shadow: 0 6px 22px var(--shadow);
}
.avatar-xl {
  width: 88px; height: 88px; border-radius: 22px; flex: 0 0 auto;
  object-fit: cover; background: var(--bg-tertiary);
  border: 3px solid var(--surface); box-shadow: 0 4px 16px var(--shadow);
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 800; color: var(--accent);
}
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .9rem; }
.kpi {
  padding: 1.1rem 1.2rem; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border);
}
.kpi .kpi-top { display: flex; align-items: center; gap: .4rem; margin-bottom: .3rem; }
.kpi .kpi-top svg { width: 16px; height: 16px; color: var(--accent); }
.kpi strong { display: block; font-size: 25px; line-height: 1.15; }

/* ---------------------------- NIVELES ---------------------------- */
.niveles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .9rem; }
.nivel-card {
  position: relative; text-align: left;
  padding: 1rem; border-radius: 16px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text-primary); min-height: 118px;
  display: flex; flex-direction: column; gap: .3rem;
}
.nivel-card.jugable { border-color: var(--accent); box-shadow: 0 4px 16px rgba(217,59,34,.16); }
.nivel-card.bloqueado { opacity: .55; }
.nivel-card .nivel-num {
  font-size: 11px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted);
}
.nivel-card b { font-size: 15px; line-height: 1.25; }
.nivel-card .nivel-meta { font-size: 12px; color: var(--text-secondary); margin-top: auto; }
.nivel-card .estrellas { display: flex; gap: 2px; margin-top: .3rem; }
.nivel-card .estrellas svg { width: 14px; height: 14px; color: var(--border); }
.nivel-card .estrellas svg.on { color: var(--gold); fill: var(--gold); }
.nivel-card .lock {
  position: absolute; top: .7rem; right: .7rem;
  width: 18px; height: 18px; color: var(--text-muted);
}

/* ---------------------------- INSTALAR APP (skill 50) ---------------------------- */
.install-steps { text-align: left; font-size: 14.5px; line-height: 2.1; color: var(--text-primary); }
.install-steps b { color: var(--accent); }
.install-steps svg { width: 17px; height: 17px; vertical-align: -3px; color: var(--text-secondary); }
.install-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 800;
  margin-right: .5rem; vertical-align: -4px;
}

/* ---------------------------- SKELETON ---------------------------- */
.skel {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%; animation: skel 1.3s infinite; border-radius: 12px;
}
@keyframes skel { to { background-position: -200% 0; } }

/* ---------------------------- APPBAR COMPACTO EN MOBILE ---------------------------- */
/* En pantallas chicas el appbar se satura: el botón de instalar queda solo
   con su ícono (el texto vive en el menú "Ver más") y la marca no se corta. */
@media (max-width: 900px) {
  .appbar { padding-left: 1rem; padding-right: 1rem; gap: .5rem; }
  .hide-sm { display: none !important; }
  .appbar-brand img { width: 34px; height: 34px; }
  .appbar-brand b {
    font-size: 15px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: 42vw;
  }
  .appbar-actions { gap: .35rem; }
  #btn-instalar-app { padding: .5rem !important; }
  .appbar-actions .btn-primary { padding: .5rem .85rem !important; font-size: 13.5px !important; }
}
@media (max-width: 380px) {
  .appbar-brand b { display: none; }   /* en pantallas muy chicas alcanza el logo */
}
