/* ============================================================
   VOCABULANGELO · Estilos compartidos
   ============================================================ */

/* ---------- Variables de color ---------- */
:root {
  --azul-oscuro: #1F3B4C;
  --azul-titulo: #1F4E6E;
  --azul: #2C6E9E;
  --azul-claro: #B3CDE0;
  --azul-fondo: #F0F5FA;
  --azul-borde: #CFDFE9;
  --azul-borde-suave: #E4EDF5;

  --verde: #58CC71;
  --verde-oscuro: #2E7D32;
  --verde-fondo: #D7F0DC;

  --rojo: #C0392B;
  --rojo-fondo: #FADBD8;

  --texto-suave: #5F7F9E;

  --radio-grande: 2.5rem;
  --radio-medio: 1.5rem;
  --radio-chico: 1rem;

  --sombra-suave: 0 8px 20px rgba(0, 0, 0, 0.06);
  --sombra-media: 0 18px 40px rgba(31, 78, 110, 0.12);
  --sombra-fuerte: 0 25px 45px rgba(0, 0, 0, 0.1);

  /* Superficies (tema claro; el tema oscuro las redefine al final) */
  --superficie: #FFFFFF;
  --fondo-a: #EFF3F8;
  --fondo-b: #D9E2EC;
  --campo-fondo: #F6FAFE;
  --topbar-fondo: rgba(255, 255, 255, 0.92);
}

/* ---------- Reset ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Quicksand', 'Microsoft YaHei', 'PingFang SC', 'Noto Sans SC', sans-serif;
  background: linear-gradient(145deg, var(--fondo-a) 0%, var(--fondo-b) 100%);
  min-height: 100vh;
  color: var(--azul-oscuro);
  line-height: 1.5;
  padding-bottom: 3rem;
}

/* ---------- Contenedores ---------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.card {
  background: var(--superficie);
  border-radius: var(--radio-grande);
  box-shadow: var(--sombra-fuerte);
  padding: 2rem;
  border: 1px solid var(--azul-borde);
}

/* ============================================================
   SPLASH SCREEN
   ============================================================ */
.splash-overlay {
  position: fixed;
  inset: 0;
  background: var(--superficie);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 1;
  transition: opacity 0.6s ease;
}
.splash-overlay.ocultando {
  opacity: 0;
  pointer-events: none;
}
.splash-overlay img {
  max-width: min(80vw, 480px);
  max-height: 70vh;
  width: auto;
  height: auto;
  object-fit: contain;
  animation: splash-pop 0.7s cubic-bezier(.2,.8,.2,1.1);
}
@keyframes splash-pop {
  0%   { opacity: 0; transform: scale(0.88); }
  100% { opacity: 1; transform: scale(1); }
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--topbar-fondo);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--azul-borde);
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.navbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--azul-titulo);
  text-decoration: none;
  letter-spacing: -0.3px;
}
.navbar-logo img {
  height: 38px;
  width: auto;
  display: block;
}
.navbar-logo span { line-height: 1; }

.navbar-menu {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.nav-item { position: relative; }

.nav-trigger {
  background: transparent;
  border: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--azul-titulo);
  padding: 0.5rem 1rem;
  border-radius: 50px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.15s;
}
.nav-trigger:hover { background: var(--azul-fondo); }
.nav-trigger .caret { font-size: 0.7rem; transition: transform 0.2s; }
.nav-item.open .nav-trigger { background: var(--azul-fondo); }
.nav-item.open .caret { transform: rotate(180deg); }

.nav-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 240px;
  background: var(--superficie);
  border-radius: var(--radio-medio);
  box-shadow: var(--sombra-media);
  border: 1px solid var(--azul-borde);
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}
.nav-item.open .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  border-radius: 0.7rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--azul-titulo);
  transition: background 0.15s;
}
.nav-dropdown a:hover { background: var(--azul-fondo); }
.nav-dropdown a i {
  width: 1.2rem;
  text-align: center;
  color: var(--azul);
  font-size: 0.9rem;
}

.nav-toggle-mobile {
  display: none;
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--azul-titulo);
  cursor: pointer;
  padding: 0.4rem;
}

/* ============================================================
   BOTONES
   ============================================================ */
.btn {
  border: none;
  background: var(--azul-claro);
  padding: 0.7rem 1.6rem;
  border-radius: 50px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  color: var(--azul-oscuro);
  font-size: 0.92rem;
  transition: 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}
.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: var(--verde);
  color: white;
  box-shadow: 0 3px 0 var(--verde-oscuro);
}
.btn-primary:hover { background: #3db85a; }

.btn-secondary {
  background: var(--azul);
  color: white;
  box-shadow: 0 3px 0 #1a4a6b;
}
.btn-secondary:hover { background: #245b85; }

.btn-ghost {
  background: transparent;
  border: 2px solid var(--azul-borde);
}
.btn-ghost:hover { background: var(--azul-fondo); }

.btn-sm { padding: 0.5rem 1.1rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

/* ============================================================
   SECCIONES Y TEXTOS
   ============================================================ */
h1, h2, h3 { color: var(--azul-titulo); font-weight: 800; letter-spacing: -0.3px; }
h1 { font-size: 2.2rem; line-height: 1.15; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.1rem; }

.subtitle {
  color: var(--texto-suave);
  font-size: 1rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.hero {
  text-align: center;
  padding: 3.5rem 1.5rem 2rem;
  max-width: 800px;
  margin: 0 auto;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  background: linear-gradient(135deg, var(--azul-titulo), var(--verde));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.8rem;
}
.hero .tagline {
  color: var(--texto-suave);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.6;
}
.hero .tagline .cn {
  display: block;
  font-size: 0.95rem;
  opacity: 0.75;
  margin-top: 0.3rem;
}

.section-title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--texto-suave);
  margin: 2.5rem 0 1rem;
  padding-left: 0.2rem;
}

/* ---------- Cabecera de sección con los iconos de vista ---------- */
.section-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 2.5rem 0 1rem;
}
.section-cabecera .section-title { margin: 0; }

.vista-selector {
  display: flex;
  gap: 0.15rem;
  background: var(--azul-fondo);
  border: 1px solid var(--azul-borde-suave);
  border-radius: 50px;
  padding: 0.2rem;
  flex: 0 0 auto;
}
.vista-btn {
  border: none;
  background: transparent;
  color: var(--texto-suave);
  font-size: 0.78rem;
  width: 2rem;
  height: 1.7rem;
  border-radius: 50px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: 0.15s;
}
.vista-btn:hover { color: var(--azul); background: var(--superficie); }
.vista-btn.activa {
  background: var(--superficie);
  color: var(--azul-oscuro);
  box-shadow: var(--sombra-suave);
}

/* ============================================================
   GRID DE TARJETAS
   ============================================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.tile {
  background: var(--superficie);
  border-radius: var(--radio-medio);
  padding: 1.4rem;
  border: 1px solid var(--azul-borde);
  box-shadow: var(--sombra-suave);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}
.tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--sombra-media);
  border-color: var(--azul);
}
.tile .icono {
  font-size: 1.8rem;
  color: var(--azul);
  line-height: 1;
}
.tile .titulo {
  font-weight: 800;
  color: var(--azul-titulo);
  font-size: 1.05rem;
}
.tile .descripcion {
  color: var(--texto-suave);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.45;
}
.tile .badge {
  align-self: flex-start;
  background: var(--azul-fondo);
  color: var(--azul);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 0.25rem 0.7rem;
  border-radius: 50px;
  margin-top: auto;
}
.tile.borrador { opacity: 0.75; }
.tile.borrador .badge {
  background: #FFF3CD;
  color: #856404;
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-wrapper {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}
.login-card {
  background: var(--superficie);
  border-radius: var(--radio-grande);
  box-shadow: var(--sombra-fuerte);
  border: 1px solid var(--azul-borde);
  padding: 2.5rem 2rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
}
.login-card .icono {
  font-size: 3rem;
  color: var(--azul);
  margin-bottom: 1rem;
}
.login-card h2 { margin-bottom: 0.4rem; }
.login-card p {
  color: var(--texto-suave);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 1.8rem;
}
.login-card input {
  width: 100%;
  font-family: inherit;
  font-size: 1.5rem;
  text-align: center;
  letter-spacing: 0.5rem;
  padding: 0.9rem;
  border: 2px solid var(--azul-borde);
  border-radius: var(--radio-chico);
  background: var(--campo-fondo);
  outline: none;
  transition: border-color 0.15s;
  margin-bottom: 1rem;
}
.login-card input:focus {
  border-color: var(--azul);
  background: var(--superficie);
}
.login-card .btn { width: 100%; justify-content: center; }

.draft-notice {
  background: #FFF3CD;
  color: #856404;
  border: 1px solid #FFE69C;
  border-radius: 0.8rem;
  padding: 0.7rem 1rem;
  font-size: 0.82rem;
  font-weight: 700;
  margin-top: 1.2rem;
  text-align: center;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  text-align: center;
  padding: 2rem 1rem 0;
  color: var(--texto-suave);
  font-size: 0.8rem;
  font-weight: 600;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 720px) {
  .navbar-menu { display: none; }
  .nav-toggle-mobile { display: block; }

  .navbar-menu.mobile-open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--superficie);
    padding: 0.8rem;
    gap: 0.4rem;
    border-bottom: 1px solid var(--azul-borde);
    box-shadow: var(--sombra-media);
  }
  .navbar-menu.mobile-open .nav-trigger { width: 100%; justify-content: space-between; }
  .navbar-menu.mobile-open .nav-dropdown {
    position: static;
    box-shadow: none;
    border: none;
    padding-left: 0.5rem;
    transform: none;
    opacity: 1;
    visibility: visible;
    display: none;
  }
  .navbar-menu.mobile-open .nav-item.open .nav-dropdown {
    display: block;
  }
  .navbar-inner { position: relative; flex-wrap: wrap; }

  .card { padding: 1.5rem; }
  .container { padding: 0 1rem; }
}

/* ============================================================
   APP SHELL v2 · Barra superior + menú lateral
   ============================================================ */
:root {
  --topbar-alto: 3.5rem;
  --sidebar-ancho: 280px;
}

.sin-scroll { overflow: hidden; }

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 120;
  height: var(--topbar-alto);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0 1rem;
  background: var(--topbar-fondo);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--azul-borde);
}

.btn-hamburguesa {
  border: none;
  background: transparent;
  font-size: 1.2rem;
  color: var(--azul-titulo);
  cursor: pointer;
  padding: 0.5rem 0.7rem;
  border-radius: 0.7rem;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
}
.btn-hamburguesa:hover { background: var(--azul-fondo); }

.app-topbar .logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--azul-titulo);
  text-decoration: none;
  letter-spacing: -0.3px;
}
.app-topbar .logo img { height: 30px; width: auto; display: block; }

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-ancho);
  max-width: 86vw;
  background: var(--superficie);
  z-index: 200;
  transform: translateX(-105%);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--azul-borde);
  box-shadow: var(--sombra-fuerte);
}
.app-sidebar.abierto { transform: translateX(0); }

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--azul-borde-suave);
}
.sidebar-header img { height: 34px; width: auto; display: block; }
.sidebar-header .nombre {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--azul-titulo);
  letter-spacing: -0.3px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem 0.8rem;
}

.sidebar-seccion { margin-bottom: 1.1rem; }

.sidebar-seccion .etiqueta {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--texto-suave);
  padding: 0.4rem 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.sidebar-seccion .etiqueta i { font-size: 0.75rem; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.7rem;
  border-radius: 0.8rem;
  text-decoration: none;
  color: var(--azul-titulo);
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.15s, transform 0.15s;
}
.sidebar-link i { width: 1.2rem; text-align: center; color: var(--azul); font-size: 0.9rem; }
.sidebar-link:hover { background: var(--azul-fondo); transform: translateX(3px); }
.sidebar-link.activo {
  background: var(--azul-fondo);
  box-shadow: inset 3px 0 0 var(--azul);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(31, 59, 76, 0.45);
  z-index: 190;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.sidebar-backdrop.visible { opacity: 1; pointer-events: auto; }

/* ============================================================
   TARJETAS v2 · Texto extra al hover + botón info
   El texto extra SIEMPRE ocupa su espacio (reservado a 3
   líneas), pero está transparente. Al pasar el mouse solo
   cambia de color: sin movimientos de layout.
   ============================================================ */
.tile .extra {
  color: transparent;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.45;
  transition: color 0.3s ease;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  min-height: calc(3 * 1.45em);
  margin-top: 0.15rem;
  user-select: none;
}
.tile:hover .extra,
.tile.expandido .extra {
  color: var(--texto-suave);
  user-select: auto;
}

.tile .btn-info {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--azul-fondo);
  color: var(--azul);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}
.tile:hover .btn-info,
.tile.expandido .btn-info { opacity: 1; }
@media (hover: none) { .tile .btn-info { opacity: 0.85; } }

/* Badges por estado */
.tile .badge.disponible { background: var(--verde-fondo); color: var(--verde-oscuro); }
.tile .badge.idea { background: #EEEDFE; color: #534AB7; }

/* ============================================================
   VISTAS DE LAS TARJETAS DEL INICIO (los iconos de cada sección)
   0 = grandes (la de siempre) · 1 = rectangulares · 2 = con
   resumen · 3 = lista. Solo afectan al inicio (#app-contenido).
   ============================================================ */

/* ---------- 1 y 2 · tarjetas rectangulares ---------- */
#app-contenido[data-vista="1"] .grid,
#app-contenido[data-vista="2"] .grid {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.7rem;
}
#app-contenido[data-vista="1"] .tile,
#app-contenido[data-vista="2"] .tile {
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radio-chico);
}
#app-contenido[data-vista="1"] .tile:hover,
#app-contenido[data-vista="2"] .tile:hover { transform: translateY(-2px); }

#app-contenido[data-vista="1"] .tile .icono,
#app-contenido[data-vista="2"] .tile .icono {
  font-size: 1rem;
  width: 2.1rem;
  height: 2.1rem;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--azul-fondo);
  border-radius: 50%;
}
#app-contenido[data-vista="1"] .tile .titulo,
#app-contenido[data-vista="2"] .tile .titulo {
  font-size: 0.95rem;
  flex: 1 1 auto;
}

/* 1 · solo icono y título */
#app-contenido[data-vista="1"] .tile .descripcion,
#app-contenido[data-vista="1"] .tile .extra,
#app-contenido[data-vista="1"] .tile .btn-info,
#app-contenido[data-vista="1"] .tile .badge { display: none; }

/* 2 · icono, título y resumen (dos líneas como mucho) */
#app-contenido[data-vista="2"] .tile { flex-wrap: wrap; }
#app-contenido[data-vista="2"] .tile .descripcion {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
#app-contenido[data-vista="2"] .tile .extra,
#app-contenido[data-vista="2"] .tile .btn-info,
#app-contenido[data-vista="2"] .tile .badge { display: none; }

/* ---------- 3 · lista: tarjetas alargadas, una por fila ---------- */
#app-contenido[data-vista="3"] .grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}
#app-contenido[data-vista="3"] .tile {
  flex-direction: row;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1.1rem 0.75rem 0.9rem;
  background: var(--superficie);
  border: 1px solid var(--azul-borde);
  border-radius: var(--radio-chico);
  box-shadow: var(--sombra-suave);
}
#app-contenido[data-vista="3"] .tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--sombra-media);
  border-color: var(--azul);
}
#app-contenido[data-vista="3"] .tile .icono {
  font-size: 1rem;
  width: 2.1rem;
  height: 2.1rem;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--azul-fondo);
  border-radius: 50%;
}
#app-contenido[data-vista="3"] .tile .titulo { font-size: 0.95rem; flex: 1 1 auto; }
#app-contenido[data-vista="3"] .tile::after {
  content: "\f054";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 0.7rem;
  color: var(--azul-claro);
  flex: 0 0 auto;
  margin-left: 0.4rem;
}
#app-contenido[data-vista="3"] .tile .descripcion,
#app-contenido[data-vista="3"] .tile .extra,
#app-contenido[data-vista="3"] .tile .btn-info,
#app-contenido[data-vista="3"] .tile .badge { display: none; }

/* ============================================================
   TOAST · Avisos suaves
   ============================================================ */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--azul-oscuro);
  color: white;
  padding: 0.8rem 1.4rem;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.9rem;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  pointer-events: none;
  max-width: 90vw;
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   ANIMACIONES DE ENTRADA
   ============================================================ */
@keyframes tile-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
.tile {
  animation: tile-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: var(--d, 0s);
}

@media (prefers-reduced-motion: reduce) {
  .tile { animation: none !important; }
  .app-sidebar,
  .sidebar-backdrop,
  .toast,
  .tile .extra { transition: none !important; }
}

/* ============================================================
   TEMPORIZADOR · Widget anclado en la barra superior
   ============================================================ */
.topbar-espacio { flex: 1; }

.timer-widget { position: relative; }

.timer-pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border: none;
  background: var(--azul-fondo);
  color: var(--azul-titulo);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.42rem 0.85rem;
  border-radius: 50px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-variant-numeric: tabular-nums;
}
.timer-pill:hover { background: var(--azul-borde-suave); }
.timer-pill.corriendo { background: var(--verde); color: white; }
.timer-pill.terminado {
  background: var(--rojo);
  color: white;
  animation: pill-alerta 0.8s ease 3;
}
@keyframes pill-alerta {
  50% { transform: scale(1.08); }
}
@media (max-width: 540px) {
  .timer-pill-label { display: none; }
}

.timer-panel {
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  width: 250px;
  background: var(--superficie);
  border: 1px solid var(--azul-borde);
  border-radius: var(--radio-medio);
  box-shadow: var(--sombra-media);
  padding: 1rem;
  z-index: 220;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}
.timer-panel.abierto {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.timer-panel-display {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--azul-titulo);
  text-align: center;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}

.timer-panel-barra {
  height: 8px;
  border-radius: 50px;
  background: var(--azul-borde-suave);
  overflow: hidden;
  margin: 0.6rem 0 0.9rem;
}
.timer-panel-barra-fill {
  height: 100%;
  width: 0%;
  border-radius: 50px;
  background: var(--verde);
  transition: width 0.25s linear;
}

.timer-widget .timer-presets {
  display: flex;
  gap: 0.45rem;
  justify-content: center;
}
.timer-widget .timer-presets button {
  border: 1px solid transparent;
  background: var(--azul-fondo);
  color: var(--azul-titulo);
  font-family: inherit;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.35rem 0.8rem;
  border-radius: 50px;
  cursor: pointer;
  transition: 0.15s;
}
.timer-widget .timer-presets button:hover { border-color: var(--azul); }

.timer-widget-custom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 0.8rem 0;
  color: var(--texto-suave);
  font-weight: 700;
  font-size: 0.8rem;
}
.timer-widget-custom input {
  width: 3.2rem;
  text-align: center;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.35rem;
  border: 2px solid var(--azul-borde);
  border-radius: 0.6rem;
  background: var(--campo-fondo);
  color: inherit;
  outline: none;
}
.timer-widget-custom input:focus { border-color: var(--azul); }

.timer-panel-acciones {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
}
.timer-panel-acciones a.btn { padding: 0.5rem 0.8rem; }

/* ---------- Pie del sidebar (modo claro/oscuro) ---------- */
.sidebar-pie {
  padding: 0.8rem;
  border-top: 1px solid var(--azul-borde-suave);
}
.sidebar-pie .sidebar-link {
  width: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

/* ============================================================
   ANIMACIONES EXTRA
   ============================================================ */
@keyframes icono-zoom {
  0%   { transform: scale(1); }
  55%  { transform: scale(1.16); }
  100% { transform: scale(1); }
}
.tile:hover .icono { animation: icono-zoom 0.35s ease; }

@keyframes pulso-borde {
  0%, 100% { box-shadow: 0 0 0 0 rgba(88, 204, 113, 0.4); }
  70%      { box-shadow: 0 0 0 5px rgba(88, 204, 113, 0); }
}
.tile .badge.disponible { animation: pulso-borde 2.8s infinite; }

@keyframes aparecer {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.hero { animation: aparecer 0.5s ease both; }
.section-title { animation: aparecer 0.5s ease both; }

/* ============================================================
   TEMA OSCURO
   Solo redefine variables y detalles de la base. Los juegos
   mantienen sus propios temas sin interferencias.
   ============================================================ */
[data-theme="oscuro"] {
  --azul-oscuro: #D7E3EC;
  --azul-titulo: #9CC8E8;
  --azul: #5CA8DC;
  --azul-claro: #2A4A63;
  --azul-fondo: #1B3040;
  --azul-borde: #2E4658;
  --azul-borde-suave: #24384A;
  --texto-suave: #8AA5B8;
  --superficie: #142433;
  --fondo-a: #0D1B27;
  --fondo-b: #142A3D;
  --campo-fondo: #1B3040;
  --topbar-fondo: rgba(13, 27, 39, 0.92);
  --verde-fondo: rgba(88, 204, 113, 0.16);
  --rojo-fondo: rgba(192, 57, 43, 0.22);
  --sombra-suave: 0 8px 20px rgba(0, 0, 0, 0.35);
  --sombra-media: 0 18px 40px rgba(0, 0, 0, 0.45);
  --sombra-fuerte: 0 25px 45px rgba(0, 0, 0, 0.5);
}

[data-theme="oscuro"] .tile .badge.disponible {
  background: var(--verde-fondo);
  color: #7ED994;
}
[data-theme="oscuro"] .tile.borrador .badge {
  background: rgba(250, 199, 117, 0.14);
  color: #F0C070;
}
[data-theme="oscuro"] .tile .badge.idea {
  background: rgba(127, 119, 221, 0.2);
  color: #AFA9EC;
}
[data-theme="oscuro"] .draft-notice {
  background: rgba(250, 199, 117, 0.1);
  color: #F0C070;
  border-color: rgba(250, 199, 117, 0.25);
}
[data-theme="oscuro"] .toast {
  background: #0A1620;
  color: #D7E3EC;
}
[data-theme="oscuro"] .hero h1 {
  background: linear-gradient(135deg, #9CC8E8, #6FDD8B);
  -webkit-background-clip: text;
  background-clip: text;
}

@media (prefers-reduced-motion: reduce) {
  .tile .badge.disponible { animation: none !important; }
  .tile:hover .icono { animation: none !important; }
  .hero, .section-title { animation: none !important; }
}

/* ============================================================
   PESTAÑAS con paneles de ALTURA RESERVADA
   Patrón tomado de src_ideas/pestañas.html (pestañas tipo Edge),
   adaptado a los colores del proyecto y al tema oscuro.
   La clave: .paneles reserva un alto mínimo y CADA .panel-tab ocupa ese
   mismo alto, así al cambiar de pestaña el bloque no crece ni se encoge:
   solo se cruza el contenido. Es un mínimo (no una altura fija) para que
   en pantallas pequeñas sí pueda crecer si hace falta.
   ============================================================ */
.tabs {
  display: flex; gap: 6px; padding: 6px;
  background: var(--campo-fondo);
  border: 1px solid var(--azul-borde-suave);
  border-radius: 14px;
}
.tab {
  flex: 1 1 0; min-width: 0;
  appearance: none; border: 0; background: transparent;
  padding: 11px 10px; border-radius: 10px;
  font: inherit; font-size: 0.9rem; font-weight: 700;
  color: var(--texto-suave); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background 0.25s ease, color 0.25s ease,
              box-shadow 0.25s ease, transform 0.18s ease;
}
.tab i { margin-right: 0.4rem; }
.tab:hover { background: var(--superficie); color: var(--azul); }
.tab:active { transform: scale(0.98); }
.tab:focus-visible { outline: 2px solid var(--azul); outline-offset: 2px; }
.tab.activa {
  background: linear-gradient(135deg, var(--azul) 0%, #1E8FE1 100%);
  color: #fff;
  box-shadow: 0 8px 18px -8px rgba(15, 108, 189, 0.95);
}
.tab.activa:hover { color: #fff; }

/* Zona de paneles: ALTURA MÍNIMA, y CADA panel ocupa ese mínimo.
   Así el bloque no salta al cambiar de pestaña (todos los paneles miden lo
   mismo) pero puede crecer si algún contenido lo necesita de verdad, que es
   lo que pasa en pantallas pequeñas. */
.paneles {
  position: relative;
  min-height: var(--alto-panel, 320px);
}
.panel-tab { display: none; }
.panel-tab.activo {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  min-height: var(--alto-panel, 320px);
  animation: panel-tab-entra 0.28s ease;
}
@keyframes panel-tab-entra {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* El contenido de cada panel NUNCA pasa del mínimo: es lo que evita el salto */
.panel-tab canvas,
.panel-tab svg { max-width: 100%; max-height: var(--alto-panel, 320px); }

/* La nota al pie que traen algunos motores (p. ej. «Gira para sortear») NO debe
   empujar el bloque: sale del flujo y se pega abajo. Así el alto de la zona lo
   decide solo el dibujo, y el bloque queda igual en todas las pestañas. */
.panel-tab > p {
  position: absolute; left: 0; right: 0; bottom: 0;
  margin: 0; text-align: center;
}

@media (max-width: 560px) {
  /* Una sola fila que se desliza: 5 pestañas envueltas serían 3 filas de alto */
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
  .tab { flex: 0 0 auto; padding: 9px 12px; font-size: 0.82rem; }
  .paneles { min-height: var(--alto-panel-movil, var(--alto-panel, 300px)); }
  .panel-tab.activo { min-height: var(--alto-panel-movil, var(--alto-panel, 300px)); }
  .panel-tab canvas,
  .panel-tab svg { max-height: var(--alto-panel-movil, var(--alto-panel, 300px)); }
}

@media (prefers-reduced-motion: reduce) {
  .panel-tab.activo { animation: none; }
}

/* ============================================================
   ANCHO COMPLETO (opt-in, pagina por pagina)
   El ancho normal de las paginas es 1400px (ver .container arriba).
   Una pagina que necesite aprovechar pantallas muy anchas (una tabla con
   muchas columnas, por ejemplo) pone class="ancho-completo" en su <body>
   y su contenido ocupa todo el ancho disponible. Es voluntario: ninguna
   otra pagina cambia si no lo pide.
   ============================================================ */
body.ancho-completo .container{
  max-width:none;
  padding-left:clamp(1rem, 2vw, 2.5rem);
  padding-right:clamp(1rem, 2vw, 2.5rem);
}
