/* ============================================================

/* Hueco que ocupa el header fijo en móvil: su alto real (56px) + respiro (14px).
   Única fuente de verdad — ver la nota junto a .uc-app más abajo. */
:root {
  --uc-header-offset: 70px;
  /* Todo lo que en la sala móvil NO es el tablero, sumado:
     70 header + 6 padding + 27 latencia + 68+68 tarjetas + 16 gaps + 90 reserva
     de la barra inferior = 345. El tablero es cuadrado, así que su ancho fija
     su alto: si no se le pone este techo, la columna no cabe y aparece scroll. */
  --uc-room-chrome: 345px;
}
   Drawer móvil (rediseño) — 100% propio, sin Metronic.
   Solo móvil (<992px). Desktop conserva su sidebar.
   Scopeado bajo .ucd para no colisionar.
   ============================================================ */

.ucd {
  --purple: #7f38ff;
  --green: #31efb2;
  --text: #f7f5ff;
  --muted: #8f91bb;
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 13px 150px;
  scrollbar-width: none;
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.ucd::-webkit-scrollbar { display: none; }
.ucd .svg-sprite { position: fixed; width: 0; height: 0; overflow: hidden; }

.ucd .drawer-grip {
  width: 48px; height: 5px; flex: none;
  margin: 0 auto 15px;
  border-radius: 999px;
  background: linear-gradient(90deg, #413474, #5c4699);
  box-shadow: inset 0 1px 1px rgba(255,255,255,.18);
}

/* ── Profile card ── */
.ucd .profile-card {
  position: relative;
  flex: none;
  min-height: 106px;
  display: grid;
  grid-template-columns: 54px 1fr 32px;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid rgba(132, 74, 255, .31);
  border-radius: 18px;
  background:
    radial-gradient(circle at 80% 22%, rgba(124, 65, 255, .19), transparent 32%),
    linear-gradient(145deg, rgba(27, 28, 63, .93), rgba(20, 22, 50, .84));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 14px 34px rgba(0,0,0,.18);
  overflow: hidden;
}
.ucd .avatar {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  border-radius: 15px;
  font-size: 22px; font-weight: 800; color: #fff;
  background: linear-gradient(145deg, #9d61ff, #6123e8);
  border: 1px solid rgba(255,255,255,.24);
  box-shadow: 0 10px 20px rgba(94, 32, 211, .36), inset 0 1px 0 rgba(255,255,255,.28);
}
.ucd .profile-copy { min-width: 0; }
.ucd .profile-copy h2 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.02em; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ucd .profile-copy p { margin: 4px 0 7px; color: #9693ca; font-size: 13px; white-space: nowrap; }
.ucd .status { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-weight: 700; font-size: 12.5px; }
.ucd .status i { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(49,239,178,.10), 0 0 12px rgba(49,239,178,.78); }
.ucd .edit-button { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid rgba(133, 88, 255,.18); border-radius: 50%; background: rgba(100, 62, 188, .16); cursor: pointer; }
.ucd .edit-button svg { width: 15px; height: 15px; fill: #a890ff; }
.ucd .profile-star { position: absolute; color: #9b6cff; text-shadow: 0 0 12px currentColor; pointer-events: none; }
.ucd .star-one { right: 11px; top: 13px; font-size: 11px; }
.ucd .star-two { right: 25px; top: 27px; font-size: 6px; }

/* ── Nav ── */
.ucd .drawer-nav { margin-top: 22px; }
.ucd .section-label { margin: 24px 11px 12px; color: #928ac1; letter-spacing: .1em; font-size: 11.5px; font-weight: 700; }

.ucd .nav-item {
  min-height: 68px;
  display: grid;
  grid-template-columns: 44px minmax(0,1fr) 20px;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border: 1px solid rgba(139, 86, 255, .34);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(25, 27, 60, .78), rgba(13, 15, 38, .83));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease;
}
.ucd .nav-item + .nav-item { margin-top: 12px; }
.ucd .nav-item:active { transform: scale(.99); }
.ucd .nav-item--active {
  min-height: 60px;
  background: linear-gradient(100deg, #5f20f6 0%, #9a60fa 100%);
  border-color: rgba(255,255,255,.08);
  box-shadow: 0 12px 24px rgba(86, 26, 212, .27), inset 0 1px 0 rgba(255,255,255,.16);
}
.ucd .nav-item--compact { min-height: 62px; }
.ucd .nav-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(145deg, rgba(100, 48, 216, .48), rgba(43, 31, 111, .68)); }
.ucd .nav-icon svg { width: 21px; height: 21px; fill: #e7e0ff; }
.ucd .nav-icon--plain { width: 40px; height: 40px; background: transparent; }
.ucd .nav-icon--plain svg { width: 20px; height: 20px; }
.ucd .nav-icon--bolt svg { fill: #8d5cff; }
.ucd .nav-icon--user svg { width: 20px; height: 20px; fill: #a782ff; }
.ucd .nav-copy { min-width: 0; }
.ucd .nav-copy b { display: block; font-size: 15px; font-weight: 700; letter-spacing: -.01em; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ucd .nav-copy small { display: block; margin-top: 2px; color: #8f8ab9; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ucd .nav-item--active .nav-copy b { font-size: 16px; font-weight: 800; }
.ucd .score-copy b { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ucd .score-copy small { letter-spacing: .1em; text-transform: uppercase; }
.ucd .chevron { width: 18px; height: 18px; color: #aa8bff; }
.ucd .nav-item--active .chevron { color: #fff; }

/* ── Footer (logout) ── */
.ucd .drawer-footer { margin-top: auto; padding-top: 20px; }
.ucd .logout-button {
  width: 100%;
  min-height: 54px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  border: 0; border-radius: 14px;
  background: linear-gradient(100deg, #d51f4b, #f03b57);
  box-shadow: 0 14px 26px rgba(202, 22, 66, .22), inset 0 1px 0 rgba(255,255,255,.13);
  color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
  text-decoration: none;
}
.ucd .logout-button svg { width: 21px; height: 21px; }

/* Botones de sesión (guest) */
.ucd .auth-button {
  width: 100%; min-height: 50px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  border-radius: 13px; font-size: 14.5px; font-weight: 700;
  text-decoration: none; color: #fff;
}
.ucd .auth-button--primary { background: linear-gradient(100deg, #5f20f6, #9a60fa); box-shadow: 0 12px 24px rgba(86,26,212,.28); }
.ucd .auth-button--ghost { background: rgba(255,255,255,.05); border: 1px solid rgba(139,86,255,.3); color: #cdb9ff; margin-top: 10px; }

/* La decoración vieja in-flow queda anulada (ahora es fondo fijo, ver .uc-deco) */
.ucd .drawer-decoration { display: none; }

/* ── Drawer 100% propio (sin Metronic) — solo móvil ── */
#uc-scrim {
  position: fixed;
  inset: 0;
  z-index: 1040;
  background: rgba(1, 2, 8, .68);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
#uc-scrim.visible { opacity: 1; pointer-events: auto; }

/* Ilustración FIJA al fondo del drawer (no scrollea con el contenido) */
.uc-deco {
  position: absolute;
  z-index: 0;
  inset: auto 0 0 0;
  height: 176px;
  background: url('../img/drawer-footer.png?v=uc2') no-repeat bottom left;
  background-size: 130% auto;
  pointer-events: none;
  border-radius: 0 0 24px 0;
}
/* Degradado arriba para fundir la imagen con el fondo del drawer (sin borde de caja) */
.uc-deco::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 62%;
  background: linear-gradient(180deg, #080a19 0%, rgba(8, 10, 25, 0) 100%);
}

@media (max-width: 991px) {
  body #kt_aside.aside {
    position: fixed !important;
    z-index: 1050 !important;
    top: max(10px, env(safe-area-inset-top)) !important;
    bottom: max(10px, env(safe-area-inset-bottom)) !important;
    left: 0 !important;
    right: auto !important;
    width: min(78vw, 320px) !important;
    max-width: none !important;
    min-width: 0 !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    overflow: hidden !important;
    border: 1px solid rgba(144, 97, 255, .27) !important;
    border-left: 0 !important;
    border-radius: 0 24px 24px 0 !important;
    background:
      radial-gradient(circle at 90% 8%, rgba(83, 31, 177, .18), transparent 26%),
      linear-gradient(180deg, rgba(7, 9, 24, .99), rgba(8, 10, 25, .99)) !important;
    box-shadow: 25px 0 60px rgba(0, 0, 0, .48) !important;
    transform: translateX(calc(-100% - 24px)) !important;
    transition: transform .34s cubic-bezier(.22, .82, .25, 1) !important;
  }
  body #kt_aside.aside.uc-open { transform: translateX(0) !important; }
}

/* ── Barra de navegación móvil (logo + hamburguesa): FIJA con blur ──
   position:fixed (no sticky) porque body/html tienen overflow-x:hidden en
   móvil, y eso rompe position:sticky. Se compensa el contenido con padding-top. */
@media (max-width: 991px) {
  #kt_header.header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1030 !important;
    display: flex !important;
    align-items: center !important;
    height: calc(56px + env(safe-area-inset-top)) !important;
    min-height: 0 !important;
    padding: env(safe-area-inset-top) 16px 0 !important;
    background: rgba(9, 11, 24, 0.55) !important;
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    backdrop-filter: blur(16px) saturate(140%);
    border-bottom: 1px solid rgba(147, 130, 255, 0.10) !important;
  }
  #kt_header .header-brand { width: 100% !important; background: transparent !important; }
  #kt_header .header-logo { height: 30px !important; width: auto !important; }
  /* El contenido baja para no quedar tapado por el header fijo */
  /* Solo el hueco del header: body ya empuja el contenido con
     padding-top: env(safe-area-inset-top) (ver base.html). Sumarlo aquí otra
     vez contaba el notch dos veces. */
  #kt_content.content { padding-top: var(--uc-header-offset) !important; }
}

/* ── Página de juego en móvil: centrar tablero + cards sin scroll ──
   El header fijo empuja el contenido, y .uc-center tenía min-height:90vh que
   forzaba overflow. Aquí .uc-app llena el alto disponible bajo el header y
   centra su contenido; se anula el 90vh.

   La altura tiene que cuadrar EXACTA o la sala se puede scrollear:

     body pad-top (S_top)  +  #kt_content pad-top (H)  +  .uc-app  +  body pad-bottom (S_bot)  =  100dvh

   de donde .uc-app = 100dvh - H - S_top - S_bot. body ya aporta los dos insets
   (base.html), así que #kt_content solo añade H y aquí se restan ambos.

   Estuvo mal de dos formas a la vez: H valía 70 arriba y 66 aquí (4px), y el
   inset superior se contaba dos veces. En escritorio los insets son 0 y solo
   se veían los 4px; en el WebView de iOS son ~47 y ~34, así que sobraban ~85px
   y de ahí el scroll que en emulación de escritorio no aparecía nunca. */
@media (max-width: 991px) {
  .uc-app {
    min-height: calc(100dvh - var(--uc-header-offset) - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    align-content: center !important;
  }
  .uc-center { min-height: 0 !important; }
}

/* El tablero nunca puede ser más alto que el hueco que le dejan las tarjetas,
   el header y la barra inferior. Solo en vertical: en apaisado 100dvh es
   pequeño y este techo dejaría el tablero diminuto, así que ahí manda la regla
   de uc-room.css. */
@media (max-width: 991px) and (orientation: portrait) {
  .uc-app .player-card.card,
  .uc-board-card {
    width: min(100%, calc(100dvh - var(--uc-room-chrome)
                          - env(safe-area-inset-top) - env(safe-area-inset-bottom))) !important;
  }
}
